add gateway info for position marker

This commit is contained in:
liamcottle
2024-08-28 23:54:22 +12:00
parent dcbde41fc9
commit efb019b500
2 changed files with 11 additions and 1 deletions

View File

@ -488,6 +488,8 @@ app.get('/api/v1/nodes/:nodeId/position-history', async (req, res) => {
latitude: position.latitude, latitude: position.latitude,
longitude: position.longitude, longitude: position.longitude,
altitude: position.altitude, altitude: position.altitude,
gateway_id: position.gateway_id,
channel_id: position.channel_id,
created_at: position.created_at, created_at: position.created_at,
}); });
}); });

View File

@ -3818,7 +3818,15 @@
let tooltip = ""; let tooltip = "";
tooltip += `<b>${moment(new Date(positionHistory.created_at)).format("DD/MM/YYYY hh:mm A")}</b></br>`; tooltip += `<b>${moment(new Date(positionHistory.created_at)).format("DD/MM/YYYY hh:mm A")}</b></br>`;
tooltip += `Position: ${positionHistory.latitude}, ${positionHistory.longitude}</br>`; tooltip += `Position: ${positionHistory.latitude}, ${positionHistory.longitude}</br>`
// add gateway info if available
if(positionHistory.gateway_id){
const gatewayNode = findNodeById(positionHistory.gateway_id);
if(gatewayNode){
tooltip += `Heard by: <a href="javascript:void(0);" onclick="goToNode(${gatewayNode.node_id})">[${gatewayNode.short_name}] ${gatewayNode.long_name}</a>`;
}
}
// create position history marker // create position history marker
const marker = L.marker([positionHistory.latitude, longitude],{ const marker = L.marker([positionHistory.latitude, longitude],{