Don't allow recursive Preview actions #2775 (#2869)

* Don't allow recursive Preview actions #2775

* actionsToBeIncluded and actionsToBeSkipped passed in as options object.

* Revert "actionsToBeIncluded and actionsToBeSkipped passed in as options object."

This reverts commit f501d0b4bafab4e89e1afa561fb5a8e5c8edeabe.

* Revert "Don't allow recursive Preview actions #2775"

This reverts commit 5563cbea3acce4b884e25440b62e89034328c497.

* Don't allow recursive Preview actions

Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
Nikhil 2020-05-01 09:33:10 -07:00 committed by GitHub
parent 3282934cf6
commit 23303c910e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,12 @@ export default class PreviewAction {
* Dependencies * Dependencies
*/ */
this._openmct = openmct; this._openmct = openmct;
if (PreviewAction.isVisible === undefined) {
PreviewAction.isVisible = false;
}
} }
invoke(objectPath) { invoke(objectPath) {
let preview = new Vue({ let preview = new Vue({
components: { components: {
@ -59,12 +64,19 @@ export default class PreviewAction {
callback: () => overlay.dismiss() callback: () => overlay.dismiss()
} }
], ],
onDestroy: () => preview.$destroy() onDestroy: () => {
PreviewAction.isVisible = false;
preview.$destroy()
}
}); });
PreviewAction.isVisible = true;
} }
appliesTo(objectPath) { appliesTo(objectPath) {
return !this._isNavigatedObject(objectPath) && !this._preventPreview(objectPath); return !PreviewAction.isVisible && !this._isNavigatedObject(objectPath);
} }
_isNavigatedObject(objectPath) { _isNavigatedObject(objectPath) {
let targetObject = objectPath[0]; let targetObject = objectPath[0];
let navigatedObject = this._openmct.router.path[0]; let navigatedObject = this._openmct.router.path[0];