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

/**
 * Admin page: Branches
 * @since     17-09-2015
 * @author    Juha Sippola
 */

#}

{# Row count bar area size in px #}
{% set BAR_AREA = 120 %}

{% include "header.html" %}

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

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

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

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

<h1 class="page-header">Admin</h1>

{##### Navigation #####}

<ul class="nav nav-tabs">
<li role="presentation"><a href="{{ adminRoute }}">Summary</a></li>
<li role="presentation" class="active"><a href="{{ adminBranchesRoute }}">Branches</a></li>
<li role="presentation"><a href="{{ adminDataRoute }}">Data maintenance</a></li>
</ul>
<br>

{##### Branches #####}

{# Calculate counts #}
{% set maxCount = 1 %}
{% set branchCount = 0 %}
{% for branch in branches %}
{%      if branch.runCount > maxCount %}
{%          set maxCount = branch.runCount %}
{%      endif %}
{%      set branchCount = branchCount + 1 %}
{% endfor %}

<div class="panel panel-primary">
<div class="panel-heading">
<h4 class="panel-title bold">Branches ({{ branchCount }})</h4>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>branch</th>
<th></th>
<th class="rightBorder"></th>
<th class="center">latest run</th>
<th class="center">total runs</th>
<th class="showInLargeDisplay"></th>
</tr>
</thead>
<tbody>
{# Print branches #}
{% for branch in branches %}
<tr>
{# Branch name #}
{% if branch.archived %}
<td><span class="glyphicon glyphicon-eye-close gray"></span> <span class="gray">{{ branch.name }}</span></td>
{% else %}
<td><span class="glyphicon glyphicon-eye-open"></span> {{ branch.name }}</td>
{% endif %}
{%      set branchTag = branch.name|replace({'.': '-'}) %}{# '.' not allowed in id #}

{# Archive button (opens a confirmation modal) #}
{% if branch.archived %}
<td id="{{ branchTag }}ArchiveButton"><button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#{{ branchTag }}RestoreModal">Restore</button></td>
{% else %}
<td id="{{ branchTag }}ArchiveButton"><button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#{{ branchTag }}ArchiveModal">Archive</button></td>
{% endif %}

{# Remove button (opens a confirmation modal) #}
<td id="{{ branchTag }}RemoveButton" class="rightBorder"><button type="button" class="btn btn-danger btn-xs" data-toggle="modal" data-target="#{{ branchTag }}RemoveModal">Remove</button></td>

{# Latest project_run #}
<td class="center">{{ branch.latestRun }}</td>

{# Show run count as numbers #}
{%      set runs = branch.runCount %}
<td class="center">{{ runs }}</td>

{# Show row count as bars (scaled to BAR_AREA px) #}
{%      set runsBar = ((BAR_AREA/maxCount) * runs)|round(0, 'floor') %}
{%      if (runs > 0) and (runsBar == 0) %}
{%          set runsBar = 1 %}
{%      endif %}
<td class="center showInLargeDisplay">
<div>
<div class="floatLeft blueBackground" style="width: {{ runsBar }}px">&nbsp;</div>
</div>
</td>
</tr>
{% endfor %}{# branch #}
</tbody>
</table>
</div> {# .table-responsive #}
</div> {# .panel-body #}
</div> {# .panel... #}

{# Modals for remove/archive/restore confirmations #}
{% set removeMessage = "Removing the branch will delete it from the database permanently. This will also delete all related items from the xxx_run tables. THIS OPERATION CANNOT BE UNDONE!" %}
{% set archiveMessage = "Archiving the branch will tag it so that it will not show up on the views. This will NOT delete the branch nor its related items from the database. Archived branch can be restored or removed." %}
{% set restoreMessage = "Restoring the branch will clear the archived tag so that the branch will show up on the views again." %}
{% for branch in branches %}
{%      set branchTag = branch.name|replace({'.': '-'}) %}{# '.' not allowed in id #}

{# Remove confirmation #}
<div class="modal fade" id="{{ branchTag }}RemoveModal" tabindex="-1" role="dialog" aria-labelledby="{{ branchTag }}RemoveModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="{{ branchTag }}RemoveModalLabel">Remove branch "{{ branch.name }}"</h4>
</div>
<div class="modal-body">{{ removeMessage }}</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" id="cancel_branch_remove_{{ branch.name }}">Cancel</button>
<button type="button" class="btn btn-danger" data-dismiss="modal" id="confirm_branch_remove_{{ branchTag }}" name="{{ branch.name }}">Remove</button>
</div>
</div>
</div>
</div> {# .modal #}

{# Archive confirmation #}
{% if not branch.archived %}
<div class="modal fade" id="{{ branchTag }}ArchiveModal" tabindex="-1" role="dialog" aria-labelledby="{{ branchTag }}ArchiveModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="{{ branchTag }}ArchiveModalLabel">Archive branch "{{ branch.name }}"</h4>
</div>
<div class="modal-body">{{ archiveMessage }}</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" id="cancel_branch_archive_{{ branch.name }}">Cancel</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" id="confirm_branch_archive_{{ branchTag }}" name="{{ branch.name }}">Archive</button>
</div>
</div>
</div>
</div> {# .modal #}
{% endif %}

{# Restore confirmation #}
{% if branch.archived %}
<div class="modal fade" id="{{ branchTag }}RestoreModal" tabindex="-1" role="dialog" aria-labelledby="{{ branchTag }}RestoreModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="{{ branchTag }}RestoreModalLabel">Restore branch "{{ branch.name }}"</h4>
</div>
<div class="modal-body">{{ restoreMessage }}</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" id="cancel_branch_restore_{{ branch.name }}">Cancel</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" id="confirm_branch_restore_{{ branchTag }}" name="{{ branch.name }}">Restore</button>
</div>
</div>
</div>
</div> {# .modal #}
{% endif %}

{% endfor %}{# branch #}

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

{% include "footer.html" %}

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

{% include "close.html" %}