mirror of
https://github.com/nasa/openmct.git
synced 2025-04-15 06:56:43 +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:
parent
31337eaf4f
commit
aa67489404
platform/search
@ -35,14 +35,14 @@
|
||||
<!-- Search icon -->
|
||||
<!-- ui symbols for search are 'd' and 'M' -->
|
||||
<div class="ui-symbol search-icon"
|
||||
ng-class="{content: controller.hasInput()}">
|
||||
ng-class="{content: !(ngModel.input === '' || ngModel.input === undefined)}">
|
||||
M
|
||||
</div>
|
||||
|
||||
<!-- Clear icon/button 'x' -->
|
||||
<a class="ui-symbol clear-icon"
|
||||
ng-class="{content: controller.hasInput()}"
|
||||
ng-click="controller.clear()">
|
||||
ng-class="{content: !(ngModel.input === '' || ngModel.input === undefined)}"
|
||||
ng-click="ngModel.input = ''; controller.search()">
|
||||
x
|
||||
</a>
|
||||
|
||||
@ -135,8 +135,8 @@
|
||||
|
||||
<!-- Loading icon -->
|
||||
<div class="load-icon"
|
||||
ng-class="{loading: controller.isLoading()}"
|
||||
ng-if="controller.isLoading()">
|
||||
ng-class="{loading: loading}"
|
||||
ng-if="loading">
|
||||
<span class="icon wait-spinner"></span>
|
||||
<span class="title-label">Loading...</span>
|
||||
</div>
|
||||
|
@ -33,15 +33,15 @@ define(function () {
|
||||
function SearchController($scope, searchService, types) {
|
||||
// Starting amount of results to load. Will get increased.
|
||||
var numResults = INITIAL_LOAD_NUMBER,
|
||||
loading = false,
|
||||
fullResults = {hits: []};
|
||||
|
||||
// Scope variables are
|
||||
// $scope.results, $scope.types
|
||||
// $scope.ngModel.input, $scope.ngModel.search, $scope.ngModel.checked
|
||||
// Scope variables are:
|
||||
// results, types, loading, filtersString,
|
||||
// ngModel.input, ngModel.search, ngModel.checked
|
||||
$scope.types = [];
|
||||
$scope.ngModel.checked = {};
|
||||
$scope.filtersString = "";
|
||||
$scope.loading = false;
|
||||
|
||||
function filter(hits) {
|
||||
var newResults = [],
|
||||
@ -63,7 +63,7 @@ define(function () {
|
||||
|
||||
// We are starting to load.
|
||||
if (inputText !== '' && inputText !== undefined) {
|
||||
loading = true;
|
||||
$scope.loading = true;
|
||||
}
|
||||
|
||||
// Update whether the file tree should be displayed
|
||||
@ -90,7 +90,7 @@ define(function () {
|
||||
}
|
||||
|
||||
// Now we are done loading.
|
||||
loading = false;
|
||||
$scope.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@ -158,14 +158,6 @@ define(function () {
|
||||
*/
|
||||
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
|
||||
* 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.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user