mirror of
https://github.com/nasa/openmct.git
synced 2025-02-02 17:21:14 +00:00
allow contextual domain objects to row actions
This commit is contained in:
parent
7ec2c4475b
commit
483f2feac8
@ -175,14 +175,22 @@ export default {
|
|||||||
getDatum() {
|
getDatum() {
|
||||||
return this.row.fullDatum;
|
return this.row.fullDatum;
|
||||||
},
|
},
|
||||||
showContextMenu: function (event) {
|
showContextMenu: async function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
this.updateViewContext();
|
this.updateViewContext();
|
||||||
this.markRow(event);
|
this.markRow(event);
|
||||||
|
|
||||||
|
const contextualDomainObject = await this.row.getContextualDomainObject?.();
|
||||||
|
|
||||||
|
let objectPath = this.objectPath;
|
||||||
|
if (contextualDomainObject) {
|
||||||
|
objectPath = objectPath.slice();
|
||||||
|
objectPath.unshift(contextualDomainObject);
|
||||||
|
}
|
||||||
|
|
||||||
const actions = this.row.getContextMenuActions().map(key => this.openmct.actions.getAction(key));
|
const actions = this.row.getContextMenuActions().map(key => this.openmct.actions.getAction(key));
|
||||||
const menuItems = this.openmct.menus.actionsToMenuItems(actions, this.objectPath, this.currentView);
|
const menuItems = this.openmct.menus.actionsToMenuItems(actions, objectPath, this.currentView);
|
||||||
if (menuItems.length) {
|
if (menuItems.length) {
|
||||||
this.openmct.menus.showMenu(event.x, event.y, menuItems);
|
this.openmct.menus.showMenu(event.x, event.y, menuItems);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user