[Search] Tweak controller loading

Changed the controller to update the tree
display status when the search result
promise is fufilled, not before making the
search query.
Also chagned the loading increment from
5 to 20.
This commit is contained in:
slhale 2015-08-04 16:40:31 -07:00
parent d82be0deef
commit c9acfc9f89

View File

@ -28,7 +28,7 @@ define(function () {
"use strict";
var INITIAL_LOAD_NUMBER = 20,
LOAD_INCREMENT = 5;
LOAD_INCREMENT = 20;
function SearchController($scope, searchService) {
// Starting amount of results to load. Will get increased.
@ -42,13 +42,6 @@ define(function () {
// We are starting to load.
loading = true;
// Update whether the file tree should be displayed
if (inputText === '' || inputText === undefined) {
$scope.ngModel.search = false;
} else {
$scope.ngModel.search = true;
}
if (!maxResults) {
// Reset 'load more'
numResults = INITIAL_LOAD_NUMBER;
@ -59,6 +52,13 @@ define(function () {
fullResults = result;
$scope.results = result.hits.slice(0, numResults);
// Update whether the file tree should be displayed
if (inputText === '' || inputText === undefined) {
$scope.ngModel.search = false;
} else {
$scope.ngModel.search = true;
}
// Now we are done loading.
loading = false;
});