events.js: Don't search as long as the user is typing

500ms is for the average typist. Still fast enough, imho.

refs #3348
This commit is contained in:
Johannes Meyer 2018-04-24 12:33:04 +02:00
parent b76e6e7597
commit c2b3bbb87b
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) {