Conversation
There was a problem hiding this comment.
Pull request overview
Adds admin-controlled ordering for public pages (page switcher) by persisting a new pageOrderingSettings site-data object, applying it in the pages API, and providing a Manage UI to reorder pages. Also adds up/down reordering UI for monitors inside a monitor group, and updates docs.
Changes:
- Introduce
PageOrderingSettingsin shared types + site-data plumbing (siteDataKeys,SiteDataTransformed). - Apply
pageOrderingSettingsordering in/dashboard-apis/pagesand adjustPageSelectorhome-page selection behavior. - Add Manage → Customizations UI to enable and reorder pages; add monitor-group reorder UI; update docs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/types/site.ts | Adds PageOrderingSettings interface. |
| src/lib/server/controllers/siteDataController.ts | Extends transformed site data typing to include pageOrderingSettings. |
| src/lib/server/controllers/siteDataKeys.ts | Registers pageOrderingSettings as a validated site-data key. |
| src/lib/server/api-server/pages/get.ts | Sorts returned pages according to pageOrderingSettings when enabled. |
| src/lib/components/PageSelector.svelte | Adjusts how the default home page is selected when current path isn’t found. |
| src/routes/(manage)/manage/app/customizations/+page.svelte | Adds UI and persistence for enabling/reordering pages in the switcher. |
| src/routes/(manage)/manage/app/monitors/[tag]/types/monitor-group.svelte | Adds up/down reordering UI for group monitor members. |
| src/routes/(docs)/docs/content/v4/setup/customizations.md | Documents page ordering and verification steps. |
| src/routes/(manage)/manage/app/pages/[page_id]/+page.svelte | Removes the page-path placeholder. |
| class="h-8 w-8" | ||
| disabled={index === 0} | ||
| onclick={() => movePageUp(index)} | ||
| > | ||
| <ArrowUp class="h-4 w-4" /> |
There was a problem hiding this comment.
These icon-only reorder buttons don’t provide an accessible name. Add an aria-label (or visually-hidden text) so screen readers can announce the action (e.g., “Move page up/down”).
| disabled={index === displayPages.length - 1} | ||
| onclick={() => movePageDown(index)} | ||
| > | ||
| <ArrowDown class="h-4 w-4" /> | ||
| </Button> |
There was a problem hiding this comment.
These icon-only reorder buttons don’t provide an accessible name. Add an aria-label (or visually-hidden text) so screen readers can announce the action (e.g., “Move page up/down”).
| disabled={index === 0} | ||
| onclick={() => moveMonitorUp(index)} | ||
| > | ||
| <ArrowUp class="h-3.5 w-3.5" /> | ||
| </Button> |
There was a problem hiding this comment.
These icon-only reorder buttons don’t provide an accessible name. Add an aria-label (or visually-hidden text) so screen readers can announce the action (e.g., “Move monitor up/down”).
| disabled={index === formData.monitors.length - 1} | ||
| onclick={() => moveMonitorDown(index)} | ||
| > | ||
| <ArrowDown class="h-3.5 w-3.5" /> | ||
| </Button> |
There was a problem hiding this comment.
These icon-only reorder buttons don’t provide an accessible name. Add an aria-label (or visually-hidden text) so screen readers can announce the action (e.g., “Move monitor up/down”).
| @@ -13,6 +13,7 @@ Use **Manage → Customizations** to control visual behavior of the public statu | |||
| - Default theme and theme toggle | |||
| - Site-wide announcement banner | |||
| - Custom CSS (stored now, injection pending) | |||
There was a problem hiding this comment.
The intro list still says “Custom CSS (stored now, injection pending)”, but the public layout currently injects customCSS into the <head> as a <style> block. Please update this bullet to match the current runtime behavior.
| - Custom CSS (stored now, injection pending) | |
| - Custom CSS injected into the public layout `<head>` |
| let currentPath = $derived(page.params.page_path); | ||
|
|
||
| let pages = $state<PageNavItem[]>([]); | ||
| let pagesLoading = $state(false); | ||
|
|
||
| const currentPage = $derived(pages.find((p) => p.page_path === currentPath) || pages[0]); | ||
| const defaultHomePage = $derived(pages.find((p) => p.page_path == "")); |
There was a problem hiding this comment.
currentPath is derived directly from page.params.page_path, which will be undefined on the home route. That makes the later comparisons (page.page_path === currentPath) not match the home page and can prevent the correct active page highlighting. Consider normalizing currentPath to an empty string (e.g. page.params.page_path ?? "") and use strict equality when finding the default home page.
| async function fetchPages() { | ||
| loadingPages = true; | ||
| try { | ||
| const response = await fetch(clientResolver(resolve, "/manage/api"), { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify({ action: "getPages" }) | ||
| }); |
There was a problem hiding this comment.
fetchPages calls the getPages admin action, which (per manage/api/+server.ts) loads monitors for each page via GetPageMonitors (N+1 queries). This customization screen only needs id/page_path/page_title, so this can become unnecessarily expensive with many pages/monitors. Consider adding a lightweight action/endpoint (or an includeMonitors flag) and using that here.
| <p class="text-sm font-medium">Selected: {formData.monitors.length} monitor(s) — Execution Order</p> | ||
| <p class="text-muted-foreground text-xs">Monitors will be executed in this order. Use arrows to reorder.</p> |
There was a problem hiding this comment.
The header/copy says “Execution Order” / “Monitors will be executed in this order”, but group monitors don’t execute member checks; they aggregate the latest results from member monitors (see GroupCall). Since ordering doesn’t affect the computed result, this wording is misleading. Please rephrase to something like “Display order” / “Evaluation order (no functional impact)”.
| <p class="text-sm font-medium">Selected: {formData.monitors.length} monitor(s) — Execution Order</p> | |
| <p class="text-muted-foreground text-xs">Monitors will be executed in this order. Use arrows to reorder.</p> | |
| <p class="text-sm font-medium">Selected: {formData.monitors.length} monitor(s) — Display order</p> | |
| <p class="text-muted-foreground text-xs">Evaluation order (no functional impact). Use arrows to reorder.</p> |
This pull request introduces a new feature that allows administrators to control the display order of pages in the public page switcher via the "Manage → Customizations" interface. It adds a new
pageOrderingSettingsobject to site data, updates the backend API to respect this ordering, and provides a UI for reordering pages. Additionally, it improves the monitor group UI to allow reordering of monitors. Documentation is updated to describe the new functionality.Request in #609
Page Ordering Feature
PageOrderingSettingsinterface and integrated it into site data, allowing page order and enable/disable state to be stored and retrieved (src/lib/types/site.ts,src/lib/server/controllers/siteDataController.ts,src/lib/server/controllers/siteDataKeys.ts). [1] [2] [3] [4]pageOrderingSettingsis enabled (src/lib/server/api-server/pages/get.ts).src/lib/components/PageSelector.svelte).Admin UI for Page Ordering
src/routes/(manage)/manage/app/customizations/+page.svelte). [1] [2] [3] [4] [5] [6] [7]Monitor Group UI Improvements
src/routes/(manage)/manage/app/monitors/[tag]/types/monitor-group.svelte). (src/routes/(manage)/manage/app/monitors/[tag]/types/monitor-group.svelteR4-R11, src/routes/(manage)/manage/app/monitors/[tag]/types/monitor-group.svelteR102-R119, src/routes/(manage)/manage/app/monitors/[tag]/types/monitor-group.svelteL226-R287)Documentation Updates
src/routes/(docs)/docs/content/v4/setup/customizations.md). [1] [2] [3]Minor Fixes
src/routes/(manage)/manage/app/pages/[page_id]/+page.svelte). (src/routes/(manage)/manage/app/pages/[page_id]/+page.svelteL465)