Tree Performance Fixes (#2353)

* Disable disclosure triangle transition

* Reduce number of times navigation path is calculated
This commit is contained in:
Andrew Henry 2019-04-05 09:44:38 -07:00 committed by Pegah Sarram
parent 8b275b206b
commit 517a40a32b
5 changed files with 17 additions and 15 deletions

View File

@ -148,8 +148,6 @@ button {
display: block;
font-family: symbolsfont;
font-size: 1rem * $s;
transform-origin: center;
transition: $transOut;
}
}

View File

@ -59,7 +59,8 @@ export default {
default() {
return [];
}
}
},
navigateToPath: String
},
data() {
return {

View File

@ -211,7 +211,8 @@
return {
id: this.openmct.objects.makeKeyString(c.identifier),
object: c,
objectPath: [c]
objectPath: [c],
navigateToParent: '/browse'
};
});
});

View File

@ -7,7 +7,8 @@
v-model="expanded">
</view-control>
<object-label :domainObject="node.object"
:objectPath="node.objectPath">
:objectPath="node.objectPath"
:navigateToPath="navigateToPath">
</object-label>
</div>
<ul v-if="expanded" class="c-tree">
@ -36,13 +37,12 @@
node: Object
},
data() {
this.pathToObject = this.buildPathString(this.node.objectPath);
this.navigateToPath = this.buildPathString(this.node.navigateToParent)
return {
hasChildren: false,
isLoading: false,
loaded: false,
isNavigated: this.pathToObject === this.openmct.router.currentLocation.path,
isNavigated: this.navigateToPath === this.openmct.router.currentLocation.path,
children: [],
expanded: false
}
@ -103,7 +103,8 @@
this.children.push({
id: this.openmct.objects.makeKeyString(child.identifier),
object: child,
objectPath: [child].concat(this.node.objectPath)
objectPath: [child].concat(this.node.objectPath),
navigateToParent: this.navigateToPath
});
},
removeChild(identifier) {
@ -115,15 +116,13 @@
this.isLoading = false;
this.loaded = true;
},
buildPathString(path) {
return '/browse/' + path.map(o => o && this.openmct.objects.makeKeyString(o.identifier))
.reverse()
.join('/');
buildPathString(parentPath) {
return [parentPath, this.openmct.objects.makeKeyString(this.node.object.identifier)].join('/');
},
highlightIfNavigated(newPath, oldPath){
if (newPath === this.pathToObject) {
if (newPath === this.navigateToPath) {
this.isNavigated = true;
} else if (oldPath === this.pathToObject) {
} else if (oldPath === this.navigateToPath) {
this.isNavigated = false;
}
}

View File

@ -13,6 +13,9 @@ export default {
if (!this.objectPath.length) {
return;
}
if (this.navigateToPath) {
return '#' + this.navigateToPath;
}
return '#/browse/' + this.objectPath
.map(o => o && this.openmct.objects.makeKeyString(o.identifier))
.reverse()