mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 06:38:17 +00:00
[Search] Remove unnecissary funtions
Removed isLoading, hasInput, and clear functions in favor of having the logic within the search template.
This commit is contained in:
@ -35,14 +35,14 @@
|
|||||||
<!-- Search icon -->
|
<!-- Search icon -->
|
||||||
<!-- ui symbols for search are 'd' and 'M' -->
|
<!-- ui symbols for search are 'd' and 'M' -->
|
||||||
<div class="ui-symbol search-icon"
|
<div class="ui-symbol search-icon"
|
||||||
ng-class="{content: controller.hasInput()}">
|
ng-class="{content: !(ngModel.input === '' || ngModel.input === undefined)}">
|
||||||
M
|
M
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Clear icon/button 'x' -->
|
<!-- Clear icon/button 'x' -->
|
||||||
<a class="ui-symbol clear-icon"
|
<a class="ui-symbol clear-icon"
|
||||||
ng-class="{content: controller.hasInput()}"
|
ng-class="{content: !(ngModel.input === '' || ngModel.input === undefined)}"
|
||||||
ng-click="controller.clear()">
|
ng-click="ngModel.input = ''; controller.search()">
|
||||||
x
|
x
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -135,8 +135,8 @@
|
|||||||
|
|
||||||
<!-- Loading icon -->
|
<!-- Loading icon -->
|
||||||
<div class="load-icon"
|
<div class="load-icon"
|
||||||
ng-class="{loading: controller.isLoading()}"
|
ng-class="{loading: loading}"
|
||||||
ng-if="controller.isLoading()">
|
ng-if="loading">
|
||||||
<span class="icon wait-spinner"></span>
|
<span class="icon wait-spinner"></span>
|
||||||
<span class="title-label">Loading...</span>
|
<span class="title-label">Loading...</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,15 +33,15 @@ define(function () {
|
|||||||
function SearchController($scope, searchService, types) {
|
function SearchController($scope, searchService, types) {
|
||||||
// Starting amount of results to load. Will get increased.
|
// Starting amount of results to load. Will get increased.
|
||||||
var numResults = INITIAL_LOAD_NUMBER,
|
var numResults = INITIAL_LOAD_NUMBER,
|
||||||
loading = false,
|
|
||||||
fullResults = {hits: []};
|
fullResults = {hits: []};
|
||||||
|
|
||||||
// Scope variables are
|
// Scope variables are:
|
||||||
// $scope.results, $scope.types
|
// results, types, loading, filtersString,
|
||||||
// $scope.ngModel.input, $scope.ngModel.search, $scope.ngModel.checked
|
// ngModel.input, ngModel.search, ngModel.checked
|
||||||
$scope.types = [];
|
$scope.types = [];
|
||||||
$scope.ngModel.checked = {};
|
$scope.ngModel.checked = {};
|
||||||
$scope.filtersString = "";
|
$scope.filtersString = "";
|
||||||
|
$scope.loading = false;
|
||||||
|
|
||||||
function filter(hits) {
|
function filter(hits) {
|
||||||
var newResults = [],
|
var newResults = [],
|
||||||
@ -63,7 +63,7 @@ define(function () {
|
|||||||
|
|
||||||
// We are starting to load.
|
// We are starting to load.
|
||||||
if (inputText !== '' && inputText !== undefined) {
|
if (inputText !== '' && inputText !== undefined) {
|
||||||
loading = true;
|
$scope.loading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update whether the file tree should be displayed
|
// Update whether the file tree should be displayed
|
||||||
@ -90,7 +90,7 @@ define(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now we are done loading.
|
// Now we are done loading.
|
||||||
loading = false;
|
$scope.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,14 +158,6 @@ define(function () {
|
|||||||
*/
|
*/
|
||||||
search: search,
|
search: search,
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks to see if we are still waiting for the results to be
|
|
||||||
* fully updated.
|
|
||||||
*/
|
|
||||||
isLoading: function () {
|
|
||||||
return loading;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if there are more search results to display. If the answer
|
* Checks to see if there are more search results to display. If the answer
|
||||||
* is unclear, this function will err on there being more results.
|
* is unclear, this function will err on there being more results.
|
||||||
@ -200,24 +192,6 @@ define(function () {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if the search bar has any text inputted into it.
|
|
||||||
* Used as a helper for CSS styling.
|
|
||||||
*/
|
|
||||||
hasInput: function () {
|
|
||||||
return !($scope.ngModel.input === "" || $scope.ngModel.input === undefined);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the input text.
|
|
||||||
*/
|
|
||||||
clear: function () {
|
|
||||||
// Clear input field
|
|
||||||
$scope.ngModel.input = '';
|
|
||||||
// Call search to clear the results list too
|
|
||||||
search();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-filters the search restuls. Called when ngModel.checked changes.
|
* Re-filters the search restuls. Called when ngModel.checked changes.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user