Add status page and tests.

Commit
63f4831688278cd4f380e347c83d9f408e5a3fcf
Author
Marius Peter <dev@marius-peter.com>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
Changed files
roles/dashboard/t/05-status-page.t
index 00000000..1ae7b71b 000000..100644
@@ -0,0 +1,27 @@
1 Added: # -*- mode: cperl; -*-
2 Added:
3 Added: use Mojo::Base -strict;
4 Added:
5 Added: use Test2::V0;
6 Added:
7 Added: use FindBin;
8 Added: use lib "${FindBin::Bin}/../lib/";
9 Added: use lib "${FindBin::Bin}/lib/";
10 Added: use Dashboard::Test qw(test_app);
11 Added:
12 Added: my $t = test_app();
13 Added:
14 Added: $t->get_ok('/status')
15 Added: ->status_is(200)
16 Added: ->text_is('h1', 'DAQ Status')
17 Added: ->element_exists('a.header-status-link[href="/status"][data-header-status]')
18 Added: ->element_exists('table.status-table')
19 Added: ->element_exists('tr[data-status-page-item="hub"]')
20 Added: ->element_exists('tr[data-status-page-item="ph"]')
21 Added: ->element_exists('tr[data-status-page-item="do"]')
22 Added: ->element_exists('tr[data-status-page-item="orp"]')
23 Added: ->element_exists('tr[data-status-page-item="ec"]')
24 Added: ->content_like(qr/Last seen online/)
25 Added: ->content_like(qr/Checking status/);
26 Added:
27 Added: done_testing;
roles/dashboard/templates/dashboard/status.html.ep
index 00000000..dea89278 000000..100644
@@ -0,0 +1,40 @@
1 Added: <!-- -*- mode: web; -*- -->
2 Added:
3 Added: % layout 'default';
4 Added: % title 'FAPG DAQ Status';
5 Added:
6 Added: <section class="dashboard-card status-page-card">
7 Added: <div class="panel-heading">
8 Added: <div>
9 Added: <h1>DAQ Status</h1>
10 Added: <p>Current connection status for the hub and sensor probes.</p>
11 Added: </div>
12 Added: </div>
13 Added:
14 Added: <div class="message-table-wrap">
15 Added: <table class="message-table status-table">
16 Added: <thead>
17 Added: <tr>
18 Added: <th scope="col">Probe</th>
19 Added: <th scope="col">Node</th>
20 Added: <th scope="col">Status</th>
21 Added: <th scope="col">Last seen online</th>
22 Added: <th scope="col">Message</th>
23 Added: </tr>
24 Added: </thead>
25 Added: <tbody data-status-page-rows>
26 Added: % for my $item ($items->@*) {
27 Added: <tr data-status-page-item="<%= $item->{key} %>">
28 Added: <td data-status-page-label><%= $item->{label} %></td>
29 Added: <td data-status-page-node>Checking…</td>
30 Added: <td><span class="status-pill is-unknown" data-status-page-state>Checking</span></td>
31 Added: <td data-status-page-last-seen>Checking…</td>
32 Added: <td data-status-page-message>Checking status…</td>
33 Added: </tr>
34 Added: % }
35 Added: </tbody>
36 Added: </table>
37 Added: </div>
38 Added: </section>
39 Added:
40 Added: <script src="/js/dashboard.js"></script>