]> source.dussan.org Git - archiva.git/commitdiff
validate repository is selectionned before adding metadata
authorOlivier Lamy <olamy@apache.org>
Mon, 10 Sep 2012 22:14:00 +0000 (22:14 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 10 Sep 2012 22:14:00 +0000 (22:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1383126 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/search.js

index a317d18266f3165d079006a022f7fb5378dd4e37..599d115066057ff11ffb454dbb8f92ad994aa6cf 100644 (file)
@@ -307,6 +307,7 @@ browse.artifact.metadatas.save=Save
 artifact.metadata.key.mandatory=Key is mandatory
 artifact.metadata.value.mandatory=Value is mandatory
 browse.artifact.content.header=File Content
+repository.selected.missing=You must select a groupId
 
 
 #login
index ed4b5dfe425c805aeebb841385e519be363d7d1b..b85f837586a85e9053f09c6c89d89bcea54aba37 100644 (file)
@@ -464,9 +464,15 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
       metadatasUrl+="/"+encodeURIComponent(version);
       metadatasUrl+="/"+encodeURIComponent(entry.key());
       var selectedRepo=getSelectedBrowsingRepository();
-      if (selectedRepo){
-        metadatasUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
+
+      if(!selectedRepo){
+        clearUserMessages();
+        displayErrorMessage($.i18n.prop('repository.selected.missing'));
+        return;
       }
+
+      metadatasUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
+
       $.ajax(metadatasUrl, {
         type: "DELETE",
         dataType: 'json',
@@ -498,12 +504,21 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
         displayErrorMessage( $.i18n.prop("artifact.metadata.value.mandatory"));
         return;
       }
+
+      var selectedRepo=getSelectedBrowsingRepository();
+
+      if(!selectedRepo){
+        clearUserMessages();
+        displayErrorMessage($.i18n.prop('repository.selected.missing'));
+        return;
+      }
+
       var metadatasUrl="restServices/archivaServices/browseService/metadata/"+encodeURIComponent(groupId);
       metadatasUrl+="/"+encodeURIComponent(artifactId);
       metadatasUrl+="/"+encodeURIComponent(version);
       metadatasUrl+="/"+encodeURIComponent(entry.key());
       metadatasUrl+="/"+encodeURIComponent(entry.value());
-      var selectedRepo=getSelectedBrowsingRepository();
+
       if (selectedRepo){
         metadatasUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
       }