mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 15:02:23 +00:00
[MCT3739] Updating document title when domainObject name mutates (#4367)
* Change document title on BrowseBar or PropertiesDialog change * Revert update name title mutation * Added listener for object name mutation * Remove properties action approach and scope to * instead of name * Remove extra line break
This commit is contained in:
parent
b9b0cfe0ef
commit
5caa5e1a50
@ -44,6 +44,12 @@ define([
|
|||||||
openmct.layout.$refs.browseBar.viewKey = viewProvider.key;
|
openmct.layout.$refs.browseBar.viewKey = viewProvider.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateDocumentTitleOnNameMutation(domainObject) {
|
||||||
|
if (typeof domainObject.name === 'string' && domainObject.name !== document.title) {
|
||||||
|
document.title = domainObject.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function navigateToPath(path, currentViewKey) {
|
function navigateToPath(path, currentViewKey) {
|
||||||
navigateCall++;
|
navigateCall++;
|
||||||
let currentNavigation = navigateCall;
|
let currentNavigation = navigateCall;
|
||||||
@ -72,7 +78,6 @@ define([
|
|||||||
browseObject = objects[0];
|
browseObject = objects[0];
|
||||||
|
|
||||||
openmct.layout.$refs.browseBar.domainObject = browseObject;
|
openmct.layout.$refs.browseBar.domainObject = browseObject;
|
||||||
|
|
||||||
if (!browseObject) {
|
if (!browseObject) {
|
||||||
openmct.layout.$refs.browseObject.clear();
|
openmct.layout.$refs.browseObject.clear();
|
||||||
|
|
||||||
@ -82,8 +87,9 @@ define([
|
|||||||
let currentProvider = openmct
|
let currentProvider = openmct
|
||||||
.objectViews
|
.objectViews
|
||||||
.getByProviderKey(currentViewKey);
|
.getByProviderKey(currentViewKey);
|
||||||
|
|
||||||
document.title = browseObject.name; //change document title to current object in main view
|
document.title = browseObject.name; //change document title to current object in main view
|
||||||
|
// assign listener to global for later clearing
|
||||||
|
unobserve = openmct.objects.observe(browseObject, '*', updateDocumentTitleOnNameMutation);
|
||||||
|
|
||||||
if (currentProvider && currentProvider.canView(browseObject, openmct.router.path)) {
|
if (currentProvider && currentProvider.canView(browseObject, openmct.router.path)) {
|
||||||
viewObject(browseObject, currentProvider);
|
viewObject(browseObject, currentProvider);
|
||||||
@ -108,7 +114,6 @@ define([
|
|||||||
function pathToObjects(path) {
|
function pathToObjects(path) {
|
||||||
return Promise.all(path.map((keyString) => {
|
return Promise.all(path.map((keyString) => {
|
||||||
let identifier = openmct.objects.parseKeyString(keyString);
|
let identifier = openmct.objects.parseKeyString(keyString);
|
||||||
|
|
||||||
if (openmct.objects.supportsMutation(identifier)) {
|
if (openmct.objects.supportsMutation(identifier)) {
|
||||||
return openmct.objects.getMutable(identifier);
|
return openmct.objects.getMutable(identifier);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user