blob: 396fb8edf88ee8d4819304e82e10bee9af5eddd8 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001{% load static %}
2{% load projecttags %}
3{% load humanize %}
4
5
6{%if mru.count > 0%}
7
8 <div class="page-header">
9 <h1>
10 Latest builds
11 </h1>
12 </div>
13 <div id="latest-builds">
14 {% for build in mru %}
15 <div class="alert {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%} project-name ">
16 <span class="label {%if build.outcome == build.SUCCEEDED%}label-success{%elif build.outcome == build.FAILED%}label-important{%else%}label-info{%endif%}">
17 <a href={% url 'project' build.project.pk %}>
18 {{build.project.name}}
19 </a>
20 </span>
21
22 <div class="row-fluid">
23 <div class="span3 lead">
24 {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
25 <a href="{%url 'builddashboard' build.pk%}" class="{%if build.outcome == build.SUCCEEDED %}success{%else%}error{%endif%}">
26 {% endif %}
27 {% if build.target_set.all.count > 0 %}
28 <span data-toggle="tooltip"
29 {%if build.target_set.all.count > 1%}
30 title="Targets: {%for target in build.target_set.all%}{{target.target}} {%endfor%}"
31 {%endif%}
32 >
33
34 {{build.target_set.all.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%}
35 </span>
36 {% endif %}
37 {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
38 </a>
39 {% endif %}
40 </div>
41 <div class="span2 lead">
42 {% if build.completed_on|format_build_date %}
43 {{ build.completed_on|date:'d/m/y H:i' }}
44 {% else %}
45 {{ build.completed_on|date:'H:i' }}
46 {% endif %}
47 </div>
48 {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
49 <div class="span2 lead">
50 {% if build.errors.count %}
51 <i class="icon-minus-sign red"></i> <a href="{%url 'builddashboard' build.pk%}#errors" class="error">{{build.errors.count}} error{{build.errors.count|pluralize}}</a>
52 {% endif %}
53 </div>
54 <div class="span2 lead">
55 {% if build.warnings.count %}
56 <i class="icon-warning-sign yellow"></i> <a href="{%url 'builddashboard' build.pk%}#warnings" class="warning">{{build.warnings.count}} warning{{build.warnings.count|pluralize}}</a>
57 {% endif %}
58 </div>
59 <div class="lead ">
60 <span class="lead">
61 Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a>
62 </span>
63 <button class="btn
64 {% if build.outcome == build.SUCCEEDED %}
65 btn-success
66 {% elif build.outcome == build.FAILED %}
67 btn-danger
68 {% else %}
69 btn-info
70 {%endif%}
71 pull-right"
72 onclick='scheduleBuild({% url 'projectbuilds' build.project.id as bpi %}{{bpi|json}},
73 {{build.project.name|json}},
74 {% url 'project' build.project.id as bpurl %}{{bpurl|json}},
75 {{build.target_set.all|get_tasks|json}})'>
76
77 Run again
78 </button>
79 </div>
80 {%endif%}
81 {%if build.outcome == build.IN_PROGRESS %}
82 <div class="span4">
83 <div class="progress" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete">
84 <div style="width: {{build.completeper}}%;" class="bar"></div>
85 </div>
86 </div>
87 <div class="lead pull-right">{{build.completeper}}% of tasks complete</div>
88 {%endif%}
89 </div>
90 </div>
91
92 {% endfor %}
93 </div>
94
95<script>
96
97function scheduleBuild(url, projectName, projectUrl, buildlist) {
98 console.log("scheduleBuild");
99 libtoaster.startABuild(url, null, buildlist.join(" "), function(){
100 console.log("reloading page");
101 window.location.reload();
102 }, null);
103}
104
105$(document).ready(function(){
106
107 $(".cancel-build-btn").click(function (){
108 var url = $(this).data('request-url');
109 var buildIds = $(this).data('build-id');
110 var btn = $(this);
111
112 libtoaster.cancelABuild(url, buildIds, function(){
113 btn.parents(".alert").fadeOut();
114 }, null);
115 });
116});
117
118</script>
119
120{%endif%}
121