Don't allow recursive Preview actions #2775

This commit is contained in:
Nikhil Mandlik 2020-04-02 17:23:27 -07:00
parent ea90d02d66
commit 5563cbea3a
4 changed files with 23 additions and 5 deletions

View File

@ -75,9 +75,11 @@ class ContextMenuAPI {
/**
* @private
*/
_showContextMenuForObjectPath(objectPath, x, y, actionsToBeIncluded) {
let applicableActions = this._allActions.filter((action) => {
_showContextMenuForObjectPath(objectPath, x, y, actionsToBeIncluded, actionsToBeSkipped = []) {
let applicableActions = this._allActions.filter(action => {
if (actionsToBeSkipped.includes(action.key)) {
return false;
}
if (actionsToBeIncluded) {
if (action.appliesTo === undefined && actionsToBeIncluded.includes(action.key)) {

View File

@ -11,6 +11,12 @@ import contextMenu from '../mixins/context-menu-gesture'
export default {
mixins: [contextMenu],
props: {
actionsToBeSkipped: {
type: Array,
default() {
return [];
}
},
objectPath: {
type: Array,
required: true

View File

@ -1,6 +1,12 @@
export default {
inject: ['openmct'],
props: {
'actionsToBeSkipped': {
type: Array,
default() {
return [];
}
},
'objectPath': {
type: Array,
default() {
@ -30,7 +36,7 @@ export default {
showContextMenu(event) {
event.preventDefault();
event.stopPropagation();
this.openmct.contextMenu._showContextMenuForObjectPath(this.objectPath, event.clientX, event.clientY);
this.openmct.contextMenu._showContextMenuForObjectPath(this.objectPath, event.clientX, event.clientY, null, this.actionsToBeSkipped);
}
}
};

View File

@ -30,7 +30,10 @@
<span class="l-browse-bar__object-name">
{{ domainObject.name }}
</span>
<context-menu-drop-down :object-path="objectPath" />
<context-menu-drop-down
:actions-to-be-skipped="actionsToBeSkipped"
:object-path="objectPath"
/>
</div>
</div>
<div class="l-browse-bar__end">
@ -67,6 +70,7 @@ export default {
let type = this.openmct.types.get(domainObject.type);
return {
actionsToBeSkipped: ['preview'],
domainObject: domainObject,
type: type,
notebookEnabled: false,