From 91e2a266aeb1b4a9ff5c8f577f792fbf2424f826 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sat, 29 Dec 2012 23:59:08 +0000 Subject: [PATCH] add form for url cache failure setup git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1426862 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/i18n/default.properties | 19 +++--- .../main/webapp/js/archiva/general-admin.js | 32 +++++++++- .../js/templates/archiva/general-admin.html | 64 +++++++++++++++++-- 3 files changed, 100 insertions(+), 15 deletions(-) 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 d6b036c94..eef0672fd 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 @@ -46,6 +46,15 @@ error.500=An error has happened you must contact the administrator to check the administration.repositories=Repositories Administration +runtime.cache.timeToLiveSeconds.label=Time to Live (seconds) +runtime.cache.timeToLiveSeconds.help.title= +runtime.cache.timeToLiveSeconds.help.content= +runtime.cache.timeToIdleSeconds.label=Time to Idle (seconds) +runtime.cache.timeToIdleSeconds.help.title= +runtime.cache.timeToIdleSeconds.help.content= +runtime.cache.maxElementsInMemory.label=Max Elements in memory +runtime.cache.maxElementsOnDisk.label=Max Elements on disk + # managed repositories screen managedrepository.delete.confirm=Delete Managed Repository managedrepository.delete.warning.message=Are you sure you want to delete the following managed repository? @@ -634,13 +643,7 @@ redback.runtime.ldap.checkModification=Verify LDAP changes. redback.runtime.ldap.checkServer=Verify LDAP configuration on server side. redback.runtime.useUsersCache.label=Use a cache for users. redback.runtime.users.cache.title=Users Cache -redback.runtime.usersCacheTimeToLiveSeconds.label=Time to Live (seconds) -redback.runtime.usersCacheTimeToLiveSeconds.help.title= -redback.runtime.usersCacheTimeToLiveSeconds.help.content= -redback.runtime.usersCacheTimeToIdleSeconds.label=Time to Idle (seconds) -redback.runtime.usersCacheTimeToIdleSeconds.help.title= -redback.runtime.usersCacheTimeToIdleSeconds.help.content= -redback.runtime.maxElementsInMemory.label=Max Elements in memory -redback.runtime.maxElementsOnDisk.label=Max Elements on disk + + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js index f42f5e6d6..42dcb5522 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js @@ -558,7 +558,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" var mainContent=$("#main-content"); mainContent.html($("#runtime-configuration-screen").tmpl()); - + mainContent.find("#network-configuration-form" ).html(mediumSpinnerImg()); $.ajax("restServices/archivaServices/archivaAdministrationService/getNetworkConfiguration", { type: "GET", dataType: 'json', @@ -566,7 +566,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" var networkConfiguration=new NetworkConfiguration(data.maxTotal,data.maxTotalPerHost,data.usePooling); var networkConfigurationViewModel=new NetworkConfigurationViewModel(networkConfiguration); - ko.applyBindings(networkConfigurationViewModel,mainContent.get(0)); + ko.applyBindings(networkConfigurationViewModel,mainContent.find("#network-configuration-form-content").get(0)); var validator = mainContent.find("#network-configuration-edit-form") .validate({ showErrors: function(validator, errorMap, errorList) { @@ -576,8 +576,36 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } }); + + $.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/archivaRuntimeConfiguration", { + type: "GET", + dataType: 'json', + success: function(data){ + + var archivaRuntimeConfiguration=mapArchivaRuntimeConfiguration(data); + var archivaRuntimeConfigurationViewModel=new ArchivaRuntimeConfigurationViewModel(archivaRuntimeConfiguration); + ko.applyBindings(archivaRuntimeConfigurationViewModel,mainContent.find("#cache-failure-form").get(0)); + + } + }); + } + ArchivaRuntimeConfigurationViewModel=function(archivaRuntimeConfiguration){ + var self=this; + this.archivaRuntimeConfiguration=ko.observable(archivaRuntimeConfiguration); + } + + ArchivaRuntimeConfiguration=function(cacheConfiguration){ + this.urlFailureCacheConfiguration=ko.observable(cacheConfiguration); + } + + mapArchivaRuntimeConfiguration=function(data){ + if(!data){ + return null; + } + return new ArchivaRuntimeConfiguration(data.urlFailureCacheConfiguration?mapCacheConfiguration(data.urlFailureCacheConfiguration):null); + } //--------------------------- // organisation/appearance configuration part //--------------------------- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html index fbb4cb79c..8471a4136 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html @@ -281,9 +281,12 @@ @@ -326,6 +333,53 @@ + +