From: Olivier Lamy Date: Tue, 6 Mar 2012 18:31:44 +0000 (+0000) Subject: [MRM-1577] rewrite legacy path admin page X-Git-Tag: archiva-1.4-M3~1108 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=024b2290c7456c7e269ae82d9ed48d128621c603;p=archiva.git [MRM-1577] rewrite legacy path admin page grid done. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1297638 13f79535-47bb-0310-9956-ffa450edef68 --- 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 19dc750d4..119a47755 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 @@ -127,6 +127,7 @@ menu.artifacts=Artifacts menu.artifacts.search=Search menu.artifacts.browse=Browse menu.topbar.quicksearch=Quick Search +menu.legacy-artifact-support=Legacy Support #user user.change.password.required=Change password required @@ -241,4 +242,6 @@ search.artifact.search.form.query.bundleRequireBundle=Require Bundle #login login.username.placehoder=Username -login.password.placehoder=Password \ No newline at end of file +login.password.placehoder=Password + +#legacy artifact path support 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 9711235e4..53907404c 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 @@ -22,19 +22,147 @@ $(function() { // legacy path part //------------------------- + LegacyArtifactPath=function(path,groupId,artifactId,version,classifier,type){ + //private String path; + this.path=ko.observable(path); + + /** + * The artifact reference, as " [groupId] : + * [artifactId] : [version] : [classifier] : [type] ". + */ + //private String artifact; + //this.artifact=ko.observable(artifact); + + //private String groupId; + this.groupId=ko.observable(groupId); + + //private String artifactId; + this.artifactId=ko.observable(artifactId); + + //private String version; + this.version=ko.observable(version); + + //private String classifier; + this.classifier=ko.observable(classifier); + + //private String type; + this.type=ko.observable(type); + + this.modified=ko.observable(); + + this.artifact = ko.computed(function() { + var artifactValue=""; + if (this.groupId()){ + artifactValue+=this.groupId(); + } + if (this.artifactId()){ + artifactValue+=":"+this.artifactId(); + } + if (this.version()){ + artifactValue+=":"+this.version(); + } + if (this.classifier()){ + artifactValue+=":"+this.classifier(); + } + if (this.type()){ + artifactValue+=":"+this.type(); + } + return artifactValue; + }, this); + } + + mapLegacyArtifactPaths=function(data){ + if (data){ + return $.isArray(data)? $.map(data,function(item){ + return mapLegacyArtifactPath(item); + }):[mapLegacyArtifactPath(data)]; + } + return []; + } + + mapLegacyArtifactPath=function(data){ + return data?new LegacyArtifactPath(data.path,data.groupId,data.artifactId,data.version,data.classifier,data.type):null; + } + LegacyPathViewModel=function(){ + var self=this; + this.legacyArtifactPaths=ko.observableArray([]); + + this.gridViewModel = new ko.simpleGrid.viewModel({ + data: self.legacyArtifactPaths, + columns: [ + { + headerText: $.i18n.prop('legacy-artifact-paths.path'), + rowText: "path" + }, + { + headerText: $.i18n.prop('legacy-artifact-paths.artifact'), + rowText: "artifact" + } + ], + pageSize: 5, + gridUpdateCallBack: function(networkProxy){ + $("#main-content #legacy-artifact-paths-table [title]").tooltip(); + } + }); + + + editLegacyArtifactPath=function(legacyArtifactPath){ + + } + + removeLegacyArtifactPath=function(legacyArtifactPath){ + + } + + updateLegacyArtifactPath=function(legacyArtifactPath){ + + } } - displayLegacySupport=function(){ + displayLegacyArtifactPathSupport=function(){ clearUserMessages(); var mainContent=$("#main-content"); - mainContent.html($("#legacy-path-main" ).html()); + mainContent.html($("#legacy-artifact-path-main" ).html()); + + $.ajax("restServices/archivaServices/archivaAdministrationService/getLegacyArtifactPaths", { + type: "GET", + dataType: 'json', + success: function(data){ + var legacyPathViewModel=new LegacyPathViewModel(); + var legacyPaths=mapLegacyArtifactPaths(data); + $.log("legacyPaths:"+legacyPaths.length); + legacyPathViewModel.legacyArtifactPaths(legacyPaths); + ko.applyBindings(legacyPathViewModel,mainContent.find("#legacy-artifact-paths-view" ).get(0)); + activateLegacyArtifactPathsGridTab(); + } + }); + - var legacyPathViewModel=new LegacyPathViewModel(); + } + + + activateLegacyArtifactPathsGridTab=function(){ + var mainContent = $("#main-content"); + mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").removeClass("active"); + mainContent.find("#legacy-artifact-paths-edit").removeClass("active"); + + mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").addClass("active"); + mainContent.find("#legacy-artifact-paths-view").addClass("active"); + mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add")); - ko.applyBindings(legacyPathViewModel,mainContent.find("#legacy-path-screen" ).get(0)) } + activateLegacyArtifactPathsEditTab=function(){ + var mainContent = $("#main-content"); + mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").removeClass("active"); + mainContent.find("#legacy-artifact-paths-view").removeClass("active"); + + mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").addClass("active"); + mainContent.find("#legacy-artifact-paths-edit").addClass("active"); + } + + }); \ 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 9db28f811..d8f33fb33 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 @@ -82,11 +82,14 @@ $(function() { var screen = $.urlParam('screen'); $.log("screen:"+screen+',operations:'+window.redbackModel.operatioNames); if(screen){ - if(screen=='proxy-connectors'&& $.inArray('archiva-manage-configuration',window.redbackModel.operatioNames)>=0){ displayProxyConnectors(); return; } + if(screen=="legacy-artifact-path-support"&& $.inArray('archiva-manage-configuration',window.redbackModel.operatioNames)>=0){ + displayLegacyArtifactPathSupport(); + 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 d484b0297..9ebecb04e 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 @@ -16,10 +16,73 @@ ~ specific language governing permissions and limitations ~ under the License. --> - + + - \ No newline at end of file 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 1af0b573e..9d3125a1a 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 @@ -43,7 +43,7 @@ ${$.i18n.prop('menu.network-proxies')}
  • - ${$.i18n.prop('menu.legacy-support')} + ${$.i18n.prop('menu.legacy-artifact-support')}
  • diff --git a/pom.xml b/pom.xml index 513744ced..440d55064 100644 --- a/pom.xml +++ b/pom.xml @@ -1603,7 +1603,7 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 2.4-SNAPSHOT 1.5 1.5