[Perl] DAQ system for the FAPG.
fix preserve stale index quick cards
- Rename the quick-card row hook to avoid status-pill selection. - Remove obsolete quick-card handling from the status loader. - Add regression coverage forbidding the conflicting status hook. - Let reading timestamps alone control per-card stale styling.
Changed files
roles/dashboard/public/js/dashboard/status.js
@@ -85,35 +85,10 @@
85
85
});
86
86
}
87
87
88
Removed:
function quickCardLabel(state) {
89
Removed:
return {
90
Removed:
healthy: "",
91
Removed:
stale: "",
92
Removed:
"probe-error": "Error",
93
Removed:
unreachable: "",
94
Removed:
unknown: ""
95
Removed:
}[state] || "";
96
Removed:
}
97
Removed:
98
Removed:
function loadQuickCardStatuses(statuses) {
99
Removed:
const pills = Array.from(document.querySelectorAll("[data-reading-quick-status]"));
100
Removed:
if (!pills.length) return;
101
Removed:
102
Removed:
pills.forEach(pill => {
103
Removed:
const probe = pill.dataset.readingQuickStatus;
104
Removed:
const state = stateForNodeStatus(statuses[probe] || null);
105
Removed:
const displayState = state === "unreachable" ? "stale" : state;
106
Removed:
const label = quickCardLabel(state);
107
Removed:
pill.className = `status-pill is-${displayState}`;
108
Removed:
pill.textContent = label;
109
Removed:
pill.hidden = !label;
110
Removed:
});
111
Removed:
}
112
Removed:
113
88
export function createStatusLoader() {
114
89
return async function loadStatuses() {
115
90
const hasStatusElements = document.querySelector(
116
Removed:
"[data-header-status], [data-status-page-item], [data-reading-quick-status]"
91
Added:
"[data-header-status], [data-status-page-item]"
117
92
);
118
93
if (!hasStatusElements) return;
119
94
@@ -126,6 +101,5 @@
126
101
127
102
loadHeaderStatus(statuses);
128
103
loadStatusPage(statuses);
129
Removed:
loadQuickCardStatuses(statuses);
130
104
};
131
105
}
roles/dashboard/t/00-homepage.t
@@ -19,7 +19,8 @@
19
19
->element_exists_not('.navbar-nav a.nav-link.active')
20
20
->element_exists_not('nav[aria-label="Breadcrumb"]')
21
21
->element_exists(
22
Removed:
'section.reading-quick-status [data-reading-quick-status]')
22
Added:
'section.reading-quick-status [data-reading-quick-list]')
23
Added:
->element_exists_not('[data-reading-quick-status]')
23
24
->element_exists('[data-weather-forecast]')
24
25
->element_exists('canvas#chart-weather-forecast')
25
26
->element_exists(
roles/dashboard/templates/dashboard/index.html.ep
@@ -5,7 +5,7 @@
5
5
<section class="mb-3" aria-label="DAQ status overview">
6
6
7
7
<section class="reading-quick-status mb-3" aria-label="Sensor reading quick status">
8
Removed:
<div class="row g-2" data-reading-quick-status>
8
Added:
<div class="row g-2" data-reading-quick-list>
9
9
% for my $probe ($probes->@*) {
10
10
<div class="col-6 col-sm-6 col-xl-3">
11
11
<a class="reading-quick-link text-decoration-none text-body d-block h-100" href="/probes/<%= $probe->{key} %>">