Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-49138] Build Now to redirect to new build #7633

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion core/src/main/resources/lib/hudson/project/configurable.jelly
Expand Up @@ -30,7 +30,22 @@ THE SOFTWARE.
<l:task href="${url}/build?delay=0sec" icon="icon-clock icon-md" onclick="${it.parameterized?null:'return build_' + id + '(this)'}" permission="${it.BUILD}" post="${!it.parameterized}" title="${it.buildNowText}"/>
<script>
function build_${id}(a) {
new Ajax.Request(a.href);
new Ajax.Request(a.href, {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method: 'POST',
onSuccess: function (t) {
if (t.status === 201) {
setTimeout(function () {
new Ajax.Request(t.getHeader('Location') + 'api/json?tree=executable[url]', {
onSuccess: function (t2) {
if (t2.status === 200 &amp;&amp; t2.responseJSON.executable != null &amp;&amp; t2.responseJSON.executable.url != null) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

location = t2.responseJSON.executable.url;
}
}
});
}, 1000);
}
}
});
hoverNotification('${%Build scheduled}',a.parentNode);
return false;
}
Expand Down