mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 09:52:04 +00:00
[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:
parent
ac20c01233
commit
03abb5e5de
@ -698,7 +698,7 @@ export default {
|
||||
|
||||
const promises = this.openmct.objects.search(this.searchValue, abortSignal)
|
||||
.map(promise => promise
|
||||
.then(results => this.aggregateSearchResults(results)));
|
||||
.then(results => this.aggregateSearchResults(results, abortSignal)));
|
||||
|
||||
Promise.all(promises).then(() => {
|
||||
this.searchLoading = false;
|
||||
@ -710,24 +710,26 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
async aggregateSearchResults(results) {
|
||||
async aggregateSearchResults(results, abortSignal) {
|
||||
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
|
||||
objectPath.shift();
|
||||
// removing the item itself, as the path we pass to buildTreeItem is a parent path
|
||||
objectPath.shift();
|
||||
|
||||
// if root, remove, we're not using in object path for tree
|
||||
let lastObject = objectPath.length ? objectPath[objectPath.length - 1] : false;
|
||||
if (lastObject && lastObject.type === 'root') {
|
||||
objectPath.pop();
|
||||
// if root, remove, we're not using in object path for tree
|
||||
let lastObject = objectPath.length ? objectPath[objectPath.length - 1] : false;
|
||||
if (lastObject && lastObject.type === 'root') {
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user