nextcloud/settings/js/users/filter.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-04-02 23:48:35 +04:00
/**
* Copyright (c) 2014, Arthur Schiwon <blizzz@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
/**
2014-04-03 00:00:25 +04:00
* @brief this object takes care of the filter funcationality on the user
* management page
2014-04-02 23:48:35 +04:00
* @param jQuery input element that works as the user text input field
2014-04-03 00:00:25 +04:00
* @param object the UserList object
2014-04-02 23:48:35 +04:00
*/
function UserManagementFilter(filterInput, userList) {
this.filterInput = filterInput;
this.userList = userList;
this.thread = undefined;
this.init();
}
2014-04-03 00:00:25 +04:00
/**
* @brief sets up when the filter action shall be triggered
*/
2014-04-02 23:48:35 +04:00
UserManagementFilter.prototype.init = function() {
umf = this;
this.filterInput.keyup(function() {
clearTimeout(umf.thread);
umf.thread = setTimeout(
function() {
umf.run();
},
300
);
});
}
2014-04-03 00:00:25 +04:00
/**
* @brief the filter action needs to be done, here the accurate steps are being
* taken care of
*/
2014-04-02 23:48:35 +04:00
UserManagementFilter.prototype.run = function() {
this.userList.empty();
this.userList.update();
}
2014-04-03 00:00:25 +04:00
/**
* @brief returns the filter String
* @returns string
*/
2014-04-02 23:48:35 +04:00
UserManagementFilter.prototype.getPattern = function() {
return this.filterInput.val();
}