]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1574] delete managed repository
authorOlivier Lamy <olamy@apache.org>
Mon, 16 Jan 2012 16:54:20 +0000 (16:54 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 16 Jan 2012 16:54:20 +0000 (16:54 +0000)
TODO ask for delete content !

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1232063 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html

index 22d52654e561ec2396e95f2d376cfffa42bf60f3..a3da7d21d38850cdd36186b0200c18faf9bd8946 100644 (file)
 # --------------------------------------------------------------------
 #  Archiva webapp i18n default en file
 # --------------------------------------------------------------------
+
+#default common
+id=id
+warning.not.undone.operation=WARNING: This operation can not be undone.
+
+# managed repositories screen
+managedrepository.delete.confirm=Delete Managed Repository
+managedrepository.delete.warning.message=Are you sure you want to delete the following managed repository?
+managedrepository.deleted=Managed Repository " {0} " deleted.
\ No newline at end of file
index 45bfff92689cd2340b02ed2df5f8523973c82e4b..69b4dfecca5a0fcb1b93b000c710484a0ded0ee2 100644 (file)
@@ -65,6 +65,8 @@ $(function() {
 
     //private boolean stageRepoNeeded;
     this.stageRepoNeeded=ko.observable(stageRepoNeeded);
+
+
   }
 
   ManagedRepositoryViewModel=function(managedRepository, update, managedRepositoriesViewModel){
@@ -151,6 +153,40 @@ $(function() {
       activateManagedRepositoryFormValidation();
     }
 
+    removeManagedRepository=function(managedRepository){
+      clearUserMessages();
+      openDialogConfirm(
+          function(){
+            var url = "restServices/archivaServices/managedRepositoriesService/deleteManagedRepository?";
+            url += "repositoryId="+encodeURIComponent(managedRepository.id());
+            url += "&deleteContent=false";
+            $.ajax(url,
+              {
+                type: "GET",
+                  success: function(data) {
+                    self.managedRepositories.remove(managedRepository);
+                    displaySuccessMessage($.i18n.prop("managedrepository.deleted",managedRepository.name()));
+
+                  },
+                  error: function(data) {
+                    var res = $.parseJSON(data.responseText);
+                    displayRestError(res);
+                  },
+                  complete: function(){
+                    closeDialogConfirm();
+                  }
+              }
+            );
+
+          },
+          $.i18n.prop("ok"),
+          $.i18n.prop("cancel"),
+          $.i18n.prop("managedrepository.delete.confirm",managedRepository.name()),
+          $("#managed-repository-delete-warning-tmpl").tmpl(managedRepository));
+    }
+
+
+
   }
 
   activateManagedRepositoriesGridTab=function(){
index ebd9d1892fab2911edbdb1ec22d0cdf64308ecf5..b74a9b85bd7c23d7b01ef4463f14b8848a430f26 100644 (file)
@@ -68,7 +68,7 @@
         <th>${$.i18n.prop('release.included')}</th>
         <th>${$.i18n.prop('snapshots.included')}</th>
         <th>${$.i18n.prop('edit')}</th>
-
+        <th>${$.i18n.prop('delete')}</th>
       </tr>
   </thead>
   <tbody>
@@ -92,7 +92,8 @@
                   <img src="images/dialog-error.png"/>
               {{/if}}
             </td>
-            <td><a href="#" data-bind="click: function(){ editManagedRepository(row) }">Edit</a></td>
+            <td><a href="#" data-bind="click: function(){ editManagedRepository(row) }">${$.i18n.prop('edit')}</a></td>
+            <td><a href="#" data-bind="click: function(){ removeManagedRepository(row) }">${$.i18n.prop('delete')}</a></td>
           </tr>
       {{/each}}
   </tbody>
       <button data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
       <button data-bind="click: displayGrid" class="btn">${$.i18n.prop('cancel')}</button>
     </form>
+</script>
+
+<script id="managed-repository-delete-warning-tmpl" type='text/x-jquery-tmpl'>
+  <div>
+    <a class="close" href="#">×</a>
+    <div class="alert-message warning">
+      <p>
+        <strong>${$.i18n.prop('warning.not.undone.operation')}</strong>
+      </p>
+    </div>
+    <div>
+      <span><strong>${$.i18n.prop('managedrepository.delete.warning.message')}</strong>.</span>
+      <div>${$.i18n.prop('id')}: ${id()}</div>
+      <div>${$.i18n.prop('name')}: ${name()}</div>
+    </div>
+  </div>
 </script>
\ No newline at end of file