summaryrefslogtreecommitdiffstats
path: root/non-puppet/qtmetrics2/templates/testsets_duration_data.html
blob: 59497d95486f11cd3b51b572b50a8860ac875e20 (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
{#
#############################################################################
##
## 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$
##
#############################################################################

/**
 * Top duration (testsets and testfunctions) data
 * @since     24-09-2015
 * @author    Juha Sippola
 */

#}

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

{# runs as TestsetRun objects
/**
 * @var TestsetRun[] runs
 */
#}
{# runs as TestfunctionRun objects
/**
 * @var TestfunctionRun[] runs
 */
#}

{##### List #####}

{# Calculate max duration for the bar #}
{% set runCount = 0 %}
{% set maxDuration = 1 %}
{% for run in runs %}
{%      set runCount = runCount + 1 %}
{%      if run.getDuration > maxDuration %}
{%          set maxDuration = run.getDuration %}
{%      endif %}
{% endfor %}

<div class="panel panel-primary">
<div class="panel-heading">
<h4 class="panel-title bold">Last {{ lastDays }} days <small>(since {{ sinceDate }}, duration over {{ durationLimitSec }}s)</small></h4>
</div>

{% if runCount > 0 %}

<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
{%      if list == 'testsets' %}
<th>testset</th>
{%      else %}
<th>test function</th>
{%      endif %}
<th class="leftBorder center">duration</th>
<th class="showInLargeDisplay"></th>
<th class="leftBorder">build information</th>
</tr>
</thead>
<tbody>

{# Print testsets #}
{%      for run in runs %}
<tr>
{# Testset and project  name#}
{%          if list == 'testsets' %}
{%              set link = testsetRoute ~ '/' ~ run.getName|url_encode ~ '/' ~ run.getTestsetProjectName|url_encode %}
<td><a href="{{ link }}">
{%              if run.getName|length > constant('TestsetRun::SHORT_NAME_LENGTH') %}
<span class="clickOnTouch" data-toggle="tooltip" data-placement="top" title="{{ run.getName }}">{{ run.getShortName }}</span>
{%              else %}
{{ run.getShortName }}
{%              endif %}
</a><br>in {{ run.getTestsetProjectName }}</td>

{# Testfunction name #}
{%          else %}
<td>
{%              if run.getName|length > constant('TestsetRun::SHORT_NAME_LENGTH') %}
<span class="clickOnTouch" data-toggle="tooltip" data-placement="top" title="{{ run.getName }}">{{ run.getShortName }}</span>
{%              else %}
{{ run.getShortName }}
{%              endif %}
</td>
{%          endif %}

{# Duration #}
{%          if run.getDuration > 60 %}
{%              set durationFormatted = ' (00:' ~ (run.getDuration|round)|date("i:s") ~ ')' %}
{%          else %}
{%              set durationFormatted = '' %}
{%          endif %}
<td class="leftBorder center">{{ run.getDuration }}s<br>{{ durationFormatted }}</td>

{# Show results as bars (scaled to BAR_AREA px) #}
{%          set bar = ((BAR_AREA/maxDuration) * run.getDuration)|round(0, 'floor') %}
{%          if (run.getDuration > 0) and (bar == 0) %}
{%              set bar = 1 %}
{%          endif %}
<td class="center showInLargeDisplay">
<div>
<div class="floatLeft blueBackground" style="width: {{ bar }}px">&nbsp;</div>
</div>
</td>
{# Build info #}
{%          if run.getResult == constant('testsetRun::RESULT_SUCCESS') %}
{%              set resultIcon = 'glyphicon glyphicon-ok green' %}
{%          elseif run.getResult == constant('testsetRun::RESULT_FAILURE') %}
{%              set resultIcon = 'glyphicon glyphicon-remove red' %}
{%          elseif run.getResult == constant('TestfunctionRun::RESULT_SUCCESS') %}
{%              set resultIcon = 'glyphicon glyphicon-ok green' %}
{%          elseif run.getResult == constant('TestfunctionRun::RESULT_FAILURE') %}
{%              set resultIcon = 'glyphicon glyphicon-remove red' %}
{%          elseif run.getResult == constant('TestfunctionRun::RESULT_FAILURE_EXPECTED') %}
{%              set resultIcon = 'glyphicon glyphicon-remove-sign green' %}
{%          elseif run.getResult == constant('TestfunctionRun::RESULT_SUCCESS_UNEXPECTED') %}
{%              set resultIcon = 'glyphicon glyphicon-ok-sign red' %}
{%          elseif run.getResult == constant('TestfunctionRun::RESULT_SKIP') %}
{%              set resultIcon = 'glyphicon glyphicon-ban-circle gray' %}
{%          else %}
{%              set resultIcon = '' %}
{%          endif %}
{%          if list == 'testsets' %}
{%              set resultTitle = 'testset result: ' ~ run.getResult %}
{%          else %}
{%              set resultTitle = 'test function result: ' ~ run.getResult %}
{%          endif %}
<td class="leftBorder"><small>
<span class="clickOnTouch" data-toggle="tooltip" data-placement="top" title="{{ resultTitle }}"><span class="{{ resultIcon }}"></span></span>
<a href="{{ run.getBuildLink }}" target="_blank"><span class="spaceHorizontal glyphicon glyphicon-folder-open"></span></a>
{{ run.getBranchName }} build on {{ run.getTimestamp }}
<br>{{ run.getConfName }}</small></td>
</tr>
{%      endfor %}{# run #}
</tbody>
</table>
</div> {# .table-responsive #}
</div> {# .panel-body #}

{% endif %}{# runCount #}
</div> {# .panel... #}

{% if runCount == 0 %}
<div class="alert alert-info" role="alert">
{%      if list == 'testsets' %}
There are not any testsets with duration less than {{ durationLimitSec }}s since {{ sinceDate }}!
{%      else %}
The testset {{ testset }} ({{ project }}) either does not have any {{ list }},
or the duration of all {{ list }} since {{ sinceDate }} is less than {{ durationLimitSec }}s!
{%      endif %}
</div>
{% endif %}{# runCount #}