mirror of
https://github.com/nasa/openmct.git
synced 2025-06-20 16:10:23 +00:00
* [#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:
@ -86,11 +86,20 @@ define(
|
|||||||
})
|
})
|
||||||
.join('/');
|
.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)) {
|
return objNew;
|
||||||
openmct.editor.edit();
|
});
|
||||||
|
if (isFirstViewEditable(object.useCapability('adapter'), path)) {
|
||||||
|
openmct.editor.edit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openmct.router.once('afterNavigation', editObject);
|
||||||
|
|
||||||
|
openmct.router.navigate(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
newModel.type = this.type.getKey();
|
newModel.type = this.type.getKey();
|
||||||
|
@ -147,6 +147,10 @@ class ApplicationRouter extends EventEmitter {
|
|||||||
let targetObject = objectPath[0];
|
let targetObject = objectPath[0];
|
||||||
let navigatedObject = this.path[0];
|
let navigatedObject = this.path[0];
|
||||||
|
|
||||||
|
if (!targetObject.identifier) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return this.openmct.objects.areIdsEqual(targetObject.identifier, navigatedObject.identifier);
|
return this.openmct.objects.areIdsEqual(targetObject.identifier, navigatedObject.identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ define([
|
|||||||
objects = objects.reverse();
|
objects = objects.reverse();
|
||||||
|
|
||||||
openmct.router.path = objects;
|
openmct.router.path = objects;
|
||||||
|
openmct.router.emit('afterNavigation');
|
||||||
browseObject = objects[0];
|
browseObject = objects[0];
|
||||||
|
|
||||||
openmct.layout.$refs.browseBar.domainObject = browseObject;
|
openmct.layout.$refs.browseBar.domainObject = browseObject;
|
||||||
|
Reference in New Issue
Block a user