fix: display scanner name instead of "Your Position"
Show the scanner's configured name (or hostname if not set) in map markers and popups instead of the generic "Your Position" label. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -378,6 +378,7 @@ def create_app(config: Config | None = None) -> Flask:
|
||||
def index():
|
||||
"""Main dashboard page"""
|
||||
rf_config = app.config["RF_CONFIG"]
|
||||
scanner_identity = app.config["SCANNER_IDENTITY"]
|
||||
return render_template(
|
||||
"index.html",
|
||||
lat=app.config["CURRENT_LAT"],
|
||||
@@ -389,6 +390,10 @@ def create_app(config: Config | None = None) -> Flask:
|
||||
"floor_height_m": rf_config.building.floor_height_m,
|
||||
"ground_floor_number": rf_config.building.ground_floor_number,
|
||||
"current_floor": rf_config.building.current_floor
|
||||
},
|
||||
scanner={
|
||||
"id": scanner_identity["id"],
|
||||
"name": scanner_identity["name"]
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -939,6 +939,7 @@ function updateMapMarkers() {
|
||||
const lon = parseFloat(document.getElementById('lon-input').value);
|
||||
|
||||
// Add center marker (this scanner) - distinct star shape
|
||||
const localScannerName = APP_CONFIG.scanner?.name || APP_CONFIG.scanner?.id || 'Scanner';
|
||||
const scannerIcon = `
|
||||
<div style="position:relative;width:24px;height:24px;">
|
||||
<svg viewBox="0 0 24 24" style="width:24px;height:24px;filter:drop-shadow(0 0 4px rgba(255,0,128,0.8));">
|
||||
@@ -952,7 +953,7 @@ function updateMapMarkers() {
|
||||
iconSize: [24, 24],
|
||||
iconAnchor: [12, 12]
|
||||
})
|
||||
}).addTo(map).bindPopup('📍 This Scanner');
|
||||
}).addTo(map).bindPopup(`📍 ${localScannerName}`);
|
||||
markers.push(centerMarker);
|
||||
|
||||
// Add peer scanner markers (async, won't block)
|
||||
@@ -1843,10 +1844,11 @@ function update3DMarkers() {
|
||||
const groundFloor = buildingConfig.groundFloorNumber || 0;
|
||||
|
||||
// Add scanner position marker at center (draggable for fine-grained positioning)
|
||||
const scannerName = APP_CONFIG.scanner?.name || APP_CONFIG.scanner?.id || 'Scanner';
|
||||
const scannerEl = document.createElement('div');
|
||||
scannerEl.className = 'marker-3d center draggable';
|
||||
scannerEl.innerHTML = `<div class="marker-icon">📍</div><div class="marker-floor">F${scannerFloor}</div>`;
|
||||
scannerEl.title = `Your Position - Floor ${scannerFloor} (drag to reposition)`;
|
||||
scannerEl.title = `${scannerName} - Floor ${scannerFloor} (drag to reposition)`;
|
||||
|
||||
const scannerOffset = (scannerFloor - groundFloor) * pixelsPerFloor;
|
||||
const scannerMarker = new maplibregl.Marker({
|
||||
@@ -1856,7 +1858,7 @@ function update3DMarkers() {
|
||||
})
|
||||
.setLngLat([lon, lat])
|
||||
.setPopup(new maplibregl.Popup().setHTML(`
|
||||
<strong>📍 Your Position</strong><br>
|
||||
<strong>📍 ${escapeHtml(scannerName)}</strong><br>
|
||||
Floor: ${scannerFloor}<br>
|
||||
Lat: ${lat.toFixed(6)}<br>
|
||||
Lon: ${lon.toFixed(6)}<br>
|
||||
|
||||
@@ -65,6 +65,10 @@
|
||||
groundFloorNumber: {{ building.ground_floor_number | default(0) }},
|
||||
currentFloor: {{ building.current_floor | default(0) }}
|
||||
},
|
||||
scanner: {
|
||||
id: {{ scanner.id | default('') | tojson }},
|
||||
name: {{ scanner.name | default('') | tojson }}
|
||||
},
|
||||
maplibre: {
|
||||
style: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user