]> source.dussan.org Git - archiva.git/commitdiff
deleting groupId tru the ui
authorOlivier Lamy <olamy@apache.org>
Wed, 5 Sep 2012 17:03:02 +0000 (17:03 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 5 Sep 2012 17:03:02 +0000 (17:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1381246 13f79535-47bb-0310-9956-ffa450edef68

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

index 367e7cac68d6b7521da5c865f1ab79cc6b9e2e2f..ae02c3a6fb7fc67419497e4469fa2a842724b72b 100644 (file)
@@ -80,6 +80,38 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
       }
       return value;
     }
+
+    deleteKarma=function(){
+      return hasKarma('archiva-delete-artifact');
+    }
+
+    deleteGroupId=function(groupId){
+      var repoId=getSelectedBrowsingRepository();
+      if(!repoId){
+        displayErrorMessage($.i18n.prop('groupId.delete.missing.repoId'));
+        return;
+      }
+      openDialogConfirm(function(){
+        $.ajax({
+          url:"restServices/archivaServices/repositoriesService/deleteGroupId?groupId="+groupId+"&repositoryId="+repoId,
+          type:"GET",
+          dataType:"json",
+          success:function(data){
+
+
+          },
+          error:function(data){
+            displayRestError(data,"user-messages");
+          },
+          complete:function(){
+            closeDialogConfirm();
+          }
+        });
+      }, $.i18n.prop('ok'),
+          $.i18n.prop('cancel'),
+          $.i18n.prop('groupId.delete.confirm.title'),
+          $.i18n.prop('groupId.delete.confirm.save'));
+    }
   }
 
   calculateBreadCrumbEntries=function(groupId){
index b5907b124d980cc1554284f7d37d6bcfb994372d..271aefdad9de7210476a25a480dfa3b6e652069a 100644 (file)
         {{if browseResultEntry.project}}
           <li class="browse-list-project" data-bind="click:function(){displayProjectEntry(browseResultEntry.name)}">
             <a href="#">${displayEntry(browseResultEntry.name)}</a>
+          </li>
         {{else}}
-          <li class="browse-list" data-bind="click:function(){displayGroupId(browseResultEntry.name)}">
-            <a href="#" title="folder ${displayEntry(browseResultEntry.name)}">${displayEntry(browseResultEntry.name)}</a>
+          {{if deleteKarma}}
+            <li class="browse-list">
+              <img src="images/trash.png" data-bind="click:function(){deleteGroupId(browseResultEntry.name)}"/>
+              <a data-bind="click:function(){displayGroupId(browseResultEntry.name)}" href="#" title="folder ${displayEntry(browseResultEntry.name)}">${displayEntry(browseResultEntry.name)}</a>
+            </li>
+          {{else}}
+            <li class="browse-list" >
+              <a href="#" title="folder ${displayEntry(browseResultEntry.name)}" data-bind="click:function(){displayGroupId(browseResultEntry.name)}">${displayEntry(browseResultEntry.name)}</a>
+            </li>
+          {{/if}}
         {{/if}}          
-          </li>
+
       {{/each}}
     </ul>
   </div>