mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 21:28:12 +00:00
Notebook saved link (#2998)
* https://github.com/nasa/openmct/issues/2859 * create and store link to default notebook in storage and pass it to notification. * [Notebook] Add link to notebook inside 'Saved to Notebook' notification #2860 * Added custom autoDismissTimeout for into notifications. * Backwards compatibility fix for old notebook model without link in metadata. * lint fixes * added JS Doc description for API changes + changed property names to appropriate function. * fixed bug due to merging. * fixed url update loop Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
@ -48,14 +48,29 @@ export function getDefaultNotebook() {
|
||||
return JSON.parse(notebookStorage);
|
||||
}
|
||||
|
||||
export async function getDefaultNotebookLink(openmct, domainObject = null) {
|
||||
if (!domainObject) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const path = await openmct.objects.getOriginalPath(domainObject.identifier)
|
||||
.then(objectPath => objectPath
|
||||
.map(o => o && openmct.objects.makeKeyString(o.identifier))
|
||||
.reverse()
|
||||
.join('/')
|
||||
);
|
||||
const { page, section } = getDefaultNotebook();
|
||||
|
||||
return `#/browse/${path}?sectionId=${section.id}&pageId=${page.id}`;
|
||||
}
|
||||
|
||||
export function setDefaultNotebook(openmct, notebookStorage, domainObject) {
|
||||
observeDefaultNotebookObject(openmct, notebookStorage.notebookMeta, domainObject);
|
||||
observeDefaultNotebookObject(openmct, notebookStorage, domainObject);
|
||||
saveDefaultNotebook(notebookStorage);
|
||||
}
|
||||
|
||||
export function setDefaultNotebookSection(section) {
|
||||
const notebookStorage = getDefaultNotebook();
|
||||
|
||||
notebookStorage.section = section;
|
||||
saveDefaultNotebook(notebookStorage);
|
||||
}
|
||||
|
Reference in New Issue
Block a user