]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1714] using LDAP can be configurable with the ui
authorOlivier Lamy <olamy@apache.org>
Fri, 23 Nov 2012 21:33:34 +0000 (21:33 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 23 Nov 2012 21:33:34 +0000 (21:33 +0000)
limit choice to a list of available implementations.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1413071 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html

index 1030f56770dbd119618e230403d4fb42f5ab682b..29abcc4f68da62e16c51996ece24747b464082cb 100644 (file)
@@ -1155,9 +1155,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
     this.userManagerImpl=ko.observable(userManagerImpl);
   }
 
-  ArchivaRuntimeConfigurationViewModel=function(archivaRuntimeConfiguration){
+  ArchivaRuntimeConfigurationViewModel=function(archivaRuntimeConfiguration,userManagerImplementationInformations){
     this.archivaRuntimeConfiguration=ko.observable(archivaRuntimeConfiguration);
-    self=this;
+    this.userManagerImplementationInformations=ko.observable(userManagerImplementationInformations);
+    var self=this;
 
     saveArchivaRuntimeConfiguration=function(){
       $.log("saveArchivaRuntimeConfiguration");
@@ -1190,20 +1191,47 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
     }
   }
 
+  UserManagerImplementationInformation=function(beanId,descriptionKey){
+    this.beanId=beanId;
+    this.descriptionKey=descriptionKey;
+    this.description= $.i18n.prop(descriptionKey);
+  }
+
+  mapUserManagerImplementationInformations=function(data){
+    return $.map(data, function(item) {
+      return mapUserManagerImplementationInformation(item);
+    });
+  }
+
+  mapUserManagerImplementationInformation=function(data){
+    if(data==null){
+      return null;
+    }
+    return new UserManagerImplementationInformation(data.beanId,data.descriptionKey);
+  }
+
   displayRuntimeConfiguration=function(){
     $.log("displayRuntimeConfiguration");
     var mainContent = $("#main-content");
     mainContent.html(mediumSpinnerImg());
 
-
-    $.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/archivaRuntimeConfiguration", {
+    $.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/userManagerImplementationInformation", {
       type: "GET",
       dataType: 'json',
       success: function(data) {
-        var archivaRuntimeConfiguration = mapArchivaRuntimeConfiguration(data);
-        var archivaRuntimeConfigurationViewModel = new ArchivaRuntimeConfigurationViewModel(archivaRuntimeConfiguration);
-        mainContent.html( $( "#runtime-configuration-main" ).tmpl( ) );
-        ko.applyBindings(archivaRuntimeConfigurationViewModel,$("#runtime-configuration-content" ).get(0));
+      var userManagerImplementationInformations=mapUserManagerImplementationInformations(data);
+      $.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/archivaRuntimeConfiguration", {
+        type: "GET",
+        dataType: 'json',
+        success: function(data) {
+          var archivaRuntimeConfiguration = mapArchivaRuntimeConfiguration(data);
+          var archivaRuntimeConfigurationViewModel =
+              new ArchivaRuntimeConfigurationViewModel(archivaRuntimeConfiguration,userManagerImplementationInformations);
+          mainContent.html( $( "#runtime-configuration-main" ).tmpl( ) );
+          ko.applyBindings(archivaRuntimeConfigurationViewModel,$("#runtime-configuration-content" ).get(0));
+        }
+      });
+
       }
     });
 
index f1659dd6825a9fc47782b006392e27efe3771d54..0f18811451fcb96560f2748d2629dc0564934817 100644 (file)
             ${$.i18n.prop('runtime-configuration.usermanager.label')}
           </label>
           <div class="controls">
+            <select data-bind="options: userManagerImplementationInformations,optionsValue: 'beanId', optionsText: 'description', value: archivaRuntimeConfiguration().userManagerImpl, optionsCaption: 'Choose...'"></select>
             <input type="text" id="userManagerImpl" name="userManagerImpl" class="input-small required"
                     data-bind="value: archivaRuntimeConfiguration().userManagerImpl"/>
           </div>