From b3fec01ba6034c4d096514a5462f96e5257709e3 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 23 Nov 2012 21:33:34 +0000 Subject: [PATCH] [MRM-1714] using LDAP can be configurable with the ui 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 --- .../main/webapp/js/archiva/general-admin.js | 44 +++++++++++++++---- .../js/templates/archiva/general-admin.html | 1 + 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js index 1030f5677..29abcc4f6 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js @@ -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)); + } + }); + } }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html index f1659dd68..0f1881145 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html @@ -904,6 +904,7 @@ ${$.i18n.prop('runtime-configuration.usermanager.label')}
+