feat(admin): add settings editor tab to admin dashboard - #706
Conversation
Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
… backups Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
Reconcile merged UI-DASH and Settings PRs with the settings editor branch: keep settings editor/backup APIs, adopt upstream Grafana port 7777, fail-closed rate limiting, admin-health warnings, and Settings review refactors.
🦋 Changeset detectedLatest commit: e5b9c4c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Ferryx349
commented
Jul 22, 2026
This PR is on the top of #690 |
There was a problem hiding this comment.
Pull request overview
Adds a browser-based settings editor to the admin dashboard, backed by new authenticated admin settings endpoints. This extends the existing admin console beyond metrics/health by enabling operators to view merged config, stage edits, validate, apply updates atomically with backups, and restore prior versions.
Changes:
- Added admin settings API endpoints (get settings, schema, validate, patch/apply changes, list backups, restore) with audit logging and atomic writes + backups.
- Introduced settings redaction utilities and expanded the guided settings schema/categories exposed to the dashboard UI.
- Added the Settings tab UI (HTML/CSS/JS) with category-driven editor, staged diff preview, validation, apply/discard, reload, and restore flows, plus new unit tests.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/utils/settings-redaction.spec.ts | Unit tests for secret/path redaction utilities. |
| test/unit/utils/settings-config.spec.ts | Aligns imports for settings-config test coverage. |
| test/unit/routes/admin-settings.spec.ts | End-to-end unit tests for the new admin settings API routes (auth, patch, validate, backups/restore). |
| test/unit/app/maintenance-worker.spec.ts | Updates maintenance worker tests to stub new telemetry shutdown behavior. |
| src/utils/settings.ts | Adjusts settings file watching to watch the config directory for settings changes. |
| src/utils/settings-redaction.ts | Adds utilities to redact sensitive settings values and paths. |
| src/utils/settings-guided-schema.ts | Expands/adjusts guided schema categories and exposed editable settings. |
| src/utils/settings-config.ts | Adds backups + audit log support, atomic save, backup restore/listing, and schema validation tweaks. |
| src/schemas/admin-settings-schema.ts | Adds zod schemas for admin settings patch/restore request bodies. |
| src/routes/admin/index.ts | Registers new authenticated admin settings routes in the admin router. |
| src/factories/controllers/post-admin-settings-validate-controller-factory.ts | Factory wiring for validate controller. |
| src/factories/controllers/post-admin-settings-restore-controller-factory.ts | Factory wiring for restore controller. |
| src/factories/controllers/patch-admin-settings-controller-factory.ts | Factory wiring for patch controller. |
| src/factories/controllers/get-admin-settings-schema-controller-factory.ts | Factory wiring for schema controller. |
| src/factories/controllers/get-admin-settings-controller-factory.ts | Factory wiring for settings controller. |
| src/factories/controllers/get-admin-settings-backups-controller-factory.ts | Factory wiring for backups controller. |
| src/controllers/admin/post-settings-validate-controller.ts | Implements “validate merged settings” endpoint. |
| src/controllers/admin/post-settings-restore-controller.ts | Implements restore-from-backup endpoint + audit entry. |
| src/controllers/admin/patch-settings-controller.ts | Implements validated patch/apply flow + audit logging + redacted responses. |
| src/controllers/admin/get-settings-schema-controller.ts | Serves guided schema for UI editor. |
| src/controllers/admin/get-settings-controller.ts | Serves merged settings with secret redaction. |
| src/controllers/admin/get-settings-backups-controller.ts | Serves settings backup listing for restore UI. |
| resources/admin/dashboard.html | Adds Settings tab markup and UI layout containers. |
| resources/admin/assets/dashboard.js | Implements settings editor UX: load schema/settings, stage changes, diff preview, apply/discard/restore/reload, and validate-all. |
| resources/admin/assets/dashboard.css | Styles settings editor layout, diff preview, and toolbar controls. |
| .changeset/admin-settings-ui.md | Changeset for UI feature release notes. |
| .changeset/admin-settings-api.md | Changeset for API feature release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public async handleRequest(_request: Request, response: Response): Promise<void> { | ||
| response.status(200).setHeader('content-type', 'application/json').send({ categories: guidedSettingCategories }) | ||
| } |
| const validateFieldInput = (field, rawValue) => { | ||
| if (field.type === 'number') { | ||
| const trimmed = String(rawValue).trim() | ||
| if (!trimmed) { | ||
| return 'Value is required' | ||
| } | ||
| if (!/^-?\d+(\.\d+)?$/.test(trimmed)) { | ||
| return 'Enter a valid number' | ||
| } | ||
| } | ||
| if (field.type === 'string' || field.type === 'select') { | ||
| if (!String(rawValue).trim()) { | ||
| return 'Value is required' | ||
| } | ||
| } | ||
| return undefined | ||
| } |
# Conflicts: # src/controllers/admin/get-settings-controller.ts # src/controllers/admin/patch-settings-controller.ts # src/routes/admin/index.ts # src/schemas/admin-settings-schema.ts # src/utils/settings-config.ts # test/unit/routes/admin-settings.spec.ts
- Strip non-serializable properties from settings schema API response - Relax client-side validation to allow clearing optional string/select fields
Description
This PR adds a Settings tab to the admin dashboard so relay operators can review and edit configuration from the browser instead of only via CLI.
Test plan
settings.yamlupdatesRelated Issue
Fixes- #665
Screenshots (if appropriate):
Settings-ui.mov
This is how final UI looks.
Types of changes
Checklist: