[Perl] DAQ system for the FAPG.
Replace graph routes with probe routes
Changed files
roles/dashboard/lib/FAPG/DAQ/Dashboard.pm
@@ -76,7 +76,7 @@
76
76
$r->get('/probes')->to('dashboard#probe_list');
77
77
$r->get('/downloads')->to('dashboard#downloads');
78
78
$r->get('/downloads/readings.csv')->to('Download#readings');
79
Removed:
$r->get('/graphs/:probe')->to('dashboard#graph');
79
Added:
$r->get('/probes/:probe')->to('dashboard#graph');
80
80
81
81
$r->get('/api/readings/:probe/series')->to('Reading#series');
82
82
$r->get('/api/readings/:probe')->to('Reading#list');
roles/dashboard/public/js/dashboard.js
@@ -808,7 +808,7 @@
808
808
}
809
809
810
810
function probeFromPath() {
811
Removed:
const match = window.location.pathname.match(/^\/graphs\/([a-z]+)$/);
811
Added:
const match = window.location.pathname.match(/^\/probes\/([a-z]+)$/);
812
812
const probe = match ? match[1] : null;
813
813
814
814
return chartElement(probe) ? probe : null;
roles/dashboard/t/00-homepage.t
@@ -41,16 +41,16 @@
41
41
->content_like(qr/data-reading-quick-probe="orp"/)
42
42
->content_like(qr/data-reading-quick-probe="ec"/)
43
43
->element_exists(
44
Removed:
'a.reading-quick-link[href="/graphs/ph"] article[data-reading-quick-probe="ph"]'
44
Added:
'a.reading-quick-link[href="/probes/ph"] article[data-reading-quick-probe="ph"]'
45
45
)
46
46
->element_exists(
47
Removed:
'a.reading-quick-link[href="/graphs/do"] article[data-reading-quick-probe="do"]'
47
Added:
'a.reading-quick-link[href="/probes/do"] article[data-reading-quick-probe="do"]'
48
48
)
49
49
->element_exists(
50
Removed:
'a.reading-quick-link[href="/graphs/orp"] article[data-reading-quick-probe="orp"]'
50
Added:
'a.reading-quick-link[href="/probes/orp"] article[data-reading-quick-probe="orp"]'
51
51
)
52
52
->element_exists(
53
Removed:
'a.reading-quick-link[href="/graphs/ec"] article[data-reading-quick-probe="ec"]'
53
Added:
'a.reading-quick-link[href="/probes/ec"] article[data-reading-quick-probe="ec"]'
54
54
)
55
55
->element_exists_not('article[data-reading-quick-probe="ph"] h3 a')
56
56
->content_like(qr/Dissolved Oxygen/)
roles/dashboard/t/01-graph-page.t
@@ -11,7 +11,7 @@
11
11
12
12
my $t = test_app();
13
13
14
Removed:
$t->get_ok('/graphs/ph')
14
Added:
$t->get_ok('/probes/ph')
15
15
->status_is(200)
16
16
->text_is( 'a.page-brand[href="/"]', 'FAPG' )
17
17
->element_exists('a.header-status-link[href="/status"][data-header-status]')
@@ -38,7 +38,9 @@
38
38
->content_like(qr/data-smoothing-toggle checked/)
39
39
->content_like(qr/Latest pH Reading Messages/);
40
40
41
Removed:
$t->get_ok('/graphs/unknown')->status_is(404);
41
Added:
$t->get_ok('/probes/unknown')->status_is(404);
42
Added:
43
Added:
$t->get_ok('/graphs/ph')->status_is(404);
42
44
43
45
$t->get_ok('/probes')
44
46
->status_is(200)
roles/dashboard/templates/dashboard/index.html.ep
@@ -19,7 +19,7 @@
19
19
<section class="reading-quick-status" aria-label="Sensor reading quick status">
20
20
<div class="reading-quick-grid" data-reading-quick-status>
21
21
% for my $probe ($probes->@*) {
22
Removed:
<a class="reading-quick-link" href="/graphs/<%= $probe->{key} %>">
22
Added:
<a class="reading-quick-link" href="/probes/<%= $probe->{key} %>">
23
23
<article
24
24
class="reading-quick-item is-unknown"
25
25
data-reading-quick-probe="<%= $probe->{key} %>"