From 478e79a03edc724449387c4f8acdfadc6440082b Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 8 Mar 2012 20:29:36 +0000 Subject: [PATCH] [MRM-1581] rewrite network configuration page. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1298561 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/webapp/js/archiva/general-admin.js | 47 +++++++++++++++++++ .../src/main/webapp/js/archiva/main.js | 4 ++ .../js/archiva/templates/general-admin.html | 35 ++++++++++++++ .../webapp/js/archiva/templates/menu.html | 5 ++ .../js/archiva/templates/network-proxies.html | 20 ++++---- 5 files changed, 101 insertions(+), 10 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 8f908434b..339fdbaf9 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 @@ -500,5 +500,52 @@ $(function() { } + //--------------------------- + // network configuration part + //--------------------------- + NetworkConfiguration=function(maxTotal,maxTotalPerHost,usePooling){ + //private int maxTotal = 30; + this.maxTotal=ko.observable(maxTotal); + + //private int maxTotalPerHost = 30; + this.maxTotalPerHost=ko.observable(maxTotalPerHost); + + //private boolean usePooling = true; + this.usePooling=ko.observable(usePooling); + } + + NetworkConfigurationViewModel=function(networkConfiguration){ + var self=this; + this.networkConfiguration=ko.observable(networkConfiguration); + + save=function(){ + clearUserMessages(); + $.ajax("restServices/archivaServices/archivaAdministrationService/setNetworkConfiguration", { + type: "POST", + contentType: 'application/json', + data: ko.toJSON(self.networkConfiguration), + dataType: 'json', + success: function(data){ + displaySuccessMessage( $.i18n.prop("network-configuration.updated")); + } + }); + } + } + + displayNetworkConfiguration=function(){ + var mainContent=$("#main-content"); + mainContent.html($("#network-configuration-screen").tmpl()); + + $.ajax("restServices/archivaServices/archivaAdministrationService/getNetworkConfiguration", { + type: "GET", + dataType: 'json', + success: function(data){ + var networkConfiguration=new NetworkConfiguration(data.maxTotal,data.maxTotalPerHost,data.usePooling); + var networkConfigurationViewModel=new NetworkConfigurationViewModel(networkConfiguration); + ko.applyBindings(networkConfigurationViewModel,mainContent.get(0)); + } + }); + + } }); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js index b9265106e..985f0323b 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js @@ -94,6 +94,10 @@ $(function() { displayRepositoryScanning(); return; } + if (screen=='network-configuration'&& hasKarma('archiva-manage-configuration')){ + displayNetworkConfiguration(); + return; + } } // by default display search screen diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html index 69959ed7f..c3368d5f4 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html @@ -274,5 +274,40 @@ + + + + diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html index b87ac8b28..6e7abb786 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html @@ -48,6 +48,11 @@
  • ${$.i18n.prop('menu.repository-scanning')}
  • +
  • + ${$.i18n.prop('menu.network-configuration')} +
  • + +