archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1244270 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva: repository-groups.js templates/repository-groups.html
Date Tue, 14 Feb 2012 23:34:19 GMT
Author: olamy
Date: Tue Feb 14 23:34:18 2012
New Revision: 1244270

URL: http://svn.apache.org/viewvc?rev=1244270&view=rev
Log:
[MRM-1575] rewrite repositories group page
implements delete and add.

Modified:
    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/repository-groups.html

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=1244270&r1=1244269&r2=1244270&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 23:34:18 2012
@@ -63,7 +63,7 @@ $(function() {
       if (self.update){
         self.repositoryGroupsViewModel.saveRepositoryGroup(repositoryGroup);
       } else {
-        $.log("addRepository group");
+        self.repositoryGroupsViewModel.addRepositoryGroup(repositoryGroup);
       }
     }
 
@@ -82,7 +82,21 @@ $(function() {
     }
 
     this.deleteRepositoryGroup=function(repositoryGroup){
-      $.log("deleteRepositoryGroup:"+repositoryGroup.id());
+      clearUserMessages();
+      $.ajax("restServices/archivaServices/repositoryGroupService/deleteRepositoryGroup/"+encodeURIComponent(repositoryGroup.id()),
+        {
+          type: "GET",
+          success: function(data) {
+            var message=$.i18n.prop('repository.group.deleted',repositoryGroup.id());
+            displaySuccessMessage(message);
+            self.repositoryGroups.remove(repositoryGroup);
+          },
+          error: function(data) {
+            var res = $.parseJSON(data.responseText);
+            displayRestError(res);
+          }
+        }
+      );
     }
 
     this.editRepositoryGroup=function(repositoryGroup){
@@ -90,6 +104,7 @@ $(function() {
       var repositoryGroupViewModel=new RepositoryGroupViewModel(repositoryGroup,true,self);
       activateRepositoryGroupEditTab();
       ko.applyBindings(repositoryGroupViewModel,$("#main-content #repository-groups-edit"
).get(0));
+      $("#main-content #repository-groups-view-tabs-li-edit a").html($.i18n.prop("edit"));
     }
 
     this.saveRepositoryGroup=function(repositoryGroup){
@@ -105,9 +120,6 @@ $(function() {
               var message=$.i18n.prop('repository.group.updated',repositoryGroup.id());
               displaySuccessMessage(message);
               repositoryGroup.modified(false);
-              if (!this.bulkMode){
-                //activateNetworkProxiesGridTab();
-              }
             },
             error: function(data) {
               var res = $.parseJSON(data.responseText);
@@ -118,6 +130,30 @@ $(function() {
 
     }
 
+    this.addRepositoryGroup=function(repositoryGroup){
+      clearUserMessages();
+      $.ajax("restServices/archivaServices/repositoryGroupService/addRepositoryGroup",
+        {
+          type: "POST",
+          contentType: 'application/json',
+          data: "{\"repositoryGroup\": " + ko.toJSON(repositoryGroup)+"}",
+          dataType: 'json',
+          success: function(data) {
+            $.log("update repositoryGroup id:"+repositoryGroup.id());
+            var message=$.i18n.prop('repository.group.added',repositoryGroup.id());
+            displaySuccessMessage(message);
+            repositoryGroup.modified(false);
+            self.repositoryGroups.push(repositoryGroup);
+          },
+          error: function(data) {
+            var res = $.parseJSON(data.responseText);
+            displayRestError(res);
+          }
+        }
+      );
+
+    }
+
     getManagedRepository=function(id){
       $.log("getManagedRepository:"+id);
       return findManagedRepository(self.managedRepositories());
@@ -156,7 +192,7 @@ $(function() {
             mainContent.find("#repository-groups-view-tabs").on('show', function (e) {
               if ($(e.target).attr("href")=="#repository-groups-edit") {
                 var repositoryGroup = new RepositoryGroup();
-                var repositoryGroupViewModel=new RepositoryGroupViewModel(repositoryGroup,false,self);
+                var repositoryGroupViewModel=new RepositoryGroupViewModel(repositoryGroup,false,self.repositoryGroupsViewModel);
                 activateRepositoryGroupEditTab();
                 ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit"
).get(0));
               }

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=1244270&r1=1244269&r2=1244270&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 23:34:18 2012
@@ -118,12 +118,12 @@
     </div>
   {{else}}
     <div class="dotted span7">
-      <form id="repository-group-edit-form" class="form-horizontal">
+      <form id="repository-group-edit-form" class="">
         <fieldset id="repository-group-edit-fieldset">
           <div class="control-group">
             <label class="control-label" for="id">${$.i18n.prop('id')}</label>
             <div class="controls">
-              <input type="text" class="xlarge required" id="id" name="id" size="50"
+              <input type="text" class="xlarge required" id="id" name="id" size="15"
                    data-bind="value: repositoryGroup.id,css:{'uneditable-input': update},readonly:update"/>
             </div>
           </div>



Mime
View raw message