diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index 55ef253de..99265dff5 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -593,5 +593,9 @@ redback.runtime.ldap.ssl.label=ssl enabled redback.runtime.ldap.authenticationMethod.label=authenticationMethod ldap.bind.authenticator.enabled.help.content=Will toggle the use of authenticator that will authenticate using the bind operation. ldap.bind.authenticator.allowEmptyPasswords.help.content=Allow to use empty password with Ldap authenticator. +redback.runtime.properties.key.label=Key +redback.runtime.properties.value.label=Value +redback.runtime.user-managers.impls.choosed=UserManager(s) choosed +redback.runtime.user-managers.impls.available=UserManager(s) availables 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 470c3f493..1e40be952 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 @@ -1152,52 +1152,84 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" ArchivaRuntimeConfiguration=function(userManagerImpls,ldapConfiguration,migratedFromRedbackConfiguration,configurationPropertiesEntries){ + var self=this; + this.modified=ko.observable(false); + this.modified.subscribe(function(newValue){$.log("ArchivaRuntimeConfiguration modified")}); + this.userManagerImpls=ko.observableArray(userManagerImpls); + this.userManagerImpls.subscribe(function(newValue){self.modified(true)}); + this.ldapConfiguration=ko.observable(ldapConfiguration); + this.ldapConfiguration.subscribe(function(newValue){self.modified(true)}); + this.migratedFromRedbackConfiguration=ko.observable(migratedFromRedbackConfiguration); + this.configurationPropertiesEntries=ko.observableArray(configurationPropertiesEntries?configurationPropertiesEntries:[]); + this.configurationPropertiesEntries.subscribe(function(newValue){ + self.modified(true); + $.log("configurationPropertiesEntries modified") + }); } mapArchivaRuntimeConfiguration=function(data){ + var archivaRuntimeConfiguration = + new ArchivaRuntimeConfiguration(data.userManagerImpls,mapLdapConfiguration(data.ldapConfiguration),data.migratedFromRedbackConfiguration); + var configurationPropertiesEntries = data.configurationPropertiesEntries == null ? []: $.each(data.configurationPropertiesEntries,function(item){ - return new Entry(item.key, item.value); + return new Entry(item.key, item.value,function(newValue){ + archivaRuntimeConfiguration.modified(true); + }); }); if (!$.isArray(configurationPropertiesEntries)){ - configurationPropertiesEntries=[]; + configurationPropertiesEntries=[]; } + archivaRuntimeConfiguration.configurationPropertiesEntries(configurationPropertiesEntries); + archivaRuntimeConfiguration.modified(false); + return archivaRuntimeConfiguration; - return new ArchivaRuntimeConfiguration(data.userManagerImpls,mapLdapConfiguration(data.ldapConfiguration),data.migratedFromRedbackConfiguration, - configurationPropertiesEntries); } LdapConfiguration=function(hostName,port,ssl,baseDn,contextFactory,bindDn,password,authenticationMethod, extraPropertiesEntries){ + + var self=this; + this.modified=ko.observable(false); + //private String hostName; this.hostName=ko.observable(hostName); + this.hostName.subscribe(function(newValue){self.modified(true)}); //private String port; this.port=ko.observable(port); + this.port.subscribe(function(newValue){self.modified(true)}); //private boolean ssl = false; this.ssl=ko.observable(ssl); + this.ssl.subscribe(function(newValue){self.modified(true)}); //private String baseDn; this.baseDn=ko.observable(baseDn); + this.baseDn.subscribe(function(newValue){self.modified(true)}); //private String contextFactory; this.contextFactory=ko.observable(contextFactory); + this.contextFactory.subscribe(function(newValue){self.modified(true)}); //private String bindDn; this.bindDn=ko.observable(bindDn); + this.bindDn.subscribe(function(newValue){self.modified(true)}); //private String password; this.password=ko.observable(password); + this.password.subscribe(function(newValue){self.modified(true)}); //private String authenticationMethod; this.authenticationMethod=ko.observable(authenticationMethod); + this.authenticationMethod.subscribe(function(newValue){self.modified(true)}); this.extraPropertiesEntries=ko.observableArray(extraPropertiesEntries); + this.extraPropertiesEntries.subscribe(function(newValue){self.modified(true)}); } mapLdapConfiguration=function(data){ @@ -1259,8 +1291,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } userManagerImplMoved=function(arg){ - $.log("userManagerImplMoved:"+arg.sourceIndex+" to " + arg.targetIndex); - //self.usedUserManagerImpls().push(self.availableUserManagerImpls()[arg.sourceIndex]); + $.log("userManagerImplMoved"); + self.archivaRuntimeConfiguration().modified(true); } saveArchivaRuntimeConfiguration=function(){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index 343ddef07..55aae1371 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -355,11 +355,18 @@ require(["jquery","jquery.tmpl","i18n","knockout"], function(jquery,jqueryTmpl,i * mapping for a java Map entry * @param key * @param value + * @param subscribeFn if any will be called as subscrible function field */ - Entry=function(key,value){ + Entry=function(key,value,subscribeFn){ var self=this; this.key=ko.observable(key); + if(subscribeFn){ + this.key.subscribe(function(newValue){subscribeFn(newValue)}); + } this.value=ko.observable(value); + if(subscribeFn){ + this.value.subscribe(function(newValue){$.log("value modified");subscribeFn(newValue);}); + } } /** 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 70de4ca4a..7c86a4113 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 @@ -906,18 +906,16 @@