From 12be87e09562c3617ea20bc5d5eb2bd234d79f4e Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 26 Mar 2012 09:56:59 +0000 Subject: [PATCH] control key/value not empty git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1305285 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/archiva/i18n/default.properties | 2 ++ .../src/main/webapp/js/archiva/search.js | 12 ++++++++++++ 2 files changed, 14 insertions(+) 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 d37fa25f3..00070192a 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 @@ -286,6 +286,8 @@ browse.artifact.metadatas.delete=Delete Property browse.artifact.metadatas.key=Key browse.artifact.metadatas.value=Value browse.artifact.metadatas.save=Save +artifact.metadata.key.mandatory=Key is mandatory +artifact.metadata.value.mandatory=Value is mandatory #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 8c0b9f5fc..b3faebc6a 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 @@ -313,6 +313,7 @@ $(function() { type: "DELETE", dataType: 'json', success: function(data) { + clearUserMessages(); displaySuccessMessage( $.i18n.prop("artifact.metadata.deleted")); self.entries.remove(entry); } @@ -321,6 +322,16 @@ $(function() { } saveProperty=function(entry){ + if($.trim(entry.key() ).length<1){ + clearUserMessages(); + displayErrorMessage( $.i18n.prop("artifact.metadata.key.mandatory")); + return; + } + if($.trim(entry.value() ).length<1){ + clearUserMessages(); + displayErrorMessage( $.i18n.prop("artifact.metadata.value.mandatory")); + return; + } var metadatasUrl="restServices/archivaServices/browseService/metadata/"+encodeURIComponent(groupId); metadatasUrl+="/"+encodeURIComponent(artifactId); metadatasUrl+="/"+encodeURIComponent(version); @@ -334,6 +345,7 @@ $(function() { type: "PUT", dataType: 'json', success: function(data) { + clearUserMessages(); displaySuccessMessage( $.i18n.prop("artifact.metadata.added")); entry.editable(false); entry.modified(false); -- 2.39.5