[#4378] Ensure navigated object check works correctly when path is modified (#4433)

* [#4378] Emit event when router path is set. Handle the event when creating an object

Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
Shefali Joshi 2021-11-15 13:35:59 -08:00 committed by GitHub
parent 8ef3869325
commit 933ce7aa3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -86,11 +86,20 @@ define(
})
.join('/');
openmct.router.navigate(url);
function editObject() {
const path = objectPath.slice(-1).map(obj => {
const objNew = obj.getCapability('adapter').invoke();
if (isFirstViewEditable(object.useCapability('adapter'), objectPath)) {
openmct.editor.edit();
return objNew;
});
if (isFirstViewEditable(object.useCapability('adapter'), path)) {
openmct.editor.edit();
}
}
openmct.router.once('afterNavigation', editObject);
openmct.router.navigate(url);
}
newModel.type = this.type.getKey();

View File

@ -147,6 +147,10 @@ class ApplicationRouter extends EventEmitter {
let targetObject = objectPath[0];
let navigatedObject = this.path[0];
if (!targetObject.identifier) {
return false;
}
return this.openmct.objects.areIdsEqual(targetObject.identifier, navigatedObject.identifier);
}

View File

@ -68,6 +68,7 @@ define([
objects = objects.reverse();
openmct.router.path = objects;
openmct.router.emit('afterNavigation');
browseObject = objects[0];
openmct.layout.$refs.browseBar.domainObject = browseObject;