validate repository is selectionned before adding metadata

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1383126 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-10 22:14:00 +00:00
parent 404f915e46
commit 5027300076
2 changed files with 19 additions and 3 deletions

View 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

View 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);
}