summaryrefslogtreecommitdiffstats
path: root/non-puppet/qtmetrics2/templates/testset_project.html
blob: 65837387a4439854afe61baa088cadff64fa0f68 (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
{#
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the Quality Assurance module of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL21$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
## and conditions see http://www.qt.io/terms-conditions. For further
## information use the contact form at http://www.qt.io/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 2.1 or version 3 as published by the Free
## Software Foundation and appearing in the file LICENSE.LGPLv21 and
## LICENSE.LGPLv3 included in the packaging of this file. Please review the
## following information to ensure the GNU Lesser General Public License
## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## As a special exception, The Qt Company gives you certain additional
## rights. These rights are described in The Qt Company LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
## $QT_END_LICENSE$
##
#############################################################################

/**
 * Testset project page
 * @version   0.3
 * @since     20-07-2015
 * @author    Juha Sippola
 */

#}

{% include "header.html" %}

{# Failed/passed bar area size in px #}
{% set BAR_AREA = 60 %}

<ol class="breadcrumb">
{% for link in breadcrumb %}
<li><a href="{{ link.link }}">{{ link.name }}</a></li>
{% endfor %}
<li class="active">{{ project }}</li>
</ol>

<div class="container-fluid">
<div class="row">

<div class="col-sm-12 col-md-12 main">

{# Check if any runs available #}
{% set runsAvailable = 0 %}
{% for run in confBuilds %}
{%      set runsAvailable = 1 %}
{% endfor %}

{##### Title #####}

<h1 class="page-header">
{{ project }}
<button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info">
<span class="glyphicon glyphicon-info-sign"></span>
</button>
<small>{{ refreshed }}</small>
</h1>

{##### Info well #####}

<div class="collapse" id="info">
<div class="well infoWell">
<span class="glyphicon glyphicon-info-sign"></span> <strong>Testset project</strong><br>
<ul>
<li><strong>Latest Status</strong> shows the status based on the results of {{ project }}
testsets in the latest <strong>{{ masterProject }} {{ masterState }}</strong> builds
in any configuration across all branches.</li>
<li><strong>Results in Branches</strong> shows the results of {{ project }} testsets by branch
and their configuration in <strong>{{ masterProject }} {{ masterState }}</strong> builds
( <button type="button" class="btn btn-xs btn-success"><span class="badge">n</span></button> = all n testsets passed,
<button type="button" class="btn btn-xs btn-danger"><span class="badge">n</span></button> = n testsets failed);
details are available as tooltip on result icon.</li>
</ul>
</div>
</div>

{% if runsAvailable %}

{##### Latest Status #####}

<div class="panel panel-primary">
<div class="panel-heading">
<h4 class="panel-title bold">Latest Status</h4>
</div>

{# Get branches #}
{%      set branches = [] %}
{%      for run in latestTestsetRuns %}
{%          if run.branch not in branches %}
{%              set branches = branches|merge([run.branch]) %}
{%          endif %}
{%      endfor %}

<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th class="rightBorder">testset project</th>
{%      for branch in branches %}
<th class="center">{{ branch }}<br>
<small>failed <span class ="gray">(total)</span></small>
</th>
<th class="showInLargeDisplay"></th>
{%      endfor %}
</tr>
</thead>
<tbody>
{# Calculate max failed result count for the bar #}
{%      set maxCount = 1 %}
{%      for run in latestTestsetRuns %}
{%          if run.failed > maxCount %}
{%              set maxCount = run.failed %}
{%          endif %}
{%      endfor %}

<tr>
{# Project name #}
<td class="rightBorder">{{ project }}</td>

{# Result (by branch) #}
{%      for branch in branches %}
{%          for run in latestTestsetRuns if project == run.project and branch == run.branch %}

{# Show results #}
{%              set failed = run.failed %}
{%              set passed = run.passed %}
{%              set total = passed + failed %}
<td class="center">{{ failed }}<span class ="gray"> ({{ total }})</span></td>

{# Show results as bars (scaled to BAR_AREA px) #}
{%              set failedBar = ((BAR_AREA/maxCount) * failed)|round(0, 'floor') %}
{%              if (failed > 0) and (failedBar == 0) %}
{%                  set failedBar = 1 %}
{%              endif %}
{%              if failed == 0 %}
{%                  set failed = '' %}
{%              endif %}
{%              if (passed > 0) and (failed == 0) %}
{%                  set passedBar = BAR_AREA %}
{%              else %}
{%                  set passed = '' %}
{%              endif %}
<td class="center showInLargeDisplay">
<div>
<div class="floatLeft redBackground" style="width: {{ failedBar }}px">{{ failed }}</div>
<div class="floatLeft greenBackground" style="width: {{ passedBar }}px">{{ passed }}</div>
</div>
</td>
{%          else %}{# for #}
<td></td>
{%          endfor %}
{%      endfor %}
</tr>
</tbody>
</table>
</div> {# .table-responsive #}
</div> {# .panel-body #}
</div> {# .panel... #}

{##### Results in Branches #####}

<div class="panel panel-primary">
<div class="panel-heading">
<h4 class="panel-title bold">Results in Branches</h4>
</div>
</div>

{# Get branches #}
{%      set branches = [] %}
{%      for run in projectBuilds %}
{%          if run.branch not in branches %}
{%              set branches = branches|merge([run.branch]) %}
{%          endif %}
{%      endfor %}

{# Loop all the branches #}
{%      for branch in branches %}

{# Get all build keys #}
{%          set buildKey = '' %}
{%          set buildKeys = [] %}
{%          set dates = [] %}
{%          for run in projectBuilds %}
{%              if run.branch == branch %}
{%                  if buildKey != run.buildKey %}
{%                      set buildKey = run.buildKey %}
{%                      set buildKeys = buildKeys|merge([run.buildKey]) %}
{%                      set dates = dates|merge([run.timestamp]) %}
{%                  endif %}
{%              endif %}
{%          endfor %}

{# Check if testsets run for this branch #}
{%          set testsetBranch = 0 %}
{%          for run in confBuilds if run.branch == branch %}
{%              set testsetBranch = 1 %}
{%          endfor %}

{# Show branch if testsets run for it #}
{%          if testsetBranch %}
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title bold">{{ branch }}</h4>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th class="bold rightBorder">{{ project }}</th>
{%              for key, buildKey in buildKeys %}
<th class="center">
{%                  if buildKey|length > 6 %}
<span class="clickOnTouch" data-toggle="tooltip" data-placement="top" title="{{ buildKey }}">{{ buildKey|slice(0, 4) }}...</span><br>
{%                  else %}
{{ buildKey }}<br>
{%                  endif %}
<span class="gray"><small>{{ dates[key]|date("m-d") }}</small></span>
</th>
{%              endfor %}
</tr>
</thead>
<tbody>
{%              set confPrev = '' %}
{%              set buildKeyIndexPrinted = -1 %}
{%              set buildKeyFound = 0 %}
{%              for run in confBuilds if run.branch == branch %}

{# New row for each conf #}
{%                  if confPrev != run.conf %}
{# Close previous row #}
{%                      if confPrev != '' %}
{# Fill empty cells at the end of the row #}
{%                          for key, buildKey in buildKeys %}
{%                              if key > buildKeyIndexPrinted %}
<td></td>
{%                              endif %}
{%                          endfor %}
</tr>
{%                      endif %}
<tr>
{%                      set link = confRoute ~ '/' ~ run.conf|url_encode  ~ '/' ~ project|url_encode %}
<td class="rightBorder"><a href="{{ link }}"><small>{{ run.conf }}</small></a></td>
{%                      set buildKeyIndexPrinted = -1 %}
{%                  endif %}

{# Result per build key #}
{%                  set buildKeyFound = 0 %}
{%                  for key, buildKey in buildKeys %}
{# Print each column only once (checked based on column index key and buildKeyFound flag) #}
{%                      if key > buildKeyIndexPrinted and not buildKeyFound %}
{%                          if buildKey == run.buildKey %}
{# Print results #}
<td class="center">
{%                              if (run.failed + run.ifailed) > 0 %}
<button type="button" class="btn btn-xs btn-danger clickOnTouch" data-toggle="tooltip" data-placement="top" data-html="true"
title="<table>
<tr><th>Build key: </th><td>{{ buildKey }}</td></tr>
<tr><th>Configuration: </th><td>{{ run.conf }}</td></tr>
<tr><th>Testsets passed: </th><td>{{ run.passed }}</td></tr>
<tr><th>Testsets passed (insignificant): </th><td>{{ run.ipassed }}</td></tr>
<tr><th>Testsets failed: </th><td>{{ run.failed }}</td></tr>
<tr><th>Testsets failed (insignificant): </th><td>{{ run.ifailed }}</td></tr></table>">
<span class="badge">{{ run.failed + run.ifailed }}</span></button>
{%                              elseif (run.passed + run.ipassed) > 0 %}
<button type="button" class="btn btn-xs btn-success clickOnTouch" data-toggle="tooltip" data-placement="top" data-html="true"
title="<table>
<tr><th>Build key: </th><td>{{ buildKey }}</td></tr>
<tr><th>Configuration: </th><td>{{ run.conf }}</td></tr>
<tr><th>Testsets passed: </th><td>{{ run.passed }}</td></tr>
<tr><th>Testsets passed (insignificant): </th><td>{{ run.ipassed }}</td></tr>
<tr><th>Testsets failed: </th><td>{{ run.failed }}</td></tr>
<tr><th>Testsets failed (insignificant): </th><td>{{ run.ifailed }}</td></tr></table>">
<span class="badge"><small>{{ run.passed + run.ipassed }}</small></span></button>
{%                              endif %}
</td>
{%                              set buildKeyFound = 1 %}
{%                          else %}
{# Print empty cell #}
<td></td>
{%                          endif %}
{%                          set buildKeyIndexPrinted = key %}
{%                      endif %}
{%                  endfor %}
{%                  set confPrev = run.conf %}
{%              endfor %}

{# Close last row (also fill empty cells at the end of the row) #}
{%              for key, buildKey in buildKeys %}
{%                  if key > buildKeyIndexPrinted %}
<td></td>
{%                  endif %}
{%              endfor %}
</tr>
</tbody>
</table>
</div> {# .table-responsive #}
</div> {# .panel-body #}
</div> {# .panel... #}
{%          endif %}{# testsetBranch #}
{%      endfor %}{# branch #}

{% else %}{# runsAvailable #}
<div class="alert alert-danger" role="alert">
No test result data available for project {{ project }}!
</div>
{% endif %}{# runsAvailable #}

</div> {# .col... #}
</div> {# .row #}
</div> {# .container-fluid #}

{% include "footer.html" %}

{# Local scripts for this page #}
<script src="scripts/tooltip.js"></script>

{% include "close.html" %}