1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
{% load static %}
{% load projecttags %}
{% load humanize %}
{%if mru.count > 0%}
<div class="page-header top-air">
<h1>
Latest Builds
</h1>
</div>
<div id="latest-builds">
{% for build in mru %}
<div class="alert {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%}" style="padding-top: 0;">
{% if build.project %}
<span class="label {%if build.outcome == build.SUCCEEDED%}label-success{%elif build.outcome == build.FAILED%}label-danger{%else%}label-info{%endif%}" style="font-weight: normal; margin-bottom: 5px; margin-left:-15px; padding-top:5px;"> {{build.project.name}} </span>
{% endif %}
<div class="row-fluid">
<div class="span4 lead">
{%if build.outcome == build.SUCCEEDED%}<i class="icon-ok-sign success"></i>{%elif build.outcome == build.FAILED%}<i class="icon-minus-sign error"></i>{%else%}{%endif%}
{%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
<a href="{%url 'builddashboard' build.pk%}" class="{%if build.outcome == build.SUCCEEDED %}success{%else%}error{%endif%}">
{% endif %}
<span data-toggle="tooltip" {%if build.target_set.all.count > 1%}title="Targets: {%for target in build.target_set.all%}{{target.target}} {%endfor%}"{%endif%}>{{build.target_set.all.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|naturaltime}})</span>
{%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
</a>
{% endif %}
</div>
{%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
<div class="span2 lead">
{% if build.errors_no %}
<i class="icon-minus-sign red"></i> <a href="{%url 'builddashboard' build.pk%}#errors" class="error">{{build.errors_no}} error{{build.errors_no|pluralize}}</a>
{% endif %}
</div>
<div class="span2 lead">
{% if build.warnings_no %}
<i class="icon-warning-sign yellow"></i> <a href="{%url 'builddashboard' build.pk%}#warnings" class="warning">{{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a>
{% endif %}
</div>
<div class="lead ">
<span class="lead{%if not build.project%} pull-right{%endif%}">
Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent|sectohms }}</a>
</span>
{% if build.project %}
<a class="btn {%if build.outcome == build.SUCCEEDED%}btn-success{%elif build.outcome == build.FAILED%}btn-danger{%else%}btn-info{%endif%} pull-right" onclick="scheduleBuild({% url 'xhr_projectbuild' build.project.id as bpi%}{{bpi|json}}, {{build.project.name|json}}, {{build.get_sorted_target_list|mapselect:'target'|json}})">Run again</a>
{% endif %}
</div>
{%endif%}
{%if build.outcome == build.IN_PROGRESS %}
<div class="span4">
<div class="progress" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete">
<div style="width: {{build.completeper}}%;" class="bar"></div>
</div>
</div>
<div class="lead pull-right">ETA: in {{build.eta|naturaltime}}</div>
{%endif%}
</div>
</div>
{% endfor %}
</div>
<script>
function _makeXHRBuildCall(url, data, onsuccess, onfail) {
$.ajax( {
type: "POST",
url: url,
data: data,
headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
success: function (_data) {
if (_data.error != "ok") {
alert(_data.error);
} else {
if (onsuccess != undefined) onsuccess(_data);
}
},
error: function (_data) {
alert("Call failed");
console.log(_data);
if (onfail) onfail(data);
} });
}
function scheduleBuild(url, projectName, buildlist) {
console.log("scheduleBuild");
_makeXHRBuildCall(url, {targets: buildlist.join(" ")}, function (_data) {
$('#latest-builds').prepend('<div class="alert alert-info" style="padding-top:0px">' + '<span class="label label-info" style="font-weight: normal; margin-bottom: 5px; margin-left:-15px; padding-top:5px;">'+projectName+'</span><div class="row-fluid">' +
'<div class="span4 lead">' + buildlist.join(" ") +
'</div><div class="span4 lead pull-right">Build queued. Your build will start shortly.</div></div></div>');
});
}
</script>
{%endif%}
|