Skip to content

Commit

Permalink
Improve remote option warning messages and behavior for rundeck#467
Browse files Browse the repository at this point in the history
* update text when remote value json is empty
* fix detection after form submit of missing values
* fix auto reload of remote values after form submit
  • Loading branch information
gschueler committed Jul 24, 2013
1 parent c19bf34 commit 6702368
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 2 additions & 0 deletions rundeckapp/grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,5 @@ project.archive.import.jobUUIDBehavior.preserve.label=Retain UUIDs
project.archive.import.jobUUIDBehavior.remove.label=Generate new UUIDs
project.archive.import.jobUUIDBehavior.remove.description=A new UUID will be generated for each Job created.
scheduledExecution.uuid.unique=Cannot create a Job with UUID {2}: a Job already exists with this UUID. Change the UUID or delete the other Job.
option.value.required=required
option.remote.dependency.emptyresult=No values to choose from. Make sure to select a value for the following input options\:
17 changes: 10 additions & 7 deletions rundeckapp/grails-app/views/framework/_commandOptions.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ used by _editOptions.gsp template
</g:if>
</td>
%{--determine if option has all dependencies met--}%
<g:set var="optionDepsMet" value="${!optiondependencies[optName] || selectedoptsmap && optiondependencies[optName].every {null!=selectedoptsmap[it]}}" />
<g:set var="optionDepsMet" value="${!optiondependencies[optName] || selectedoptsmap && optiondependencies[optName].every {selectedoptsmap[it]}}" />
<td>
<g:if test="${optionSelect.realValuesUrl !=null}">
<g:set var="holder" value="${rkey+'_'+optName+'_hold'}"/>
<span id="${holder}" >
<g:if test="${!optionDepsMet}">
<span class="info note">
Select a value for these options: ${optiondependencies[optName].join(', ').encodeAsHTML()}
<g:message code="option.remote.dependency.emptyresult" /> ${optiondependencies[optName].join(', ').encodeAsHTML()}
</span>
</g:if>
<g:hiddenField name="${fieldName}" value="${selectedoptsmap?selectedoptsmap[optName]:''}" id="${fieldhiddenid}"/>
Expand All @@ -60,11 +60,14 @@ used by _editOptions.gsp template
<span id="${optName.encodeAsHTML()+'_state'}">
<g:if test="${ optRequired }">
<span class="reqwarning" style="${wdgt.styleVisible(unless:optionHasValue)}">
<img src="${resource( dir:'images',file:'icon-small-warn.png' )}" class="warnimg"
alt="Required Option" title="Required Option" width="16px" height="16px" />
<g:if test="${hasError && hasError.contains('required')}">
<span class="error label">${hasError.encodeAsHTML()}</span>
<img src="${resource( dir:'images',file:'icon-tiny-warn.png' )}" class="warnimg"
alt="Required Option" title="Required Option" width="12px" height="11px" />
${hasError.encodeAsHTML()}
</g:if>
<g:else>
<g:message code="option.value.required"/>
</g:else>
</span>
</g:if>
<g:if test="${hasError && !hasError.contains('required')}">
Expand Down Expand Up @@ -92,7 +95,7 @@ used by _editOptions.gsp template
<g:set var="holder" value="${rkey + '_' + optName + '_hold'}"/>
<g:set var="fieldhiddenid" value="${rkey + '_' + optName + '_h'}"/>
<g:set var="optionDepsMet"
value="${!optiondependencies[optName] || selectedoptsmap && optiondependencies[optName].every {null!=selectedoptsmap[it]}}"/>
value="${!optiondependencies[optName] || selectedoptsmap && optiondependencies[optName].every {selectedoptsmap[it]}}"/>
<g:if test="${optiondependencies[optName]}">
remoteOptions.addOptionDependencies("${optName.encodeAsJavaScript()}", ${optiondependencies[optName] as JSON});
</g:if>
Expand All @@ -101,7 +104,7 @@ used by _editOptions.gsp template
remoteOptions.addOptionDeps("${optName.encodeAsJavaScript()}", ${dependentoptions[optName] as JSON});


<g:if test="${optionSelect.enforced}">
<g:if test="${optionSelect.enforced || selectedoptsmap && selectedoptsmap[optName]}">
<%-- Will be a drop down list, so trigger change automatically. --%>
remoteOptions.setOptionAutoReload("${optName.encodeAsJavaScript()}",true);
</g:if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ var RemoteOptionControl = Class.create({
elem.innerHTML = "<div style='display:none' class='fieldcontent'>"+elem.innerHTML+"</div>";
//insert note
var note = new Element('div',{class:'info note emptyMessage'});
note.appendChild(document.createTextNode('Select a value for these options: '));
note.appendChild(document.createTextNode('No values to choose from. Make sure to set a value for the following input options: '));
if(this.dependencies[name]){
note.appendChild(document.createTextNode(this.dependencies[name].join(', ')));
}
Expand Down
4 changes: 4 additions & 0 deletions rundeckapp/web-app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ h1 {
padding-right:4px;
background:none;
}
span.reqwarning{
font-style: italic;
color: orange;
}

.body {
padding: 25px;
Expand Down

0 comments on commit 6702368

Please sign in to comment.