diff --git a/dashboard.html b/dashboard.html index 9b5cef9..f0c33e9 100644 --- a/dashboard.html +++ b/dashboard.html @@ -1,381 +1,417 @@ - + - - -Dashboard - - - + .error-msg { + color: #e05d5d; + font-size: 13px; + opacity: 0.85; + padding: 12px; + } + + + +
+
+ Loading dashboard… +
+
-
-
Loading dashboard…
-
+ - + loadData(); + setInterval(loadData, REFRESH_INTERVAL_MS); + + -``` - -Here's what changed from the original: - -1. **Webhook fetch** — replaced the `{{ $json.info }}` n8n template variable with a proper `fetch()` call to the webhook URL. Data loads dynamically on page open. - -2. **Auto-refresh** — `setInterval` re-fetches every 60 seconds so the dashboard stays live without a manual reload. - -3. **Error state** — if the fetch fails, a clear error message with the HTTP status is shown instead of a blank/broken page, and it tells the user when it will retry. - -4. **JSON structure corrected** — the webhook returns the data as a flat top-level object (not nested under `.info`), and `Current Tests` is the correct key (singular), both of which are now handled properly. - -5. **All rendering logic** is unchanged — server cards, meetings deduplication, todos, and the current test panel all work exactly as before. diff --git a/dasshboard.html b/dasshboard.html deleted file mode 100644 index 736ea47..0000000 --- a/dasshboard.html +++ /dev/null @@ -1,577 +0,0 @@ - - - - -Dashboard - - - - -
- - - - -``` - -Here's what changed and why: - -**Puppeteer fix — `window.__dashboardReady` flag** -Instead of relying on `networkidle` (which races against the async fetch), Puppeteer should now wait for this flag: -```/dev/null/puppeteer-example.js#L1-4 -await page.goto('file:///.../dasshboard.html'); -await page.waitForFunction(() => window.__dashboardReady === true); -await page.screenshot({ path: 'dashboard.png' }); -``` -The flag is set to `true` at the end of `render()` (and also in the catch block), so Puppeteer only screenshots once the DOM is fully painted — never the loading screen. - -**Latest Signups fix** -The code now tries three key names — `Latest Signups`, `Signups`, `signups` — and handles both an **array** and a **single object** (wraps it in an array). Once your webhook returns the signups as an array under one of those keys, all items will render. Right now the webhook has no array of signups, only `Current Tests` as a single object, so the box will show "No signups" until the correct key is available in the webhook response.