diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-12-12 17:58:01 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-12-12 17:58:01 +0100 |
commit | d3fe780805f572951f619818920746df1d42466b (patch) | |
tree | 23f71022b82af8ef8a5f3b207122df9d48276604 /settings/js/users | |
parent | c7ce3b84f021eb11a1369f43c8055ba95f254443 (diff) | |
download | nextcloud-server-d3fe780805f572951f619818920746df1d42466b.tar.gz nextcloud-server-d3fe780805f572951f619818920746df1d42466b.zip |
fix initial loading limit of user management on large screens
Diffstat (limited to 'settings/js/users')
-rw-r--r-- | settings/js/users/users.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 62e18d1be04..d910e1ec129 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -353,10 +353,13 @@ var UserList = { UserDeleteHandler.deleteEntry(); }); }, - update: function (gid) { + update: function (gid, limit) { if (UserList.updating) { return; } + if(!limit) { + limit = UserList.usersToLoad; + } $userList.siblings('.loading').css('visibility', 'visible'); UserList.updating = true; if(gid === undefined) { @@ -366,7 +369,7 @@ var UserList = { var pattern = filter.getPattern(); $.get( OC.generateUrl('/settings/users/users'), - { offset: UserList.offset, limit: UserList.usersToLoad, gid: gid, pattern: pattern }, + { offset: UserList.offset, limit: limit, gid: gid, pattern: pattern }, function (result) { var loadedUsers = 0; var trs = []; @@ -385,6 +388,8 @@ var UserList = { if (result.length > 0) { UserList.doSort(); $userList.siblings('.loading').css('visibility', 'hidden'); + // reset state on load + UserList.noMoreEntries = false; } else { UserList.noMoreEntries = true; @@ -537,7 +542,7 @@ var UserList = { return; } if (UserList.scrollArea.scrollTop() + UserList.scrollArea.height() > UserList.scrollArea.get(0).scrollHeight - 500) { - UserList.update(UserList.currentGid, true); + UserList.update(UserList.currentGid); } }, @@ -770,7 +775,14 @@ $(document).ready(function () { } }); + // calculate initial limit of users to load + var initialUserCountLimit = 20, + containerHeight = $('#app-content').height(); + if(containerHeight > 40) { + initialUserCountLimit = Math.floor(containerHeight/40); + } + // trigger loading of users on startup - UserList.update(UserList.currentGid); + UserList.update(UserList.currentGid, initialUserCountLimit); }); |