mirror of
https://github.com/nasa/openmct.git
synced 2024-12-22 14:32:22 +00:00
Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
This commit is contained in:
parent
0fd637c0e9
commit
67d53fb62b
@ -216,6 +216,20 @@ export default {
|
|||||||
this.updateSection({ sections });
|
this.updateSection({ sections });
|
||||||
this.throttledSearchItem('');
|
this.throttledSearchItem('');
|
||||||
},
|
},
|
||||||
|
createNotebookStorageObject() {
|
||||||
|
const notebookMeta = {
|
||||||
|
name: this.internalDomainObject.name,
|
||||||
|
identifier: this.internalDomainObject.identifier
|
||||||
|
};
|
||||||
|
const page = this.getSelectedPage();
|
||||||
|
const section = this.getSelectedSection();
|
||||||
|
|
||||||
|
return {
|
||||||
|
notebookMeta,
|
||||||
|
section,
|
||||||
|
page
|
||||||
|
}
|
||||||
|
},
|
||||||
dragOver(event) {
|
dragOver(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.dataTransfer.dropEffect = "copy";
|
event.dataTransfer.dropEffect = "copy";
|
||||||
@ -379,12 +393,9 @@ export default {
|
|||||||
this.updateSection({ sections });
|
this.updateSection({ sections });
|
||||||
},
|
},
|
||||||
newEntry(embed = null) {
|
newEntry(embed = null) {
|
||||||
const selectedSection = this.getSelectedSection();
|
|
||||||
const selectedPage = this.getSelectedPage();
|
|
||||||
this.search = '';
|
this.search = '';
|
||||||
|
const notebookStorage = this.createNotebookStorageObject();
|
||||||
this.updateDefaultNotebook(selectedSection, selectedPage);
|
this.updateDefaultNotebook(notebookStorage);
|
||||||
const notebookStorage = getDefaultNotebook();
|
|
||||||
const id = addNotebookEntry(this.openmct, this.internalDomainObject, notebookStorage, embed);
|
const id = addNotebookEntry(this.openmct, this.internalDomainObject, notebookStorage, embed);
|
||||||
this.focusEntryId = id;
|
this.focusEntryId = id;
|
||||||
this.search = '';
|
this.search = '';
|
||||||
@ -417,13 +428,13 @@ export default {
|
|||||||
toggleNav() {
|
toggleNav() {
|
||||||
this.showNav = !this.showNav;
|
this.showNav = !this.showNav;
|
||||||
},
|
},
|
||||||
async updateDefaultNotebook(selectedSection, selectedPage) {
|
async updateDefaultNotebook(notebookStorage) {
|
||||||
const defaultNotebookObject = await this.getDefaultNotebookObject();
|
const defaultNotebookObject = await this.getDefaultNotebookObject();
|
||||||
this.removeDefaultClass(defaultNotebookObject);
|
this.removeDefaultClass(defaultNotebookObject);
|
||||||
setDefaultNotebook(this.internalDomainObject, selectedSection, selectedPage);
|
setDefaultNotebook(notebookStorage);
|
||||||
this.addDefaultClass();
|
this.addDefaultClass();
|
||||||
this.defaultSectionId = selectedSection.id;
|
this.defaultSectionId = notebookStorage.section.id;
|
||||||
this.defaultPageId = selectedPage.id;
|
this.defaultPageId = notebookStorage.page.id;
|
||||||
},
|
},
|
||||||
updateDefaultNotebookPage(pages, id) {
|
updateDefaultNotebookPage(pages, id) {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
@ -10,18 +10,7 @@ export function getDefaultNotebook() {
|
|||||||
return JSON.parse(notebookStorage);
|
return JSON.parse(notebookStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setDefaultNotebook(domainObject, section, page) {
|
export function setDefaultNotebook(notebookStorage) {
|
||||||
const notebookMeta = {
|
|
||||||
name: domainObject.name,
|
|
||||||
identifier: domainObject.identifier
|
|
||||||
};
|
|
||||||
|
|
||||||
const notebookStorage = {
|
|
||||||
notebookMeta,
|
|
||||||
section,
|
|
||||||
page
|
|
||||||
}
|
|
||||||
|
|
||||||
window.localStorage.setItem(NOTEBOOK_LOCAL_STORAGE, JSON.stringify(notebookStorage));
|
window.localStorage.setItem(NOTEBOOK_LOCAL_STORAGE, JSON.stringify(notebookStorage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user