[Abort Search] Completely Abort Search (#3728)

* added new spacecraftPosition keys and changed old spacecraft keys to spacecraftOriention keys, updated how freshness is determined

* due to tests, added some checks for missing related telemetry before acting on it

* lint fixes

* pr comments, change simple if to Boolean

* checking if search aborted before aggregating search results, which calls getOriginalPath, which calls more gets

* removing erroneous abort signal check
This commit is contained in:
Jamie V 2021-03-03 14:05:17 -08:00 committed by GitHub
parent ac20c01233
commit 03abb5e5de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -698,7 +698,7 @@ export default {
const promises = this.openmct.objects.search(this.searchValue, abortSignal) const promises = this.openmct.objects.search(this.searchValue, abortSignal)
.map(promise => promise .map(promise => promise
.then(results => this.aggregateSearchResults(results))); .then(results => this.aggregateSearchResults(results, abortSignal)));
Promise.all(promises).then(() => { Promise.all(promises).then(() => {
this.searchLoading = false; this.searchLoading = false;
@ -710,24 +710,26 @@ export default {
} }
}); });
}, },
async aggregateSearchResults(results) { async aggregateSearchResults(results, abortSignal) {
for (const result of results) { for (const result of results) {
const objectPath = await this.openmct.objects.getOriginalPath(result.identifier); if (!abortSignal.aborted) {
const objectPath = await this.openmct.objects.getOriginalPath(result.identifier);
// removing the item itself, as the path we pass to buildTreeItem is a parent path // removing the item itself, as the path we pass to buildTreeItem is a parent path
objectPath.shift(); objectPath.shift();
// if root, remove, we're not using in object path for tree // if root, remove, we're not using in object path for tree
let lastObject = objectPath.length ? objectPath[objectPath.length - 1] : false; let lastObject = objectPath.length ? objectPath[objectPath.length - 1] : false;
if (lastObject && lastObject.type === 'root') { if (lastObject && lastObject.type === 'root') {
objectPath.pop(); objectPath.pop();
}
// we reverse the objectPath in the tree, so have to do it here first,
// since this one is already in the correct direction
let resultObject = this.buildTreeItem(result, objectPath.reverse());
this.searchResultItems.push(resultObject);
} }
// we reverse the objectPath in the tree, so have to do it here first,
// since this one is already in the correct direction
let resultObject = this.buildTreeItem(result, objectPath.reverse());
this.searchResultItems.push(resultObject);
} }
}, },
searchTree(value) { searchTree(value) {