Browse Source

HUE-8279 [useradmin] Disable the "Sync" button from "Sync LDAP users/groups" dialog after clicking to avoid lock exception

Ying Chen 7 years ago
parent
commit
9d0311268b
1 changed files with 7 additions and 0 deletions
  1. 7 0
      apps/useradmin/src/useradmin/templates/list_users.mako

+ 7 - 0
apps/useradmin/src/useradmin/templates/list_users.mako

@@ -231,7 +231,11 @@ ${layout.menubar(section='users')}
           % if is_embeddable:
           $usersComponents.find('.sync-ldap form').ajaxForm({
             dataType:  'json',
+            beforeSend: function (xhr) {
+              $usersComponents.find('input[type="submit"]').attr('disabled','disabled');
+            },
             success: function(data) {
+              $usersComponents.find('input[type="submit"]').removeAttr("disabled");
               if (data && data.status == -1) {
                 renderUseradminErrors(data.errors);
               }
@@ -240,6 +244,9 @@ ${layout.menubar(section='users')}
                 $.jHueNotify.info("${ _('The users and groups were updated correctly.') }")
                 $usersComponents.find(".sync-ldap").modal("hide");
               }
+            },
+            error: function(data) {
+              $usersComponents.find('input[type="submit"]').removeAttr("disabled");
             }
           });
           % endif