Navigation Menu

Skip to content

Commit

Permalink
[FIX JENKINS-30565] Ask for confirmation before canceling/aborting (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-beck committed Aug 31, 2016
1 parent 55e23a3 commit 3af3a27
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 10 deletions.
@@ -0,0 +1 @@
confirm=Are you sure you want to cancel the queued run of {0}?
Expand Up @@ -61,8 +61,8 @@ THE SOFTWARE.
<j:if test="${build.building}"> <j:if test="${build.building}">
<div class="build-stop"> <div class="build-stop">
<!-- Check ABORT permission for Project, Admin permission otherwise --> <!-- Check ABORT permission for Project, Admin permission otherwise -->
<j:if test="${empty(it.widget.owner.ABORT) ? h.hasPermission(app.ADMINISTER) : it.widget.owner.hasPermission(it.widget.owner.ABORT)}"> <j:if test="${empty(it.widget.owner.ABORT) ? h.hasPermission(app.ADMINISTER) : it.widget.owner.hasPermission(it.widget.owner.ABORT)}">
<l:stopButton href="${link}stop" alt="[cancel]"/> <l:stopButton href="${link}stop" alt="[cancel]" confirm="${%confirm(build.fullDisplayName)}" />
</j:if> </j:if>
</div> </div>
</j:if> </j:if>
Expand Down
@@ -0,0 +1 @@
confirm=Are you sure you want to abort {0}?
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/hudson/buildCaption.jelly
Expand Up @@ -37,7 +37,7 @@ THE SOFTWARE.
<t:buildProgressBar build="${it}"/> <t:buildProgressBar build="${it}"/>
</td><td> </td><td>
<j:if test="${it.parent.hasAbortPermission()}"> <j:if test="${it.parent.hasAbortPermission()}">
<l:stopButton href="stop" alt="[${%cancel}]"/> <l:stopButton href="stop" confirm="${%confirm(it.fullDisplayName)}" alt="[${%cancel}]"/>
</j:if> </j:if>
</td> </td>
</tr></table> </tr></table>
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/lib/hudson/buildCaption.properties
@@ -0,0 +1 @@
confirm=Are you sure you want to abort {0}?
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/hudson/executors.jelly
Expand Up @@ -110,7 +110,7 @@ THE SOFTWARE.
</st:include> </st:include>
<td class="pane" align="center" valign="middle"> <td class="pane" align="center" valign="middle">
<j:if test="${e.hasStopPermission()}"> <j:if test="${e.hasStopPermission()}">
<l:stopButton href="${rootURL}/${c.url}${url}/stop" alt="${%terminate this build}"/> <l:stopButton href="${rootURL}/${c.url}${url}/stop" confirm="${%confirm(exe.fullDisplayName)}" alt="${%terminate this build}" />
</j:if> </j:if>
</td> </td>
</j:otherwise> </j:otherwise>
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/resources/lib/hudson/executors.properties
@@ -1 +1,2 @@
Computers=master{0,choice,0#|1# + {0,number} computer ({1} of {2} executors)|1< + {0,number} computers ({1} of {2} executors)} Computers=master{0,choice,0#|1# + {0,number} computer ({1} of {2} executors)|1< + {0,number} computers ({1} of {2} executors)}
confirm=Are you sure you want to abort {0}?
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/hudson/queue.jelly
Expand Up @@ -91,7 +91,7 @@ THE SOFTWARE.
</td> </td>
<td class="pane" width="16" align="center" valign="middle"> <td class="pane" width="16" align="center" valign="middle">
<j:if test="${item.hasCancelPermission()}"> <j:if test="${item.hasCancelPermission()}">
<l:stopButton href="${rootURL}/queue/cancelItem?id=${item.id}" alt="cancel this build"/> <l:stopButton href="${rootURL}/queue/cancelItem?id=${item.id}" confirm="${%confirm(item.task.fullDisplayName)}" alt="cancel this build"/>
</j:if> </j:if>
</td> </td>
</tr> </tr>
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/resources/lib/hudson/queue.properties
@@ -1,3 +1,4 @@
Build\ Queue=Build Queue{0,choice,0#|0< ({0,number})} Build\ Queue=Build Queue{0,choice,0#|0< ({0,number})}
Filtered\ Build\ Queue=Filtered Build Queue{0,choice,0#|0< ({0,number})} Filtered\ Build\ Queue=Filtered Build Queue{0,choice,0#|0< ({0,number})}
WaitingFor=Waiting for {0} WaitingFor=Waiting for {0}
confirm=Are you sure you want to cancel the queued run of {0}?
18 changes: 15 additions & 3 deletions core/src/main/resources/lib/layout/stopButton.jelly
Expand Up @@ -33,8 +33,20 @@ THE SOFTWARE.
<st:attribute name="alt" use="required"> <st:attribute name="alt" use="required">
Alt text for image. Alt text for image.
</st:attribute> </st:attribute>
<st:attribute name="confirm" use="optional">
If defined, the user will be asked for confirmation first, and the value will be used as question.
</st:attribute>
</st:documentation> </st:documentation>
<a class="stop-button-link" href="${href}" onclick="new Ajax.Request(this.href); return false"> <j:choose>
<l:icon class="icon-stop icon-sm"/> <j:when test="${confirm == null}">
</a> <a class="stop-button-link" href="${href}" onclick='new Ajax.Request("${href}"); return false;'>
<l:icon class="icon-stop icon-sm"/>
</a>
</j:when>
<j:otherwise>
<a class="stop-button-link" href="${href}" onclick='if(confirm("${confirm}"))new Ajax.Request("${href}"); return false;'>
<l:icon class="icon-stop icon-sm"/>
</a>
</j:otherwise>
</j:choose>
</j:jelly> </j:jelly>

0 comments on commit 3af3a27

Please sign in to comment.