diff options
author | Olivier Lamy <olamy@apache.org> | 2012-09-10 22:14:00 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-09-10 22:14:00 +0000 |
commit | 502730007671d473c2123c4099abc45250642ea9 (patch) | |
tree | 79d3c00babec75a0e05df8ae9a921dac6086fc52 /archiva-modules/archiva-web | |
parent | 404f915e4652bcb07d473a0b0f244b153985ef0f (diff) | |
download | archiva-502730007671d473c2123c4099abc45250642ea9.tar.gz archiva-502730007671d473c2123c4099abc45250642ea9.zip |
validate repository is selectionned before adding metadata
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1383126 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
2 files changed, 19 insertions, 3 deletions
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index a317d1826..599d11506 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -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 diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index ed4b5dfe4..b85f83758 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -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); } |