Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for JENKINS-20025
  • Loading branch information
Chris Bush committed Aug 6, 2014
1 parent d801e6e commit eeb5c2e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Expand Up @@ -35,12 +35,11 @@ THE SOFTWARE.
<j:if test="${!empty(job)}">
<td style="border: 1px solid #bbb;">
<j:if test="${job.buildable and job.hasPermission(job.BUILD)}">
<a href="${job.url}build?delay=0sec">
<a onclick="doBuildPost('${job.shortUrl}build', this);" href="#">
<img src="${imagesURL}/16x16/clock.png"
title="${%Schedule a build}" alt="${%Schedule a build}"
border="0"
align="middle"
onclick="${job.parameterized ? null : 'return build(this)'}"
style="float: right; clear: none;" />
</a>
</j:if>
Expand Down
25 changes: 25 additions & 0 deletions src/main/webapp/js/dashboard-view.js
Expand Up @@ -54,6 +54,31 @@ function startsWith(str, substr) {
return (str.match("^"+substr) == substr);
}

function doBuildPost(url, img){
var xmlhttp;
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
} else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

var parameters = "delay=0sec";

xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState === 4){
if(xmlhttp.status === 200 || xmlhttp.status === 201){
hoverNotification('Build scheduled', img, -100);
return false;
} else {
hoverNotification('Could not schedule build: '+xmlhttp.status, img, -100);
return false;
}
}
};
xmlhttp.open("POST", url, true);
xmlhttp.send(parameters);
}

var cmds = window.document.getElementsByTagName('img');
for (var cmdIndex in cmds) {
cmd = cmds[cmdIndex];
Expand Down

0 comments on commit eeb5c2e

Please sign in to comment.