From 330b1e2c9e9bce91b898f92ad773d67f150dbc02 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Wed, 28 Aug 2024 23:54:22 +1200 Subject: [PATCH] add gateway info for position marker --- api/src/routes/position-history.ts | 2 ++ app/public/index.html | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/api/src/routes/position-history.ts b/api/src/routes/position-history.ts index 943e792..cd5996b 100644 --- a/api/src/routes/position-history.ts +++ b/api/src/routes/position-history.ts @@ -60,6 +60,8 @@ express.get("/api/v1/nodes/:nodeId/position-history", async (req, res) => { latitude: position.latitude, longitude: position.longitude, altitude: position.altitude, + gateway_id: position.gateway_id, + channel_id: position.channel_id, created_at: position.created_at, }); }); diff --git a/app/public/index.html b/app/public/index.html index 96ec2a1..6cce482 100644 --- a/app/public/index.html +++ b/app/public/index.html @@ -5036,11 +5036,16 @@

]); let tooltip = ""; - tooltip += `${moment( - new Date(positionHistory.created_at) - ).format("DD/MM/YYYY hh:mm A")}
`; tooltip += `Position: ${positionHistory.latitude}, ${positionHistory.longitude}
`; + // add gateway info if available + if (positionHistory.gateway_id) { + const gatewayNode = findNodeById(positionHistory.gateway_id); + if (gatewayNode) { + tooltip += `Heard by: [${gatewayNode.short_name}] ${gatewayNode.long_name}`; + } + } + // create position history marker const marker = L.marker([positionHistory.latitude, longitude], { icon: iconPositionHistory,