diff --git a/src/adapter/actions/LegacyContextMenuAction.js b/src/adapter/actions/LegacyContextMenuAction.js index 6ba543296d..1e89c25c54 100644 --- a/src/adapter/actions/LegacyContextMenuAction.js +++ b/src/adapter/actions/LegacyContextMenuAction.js @@ -26,6 +26,7 @@ const OUTSIDE_EDIT_PATH_BLACKLIST = ["copy", "follow", "properties", "move", "li export default class LegacyContextMenuAction { constructor(openmct, LegacyAction) { this.openmct = openmct; + this.key = LegacyAction.definition.key; this.name = LegacyAction.definition.name; this.description = LegacyAction.definition.description; this.cssClass = LegacyAction.definition.cssClass; diff --git a/src/api/contextMenu/ContextMenuAPI.js b/src/api/contextMenu/ContextMenuAPI.js index be61e6e1db..d53eb9446f 100644 --- a/src/api/contextMenu/ContextMenuAPI.js +++ b/src/api/contextMenu/ContextMenuAPI.js @@ -49,6 +49,9 @@ class ContextMenuAPI { * a single sentence or short paragraph) of this kind of view * @property {string} cssClass the CSS class to apply to labels for this * view (to add icons, for instance) + * @property {string} key unique key to identify the context menu action + * (used in custom context menu eg table rows, to identify which actions to include) + * @property {boolean} hideInDefaultMenu optional flag to hide action from showing in the default context menu (tree item) */ /** * @method appliesTo @@ -72,12 +75,21 @@ class ContextMenuAPI { /** * @private */ - _showContextMenuForObjectPath(objectPath, x, y) { + _showContextMenuForObjectPath(objectPath, x, y, actionsToBeIncluded) { + let applicableActions = this._allActions.filter((action) => { - if (action.appliesTo === undefined) { - return true; + + if (actionsToBeIncluded) { + if (action.appliesTo === undefined && actionsToBeIncluded.includes(action.key)) { + return true; + } + return action.appliesTo(objectPath, actionsToBeIncluded) && actionsToBeIncluded.includes(action.key); + } else { + if (action.appliesTo === undefined) { + return true; + } + return action.appliesTo(objectPath) && !action.hideInDefaultMenu; } - return action.appliesTo(objectPath); }); if (this._activeContextMenu) { diff --git a/src/plugins/LADTable/LADTableSetViewProvider.js b/src/plugins/LADTable/LADTableSetViewProvider.js index f11caa64b6..9b0210e3c5 100644 --- a/src/plugins/LADTable/LADTableSetViewProvider.js +++ b/src/plugins/LADTable/LADTableSetViewProvider.js @@ -38,7 +38,7 @@ define([ canEdit: function (domainObject) { return domainObject.type === 'LadTableSet'; }, - view: function (domainObject) { + view: function (domainObject, isEditing, objectPath) { let component; return { @@ -49,7 +49,8 @@ define([ }, provide: { openmct, - domainObject + domainObject, + objectPath }, el: element, template: '' diff --git a/src/plugins/LADTable/LADTableViewProvider.js b/src/plugins/LADTable/LADTableViewProvider.js index 77045fdbe6..7fe5fc4dee 100644 --- a/src/plugins/LADTable/LADTableViewProvider.js +++ b/src/plugins/LADTable/LADTableViewProvider.js @@ -38,7 +38,7 @@ define([ canEdit: function (domainObject) { return domainObject.type === 'LadTable'; }, - view: function (domainObject) { + view: function (domainObject, isEditing, objectPath) { let component; return { @@ -49,7 +49,8 @@ define([ }, provide: { openmct, - domainObject + domainObject, + objectPath }, el: element, template: '' diff --git a/src/plugins/LADTable/components/LADRow.vue b/src/plugins/LADTable/components/LADRow.vue index db9fc662c6..e32ffed3ab 100644 --- a/src/plugins/LADTable/components/LADRow.vue +++ b/src/plugins/LADTable/components/LADRow.vue @@ -1,3 +1,4 @@ + /***************************************************************************** * Open MCT, Copyright (c) 2014-2018, United States Government * as represented by the Administrator of the National Aeronautics and Space @@ -21,7 +22,7 @@ *****************************************************************************/ diff --git a/src/ui/components/ObjectView.vue b/src/ui/components/ObjectView.vue index 3ef8bce506..afbbd56c5c 100644 --- a/src/ui/components/ObjectView.vue +++ b/src/ui/components/ObjectView.vue @@ -9,7 +9,8 @@ export default { props: { view: String, object: Object, - showEditView: Boolean + showEditView: Boolean, + objectPath: Array }, destroyed() { this.clear(); @@ -91,17 +92,19 @@ export default { return; } + let objectPath = this.currentObjectPath || this.objectPath; + if (provider.edit && this.showEditView) { if (this.openmct.editor.isEditing()) { - this.currentView = provider.edit(this.currentObject); + this.currentView = provider.edit(this.currentObject, true, objectPath); } else { - this.currentView = provider.view(this.currentObject, false); + this.currentView = provider.view(this.currentObject, false, objectPath); } this.openmct.editor.on('isEditing', this.toggleEditView); this.releaseEditModeHandler = () => this.openmct.editor.off('isEditing', this.toggleEditView); } else { - this.currentView = provider.view(this.currentObject, this.openmct.editor.isEditing()); + this.currentView = provider.view(this.currentObject, this.openmct.editor.isEditing(), objectPath); if (this.currentView.onEditModeChange) { this.openmct.editor.on('isEditing', this.invokeEditModeHandler); @@ -117,7 +120,7 @@ export default { this.openmct.objectViews.on('clearData', this.clearData); }, - show(object, viewKey, immediatelySelect) { + show(object, viewKey, immediatelySelect, currentObjectPath) { if (this.unlisten) { this.unlisten(); } @@ -132,6 +135,11 @@ export default { } this.currentObject = object; + + if (currentObjectPath) { + this.currentObjectPath = currentObjectPath; + } + this.unlisten = this.openmct.objects.observe(this.currentObject, '*', (mutatedObject) => { this.currentObject = mutatedObject; }); diff --git a/src/ui/layout/BrowseBar.vue b/src/ui/layout/BrowseBar.vue index 7e894f8f7e..7a352b2466 100644 --- a/src/ui/layout/BrowseBar.vue +++ b/src/ui/layout/BrowseBar.vue @@ -19,28 +19,11 @@
-
- -
-
    -
  • - {{ view.name }} -
  • -
-
-
+ +
+ +