diff --git a/src/public/index.html b/src/public/index.html index d809520..e39d3a8 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -1477,7 +1477,7 @@ } } - function reload(goToNodeId) { + async function reload(goToNodeId) { // show loading setLoading(true); @@ -1486,7 +1486,7 @@ clearMap(); // fetch nodes - fetch('/api/v1/nodes').then(async (response) => { + await fetch('/api/v1/nodes').then(async (response) => { // update nodes var json = await response.json(); @@ -1502,8 +1502,8 @@ }); - // fetch waypoints - fetch('/api/v1/waypoints').then(async (response) => { + // fetch waypoints (after awaiting nodes, so we can use nodes cache in waypoint tooltips) + await fetch('/api/v1/waypoints').then(async (response) => { // update waypoints var json = await response.json(); @@ -1552,10 +1552,22 @@ function getTooltipContentForWaypoint(waypoint) { + // get from node name + var fromNode = findNodeById(waypoint.from); + var tooltip = `${waypoint.name}` + (waypoint.description ? `
${waypoint.description}` : '') + `

Expires: ${moment(new Date(waypoint.expire * 1000)).fromNow()}` + - `
Lat/Lng: ${waypoint.latitude}, ${waypoint.longitude}`; + `
Lat/Lng: ${waypoint.latitude}, ${waypoint.longitude}` + + `

From ID: ${waypoint.from}` + + `
From Hex ID: !${Number(waypoint.from).toString(16)}`; + + // show node name this waypoint is from, if possible + if(fromNode != null){ + tooltip += `
From Node: ${fromNode.long_name || 'Unnamed Node'}`; + } else { + tooltip += `
From Node: ???`; + } // bottom info tooltip += `

ID: ${waypoint.waypoint_id}`;