Skip to content

Commit

Permalink
[FIX JENKINS-38175] Fix various ManagementLink related bugs
Browse files Browse the repository at this point in the history
- In the context menu, the 'post' flag was set iff 'requiresConfirmation'
  was set, even though they're independent (e.g. Prepare for shutdown
  requires the former but not the latter)
- /manage screen: The icon (t:summary) does not support POST or
  confirmation links, but was set to not link only if no confirmation
  was required (i.e. POST links did not POST when the icon was clicked
  -- now the icon is not clickable as a workaround)
- /manage screen: All links requiring confirmation did POST, which masked
  the fact that the 'Reload from disk' link wasn't set up to require POST
  (it was only broken in the context menu). Now, confirmation and POST are
  separate flags, and 'Reload from disk' link now requests POST.
  • Loading branch information
daniel-beck committed Jan 2, 2017
1 parent 499eadb commit c9b878f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion core/src/main/java/jenkins/management/ReloadLink.java
Expand Up @@ -56,5 +56,9 @@ public String getUrlName() {
@Override public boolean getRequiresConfirmation() {
return true;
}


@Override
public boolean getRequiresPOST() {
return true;
}
}
6 changes: 3 additions & 3 deletions core/src/main/resources/jenkins/model/Jenkins/manage.jelly
Expand Up @@ -32,15 +32,15 @@ THE SOFTWARE.
<!-- table to show a map -->
<d:tag name="feature">
<j:set var="iconUrl" value="${icon.startsWith('/') ? resURL+icon : imagesURL+'/48x48/'+icon}"/>
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(href,iconUrl,title,requiresConfirmation,requiresConfirmation) : null}
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(href,iconUrl,title,post,requiresConfirmation) : null}
<!-- TODO summary.jelly should be modified to accept requiresConfirmation so the icon link can be included -->
<j:set var="_href" value="${href}"/>
<t:summary icon="${icon}"
href="${requiresConfirmation ? null : href}" iconOnly="true">
href="${requiresConfirmation || post ? null : href}" iconOnly="true">
<div class="link">
<j:choose>
<j:when test="${requiresConfirmation}">
<l:confirmationLink href="${_href}" post="true" message="${%are.you.sure(title)}">${title}</l:confirmationLink>
<l:confirmationLink href="${_href}" post="${post}" message="${%are.you.sure(title)}">${title}</l:confirmationLink>
</j:when>
<j:otherwise>
<f:link href="${_href}" post="${post}">${title}</f:link>
Expand Down

0 comments on commit c9b878f

Please sign in to comment.