mirror of
https://github.com/nasa/openmct.git
synced 2025-06-10 03:11:39 +00:00
Notebook Snapshotting to the default Notebook isn't working (#4475)
* Notebook Snapshotting to the default Notebook isn't working #4469
This commit is contained in:
parent
2f63718385
commit
a8da0d5917
@ -142,7 +142,6 @@ import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaul
|
|||||||
import { addNotebookEntry, createNewEmbed, getEntryPosById, getNotebookEntries, mutateObject } from '../utils/notebook-entries';
|
import { addNotebookEntry, createNewEmbed, getEntryPosById, getNotebookEntries, mutateObject } from '../utils/notebook-entries';
|
||||||
import { saveNotebookImageDomainObject, updateNamespaceOfDomainObject } from '../utils/notebook-image';
|
import { saveNotebookImageDomainObject, updateNamespaceOfDomainObject } from '../utils/notebook-image';
|
||||||
import { NOTEBOOK_VIEW_TYPE } from '../notebook-constants';
|
import { NOTEBOOK_VIEW_TYPE } from '../notebook-constants';
|
||||||
import objectUtils from 'objectUtils';
|
|
||||||
|
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import objectLink from '../../../ui/mixins/object-link';
|
import objectLink from '../../../ui/mixins/object-link';
|
||||||
@ -455,11 +454,6 @@ export default {
|
|||||||
? getDefaultNotebook().defaultSectionId
|
? getDefaultNotebook().defaultSectionId
|
||||||
: undefined;
|
: undefined;
|
||||||
},
|
},
|
||||||
getDefaultNotebookObject() {
|
|
||||||
const defaultNotebook = getDefaultNotebook();
|
|
||||||
|
|
||||||
return defaultNotebook && this.openmct.objects.get(defaultNotebook.identifier);
|
|
||||||
},
|
|
||||||
getLinktoNotebook() {
|
getLinktoNotebook() {
|
||||||
const objectPath = this.openmct.router.path;
|
const objectPath = this.openmct.router.path;
|
||||||
const link = objectLink.computed.objectLink.call({
|
const link = objectLink.computed.objectLink.call({
|
||||||
@ -619,12 +613,12 @@ export default {
|
|||||||
|
|
||||||
this.sectionsChanged({ sections });
|
this.sectionsChanged({ sections });
|
||||||
},
|
},
|
||||||
removeDefaultClass(domainObject) {
|
removeDefaultClass(defaultNotebookIdentifier) {
|
||||||
if (!domainObject) {
|
if (!defaultNotebookIdentifier) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.openmct.status.delete(domainObject.identifier);
|
this.openmct.status.delete(defaultNotebookIdentifier);
|
||||||
},
|
},
|
||||||
resetSearch() {
|
resetSearch() {
|
||||||
this.search = '';
|
this.search = '';
|
||||||
@ -633,15 +627,16 @@ export default {
|
|||||||
toggleNav() {
|
toggleNav() {
|
||||||
this.showNav = !this.showNav;
|
this.showNav = !this.showNav;
|
||||||
},
|
},
|
||||||
async updateDefaultNotebook(notebookStorage) {
|
updateDefaultNotebook(notebookStorage) {
|
||||||
const defaultNotebookObject = await this.getDefaultNotebookObject();
|
const defaultNotebook = getDefaultNotebook();
|
||||||
const isSameNotebook = defaultNotebookObject
|
const defaultNotebookIdentifier = defaultNotebook && defaultNotebook.identifier;
|
||||||
&& objectUtils.makeKeyString(defaultNotebookObject.identifier) === objectUtils.makeKeyString(notebookStorage.identifier);
|
const isSameNotebook = defaultNotebookIdentifier
|
||||||
|
&& this.openmct.objects.areIdsEqual(defaultNotebookIdentifier, notebookStorage.identifier);
|
||||||
if (!isSameNotebook) {
|
if (!isSameNotebook) {
|
||||||
this.removeDefaultClass(defaultNotebookObject);
|
this.removeDefaultClass(defaultNotebookIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defaultNotebookObject || !isSameNotebook) {
|
if (!defaultNotebookIdentifier || !isSameNotebook) {
|
||||||
setDefaultNotebook(this.openmct, notebookStorage, this.domainObject);
|
setDefaultNotebook(this.openmct, notebookStorage, this.domainObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,11 +105,6 @@ export function addNotebookEntry(openmct, domainObject, notebookStorage, embed =
|
|||||||
const date = Date.now();
|
const date = Date.now();
|
||||||
const configuration = domainObject.configuration;
|
const configuration = domainObject.configuration;
|
||||||
const entries = configuration.entries || {};
|
const entries = configuration.entries || {};
|
||||||
|
|
||||||
if (!entries) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const embeds = embed
|
const embeds = embed
|
||||||
? [embed]
|
? [embed]
|
||||||
: [];
|
: [];
|
||||||
@ -125,7 +120,8 @@ export function addNotebookEntry(openmct, domainObject, notebookStorage, embed =
|
|||||||
const newEntries = addEntryIntoPage(notebookStorage, entries, entry);
|
const newEntries = addEntryIntoPage(notebookStorage, entries, entry);
|
||||||
|
|
||||||
addDefaultClass(domainObject, openmct);
|
addDefaultClass(domainObject, openmct);
|
||||||
domainObject.configuration.entries = newEntries;
|
|
||||||
|
mutateObject(openmct, domainObject, 'configuration.entries', newEntries);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user