From 116010cbbaa88e4eb7f53be031cbba7f8400f0fe Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 26 Jan 2012 22:57:33 +0000 Subject: [PATCH] [MRM-1578] network proxies implements table and edit form git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1236435 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/webapp/js/archiva/network-proxies.js | 85 ++++++++++++- .../webapp/js/archiva/templates/menu.html | 8 +- .../js/archiva/templates/network-proxies.html | 112 ++++++++++++++++++ .../js/archiva/templates/repositories.html | 2 +- .../js/redback/templates/roles-tmpl.html | 3 - 5 files changed, 200 insertions(+), 10 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js index e3dc7b609..d3b1df30f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js @@ -54,7 +54,7 @@ $(function() { } displayGrid=function(){ - + activateNetworkProxiesGridTab(); } } @@ -63,8 +63,10 @@ $(function() { var self=this; - editNetworkProxy=function(networkProxy){ + this.gridViewModel = null; + editNetworkProxy=function(networkProxy){ + $("#main-content #network-proxies-edit a").html($.i18n.prop("edit")); } removeNetworkProxy=function(networkProxy){ @@ -74,7 +76,86 @@ $(function() { displayNetworkProxies=function(){ + clearUserMessages(); + $("#main-content").html(mediumSpinnerImg()); + $("#main-content").html($("#networkProxiesMain").tmpl()); + $("#main-content #network-proxies-view-tabs").tabs(); + var networkProxiesViewModel = new NetworkProxiesViewModel(); + + $("#main-content #network-proxies-view-tabs").bind('change', function (e) { + if ($(e.target).attr("href")=="#network-proxies-edit") { + var viewModel = new NetworkProxyViewModel(new NetworkProxy(),false,networkProxiesViewModel); + ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0)); + //activateManagedRepositoryFormValidation(); + } + if ($(e.target).attr("href")=="#network-proxies-view") { + $("#main-content #network-proxies-edit a").html($.i18n.prop("add")); + } + + }); + + + + $.ajax("restServices/archivaServices/networkProxyService/getNetworkProxies", { + type: "GET", + dataType: 'json', + success: function(data) { + networkProxiesViewModel.networkProxies(mapNetworkProxies(data)); + networkProxiesViewModel.gridViewModel = new ko.simpleGrid.viewModel({ + data: networkProxiesViewModel.networkProxies, + columns: [ + { + headerText: $.i18n.prop('identifier'), + rowText: "id" + }, + { + headerText: $.i18n.prop('protocol'), + rowText: "protocol" + }, + { + headerText: $.i18n.prop('host'), + rowText: "host" + }, + { + headerText: $.i18n.prop('port'), + rowText: "port" + }, + { + headerText: $.i18n.prop('username'), + rowText: "username" + }, + { + headerText: $.i18n.prop('password'), + rowText: "password" + } + ], + pageSize: 5, + gridUpdateCallBack: function(){ + $("#main-content #networkProxiesTable [title]").twipsy(); + } + }); + ko.applyBindings(networkProxiesViewModel,$("#main-content #networkProxiesTable").get(0)); + } + } + ); + } + + activateNetworkProxiesGridTab=function(){ + $("#main-content #network-proxies-view-tabs-li-edit").removeClass("active"); + $("#main-content #network-proxies-edit").removeClass("active"); + // activate roles grid tab + $("#main-content #network-proxies-view-tabs-li-grid").addClass("active"); + $("#main-content #network-proxies-view").addClass("active"); + $("#main-content #network-proxies-view-tabs-li-edit a").html($.i18n.prop("add")); + } + + activateNetworkProxyEditTab=function(){ + $("#main-content #remote-repositories-view-li").removeClass("active"); + $("#main-content #remote-repositories-view").removeClass("active"); + // activate role edit tab + $("#main-content #remote-repository-edit-li").addClass("active"); + $("#main-content #remote-repository-edit").addClass("active"); } mapNetworkProxy=function(data){ 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 9972c7951..003006f6e 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 @@ -19,16 +19,16 @@ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/network-proxies.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/network-proxies.html index e69de29bb..dddf3ab7c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/network-proxies.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/network-proxies.html @@ -0,0 +1,112 @@ + + + + + \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html index 2862544fb..b4d63655e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html @@ -139,7 +139,7 @@
- +
{{if update}} ${$data.managedRepository.id} diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html index ee7a674ec..e1f8b1cd0 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html @@ -180,9 +180,6 @@
- - -