Merge pull request #3425 from Icinga/fix/avoid-unnecessary-search-requests-3348

Don't search as long as the user is typing
This commit is contained in:
Eric Lippmann 2018-04-25 03:08:47 -04:00 committed by GitHub
commit 7fc9d7995f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -13,6 +13,7 @@
this.icinga = icinga;
this.searchValue = '';
this.searchTimer = null;
this.initializeModules = true;
};
@ -213,7 +214,16 @@
return;
}
_this.searchValue = $('#menu input.search').val();
return _this.autoSubmitForm(event);
if (_this.searchTimer !== null) {
clearTimeout(_this.searchTimer);
_this.searchTimer = null;
}
var _event = $.extend({}, event); // event seems gc'd once the timeout is over
_this.searchTimer = setTimeout(function () {
_this.submitForm(_event, true);
_this.searchTimer = null;
}, 500);
},
rememberSubmitButton: function(e) {