robotframework-dashboard 1.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- robotframework_dashboard/__init__.py +0 -0
- robotframework_dashboard/abstractdb.py +60 -0
- robotframework_dashboard/arguments.py +459 -0
- robotframework_dashboard/css/styling.css +431 -0
- robotframework_dashboard/dashboard.py +126 -0
- robotframework_dashboard/database.py +371 -0
- robotframework_dashboard/dependencies/bootstrap.css +6 -0
- robotframework_dashboard/dependencies/bootstrap.js +7 -0
- robotframework_dashboard/dependencies/chart.js +20 -0
- robotframework_dashboard/dependencies/chartjs-adapter-date-fns.js +7 -0
- robotframework_dashboard/dependencies/chartjs-chart-boxplot.js +2 -0
- robotframework_dashboard/dependencies/chartjs-chart-matrix.js +8 -0
- robotframework_dashboard/dependencies/chartjs-plugin-datalabels.js +7 -0
- robotframework_dashboard/dependencies/datatables.css +18 -0
- robotframework_dashboard/dependencies/datatables.js +25 -0
- robotframework_dashboard/dependencies/gridstack.css +1 -0
- robotframework_dashboard/dependencies/gridstack.js +9 -0
- robotframework_dashboard/dependencies/pako.js +2 -0
- robotframework_dashboard/dependencies.py +222 -0
- robotframework_dashboard/js/admin_page/admin_api.js +218 -0
- robotframework_dashboard/js/admin_page/admin_common.js +26 -0
- robotframework_dashboard/js/admin_page/admin_eventlisteners.js +102 -0
- robotframework_dashboard/js/admin_page/admin_information.js +128 -0
- robotframework_dashboard/js/admin_page/admin_main.js +20 -0
- robotframework_dashboard/js/admin_page/admin_theme.js +129 -0
- robotframework_dashboard/js/common.js +169 -0
- robotframework_dashboard/js/database.js +18 -0
- robotframework_dashboard/js/eventlisteners.js +675 -0
- robotframework_dashboard/js/filter.js +662 -0
- robotframework_dashboard/js/graph_creation/all.js +107 -0
- robotframework_dashboard/js/graph_creation/compare.js +77 -0
- robotframework_dashboard/js/graph_creation/keyword.js +360 -0
- robotframework_dashboard/js/graph_creation/overview.js +589 -0
- robotframework_dashboard/js/graph_creation/run.js +154 -0
- robotframework_dashboard/js/graph_creation/suite.js +338 -0
- robotframework_dashboard/js/graph_creation/tables.js +188 -0
- robotframework_dashboard/js/graph_creation/test.js +475 -0
- robotframework_dashboard/js/graph_data/donut.js +289 -0
- robotframework_dashboard/js/graph_data/duration.js +188 -0
- robotframework_dashboard/js/graph_data/duration_deviation.js +50 -0
- robotframework_dashboard/js/graph_data/failed.js +118 -0
- robotframework_dashboard/js/graph_data/flaky.js +155 -0
- robotframework_dashboard/js/graph_data/graph_config.js +332 -0
- robotframework_dashboard/js/graph_data/heatmap.js +62 -0
- robotframework_dashboard/js/graph_data/helpers.js +111 -0
- robotframework_dashboard/js/graph_data/messages.js +116 -0
- robotframework_dashboard/js/graph_data/statistics.js +219 -0
- robotframework_dashboard/js/graph_data/stats.js +43 -0
- robotframework_dashboard/js/graph_data/time_consuming.js +201 -0
- robotframework_dashboard/js/information.js +105 -0
- robotframework_dashboard/js/layout.js +451 -0
- robotframework_dashboard/js/localstorage.js +221 -0
- robotframework_dashboard/js/log.js +122 -0
- robotframework_dashboard/js/main.js +26 -0
- robotframework_dashboard/js/menu.js +252 -0
- robotframework_dashboard/js/theme.js +215 -0
- robotframework_dashboard/js/variables/chartconfig.js +88 -0
- robotframework_dashboard/js/variables/data.js +35 -0
- robotframework_dashboard/js/variables/globals.js +74 -0
- robotframework_dashboard/js/variables/graphmetadata.js +940 -0
- robotframework_dashboard/js/variables/graphs.js +69 -0
- robotframework_dashboard/js/variables/information.js +271 -0
- robotframework_dashboard/js/variables/settings.js +85 -0
- robotframework_dashboard/js/variables/svg.js +116 -0
- robotframework_dashboard/licenses/THIRD_PARTY_LICENSES.txt +250 -0
- robotframework_dashboard/main.py +88 -0
- robotframework_dashboard/processors.py +304 -0
- robotframework_dashboard/queries.py +45 -0
- robotframework_dashboard/robotdashboard.py +245 -0
- robotframework_dashboard/server.py +593 -0
- robotframework_dashboard/templates/admin.html +350 -0
- robotframework_dashboard/templates/dashboard.html +713 -0
- robotframework_dashboard/version.py +1 -0
- robotframework_dashboard-1.3.1.dist-info/METADATA +101 -0
- robotframework_dashboard-1.3.1.dist-info/RECORD +79 -0
- robotframework_dashboard-1.3.1.dist-info/WHEEL +5 -0
- robotframework_dashboard-1.3.1.dist-info/entry_points.txt +2 -0
- robotframework_dashboard-1.3.1.dist-info/licenses/LICENSE +21 -0
- robotframework_dashboard-1.3.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/* LIGHT MODE STYLING */
|
|
2
|
+
body {
|
|
3
|
+
background-color: #eee;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.border-bottom {
|
|
7
|
+
border-color: rgba(0, 0, 0, 0.175) !important;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.fullscreen,
|
|
11
|
+
.sticky-top,
|
|
12
|
+
body {
|
|
13
|
+
background-color: #eee;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.grid-stack {
|
|
17
|
+
max-height: 2400px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.grid-stack-item-content {
|
|
21
|
+
background-color: white;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.form-switch .form-check-input:not(:checked) {
|
|
25
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='black'/></svg>");
|
|
26
|
+
border-color: black;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.stat-label {
|
|
30
|
+
font-size: 1rem;
|
|
31
|
+
color: darkgrey;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.white-text {
|
|
35
|
+
color: black;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* DARK MODE STYLING */
|
|
39
|
+
.dark-mode :root {
|
|
40
|
+
color-scheme: dark;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.dark-mode .grid-stack-item-content,
|
|
44
|
+
.dark-mode .overview-card .card {
|
|
45
|
+
background: rgba(30, 41, 59, 0.9);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dark-mode .fullscreen {
|
|
49
|
+
background: rgba(30, 41, 59, 1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dark-mode .modal-content {
|
|
53
|
+
background: #0f172a;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dark-mode .border-bottom {
|
|
57
|
+
border-color: rgba(255, 255, 255, 0.15) !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.dark-mode .sticky-top,
|
|
61
|
+
.dark-mode .card,
|
|
62
|
+
.dark-mode body,
|
|
63
|
+
.dark-mode .modal-dialog {
|
|
64
|
+
background: #0f172a;
|
|
65
|
+
color: #eee;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dark-mode .list-group-item:not(.disabled),
|
|
69
|
+
.dark-mode .form-label,
|
|
70
|
+
.dark-mode .form-control,
|
|
71
|
+
.dark-mode .form-select {
|
|
72
|
+
color: #eee;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.dark-mode .list-group-item .disabled {
|
|
76
|
+
color: rgba(173, 181, 189, 0.75);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dark-mode .form-switch .form-check-input:not(:checked) {
|
|
80
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='white'/></svg>");
|
|
81
|
+
border-color: #eee;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.dark-mode .table>:not(caption)>*>* {
|
|
85
|
+
color: #eee;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.dark-mode .collapse-icon {
|
|
89
|
+
color: #eee;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.dark-mode .stat-label {
|
|
93
|
+
font-size: 0.85rem;
|
|
94
|
+
color: #9ca3af;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.dark-mode .white-text {
|
|
98
|
+
color: #eee;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* GENERAL STYLING */
|
|
102
|
+
:root {
|
|
103
|
+
font-family: Helvetica, sans-serif;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.html-scroll {
|
|
107
|
+
overflow-y: scroll;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.modal-open {
|
|
111
|
+
padding-right: 0px !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
h4,
|
|
115
|
+
h5,
|
|
116
|
+
h6 {
|
|
117
|
+
margin-bottom: 0rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
body.lock-scroll {
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
#settings,
|
|
125
|
+
#database,
|
|
126
|
+
.nav-item,
|
|
127
|
+
.information-icon,
|
|
128
|
+
.bar-graph,
|
|
129
|
+
.line-graph,
|
|
130
|
+
.fullscreen-graph,
|
|
131
|
+
.close-graph,
|
|
132
|
+
.timeline-graph,
|
|
133
|
+
.radar-graph,
|
|
134
|
+
.heatmap-graph,
|
|
135
|
+
.pie-graph,
|
|
136
|
+
.percentage-graph,
|
|
137
|
+
.stats-graph,
|
|
138
|
+
.boxplot-graph,
|
|
139
|
+
.shown-graph,
|
|
140
|
+
.hidden-graph,
|
|
141
|
+
.shown-section,
|
|
142
|
+
.hidden-section,
|
|
143
|
+
.move-up-table,
|
|
144
|
+
.move-down-table,
|
|
145
|
+
.move-up-section,
|
|
146
|
+
.move-down-section {
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.navbar-disabled {
|
|
151
|
+
opacity: 0.5;
|
|
152
|
+
user-select: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.navbar-disabled a {
|
|
156
|
+
pointer-events: none;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.navbar-disabled a:hover {
|
|
160
|
+
pointer-events: auto;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.tooltip-popup {
|
|
164
|
+
position: fixed;
|
|
165
|
+
max-width: 360px;
|
|
166
|
+
padding: 8px 12px;
|
|
167
|
+
border-radius: 8px;
|
|
168
|
+
background-color: white;
|
|
169
|
+
color: black;
|
|
170
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
171
|
+
font-size: 0.95rem;
|
|
172
|
+
white-space: pre-line;
|
|
173
|
+
pointer-events: none;
|
|
174
|
+
z-index: 9999;
|
|
175
|
+
box-sizing: border-box;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.dark-mode .tooltip-popup {
|
|
179
|
+
background-color: #0f172a;
|
|
180
|
+
color: #eee;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.navbar {
|
|
184
|
+
margin-bottom: 1rem;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.card {
|
|
188
|
+
margin-bottom: 1rem;
|
|
189
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.stats {
|
|
193
|
+
float: right;
|
|
194
|
+
text-align: right;
|
|
195
|
+
font-size: 0.9em;
|
|
196
|
+
white-space: nowrap;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.fullscreen {
|
|
200
|
+
position: fixed !important;
|
|
201
|
+
width: 100% !important;
|
|
202
|
+
height: 100% !important;
|
|
203
|
+
left: 0 !important;
|
|
204
|
+
top: 0 !important;
|
|
205
|
+
z-index: 10 !important;
|
|
206
|
+
padding: 20px 20px 20px 20px !important;
|
|
207
|
+
border-radius: 0px !important;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.dropdown-menu {
|
|
211
|
+
width: max-content;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.version-selected-dot {
|
|
215
|
+
display: inline-block;
|
|
216
|
+
width: 6px;
|
|
217
|
+
height: 6px;
|
|
218
|
+
background-color: #ec5800;
|
|
219
|
+
border-radius: 50%;
|
|
220
|
+
margin-left: 5px;
|
|
221
|
+
margin-bottom: 2px;
|
|
222
|
+
vertical-align: middle;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.selectBox {
|
|
226
|
+
position: relative;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.selectBox select {
|
|
230
|
+
width: 100%;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.overSelect {
|
|
234
|
+
position: absolute;
|
|
235
|
+
left: 0;
|
|
236
|
+
right: 0;
|
|
237
|
+
top: 0;
|
|
238
|
+
bottom: 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.filterCheckBoxes {
|
|
242
|
+
display: none;
|
|
243
|
+
position: absolute;
|
|
244
|
+
z-index: 2;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.filterCheckBoxes label {
|
|
248
|
+
display: block;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.border {
|
|
252
|
+
min-height: 42px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.stat-value {
|
|
256
|
+
font-size: 1.5rem;
|
|
257
|
+
font-weight: 600;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.fullscreen .stat-value {
|
|
261
|
+
font-size: 4rem;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.fullscreen .stat-label {
|
|
265
|
+
font-size: 2rem;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.green-text,
|
|
269
|
+
.text-passed {
|
|
270
|
+
color: rgba(151, 189, 97, 0.9);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.border-passed {
|
|
274
|
+
border-color: rgba(151, 189, 97, 0.9);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.red-text,
|
|
278
|
+
.text-failed {
|
|
279
|
+
color: rgba(206, 62, 1, 0.9);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.border-failed {
|
|
283
|
+
border-color: rgba(206, 62, 1, 0.9);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.yellow-text {
|
|
287
|
+
color: rgba(254, 216, 79, 0.9);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.border-skipped {
|
|
291
|
+
border-color: rgba(254, 216, 79, 0.9);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.blue-text {
|
|
295
|
+
color: dodgerblue;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.overview-canvas {
|
|
299
|
+
height: 200px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.overview-card {
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
min-width: 300px;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.overview-card .card {
|
|
308
|
+
border-radius: 1rem
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.project-run-cards-container {
|
|
312
|
+
display: flex;
|
|
313
|
+
flex-wrap: wrap;
|
|
314
|
+
column-gap: 24px;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.project-run-cards-container .overview-card {
|
|
318
|
+
flex: 0 1 calc((100% - 48px) / 3); /* 3 per row, subtract total gap */
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.run-card-version-title {
|
|
322
|
+
gap: 0.25rem;
|
|
323
|
+
width: fit-content;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.run-card-version-title:hover h5 {
|
|
327
|
+
color: #ec5800 !important;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.run-card-small-version {
|
|
331
|
+
display: flex;
|
|
332
|
+
gap: 0.25rem;
|
|
333
|
+
width: fit-content;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.run-card-small-version:hover div{
|
|
337
|
+
color: #ec5800 !important;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.grid-stack-item-content {
|
|
341
|
+
border-radius: 8px;
|
|
342
|
+
display: flex;
|
|
343
|
+
flex-direction: column;
|
|
344
|
+
padding: 20px;
|
|
345
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.graph-header {
|
|
349
|
+
display: flex;
|
|
350
|
+
justify-content: space-between;
|
|
351
|
+
align-items: center;
|
|
352
|
+
margin-bottom: 8px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.graph-header h6 {
|
|
356
|
+
margin: 0;
|
|
357
|
+
font-weight: 600;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.graph-controls {
|
|
361
|
+
display: flex;
|
|
362
|
+
gap: 8px;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.grid-stack-item-content .graph-body {
|
|
366
|
+
flex: 1 1 auto;
|
|
367
|
+
display: flex;
|
|
368
|
+
overflow-x: hidden;
|
|
369
|
+
overflow-y: auto;
|
|
370
|
+
width: 100%;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.graph-body .row {
|
|
374
|
+
flex-wrap: wrap;
|
|
375
|
+
margin-left: 0;
|
|
376
|
+
margin-right: 0;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.grid-stack-item-content .graph-body .vertical {
|
|
380
|
+
overflow-y: auto;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
canvas {
|
|
384
|
+
display: block;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
#alertContainer {
|
|
388
|
+
z-index: 1100;
|
|
389
|
+
top: 7rem;
|
|
390
|
+
max-width: 80%
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.alert-dismissible {
|
|
394
|
+
padding-right: 16px !important;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.grid-stack-item-content:has(.hidden-graph:not([hidden])),
|
|
398
|
+
.table-section:has(.hidden-graph:not([hidden])),
|
|
399
|
+
.card:has(.hidden-section:not([hidden])) {
|
|
400
|
+
opacity: 0.5;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.modal.dimmed {
|
|
404
|
+
pointer-events: none;
|
|
405
|
+
filter: brightness(0.5);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
#runTag {
|
|
409
|
+
max-height: 400px;
|
|
410
|
+
overflow: auto;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
@media print {
|
|
414
|
+
table {
|
|
415
|
+
width: 100%;
|
|
416
|
+
page-break-inside: auto;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.grid-stack-item-contentvas {
|
|
420
|
+
width: 100%;
|
|
421
|
+
overflow: hidden;
|
|
422
|
+
page-break-inside: avoid;
|
|
423
|
+
break-inside: avoid;
|
|
424
|
+
display: block;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
canvas {
|
|
428
|
+
height: auto !important;
|
|
429
|
+
max-width: 100% !important;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
from os.path import join, abspath, dirname
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from json import dumps
|
|
5
|
+
from zlib import compress
|
|
6
|
+
from base64 import b64encode
|
|
7
|
+
|
|
8
|
+
from .dependencies import DependencyProcessor
|
|
9
|
+
from .version import __version__
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class DashboardGenerator:
|
|
13
|
+
"""
|
|
14
|
+
Class that handles the generation of the dashboard HTML
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def generate_dashboard(
|
|
18
|
+
self,
|
|
19
|
+
name_dashboard: str,
|
|
20
|
+
data: dict,
|
|
21
|
+
generation_datetime: datetime,
|
|
22
|
+
dashboard_title: str,
|
|
23
|
+
server: bool,
|
|
24
|
+
json_config: str,
|
|
25
|
+
message_config: list,
|
|
26
|
+
quantity: int,
|
|
27
|
+
use_logs: bool,
|
|
28
|
+
offline: bool,
|
|
29
|
+
):
|
|
30
|
+
"""
|
|
31
|
+
Function that generates the dashboard by replacing all relevant placeholders.
|
|
32
|
+
"""
|
|
33
|
+
dependency_processor = DependencyProcessor()
|
|
34
|
+
|
|
35
|
+
# load template
|
|
36
|
+
index_html = join(dirname(abspath(__file__)), "templates", "dashboard.html")
|
|
37
|
+
with open(index_html, "r", encoding="utf-8") as file:
|
|
38
|
+
dashboard_data = file.read()
|
|
39
|
+
dashboard_data = dashboard_data.replace(
|
|
40
|
+
"<!-- placeholder_javascript -->", dependency_processor.get_js_block()
|
|
41
|
+
)
|
|
42
|
+
dashboard_data = dashboard_data.replace(
|
|
43
|
+
"<!-- placeholder_css -->", dependency_processor.get_css_block()
|
|
44
|
+
)
|
|
45
|
+
dashboard_data = dashboard_data.replace(
|
|
46
|
+
"<!-- placeholder_dependencies -->",
|
|
47
|
+
dependency_processor.get_dependencies_block(offline),
|
|
48
|
+
)
|
|
49
|
+
dashboard_data = dashboard_data.replace(
|
|
50
|
+
'"placeholder_version"', __version__
|
|
51
|
+
)
|
|
52
|
+
dashboard_data = dashboard_data.replace(
|
|
53
|
+
'"placeholder_runs"', f'"{self._compress_and_encode(data["runs"])}"'
|
|
54
|
+
)
|
|
55
|
+
dashboard_data = dashboard_data.replace(
|
|
56
|
+
'"placeholder_suites"', f'"{self._compress_and_encode(data["suites"])}"'
|
|
57
|
+
)
|
|
58
|
+
dashboard_data = dashboard_data.replace(
|
|
59
|
+
'"placeholder_tests"', f'"{self._compress_and_encode(data["tests"])}"'
|
|
60
|
+
)
|
|
61
|
+
dashboard_data = dashboard_data.replace(
|
|
62
|
+
'"placeholder_keywords"',
|
|
63
|
+
f'"{self._compress_and_encode(data["keywords"])}"',
|
|
64
|
+
)
|
|
65
|
+
dashboard_data = dashboard_data.replace(
|
|
66
|
+
'"placeholder_amount"', str(quantity)
|
|
67
|
+
)
|
|
68
|
+
if dashboard_title != "":
|
|
69
|
+
dashboard_data = dashboard_data.replace(
|
|
70
|
+
'"placeholder_dashboard_title"', dashboard_title
|
|
71
|
+
)
|
|
72
|
+
else:
|
|
73
|
+
dashboard_data = dashboard_data.replace(
|
|
74
|
+
'"placeholder_dashboard_title"',
|
|
75
|
+
f"Robot Framework Dashboard - {str(generation_datetime)[:-7]}",
|
|
76
|
+
)
|
|
77
|
+
if server:
|
|
78
|
+
dashboard_data = dashboard_data.replace('"placeholder_server"', "true")
|
|
79
|
+
else:
|
|
80
|
+
dashboard_data = dashboard_data.replace('"placeholder_server"', "false")
|
|
81
|
+
if message_config:
|
|
82
|
+
dashboard_data = dashboard_data.replace(
|
|
83
|
+
'"placeholder_message_config"',
|
|
84
|
+
str(message_config).replace("'", '"'),
|
|
85
|
+
)
|
|
86
|
+
if json_config:
|
|
87
|
+
dashboard_data = dashboard_data.replace(
|
|
88
|
+
'"placeholder_json_config"',
|
|
89
|
+
json_config,
|
|
90
|
+
)
|
|
91
|
+
if use_logs:
|
|
92
|
+
dashboard_data = dashboard_data.replace(
|
|
93
|
+
'"placeholder_use_logs"', "true"
|
|
94
|
+
)
|
|
95
|
+
else:
|
|
96
|
+
dashboard_data = dashboard_data.replace(
|
|
97
|
+
'"placeholder_use_logs"', "false"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# handle possible subdirectories
|
|
101
|
+
path = Path(name_dashboard)
|
|
102
|
+
path.parent.mkdir(exist_ok=True, parents=True)
|
|
103
|
+
|
|
104
|
+
# minify html
|
|
105
|
+
dashboard_data = self._minify_text(dashboard_data)
|
|
106
|
+
|
|
107
|
+
# write template
|
|
108
|
+
with open(name_dashboard, "w", encoding="utf-8") as file:
|
|
109
|
+
file.write(dashboard_data)
|
|
110
|
+
|
|
111
|
+
# warn in case of empty database
|
|
112
|
+
if len(data["runs"]) == 0:
|
|
113
|
+
print(" WARNING: There are no runs so the dashboard will be empty!")
|
|
114
|
+
|
|
115
|
+
def _compress_and_encode(self, obj):
|
|
116
|
+
json_data = dumps(obj).encode("utf-8")
|
|
117
|
+
compressed = compress(json_data)
|
|
118
|
+
return b64encode(compressed).decode("utf-8")
|
|
119
|
+
|
|
120
|
+
def _minify_text(self, text):
|
|
121
|
+
cleaned_lines = []
|
|
122
|
+
for line in text.splitlines():
|
|
123
|
+
stripped = line.strip()
|
|
124
|
+
if stripped: # keep only non-empty lines
|
|
125
|
+
cleaned_lines.append(stripped)
|
|
126
|
+
return "\n".join(cleaned_lines)
|