]> source.dussan.org Git - archiva.git/commitdiff
add a confirm dialog for deleting artifact
authorOlivier Lamy <olamy@apache.org>
Tue, 5 Jun 2012 23:18:13 +0000 (23:18 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 5 Jun 2012 23:18:13 +0000 (23:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1346654 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js

index cf0c0da0c61a8e463572eadd1d1cd11fab166b58..00159c2b940c9f89694717f787f8130efce7c1ac 100644 (file)
@@ -391,22 +391,33 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
     this.artifacts=ko.observableArray(artifacts);
     var self=this;
     deleteArtifact=function(artifact){
-      $.log("deleteArtifact");
+
       clearUserMessages();
-      $.ajax({
-        url:"restServices/archivaServices/repositoriesService/deleteArtifact",
-        type:"POST",
-        dataType:"json",
-        contentType: 'application/json',
-        data: ko.toJSON(artifact),
-        success:function(data){
-          self.artifacts.remove(artifact);
-          displaySuccessMessage( $.i18n.prop('artifact.deleted'));
-        },
-        error:function(data){
-          displayRestError(data,"user-messages");
-        }
-      });
+
+      openDialogConfirm(function(){
+        $.ajax({
+          url:"restServices/archivaServices/repositoriesService/deleteArtifact",
+          type:"POST",
+          dataType:"json",
+          contentType: 'application/json',
+          data: ko.toJSON(artifact),
+          success:function(data){
+            self.artifacts.remove(artifact);
+            displaySuccessMessage( $.i18n.prop('artifact.deleted'));
+          },
+          error:function(data){
+            displayRestError(data,"user-messages");
+          },
+          complete:function(){
+            closeDialogConfirm();
+          }
+        });
+      }, $.i18n.prop('ok'),
+          $.i18n.prop('cancel'),
+          $.i18n.prop('artifact.delete.confirm.title'),
+          $.i18n.prop('artifact.delete.confirm.save'));
+
+
 
     }