map UI changes
All checks were successful
Meshtastic Map - See local Meshtastic Nodes / deploy (push) Successful in 1s
All checks were successful
Meshtastic Map - See local Meshtastic Nodes / deploy (push) Successful in 1s
This commit is contained in:
parent
28d09862c1
commit
8641463324
@ -15,27 +15,38 @@
|
|||||||
var map = L.map('map').setView([0, 0], 2);
|
var map = L.map('map').setView([0, 0], 2);
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
||||||
let myCoords = null;
|
let myCoords = null;
|
||||||
|
const today = new Date();
|
||||||
|
|
||||||
const getNodeDesc = (node) =>{
|
const daysSince = (test) => {
|
||||||
|
if (test) {
|
||||||
|
const diffTime = Math.abs(test.getTime() - today.getTime());
|
||||||
|
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||||
|
return diffDays;
|
||||||
|
}
|
||||||
|
return "N/A"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const getNodeDesc = (node) => {
|
||||||
const deviceMetrics = node?.deviceMetrics
|
const deviceMetrics = node?.deviceMetrics
|
||||||
const hopsAway = node?.hopsAway ?? 'N/A';
|
const hopsAway = node?.hopsAway ?? 'N/A';
|
||||||
const lastHeard = node?.lastHeard;
|
const lastHeard = node?.lastHeard ? new Date(node?.lastHeard * 1000) : null
|
||||||
const num = node?.num;
|
const num = node?.num;
|
||||||
const position = node?.position;
|
const position = node?.position;
|
||||||
const snr = node?.snr ?? 'N/A';
|
const snr = node?.snr ?? 'N/A';
|
||||||
const user = node?.user;
|
const user = node?.user;
|
||||||
const lat = position?.latitude
|
const lat = position?.latitude
|
||||||
const lon = position?.longitude
|
|
||||||
return `
|
return `
|
||||||
Id: ${user.id}<br/>
|
${user.id}<br/>
|
||||||
Hops Away: ${hopsAway}<br/>
|
${user.shortName}<br/>
|
||||||
|
${hopsAway} hop<br/>
|
||||||
S/N: ${snr} dbM<br/>
|
S/N: ${snr} dbM<br/>
|
||||||
Loc: ${lat}, ${lon}
|
Last Heard: ${daysSince(lastHeard)} days
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const updateNodes= async() => {
|
const updateNodes = async () => {
|
||||||
const res = await fetch('/nodes');
|
const res = await fetch('/nodes');
|
||||||
const json = await res.json();
|
const json = await res.json();
|
||||||
const myNodeId = json['myNodeId']
|
const myNodeId = json['myNodeId']
|
||||||
|
Loading…
Reference in New Issue
Block a user