display jenkins wip branch build status on issue page

This commit is contained in:
Frédéric Péters 2018-10-07 22:16:22 +02:00
parent 427107fd17
commit 60a6e76cce
2 changed files with 40 additions and 0 deletions

View File

@ -154,6 +154,34 @@ $(function() {
}
});
if ($('.controller-issues.action-show a.overview').length) {
var project_name = $('a.overview').attr('href').split('/')[2];
var issue_no = $('.icon-edit[accesskey=e]').attr('href').split('/')[2];
$.ajax({
url: 'https://jenkins2.entrouvert.org/job/' + project_name + '-wip/api/json',
async: true,
dataType: 'json',
crossDomain: true,
success: function(data) {
$(data.jobs).each(function(idx, job) {
if (job.name.indexOf('wip%2F' + issue_no) == 0) {
$.ajax({
url: job.url + 'lastBuild/api/json',
async: true,
dataType: 'json',
crossDomain: true,
success: function(data) {
var date = new Date(data.timestamp);
var $jenkins_link = $('<div class="jenkins jenkins-' + data.result + '"><a href="' + data.url + '">Jenkins: ' + data.fullDisplayName + ': ' + data.result + '</a> (' + date.toLocaleString() + ')</div>');
$jenkins_link.appendTo($('#history'));
}
});
}
});
}
});
}
if ($('.administration').length == 0) {
/* fake access control */
return;

View File

@ -361,3 +361,15 @@ div.wiki hr {
margin: 2em auto;
width: 90%;
}
div.jenkins {
margin: 1em 1em 1em 1.6em;
border: 2px solid #e2e2e2;
padding: 1ex;
background: #fafafa;
}
div.jenkins-FAILURE {
border-color: red;
background: #ff9b9b;
}