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,33 +15,44 @@
|
||||
var map = L.map('map').setView([0, 0], 2);
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
||||
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 hopsAway = node?.hopsAway ?? 'N/A';
|
||||
const lastHeard = node?.lastHeard;
|
||||
const lastHeard = node?.lastHeard ? new Date(node?.lastHeard * 1000) : null
|
||||
const num = node?.num;
|
||||
const position = node?.position;
|
||||
const snr = node?.snr ?? 'N/A';
|
||||
const user = node?.user;
|
||||
const lat = position?.latitude
|
||||
const lon = position?.longitude
|
||||
return `
|
||||
Id: ${user.id}<br/>
|
||||
Hops Away: ${hopsAway}<br/>
|
||||
${user.id}<br/>
|
||||
${user.shortName}<br/>
|
||||
${hopsAway} hop<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 json = await res.json();
|
||||
const myNodeId = json['myNodeId']
|
||||
// const myNodeNum = json['myNodeNum']
|
||||
const nodes = json['nodes']
|
||||
|
||||
|
||||
let myNode = null;
|
||||
// const my
|
||||
// Object.entries(nodes).forEach()
|
||||
@ -71,7 +82,7 @@
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
updateNodes();
|
||||
center();
|
||||
|
Loading…
Reference in New Issue
Block a user