Driving menu Trip: the stops as big rows (look, ✓ passed, ↑ ↓, ✕), a stop at the crosshair, the start at the car, search of saved points and offline places; each leg's km and time (legs_s) and the total, in the route panel too; passed stops kept (not routed, dimmed, editable) — a reroute marks them instead of dropping them; /status.html: every status endpoint full width (the debug panel links it); the trip-as-plan-and-log model and planned-vs-driven colors in docs/TODO
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-12-01 02:21:14 +01:00
1 parent 0eb9d05cdc
commit 809e88ab1a
14 files changed
+517 -101

No files matched your search

+6 -70
View File
@@ -1,28 +1,9 @@
import { DEBUG_ICON } from "/js/icons.js";
import { escapeHtml } from "/js/gpx.js";
import { notifySidePanelOpen, onlyOneSidePanelOpen } from "/js/panels.js";
// Every read-only status endpoint, dumped as raw JSON. No check-update
// routes here — those reach out to Geofabrik/the internet, not just report
// local state.
const ENDPOINTS = [
"/api/health",
"/api/offline-tiles",
"/api/offline-tiles/build-status",
"/api/offline-regions",
"/api/offline-tiles/cache",
"/api/terrain-tiles",
"/api/terrain-tiles/build-status",
"/api/build-history",
"/api/hiking-trails",
"/api/kiwix",
"/api/plugins",
"/api/gnss/position",
"/api/livetrack/sessions",
];
const REFRESH_MS = 5000; // while open — a running build's progress shows up live
// Sidebar icon pinned to the bottom of the rail, logged-in only (map.js).
// Sidebar icon pinned to the bottom of the rail, logged-in only (map.js):
// a panel of links — every endpoint's state on the full-screen
// /status.html, the CANopen diagnostics — and the update check.
export class DebugControl {
mount(sidebar) {
this._container = document.createElement("div");
@@ -32,9 +13,8 @@ export class DebugControl {
this._icon.addEventListener("click", () => this._togglePanel());
this._panel = document.getElementById("debug-panel");
this._body = this._panel.querySelector(".debug-panel__body");
this._panel.querySelector(".basemap-panel__close").addEventListener("click", () => this._togglePanel(false));
onlyOneSidePanelOpen(this._panel, () => this._stop());
onlyOneSidePanelOpen(this._panel, () => this._icon.classList.remove("active"));
sidebar.appendChild(this._container);
}
@@ -42,51 +22,7 @@ export class DebugControl {
_togglePanel(force) {
const open = force === undefined ? this._panel.hidden : force;
this._panel.hidden = !open;
if (!open) return this._stop();
this._icon.classList.add("active");
notifySidePanelOpen(this._panel);
this._refresh();
this._timer = setInterval(() => this._refresh(), REFRESH_MS);
}
_stop() {
this._icon.classList.remove("active");
clearInterval(this._timer);
}
async _refresh() {
const sections = await Promise.all(
ENDPOINTS.map(async (url) => {
let text;
try {
const response = await fetch(url);
const body = await response.text();
try {
text = JSON.stringify(JSON.parse(body), null, 2);
} catch {
text = body;
}
if (!response.ok) text = `HTTP ${response.status}\n${text}`;
} catch (error) {
text = `request failed: ${error.message}`;
}
return { url, text };
}),
);
if (this._panel.hidden) return;
// Keep whichever sections the user collapsed collapsed across refreshes.
const closed = new Set([...this._body.querySelectorAll("details:not([open])")].map((el) => el.dataset.url));
this._body.innerHTML = sections
.map(
({ url, text }) => `
<details data-url="${url}" ${closed.has(url) ? "" : "open"}>
<summary>${url}</summary>
<pre>${escapeHtml(text)}</pre>
</details>
`,
)
.join("");
this._icon.classList.toggle("active", open);
if (open) notifySidePanelOpen(this._panel);
}
}