Show stations that were never heard, but exist in trackedStations
This commit is contained in:
parent
a387cf449b
commit
648132aa2b
20
client.js
20
client.js
@ -69,11 +69,22 @@ function redrawTable() {
|
||||
`<th>Time since Last Heard</th>` +
|
||||
`<th>Last Voltage</th>` +
|
||||
`<th>Last Temperature</th>`;
|
||||
for (let callsign in stations) {
|
||||
for (let callsign in trackedStations) {
|
||||
let tr = table.appendChild(document.createElement('tr'));
|
||||
tr.innerHTML = `<td>${getTactical(callsign)}</td>`;
|
||||
if (!(callsign in stations)) {
|
||||
tr.classList.add('neverHeard');
|
||||
tr.innerHTML +=
|
||||
'<td>Never Heard</td>' +
|
||||
'<td>Never Heard</td>' +
|
||||
'<td>Never Heard</td>' +
|
||||
'<td>Never Heard</td>';
|
||||
}
|
||||
|
||||
else {
|
||||
let station = stations[callsign];
|
||||
let nowDelta = new Date(new Date() - station.lastHeard);
|
||||
|
||||
let tr = table.appendChild(document.createElement('tr'));
|
||||
// TODO: should be set by same thing that sends alert
|
||||
if (nowDelta.getTime() > timeoutLength) {
|
||||
tr.classList.add('timedOut');
|
||||
@ -81,13 +92,12 @@ function redrawTable() {
|
||||
if (station.lastVoltage < lowVoltage) {
|
||||
tr.classList.add('lowVoltage');
|
||||
}
|
||||
tr.innerHTML =
|
||||
`<td>${getTactical(callsign)}</td>` +
|
||||
tr.innerHTML +=
|
||||
`<td>${station.lastHeard.toLocaleTimeString('en-GB')}</td>` +
|
||||
`<td>${nowDelta.toLocaleTimeString('en-GB', {timeZone: "UTC"})}</td>` +
|
||||
`<td>${station.lastVoltage||''}</td>` +
|
||||
`<td>${station.lastTemperature||''}</td>`;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,10 @@
|
||||
table.stations tr.lowVoltage {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
table.stations tr.neverHeard {
|
||||
background-color: purple;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
Loading…
Reference in New Issue
Block a user