diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-10-10 13:41:32 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-10-10 13:41:32 +0200 |
commit | 836f0839e53baa7c7d8561dec1bf0d36813c715d (patch) | |
tree | 3eeb43d0818725c077f0eb6108bcd40fa01bc4f5 /apps/user_ldap/js | |
parent | ea7975ac8ba94b3dfcd3f61ff74847de97a881b4 (diff) | |
download | nextcloud-server-836f0839e53baa7c7d8561dec1bf0d36813c715d.tar.gz nextcloud-server-836f0839e53baa7c7d8561dec1bf0d36813c715d.zip |
show a spinner next to test filter button when the test is running
Diffstat (limited to 'apps/user_ldap/js')
-rw-r--r-- | apps/user_ldap/js/ldapFilter.js | 6 | ||||
-rw-r--r-- | apps/user_ldap/js/settings.js | 32 |
2 files changed, 28 insertions, 10 deletions
diff --git a/apps/user_ldap/js/ldapFilter.js b/apps/user_ldap/js/ldapFilter.js index 7fcf8bfb28b..bb66c1df2ee 100644 --- a/apps/user_ldap/js/ldapFilter.js +++ b/apps/user_ldap/js/ldapFilter.js @@ -145,10 +145,10 @@ LdapFilter.prototype.findFeatures = function() { } }; -LdapFilter.prototype.updateCount = function() { +LdapFilter.prototype.updateCount = function(doneCallback) { if(this.target === 'User') { - LdapWizard.countUsers(); + LdapWizard.countUsers(doneCallback); } else if (this.target === 'Group') { - LdapWizard.countGroups(); + LdapWizard.countGroups(doneCallback); } }; diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index 75a4830b28e..6e936a91091 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -328,7 +328,7 @@ var LdapWizard = { } }, - _countThings: function(method, spinnerID) { + _countThings: function(method, spinnerID, doneCallback) { param = 'action='+method+ '&ldap_serverconfig_chooser='+ encodeURIComponent($('#ldap_serverconfig_chooser').val()); @@ -338,21 +338,27 @@ var LdapWizard = { function(result) { LdapWizard.applyChanges(result); LdapWizard.hideSpinner(spinnerID); + if(doneCallback !== undefined) { + doneCallback(method); + } }, function (result) { OC.Notification.show('Counting the entries failed with, ' + result.message); LdapWizard.hideSpinner(spinnerID); + if(doneCallback !== undefined) { + doneCallback(method); + } }, method ); }, - countGroups: function() { - LdapWizard._countThings('countGroups', '#ldap_group_count'); + countGroups: function(doneCallback) { + LdapWizard._countThings('countGroups', '#ldap_group_count', doneCallback); }, - countUsers: function() { - LdapWizard._countThings('countUsers', '#ldap_user_count'); + countUsers: function(doneCallback) { + LdapWizard._countThings('countUsers', '#ldap_user_count', doneCallback); }, detectEmailAttribute: function() { @@ -586,6 +592,16 @@ var LdapWizard = { }); }, + hideTestSpinner:function (countMethod) { + var selector; + if(countMethod === 'countUsers') { + selector = '#rawUserFilterContainer .ldapGetEntryCount'; + } else { + selector = '#rawGroupFilterContainer .ldapGetEntryCount'; + } + LdapWizard.hideSpinner(selector); + }, + /** init user filter tab section **/ instantiateFilters: function() { @@ -599,7 +615,8 @@ var LdapWizard = { $('#rawUserFilterContainer .ldapGetEntryCount').click(function(event) { event.preventDefault(); $('#ldap_user_count').text(''); - LdapWizard.userFilter.updateCount(); + LdapWizard.showSpinner('#rawUserFilterContainer .ldapGetEntryCount'); + LdapWizard.userFilter.updateCount(LdapWizard.hideTestSpinner); LdapWizard.detectEmailAttribute(); $('#ldap_user_count').removeClass('hidden'); }); @@ -619,7 +636,8 @@ var LdapWizard = { $('#rawGroupFilterContainer .ldapGetEntryCount').click(function(event) { event.preventDefault(); $('#ldap_group_count').text(''); - LdapWizard.groupFilter.updateCount(); + LdapWizard.showSpinner('#rawGroupFilterContainer .ldapGetEntryCount'); + LdapWizard.groupFilter.updateCount(LdapWizard.hideTestSpinner); LdapWizard.detectGroupMemberAssoc(); $('#ldap_group_count').removeClass('hidden'); }); |