Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #1306 from bkmeneguello/post-cancel-shutdown
[FIXED JENKINS-23020 JENKINS-23942] Convert the queue's cancel shutdown to POST (cherry picked from commit fda84f4)
- Loading branch information
Showing
with
94 additions
and 3 deletions.
- +10 −0 core/src/main/java/hudson/model/ManagementLink.java
- +5 −0 core/src/main/java/jenkins/management/ShutdownLink.java
- +2 −2 core/src/main/resources/jenkins/model/Jenkins/manage.jelly
- +49 −0 core/src/main/resources/lib/form/link.jelly
- +27 −0 core/src/main/resources/lib/form/link/link.js
- +1 −1 core/src/main/resources/lib/hudson/queue.jelly
@@ -0,0 +1,49 @@ | ||
<!-- | ||
The MIT License | ||
Copyright (c) 2004-2010, Sun Microsystems, Inc., Bruno Kühnen Meneguello | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
--> | ||
|
||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"> | ||
<st:documentation> | ||
Generates an anchor element with the ability to send POST requests and/or | ||
asynchronous requests. It depends the combination of post and async attributes. | ||
|
||
@since TODO | ||
<st:attribute name="clazz"> | ||
Additional CSS classes. | ||
</st:attribute> | ||
<st:attribute name="href"> | ||
Link destination URL. | ||
</st:attribute> | ||
<st:attribute name="post"> | ||
If this must send a POST request. | ||
</st:attribute> | ||
<st:attribute name="async"> | ||
If this must send an asynchronous request. | ||
</st:attribute> | ||
</st:documentation> | ||
|
||
<st:adjunct includes="lib.form.link.link"/> | ||
|
||
<a href="${attrs.href}" class="${attrs.post ? 'post' + (attrs.async ? '-async' : '') : (attrs.async ? 'async' : '')} ${attrs.clazz}"><d:invokeBody/></a> | ||
</j:jelly> |
@@ -0,0 +1,27 @@ | ||
Behaviour.specify('A.post', 'link.post', 0, function(element) { | ||
element.onclick = function(evt) { | ||
var form = document.createElement('form'); | ||
form.setAttribute('method', 'POST'); | ||
form.setAttribute('action', element.getAttribute('href')); | ||
crumb.appendToForm(form); | ||
document.body.appendChild(form); | ||
form.submit(); | ||
return false; | ||
} | ||
}); | ||
|
||
Behaviour.specify('A.post-async', 'link.post-async', 0, function(element) { | ||
element.onclick = function(evt) { | ||
new Ajax.Request(element.getAttribute('href')); | ||
return false; | ||
} | ||
}); | ||
|
||
Behaviour.specify('A.async', 'link.async', 0, function(element) { | ||
element.onclick = function(evt) { | ||
new Ajax.Request(element.getAttribute('href'), { | ||
method : 'get' | ||
}); | ||
return false; | ||
} | ||
}); |