From 119dd06ea81fb459b8c74ca285c7b5f51651adce Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Tue, 22 Oct 2013 23:45:32 +0530 Subject: [PATCH] Add a one second delay between query input and filtering history --- share/tools/web_config/js/controllers.js | 11 +++++++++++ share/tools/web_config/partials/history.html | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/share/tools/web_config/js/controllers.js b/share/tools/web_config/js/controllers.js index f415f0774..bd79dd613 100644 --- a/share/tools/web_config/js/controllers.js +++ b/share/tools/web_config/js/controllers.js @@ -216,6 +216,17 @@ controllers.controller("historyController", function($scope, $http, $timeout) { $scope.historyItems.splice(index, 1); })}; + var queryInputTimeout = null; + $scope.$watch("queryInput", function() { + if (queryInputTimeout){ + $timeout.cancel(queryInputTimeout); + } + + queryInputTimeout = $timeout(function() { + $scope.query = $scope.queryInput; + }, 1000); + }); + $scope.fetchHistory(); }); diff --git a/share/tools/web_config/partials/history.html b/share/tools/web_config/partials/history.html index ef4b04f5a..2093f7147 100644 --- a/share/tools/web_config/partials/history.html +++ b/share/tools/web_config/partials/history.html @@ -1,6 +1,6 @@
{{ loadingText }} - +