mirror of
https://github.com/nasa/openmct.git
synced 2025-04-26 05:49:42 +00:00
[Search] Removed unnecissary variable
Removed $scope.items, because it was unnecissary.
This commit is contained in:
parent
8eda495aa7
commit
33b30f7583
@ -76,7 +76,6 @@ define(function () {
|
|||||||
return objectService.getObjects(['mine']).then(function (objects) {
|
return objectService.getObjects(['mine']).then(function (objects) {
|
||||||
return listHelper(objects.mine).then(function (c) {
|
return listHelper(objects.mine).then(function (c) {
|
||||||
console.log('final result ', c);
|
console.log('final result ', c);
|
||||||
$scope.items = c; // Somewhat redundant
|
|
||||||
return c;
|
return c;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -96,37 +95,33 @@ define(function () {
|
|||||||
term = term.toLocaleLowerCase();
|
term = term.toLocaleLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh items list
|
// Get items list
|
||||||
return listify().then( function () {
|
return listify().then(function (items) {
|
||||||
// Slight time optimization
|
// (slight time optimization)
|
||||||
itemsLength = $scope.items.length;
|
itemsLength = items.length;
|
||||||
|
|
||||||
|
// Then filter through the items list
|
||||||
for (i = 0; i < itemsLength; i += 1) {
|
for (i = 0; i < itemsLength; i += 1) {
|
||||||
itemModel = $scope.items[i].getModel();
|
itemModel = items[i].getModel();
|
||||||
itemName = itemModel.name.toLocaleLowerCase();
|
itemName = itemModel.name.toLocaleLowerCase();
|
||||||
|
|
||||||
// Include any matching items, except folders
|
// Include any matching items, except folders
|
||||||
if (itemName.includes(term) && itemModel.type !== 'folder') {
|
if (itemName.includes(term) && itemModel.type !== 'folder') {
|
||||||
searchResults.push($scope.items[i]);
|
searchResults.push(items[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.results = searchResults; // Somewhat redundant
|
$scope.results = searchResults; // Some redundancy
|
||||||
return searchResults;
|
return searchResults;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the search view is opened, call listify()
|
|
||||||
// When the search button is pressed, call search()
|
|
||||||
|
|
||||||
$scope.items = listify();
|
|
||||||
$scope.results = search();
|
$scope.results = search();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
search: search,
|
search: search,
|
||||||
/**
|
|
||||||
* Check to see if there are any search results to display.
|
// Check to see if there are any search results to display.
|
||||||
*/
|
|
||||||
areResults: function () {
|
areResults: function () {
|
||||||
return $scope.results.length !== 0;
|
return $scope.results.length !== 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user