mirror of
https://github.com/nasa/openmct.git
synced 2025-03-23 12:35:48 +00:00
[Search] Fixed results display problem
Fixed problem with search results not properly being displayed in the search view. (Checked that things were defined before calling them.)
This commit is contained in:
parent
409d12aa75
commit
5980575918
@ -51,12 +51,16 @@ define(function () {
|
||||
|
||||
// Then filter through the items list
|
||||
for (i = 0; i < itemsLength; i++) {
|
||||
itemModel = items[i].getModel();
|
||||
itemName = itemModel.name.toLocaleLowerCase();
|
||||
|
||||
// Include any matching items, except folders
|
||||
if (itemName.includes(term) && itemModel.type !== 'folder') {
|
||||
searchResults.push(items[i]);
|
||||
// Prevent errors from getModel not being defined
|
||||
if (items[i].getModel) {
|
||||
itemModel = items[i].getModel();
|
||||
itemName = itemModel.name.toLocaleLowerCase();
|
||||
|
||||
// Include any matching items, except folders
|
||||
// TODO: Should have a policy for this
|
||||
if (itemName.includes(term) && itemModel.type !== 'folder') {
|
||||
searchResults.push(items[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,14 +69,16 @@ define(function () {
|
||||
});
|
||||
}
|
||||
|
||||
$scope.results = search();
|
||||
|
||||
return {
|
||||
search: search,
|
||||
|
||||
// Check to see if there are any search results to display.
|
||||
areResults: function () {
|
||||
return $scope.results.length !== 0;
|
||||
if ($scope.results) {
|
||||
return $scope.results.length > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user