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