Show stations that were never heard, but exist in trackedStations
This commit is contained in:
parent
0ba7d6fec8
commit
ce62045a3e
20
client.js
20
client.js
@ -67,11 +67,22 @@ 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 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 station = stations[callsign];
|
||||||
let nowDelta = new Date(new Date() - station.lastHeard);
|
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
|
// TODO: should be set by same thing that sends alert
|
||||||
if (nowDelta.getTime() > timeoutLength) {
|
if (nowDelta.getTime() > timeoutLength) {
|
||||||
tr.classList.add('timedOut');
|
tr.classList.add('timedOut');
|
||||||
@ -79,13 +90,12 @@ function redrawTable() {
|
|||||||
if (station.lastVoltage < lowVoltage) {
|
if (station.lastVoltage < lowVoltage) {
|
||||||
tr.classList.add('lowVoltage');
|
tr.classList.add('lowVoltage');
|
||||||
}
|
}
|
||||||
tr.innerHTML =
|
tr.innerHTML +=
|
||||||
`<td>${getTactical(callsign)}</td>` +
|
|
||||||
`<td>${station.lastHeard.toLocaleTimeString('en-GB')}</td>` +
|
`<td>${station.lastHeard.toLocaleTimeString('en-GB')}</td>` +
|
||||||
`<td>${nowDelta.toLocaleTimeString('en-GB', {timeZone: "UTC"})}</td>` +
|
`<td>${nowDelta.toLocaleTimeString('en-GB', {timeZone: "UTC"})}</td>` +
|
||||||
`<td>${station.lastVoltage||''}</td>` +
|
`<td>${station.lastVoltage||''}</td>` +
|
||||||
`<td>${station.lastTemperature||''}</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