web: fix topology device markers placed in the water#655
Open
armcconnell wants to merge 1 commit into
Open
Conversation
Device markers on the topology map and globe were positioned as a metro centroid plus a 0.3 degree (~25 mi) radial fanout, ignoring real device locations. For coastal metros like NYC that arc placed markers offshore in the Atlantic and the harbor (#652). - Extract the duplicated calculateDevicePosition from the map and globe into one shared, unit-tested helper (computeDevicePositions). - Default to a much tighter metro-centroid fanout (radius 0.3 -> 0.04 degrees) so co-located devices stay separated without landing in the water. - Add a "Precise locations" toggle (map and globe) that anchors each device at its real facility coordinates, with a small jitter so devices sharing a facility remain individually clickable; devices without facility coordinates fall back to the fanout. - Expose per-device facility latitude/longitude from the topology API (LEFT JOIN dz_facilities_current via location_pk).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #652
Summary of Changes
0.3°(~25 mi) radial fanout, ignoring real device locations; for coastal metros like NYC that arc placed markers offshore in the Atlantic and the harbor.0.3°→0.04°, ~3 mi) so co-located devices stay visually separated without landing in the water.calculateDevicePositionfrom the map and globe into one shared, unit-tested helper (computeDevicePositions).latitude/longitudefrom the topology API (LEFT JOINdz_facilities_currentvialocation_pk).The graph view is non-geo (force-directed), so it is unaffected.
Diff Breakdown
api.tstypedevicePositions.test.ts(new)Most of the change is the shared positioning helper plus wiring; the rest is the toggle and the API field.
Key files (click to expand)
web/src/components/topology/devicePositions.ts— new pure helper: fanout (default, tight radius) + facility-anchored (with co-located jitter) + fallbackweb/src/components/topology-map.tsx/topology-globe.tsx— use the shared helper, keyed off the toggle; removed the duplicated local functionsweb/src/components/topology/TopologyContext.tsx— newpreciseLocationsoverlay toggle (URL-synced like other overlays)web/src/components/topology/TopologyControlBar.tsx— "Precise locations" control on map and globeapi/handlers/topology.go— facility lat/lng on the topology DeviceTesting Verification
[0,0].