Skip to content

Commit

Permalink
add gateway info for position marker
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcottle authored and KomelT committed Aug 29, 2024
1 parent 6c16cc5 commit 330b1e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions api/src/routes/position-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
Expand Down
11 changes: 8 additions & 3 deletions app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5036,11 +5036,16 @@ <h2 class="font-bold">
]);

let tooltip = "";
tooltip += `<b>${moment(
new Date(positionHistory.created_at)
).format("DD/MM/YYYY hh:mm A")}</b></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
const marker = L.marker([positionHistory.latitude, longitude], {
icon: iconPositionHistory,
Expand Down

0 comments on commit 330b1e2

Please sign in to comment.