mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 17:08:57 +00:00
View Large overlay doesn't allow taking Snapshots (#4091)
* Added NotebookMenuSwitcher in preview header * Use preview component inside viewLargeAction * Added autoHide flag to overlay API that allows developers to specify whether an overlay should remain visible if other overlays are subsequently triggered (eg. the snapshot overlay) * When in edit mode, disable navigation link to notebook entry. Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
@ -358,6 +358,20 @@ ObjectAPI.prototype.applyGetInterceptors = function (identifier, domainObject) {
|
||||
return domainObject;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return relative url path from a given object path
|
||||
* eg: #/browse/mine/cb56f6bf-c900-43b7-b923-2e3b64b412db/6e89e858-77ce-46e4-a1ad-749240286497/....
|
||||
* @param {Array} objectPath
|
||||
* @returns {string} relative url for object
|
||||
*/
|
||||
ObjectAPI.prototype.getRelativePath = function (objectPath) {
|
||||
return objectPath
|
||||
.map(p => this.makeKeyString(p.identifier))
|
||||
.reverse()
|
||||
.join('/')
|
||||
;
|
||||
};
|
||||
|
||||
/**
|
||||
* Modify a domain object.
|
||||
* @param {module:openmct.DomainObject} object the object to mutate
|
||||
|
@ -10,28 +10,37 @@ const cssClasses = {
|
||||
};
|
||||
|
||||
class Overlay extends EventEmitter {
|
||||
constructor(options) {
|
||||
constructor({
|
||||
buttons,
|
||||
autoHide = true,
|
||||
dismissable = true,
|
||||
element,
|
||||
onDestroy,
|
||||
size
|
||||
} = {}) {
|
||||
super();
|
||||
|
||||
this.dismissable = options.dismissable !== false;
|
||||
this.container = document.createElement('div');
|
||||
this.container.classList.add('l-overlay-wrapper', cssClasses[options.size]);
|
||||
this.container.classList.add('l-overlay-wrapper', cssClasses[size]);
|
||||
|
||||
this.autoHide = autoHide;
|
||||
this.dismissable = dismissable !== false;
|
||||
|
||||
this.component = new Vue({
|
||||
provide: {
|
||||
dismiss: this.dismiss.bind(this),
|
||||
element: options.element,
|
||||
buttons: options.buttons,
|
||||
dismissable: this.dismissable
|
||||
},
|
||||
components: {
|
||||
OverlayComponent: OverlayComponent
|
||||
},
|
||||
provide: {
|
||||
dismiss: this.dismiss.bind(this),
|
||||
element,
|
||||
buttons,
|
||||
dismissable: this.dismissable
|
||||
},
|
||||
template: '<overlay-component></overlay-component>'
|
||||
});
|
||||
|
||||
if (options.onDestroy) {
|
||||
this.once('destroy', options.onDestroy);
|
||||
if (onDestroy) {
|
||||
this.once('destroy', onDestroy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,10 @@ class OverlayAPI {
|
||||
*/
|
||||
showOverlay(overlay) {
|
||||
if (this.activeOverlays.length) {
|
||||
this.activeOverlays[this.activeOverlays.length - 1].container.classList.add('invisible');
|
||||
const previousOverlay = this.activeOverlays[this.activeOverlays.length - 1];
|
||||
if (previousOverlay.autoHide) {
|
||||
previousOverlay.container.classList.add('invisible');
|
||||
}
|
||||
}
|
||||
|
||||
this.activeOverlays.push(overlay);
|
||||
|
Reference in New Issue
Block a user