You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2013/02/17 00:25:12 UTC

svn commit: r1446978 - /archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js

Author: olamy
Date: Sat Feb 16 23:25:11 2013
New Revision: 1446978

URL: http://svn.apache.org/r1446978
Log:
correctly display screen when ldap is not activated

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js?rev=1446978&r1=1446977&r2=1446978&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js Sat Feb 16 23:25:11 2013
@@ -1715,58 +1715,59 @@ define("archiva.general-admin",["jquery"
               groups = mapStringList(data);
               $.log("groups number:"+groups.length);
               redbackRuntimeConfiguration.ldapGroups=ko.observableArray(groups);
-            },
-            complete: function(data) {
-
+            }
+          } ).always(
+                  function() {
+                    $.log("complete");
+
+                    // load ldap group mappings if any
+                    $.ajax("restServices/redbackServices/ldapGroupMappingService", {
+                      type: "GET",
+                      dataType: 'json',
+                      success: function(data) {
+                        var groupMappings=mapLdapGroupMappings(data,redbackRuntimeConfigurationViewModel.modifyLdapGroupMapping);
+
+                        $.ajax("restServices/redbackServices/roleManagementService/allRoles", {
+                          type: "GET",
+                          dataType: 'json',
+                          success: function(data) {
+
+                            var allRoleNames = $.map(data, function(item) {
+                              return item.name;
+                            });
+
+                            redbackRuntimeConfigurationViewModel.allRoleNames=allRoleNames;
+                            if (redbackRuntimeConfiguration.ldapConfiguration().useRoleNameAsGroup()) {
+                              // if using groups == roles add all as mapping except already mapped
+                              $.each(groups,function(idx,item){
+                                var exists=false;
+                                // avoid duplicate if mapping really exists !
+                                $.each(groupMappings,function(idx2,groupMapping){
+                                  if(groupMapping.group()==item){
+                                    exists=true;
+                                  }
+                                });
+                                if(!exists){
+                                  groupMappings.push(new LdapGroupMapping(item,[item],true,redbackRuntimeConfigurationViewModel.modifyLdapGroupMapping));
+                                }
 
-              // load ldap group mappings if any
-              $.ajax("restServices/redbackServices/ldapGroupMappingService", {
-                type: "GET",
-                dataType: 'json',
-                success: function(data) {
-                  var groupMappings=mapLdapGroupMappings(data,redbackRuntimeConfigurationViewModel.modifyLdapGroupMapping);
-
-                  $.ajax("restServices/redbackServices/roleManagementService/allRoles", {
-                    type: "GET",
-                    dataType: 'json',
-                    success: function(data) {
-
-                      var allRoleNames = $.map(data, function(item) {
-                        return item.name;
-                      });
-
-                      redbackRuntimeConfigurationViewModel.allRoleNames=allRoleNames;
-                      if (redbackRuntimeConfiguration.ldapConfiguration().useRoleNameAsGroup()) {
-                        // if using groups == roles add all as mapping except already mapped
-                        $.each(groups,function(idx,item){
-                          var exists=false;
-                          // avoid duplicate if mapping really exists !
-                          $.each(groupMappings,function(idx2,groupMapping){
-                            if(groupMapping.group()==item){
-                              exists=true;
+                              });
                             }
-                          });
-                          if(!exists){
-                            groupMappings.push(new LdapGroupMapping(item,[item],true,redbackRuntimeConfigurationViewModel.modifyLdapGroupMapping));
-                          }
+                            redbackRuntimeConfiguration.ldapGroupMappings=ko.observableArray(groupMappings);
+                            redbackRuntimeConfiguration.modified(false);
+
+                            mainContent.html( $("#redback-runtime-configuration-main" ).tmpl() );
+                            ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#redback-runtime-configuration-content" ).get(0));
+                            activateRedbackRuntimeGeneralFormValidation();
+                            activateLdapConfigurationFormValidation();
+                            $("#ldap-group-mappings-div select" ).select2({width: "element"});
 
+                          }
                         });
                       }
-                      redbackRuntimeConfiguration.ldapGroupMappings=ko.observableArray(groupMappings);
-                      redbackRuntimeConfiguration.modified(false);
-
-                      mainContent.html( $("#redback-runtime-configuration-main" ).tmpl() );
-                      ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#redback-runtime-configuration-content" ).get(0));
-                      activateRedbackRuntimeGeneralFormValidation();
-                      activateLdapConfigurationFormValidation();
-                      $("#ldap-group-mappings-div select" ).select2({width: "element"});
-
-                    }
-                  });
-                }
-              });
-            }
-          });
+                    });
+                  }
+                );
 
         }
       });