Skip to content

Commit

Permalink
Merge pull request #47 from armfergom/JENKINS-34329
Browse files Browse the repository at this point in the history
[JENKINS-34329] Stop allowing to update domains to have blank names
  • Loading branch information
stephenc committed Apr 28, 2016
2 parents 7a916ee + 1ac82bc commit 49a06e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Expand Up @@ -355,7 +355,7 @@ public FormValidation doCheckName(@AncestorInPath DomainWrapper wrapper,
@AncestorInPath CredentialsStoreAction action,
@QueryParameter String value) {
if (StringUtils.isBlank(value)) {
return FormValidation.warning(Messages.CredentialsStoreAction_EmptyDomainNameMessage());
return FormValidation.error(Messages.CredentialsStoreAction_EmptyDomainNameMessage());
}
try {
Jenkins.checkGoodName(value);
Expand Down
Expand Up @@ -44,7 +44,7 @@
<j:otherwise>
<f:form action="configSubmit" method="POST" name="config">
<f:entry title="${%Name}" help="/plugin/credentials/help/domain/name.html">
<f:textbox field="name"/>
<f:textbox field="name" id="name" onchange="updateSave(this.form)" onkeyup="updateSave(this.form)"/>
</f:entry>
<f:entry title="${%Description}" help="/plugin/credentials/help/domain/description.html">
<f:textarea field="description"/>
Expand All @@ -54,11 +54,24 @@
items="${instance.specifications}"/>
</f:entry>
<f:bottomButtonBar>
<f:submit value="${%Save}"/>
<input type="submit" name="Submit" value="${%Save}" id="save" style="margin-left:5em" />
</f:bottomButtonBar>
</f:form>
</j:otherwise>
</j:choose>
<script><![CDATA[
var saveButton = makeButton($('save'), null);
function updateSave(form) {
function state() {
return ($('name').value.length === 0);
}
saveButton.set('disabled', state(), false);
}
updateSave(saveButton.getForm());
]]></script>
</l:main-panel>
</l:layout>
</j:jelly>
Expand Up @@ -56,7 +56,7 @@
function updateOk(form) {
function state() {
return ($('name').value.length == 0);
return ($('name').value.length === 0);
}
okButton.set('disabled', state(), false);
Expand Down

0 comments on commit 49a06e8

Please sign in to comment.