archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1243818 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp: ./ js/archiva/ js/archiva/templates/
Date Tue, 14 Feb 2012 08:20:38 GMT
Author: olamy
Date: Tue Feb 14 08:20:38 2012
New Revision: 1243818

URL: http://svn.apache.org/viewvc?rev=1243818&view=rev
Log:
[MRM-1575] rewrite repositories group page
impl grid with groups

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repository-groups.html

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html?rev=1243818&r1=1243817&r2=1243818&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
Tue Feb 14 08:20:38 2012
@@ -86,7 +86,7 @@ $.ajax(
            .script(buildLoadJsUrl("archiva/network-proxies.js")).wait()
            .script(buildLoadJsUrl("archiva/proxy-connectors.js")).wait()
            .script(buildLoadJsUrl("redback/operation.js")).wait()
-           .script(buildLoadJsUrl("repository-groups.js")).wait()
+           .script(buildLoadJsUrl("archiva/repository-groups.js")).wait()
            .script(buildLoadJsUrl("redback/redback-tmpl.js")).wait()
            .script(buildLoadJsUrl("bootstrap.js"))
            .script(buildLoadJsUrl("knockout.simpleGrid.js"))

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js?rev=1243818&r1=1243817&r2=1243818&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js
Tue Feb 14 08:20:38 2012
@@ -328,12 +328,7 @@ $(function() {
 
 
     getManagedRepository=function(id){
-      var managedRepository=$.grep(self.managedRepositories(),
-                                      function(repo,idx){
-                                        return repo.id()==id;
-                                      }
-                            );
-      return ($.isArray(managedRepository) && managedRepository.length>0) ? managedRepository[0]:new
ManagedRepository();
+      return findManagedRepository(id,self.managedRepositories());
     }
 
     getRemoteRepository=function(id){

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js?rev=1243818&r1=1243817&r2=1243818&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
Tue Feb 14 08:20:38 2012
@@ -957,4 +957,13 @@ $(function() {
     });
   }
 
+  findManagedRepository=function(id,managedRepositories){
+    var managedRepository=$.grep(managedRepositories,
+                                    function(repo,idx){
+                                      return repo.id()==id;
+                                    }
+                          );
+    return ($.isArray(managedRepository) && managedRepository.length>0) ? managedRepository[0]:new
ManagedRepository();
+  }
+
 });
\ No newline at end of file

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js?rev=1243818&r1=1243817&r2=1243818&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js
Tue Feb 14 08:20:38 2012
@@ -18,5 +18,71 @@
  */
 $(function() {
 
+  RepositoryGroup=function(id,repositories){
+
+    var self=this;
+
+    //private String id;
+    this.id=ko.observable(id);
+    this.id.subscribe(function(newValue){self.modified(true)});
+
+    // private List<String> repositories;
+    this.repositories=ko.observableArray(repositories);
+    this.repositories.subscribe(function(newValue){self.modified(true)});
+
+    this.modified=ko.observable(false);
+  }
+
+  RepositoryGroupViewModel=function(){
+    this.repositoryGroups=ko.observableArray([]);
+    this.managedRepositories=ko.observableArray([]);
+
+    findManagedRepository=function(id){
+      return findManagedRepository(id,self.managedRepositories());
+    }
+  }
+
+  displayRepositoryGroups=function(){
+    screenChange();
+    var mainContent = $("#main-content");
+    mainContent.html(mediumSpinnerImg());
+    this.repositoryGroupViewModel=new RepositoryGroupViewModel();
+    var self=this;
+
+    loadManagedRepositories(function(data) {
+      self.repositoryGroupViewModel.managedRepositories(mapManagedRepositories(data));
+
+      $.ajax("restServices/archivaServices/repositoryGroupService/getRepositoriesGroups",
{
+          type: "GET",
+          dataType: 'json',
+          success: function(data) {
+            var mappedRepositoryGroups=mapRepositoryGroups(data);
+            mainContent.html($("#repositoryGroupsMain").tmpl());
+            self.repositoryGroupViewModel.repositoryGroups(mappedRepositoryGroups);
+            //ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-table"
).get(0));
+            ko.applyBindings(repositoryGroupViewModel,mainContent.get(0));
+
+          }
+        }
+      );
+
+    });
+
+
+  }
+
+  mapRepositoryGroups=function(data){
+    if (data == null){
+      return new Array();
+    }
+    var mappedRepositoryGroups = $.map(data.repositoryGroup, function(item) {
+      return mapRepositoryGroup(item);
+    });
+    return mappedRepositoryGroups;
+  }
+
+  mapRepositoryGroup=function(data){
+    return new RepositoryGroup(data.id, mapStringArray(data.repositories));
+  }
 
 });

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=1243818&r1=1243817&r2=1243818&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 Feb 14 08:20:38 2012
@@ -31,6 +31,9 @@
     <ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-configuration']}">
       <li class="nav-header">${$.i18n.prop('menu.administration')}</li>
       <li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
+        <a href="#" id="menu-repository-groups-list-a" onclick="displayRepositoryGroups()">${$.i18n.prop('menu.repository.groups')}</a>
+      </li>
+      <li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
         <a href="#" id="menu-repositories-list-a" onclick="displayRepositoriesGrid()">${$.i18n.prop('menu.repositories')}</a>
       </li>
       <li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repository-groups.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repository-groups.html?rev=1243818&r1=1243817&r2=1243818&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repository-groups.html
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repository-groups.html
Tue Feb 14 08:20:38 2012
@@ -16,3 +16,50 @@
   ~ specific language governing permissions and limitations
   ~ under the License.
 -->
+<script id="repositoryGroupsMain" type="text/x-jquery-tmpl">
+  <div class="page-header">
+    <h2>${$.i18n.prop('repository.groups.list')}</h2>
+  </div>
+  <div id="repository-groups-table" data-bind='template:{name:"repository-groups-table-tmpl"}'>
+
+  </div>
+  <br/><br/>
+    <table class="table table-striped table-bordered">
+      <thead>
+        <th>group</th>
+        <th>repos</th>
+      </thead>
+      <tbody>
+        <div id="repository-groups-table-bind" data-bind="foreach: repositoryGroups">
+          <tr>
+            <td data-bind="value: $data.id"></td>
+          </tr>
+        </div>
+      </tbody>
+    </table>
+
+  </div>
+</script>
+
+<script id="repository-groups-table-tmpl" type="text/html">
+  <table class="table table-striped table-bordered">
+    <thead>
+      <th>group</th>
+      <th>repos</th>
+    </thead>
+    <tbody>
+    {{each(i, repositoryGroup) repositoryGroups}}
+      <tr>
+        <td>${repositoryGroup.id}</td>
+        <td>
+          <ul>
+          {{each(j,id) repositoryGroup.repositories()}}
+            <li>${id}</li>
+          {{/each}}
+          </ul>
+        </td>
+      </tr>
+    {{/each}}
+    </tbody>
+  </table>
+</script>
\ No newline at end of file



Mime
View raw message