Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | {% load static %} |
| 2 | {% load projecttags %} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 3 | {% load project_url_tag %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | {% load humanize %} |
| 5 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 6 | {%if mru and mru.count > 0%} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 8 | {%if mrb_type == 'project' %} |
| 9 | <h2> |
| 10 | Latest project builds |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 12 | {% if project.is_default %} |
| 13 | <i class="icon-question-sign get-help heading-help" title="" data-original-title="Builds in this project cannot be started from Toaster: they are started from the command line"></i> |
| 14 | {% endif %} |
| 15 | </h2> |
| 16 | {% else %} |
| 17 | <div class="page-header"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | <h1> |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 19 | Latest builds |
| 20 | </h1> |
| 21 | </div> |
| 22 | {% endif %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | <div id="latest-builds"> |
| 24 | {% for build in mru %} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 25 | <div data-latest-build-result="{{ build.id }}" class="alert build-result {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%}{% if mrb_type != 'project' %} project-name{% endif %}"> |
| 26 | {% if mrb_type != 'project' %} |
| 27 | <span class="label {%if build.outcome == build.SUCCEEDED%}label-success{%elif build.outcome == build.FAILED%}label-important{%else%}label-info{%endif%}"> |
| 28 | <a href={% project_url build.project %}> |
| 29 | {{build.project.name}} |
| 30 | </a> |
| 31 | </span> |
| 32 | {% endif %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | <div class="row-fluid"> |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 34 | <div class="span3 lead"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 36 | <a href="{%url 'builddashboard' build.pk%}" class="{%if build.outcome == build.SUCCEEDED %}success{%else%}error{%endif%}"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | {% endif %} |
| 38 | {% if build.target_set.all.count > 0 %} |
| 39 | <span data-toggle="tooltip" |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 40 | {% if build.target_set.all.count > 1 %} |
| 41 | title="Targets: |
| 42 | {% for target in build.target_set.all %} |
| 43 | {% if target.task %} |
| 44 | {{target.target}}:{{target.task}} |
| 45 | {% else %} |
| 46 | {{target.target}} |
| 47 | {% endif %} |
| 48 | {% endfor %}" |
| 49 | {% endif %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | > |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 51 | {% if build.target_set.all.0.task %} |
| 52 | {{build.target_set.all.0.target}}:{{build.target_set.all.0.task}} |
| 53 | {% else %} |
| 54 | {{build.target_set.all.0.target}} |
| 55 | {% endif %} |
| 56 | {% if build.target_set.all.count > 1 %} |
| 57 | (+ {{build.target_set.all.count|add:"-1"}}) |
| 58 | {% endif %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | </span> |
| 60 | {% endif %} |
| 61 | {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %} |
| 62 | </a> |
| 63 | {% endif %} |
| 64 | </div> |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 65 | {% if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 66 | <div class="span2 lead"> |
| 67 | {% if build.completed_on|format_build_date %} |
| 68 | {{ build.completed_on|date:'d/m/y H:i' }} |
| 69 | {% else %} |
| 70 | {{ build.completed_on|date:'H:i' }} |
| 71 | {% endif %} |
| 72 | </div> |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 73 | {% endif %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 | {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %} |
| 75 | <div class="span2 lead"> |
| 76 | {% if build.errors.count %} |
| 77 | <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> |
| 78 | {% endif %} |
| 79 | </div> |
| 80 | <div class="span2 lead"> |
| 81 | {% if build.warnings.count %} |
| 82 | <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> |
| 83 | {% endif %} |
| 84 | </div> |
| 85 | <div class="lead "> |
| 86 | <span class="lead"> |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 87 | Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 88 | </span> |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 89 | {% if build.project.is_default %} |
| 90 | <i class="pull-right icon-question-sign get-help |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 91 | {% if build.outcome == build.SUCCEEDED %} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 92 | get-help-green |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 93 | {% elif build.outcome == build.FAILED %} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 94 | get-help-red |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 95 | {% else %} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 96 | get-help-blue |
| 97 | {% endif %} |
| 98 | " title="Builds in this project cannot be started from Toaster: they are started from the command line"> |
| 99 | </i> |
| 100 | {% else %} |
| 101 | <button class="btn |
| 102 | {% if build.outcome == build.SUCCEEDED %} |
| 103 | btn-success |
| 104 | {% elif build.outcome == build.FAILED %} |
| 105 | btn-danger |
| 106 | {% else %} |
| 107 | btn-info |
| 108 | {%endif%} |
| 109 | pull-right" |
| 110 | onclick='scheduleBuild({% url 'projectbuilds' build.project.id as bpi %}{{bpi|json}}, |
| 111 | {{build.project.name|json}}, |
| 112 | {% url 'project' build.project.id as purl %}{{purl|json}}, |
| 113 | {{build.target_set.all|get_tasks|json}})'> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 114 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 115 | Run again |
| 116 | </button> |
| 117 | {% endif %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 118 | </div> |
| 119 | {%endif%} |
| 120 | {%if build.outcome == build.IN_PROGRESS %} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 121 | <div class="span4 offset1"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 122 | <div class="progress" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete"> |
| 123 | <div style="width: {{build.completeper}}%;" class="bar"></div> |
| 124 | </div> |
| 125 | </div> |
| 126 | <div class="lead pull-right">{{build.completeper}}% of tasks complete</div> |
| 127 | {%endif%} |
| 128 | </div> |
| 129 | </div> |
| 130 | |
| 131 | {% endfor %} |
| 132 | </div> |
| 133 | |
| 134 | <script> |
| 135 | |
| 136 | function scheduleBuild(url, projectName, projectUrl, buildlist) { |
| 137 | console.log("scheduleBuild"); |
| 138 | libtoaster.startABuild(url, null, buildlist.join(" "), function(){ |
| 139 | console.log("reloading page"); |
| 140 | window.location.reload(); |
| 141 | }, null); |
| 142 | } |
| 143 | |
| 144 | $(document).ready(function(){ |
| 145 | |
| 146 | $(".cancel-build-btn").click(function (){ |
| 147 | var url = $(this).data('request-url'); |
| 148 | var buildIds = $(this).data('build-id'); |
| 149 | var btn = $(this); |
| 150 | |
| 151 | libtoaster.cancelABuild(url, buildIds, function(){ |
| 152 | btn.parents(".alert").fadeOut(); |
| 153 | }, null); |
| 154 | }); |
| 155 | }); |
| 156 | |
| 157 | </script> |
| 158 | |
| 159 | {%endif%} |
| 160 | |