Commit 25f29a54 authored by Sascha Pfeiffer's avatar Sascha Pfeiffer

Fix #93 delaying search by 300ms

Signed-off-by: default avatarSascha Pfeiffer <sascha.pfeiffer@psono.com>
parent 84f8b717
......@@ -265,9 +265,14 @@
/**
* all about the datastore search:
*/
var filterTimeout;
$scope.$watch('tosearchTreeFilter', function(newValue) {
managerDatastorePassword.modifyTreeForSearch(newValue, $scope.structure.data);
if (filterTimeout) {
$timeout.cancel(filterTimeout);
}
filterTimeout = $timeout(function() {
managerDatastorePassword.modifyTreeForSearch(newValue, $scope.structure.data);
}, 300); // delay 300 ms
});
/**
......
......@@ -123,9 +123,14 @@
managerDatastorePassword.get_password_datastore();
}
var filterTimeout;
$scope.$watch('datastore.search', function (value) {
password_filter = helper.get_password_filter(value);
if (filterTimeout) {
$timeout.cancel(filterTimeout);
}
filterTimeout = $timeout(function() {
password_filter = helper.get_password_filter(value);
}, 250); // delay 250 ms
});
}
......
......@@ -165,8 +165,14 @@
* all about the datastore search:
*/
var filterTimeout;
$scope.$watch('tosearchTreeFilter', function(newValue) {
managerDatastorePassword.modifyTreeForSearch(newValue, $scope.structure.data);
if (filterTimeout) {
$timeout.cancel(filterTimeout);
}
filterTimeout = $timeout(function() {
managerDatastorePassword.modifyTreeForSearch(newValue, $scope.structure.data);
}, 300); // delay 300 ms
});
/**
......
......@@ -519,9 +519,11 @@
* @param {string} test Testable string
*/
function get_password_filter(test) {
var searchStrings = test.toLowerCase().split(" ");
return function(datastore_entry) {
var containCounter = 0;
for (var ii = searchStrings.length - 1; ii >= 0; ii--) {
if (typeof(datastore_entry.name) === 'undefined') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment