archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1297638 - in /archiva/trunk: ./ archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/ archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/ archiva-modules/archiva-web/archiva-webapp...
Date Tue, 06 Mar 2012 18:31:45 GMT
Author: olamy
Date: Tue Mar  6 18:31:44 2012
New Revision: 1297638

URL: http://svn.apache.org/viewvc?rev=1297638&view=rev
Log:
[MRM-1577] rewrite legacy path admin page
grid done.

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html
    archiva/trunk/pom.xml

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties?rev=1297638&r1=1297637&r2=1297638&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
Tue Mar  6 18:31:44 2012
@@ -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.bundle
 
 #login
 login.username.placehoder=Username
-login.password.placehoder=Password
\ No newline at end of file
+login.password.placehoder=Password
+
+#legacy artifact path support

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js?rev=1297638&r1=1297637&r2=1297638&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
Tue Mar  6 18:31:44 2012
@@ -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

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js?rev=1297638&r1=1297637&r2=1297638&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
Tue Mar  6 18:31:44 2012
@@ -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

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html?rev=1297638&r1=1297637&r2=1297638&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html
Tue Mar  6 18:31:44 2012
@@ -16,10 +16,73 @@
   ~ specific language governing permissions and limitations
   ~ under the License.
 -->
-<script id="legacy-path-main" type="text/html">
- <div id="legacy-path-screen" data-bind='template:{name:"legacy-path-div"}'></div>
+<script id="legacy-artifact-path-main" type="text/html">
+ <div id="legacy-artifact-path-screen">
+     <div class="page-header">
+       <h2>${$.i18n.prop('legacy-artifact-paths.list')}</h2>
+     </div>
+
+     <ul id="legacy-artifact-paths-view-tabs" class="nav nav-tabs">
+       <li id="legacy-artifact-paths-view-tabs-li-grid">
+         <a data-toggle="tab" href="#legacy-artifact-paths-view" id="legacy-artifact-paths-view-tabs-a-grid">${$.i18n.prop('legacy-artifact-paths.grid.tab.title')}</a>
+       </li>
+       <li id="legacy-artifact-paths-view-tabs-li-edit">
+         <a data-toggle="tab" href="#legacy-artifact-paths-edit">${$.i18n.prop('add')}</a>
+       </li>
+     </ul>
+     <div id="legacy-artifact-paths-view-tabs-content" class="tab-content">
+       <div id="legacy-artifact-paths-view" class="tab-pane">
+           <table class="table table-striped table-bordered" id="legacy-artifact-paths-table"
+                  data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'ko-legacy-artifact-paths-grid',pageLinksId:'legacy-artifact-pathsPagination'">
+           </table>
+           <div id="legacy-artifact-pathsPagination"></div>
+       </div>
+       <div id="network-proxies-edit" class="tab-pane" data-bind='template: {name:"legacy-artifact-paths-edit-tmpl"}'></div>
+     </div>
+ </div>
+</script>
+
+<script id='ko-legacy-artifact-paths-grid' type='text/x-jquery-tmpl'>
+    <thead>
+    <tr>
+        {{each(i, columnDefinition) columns}}
+        <th>${ columnDefinition.headerText }</th>
+        {{/each}}
+        <th>${$.i18n.prop('edit')}</th>
+        <th>${$.i18n.prop('delete')}</th>
+        <th>${$.i18n.prop('modified')}</th>
+    </tr>
+    </thead>
+    <tbody>
+    {{each(i, row) itemsOnCurrentPage()}}
+      <tr data-bind="css:{ 'modified': row.modified()}">
+        {{each(j, columnDefinition) columns}}
+        {{var val = (typeof columnDefinition.rowText == 'function' ? columnDefinition.rowText(row)
: row[columnDefinition.rowText])}}
+          <td>
+              ${val}
+          </td>
+        {{/each}}
+          <td>
+            <a href="#" data-bind="click: function(){ editLegacyArtifactPath(row) }">
+              <img src="images/edit-find-22-22.png" title="${$.i18n.prop('edit')}">
+            </a>
+          </td>
+          <td>
+            <a href="#" data-bind="click: function(){ removeLegacyArtifactPath(row) }">
+              <img src="images/edit-cut.png" title="${$.i18n.prop('delete')}"/>
+            </a>
+          </td>
+        {{if row.modified()}}
+          <td>
+            <a href="#" data-bind="click: function(){ updateLegacyArtifactPath(row) }"
class="btn btn-warning">${$.i18n.prop('save')}</a>
+          </td>
+        {{else}}
+          <td></td>
+        {{/if}}
+
+    </tr>
+    {{/each}}
+    </tbody>
+
 </script>
 
-<script id="legacy-path-div" type="text/html">
-   foo
-</script>
\ No newline at end of file

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html?rev=1297638&r1=1297637&r2=1297638&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html
Tue Mar  6 18:31:44 2012
@@ -43,7 +43,7 @@
         <a href="#" id="menu-network-proxies-list-a" onclick="displayNetworkProxies()">${$.i18n.prop('menu.network-proxies')}</a>
       </li>
       <li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
-        <a href="#" id="menu-legacy-support-list-a" onclick="displayLegacySupport()">${$.i18n.prop('menu.legacy-support')}</a>
+        <a href="#" id="menu-legacy-support-list-a" onclick="displayLegacyArtifactPathSupport()">${$.i18n.prop('menu.legacy-artifact-support')}</a>
       </li>
     </ul>
 

Modified: archiva/trunk/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/pom.xml?rev=1297638&r1=1297637&r2=1297638&view=diff
==============================================================================
--- archiva/trunk/pom.xml (original)
+++ archiva/trunk/pom.xml Tue Mar  6 18:31:44 2012
@@ -1603,7 +1603,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>2.3.2</version>
+          <version>2.4-SNAPSHOT</version>
           <configuration>
             <source>1.5</source>
             <target>1.5</target>



Mime
View raw message