Skip to content

Commit e4522bd

Browse files
committed
feat: block results report HTMX
Reduce the block report to an HTML fragment that is loaded with the wrapper using AJAX requests. Update the summary report links to use a bootstrap button class (which is nicer than the blue URLs anyway?), and use HTMX to replace the `#report-content` div with the block report. The `hx-push-url="true"` is important to make sure the back button on the browser works as expected. Signed-off-by: James McCorrie <[email protected]>
1 parent 7690af4 commit e4522bd

File tree

2 files changed

+5
-49
lines changed

2 files changed

+5
-49
lines changed

src/dvsim/templates/reports/block_report.html

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,12 @@
44
# SPDX-License-Identifier: Apache-2.0
55
66
-->
7-
87
{% set block = results.block %}
98
{% set tool = results.tool %}
109
{% set timestamp = results.timestamp %}
1110
{% set stages = results.stages %}
1211
{% set coverage = results.coverage %}
1312
{% set failed_jobs = results.failed_jobs %}
14-
15-
<!doctype html>
16-
<html lang="en">
17-
<head>
18-
<meta charset="utf-8">
19-
<meta name="viewport" content="width=device-width, initial-scale=1">
20-
<title>{{ block.name }} Simulation Results</title>
21-
<script src="https://unpkg.com/[email protected]"></script>
22-
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
23-
rel="stylesheet"
24-
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
25-
crossorigin="anonymous">
26-
<style>
27-
td.c0 { color: #ffffff; background-color: #EF5757; }
28-
td.c1 { color: #ffffff; background-color: #EF6D57; }
29-
td.c2 { color: #000000; background-color: #EF8357; }
30-
td.c3 { color: #000000; background-color: #EF9957; }
31-
td.c4 { color: #000000; background-color: #EFAF57; }
32-
td.c5 { color: #000000; background-color: #EFC557; }
33-
td.c6 { color: #000000; background-color: #EFDB57; }
34-
td.c7 { color: #000000; background-color: #ECEF57; }
35-
td.c8 { color: #000000; background-color: #D6EF57; }
36-
td.c9 { color: #000000; background-color: #C0EF57; }
37-
td.c10 { color: #000000; background-color: #57EF57; }
38-
</style>
39-
</head>
40-
<body>
41-
42-
<nav class="navbar navbar-expand-lg bg-body-tertiary">
43-
<div class="container-fluid">
44-
<a class="navbar-brand" href="#">Nightly Reports</a>
45-
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
46-
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
47-
aria-expanded="false" aria-label="Toggle navigation">
48-
<span class="navbar-toggler-icon"></span>
49-
</button>
50-
</div>
51-
</nav>
52-
5313
<div class="container-md">
5414
<div class="row">
5515
<div class="col">
@@ -262,9 +222,3 @@ <h3>Error Messages</h3>
262222
</div>
263223
</div>
264224
</div>
265-
266-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
267-
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
268-
crossorigin="anonymous"></script>
269-
</body>
270-
</html>

src/dvsim/templates/reports/summary_report.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ <h2>Simulation Results: {{ top.name }}</h2>
9292
{% for block_name in summary.flow_results.keys()|sort %}
9393
{% set flow = summary.flow_results[block_name] %}
9494
<tr>
95-
<td>
96-
<a href="{{ block_name }}.html">
95+
<td class="btn"
96+
hx-get="{{ block_name }}.html"
97+
hx-trigger="click"
98+
hx-push-url="true"
99+
hx-target="#report-content">
97100
{{ block_name | upper }}
98-
</a>
99101
</td>
100102
<td>{{ flow.passed }}</td>
101103
<td>{{ flow.total }}</td>

0 commit comments

Comments
 (0)