Properly debounce searching and make sure to only show results matching the current query.

This commit is contained in:
Joseph Schorr 2015-04-08 16:40:22 -04:00
parent 48f3e9af1d
commit 5ae2975134
5 changed files with 70 additions and 3 deletions

View file

@ -36,7 +36,7 @@ quayPages.constant('pages', {
});
quayDependencies = ['ngRoute', 'chieffancypants.loadingBar', 'cfp.hotkeys', 'angular-tour', 'restangular', 'angularMoment',
'mgcrea.ngStrap', 'ngCookies', 'ngSanitize', 'angular-md5', 'pasvaz.bindonce', 'ansiToHtml',
'mgcrea.ngStrap', 'ngCookies', 'ngSanitize', 'angular-md5', 'pasvaz.bindonce', 'ansiToHtml', 'debounce',
'core-ui', 'core-config-setup', 'quayPages'];
if (window.__config && window.__config.MIXPANEL_KEY) {

View file

@ -47,7 +47,6 @@ angular.module('quay').directive('headerBar', function () {
// Monitor any user changes and place the current user into the scope.
UserService.updateUserIn($scope);
$scope.currentPageContext = {};
$rootScope.$watch('currentPage.scope.viewuser', function(u) {
@ -74,7 +73,7 @@ angular.module('quay').directive('headerBar', function () {
};
ApiService.conductSearch(null, params).then(function(resp) {
if (!$scope.searchVisible) { return; }
if (!$scope.searchVisible || query != $scope.currentSearchQuery) { return; }
$scope.searchResultState = {
'state': resp.results.length ? 'results' : 'no-results',