Skip to content

feat(admin): add settings editor tab to admin dashboard - #706

Merged
cameri merged 10 commits into
cameri:mainfrom
Ferryx349:settings-UI
Jul 27, 2026
Merged

feat(admin): add settings editor tab to admin dashboard#706
cameri merged 10 commits into
cameri:mainfrom
Ferryx349:settings-UI

Conversation

@Ferryx349

Copy link
Copy Markdown
Collaborator

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.

  • Category-based guided editor driven by the settings schema
  • Stage edits locally, preview a diff before saving, then apply or discard
  • Validate all settings before apply
  • Restore from backup and reload current config
  • Sensitive values are redacted in API responses and diff preview

Test plan

  • Log into the admin dashboard and open the Settings tab
  • Edit a setting in a category and confirm the diff preview updates
  • Run Validate all on valid and invalid values
  • Apply staged changes and confirm settings.yaml updates
  • Discard changes and confirm staged edits are cleared
  • Restore backup from a previous save
  • Confirm secrets are not shown in the UI diff preview

Related Issue

Fixes- #665

Screenshots (if appropriate):

Settings-ui.mov

This is how final UI looks.

IMAGE 2026-07-22 12:01:03

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

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-bot

changeset-botBot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e5b9c4c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
nostreamMinor

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

Comment threadsrc/routes/admin/index.ts Dismissed
Comment threadsrc/routes/admin/index.ts Fixed
Comment threadsrc/routes/admin/index.ts Fixed
Comment threadsrc/routes/admin/index.ts Outdated
@Ferryx349

Copy link
Copy Markdown
CollaboratorAuthor

This PR is on the top of #690

@coveralls

coveralls commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 69.763% (+0.1%) from 69.623% — Ferryx349:settings-UI into cameri:main

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
FileDescription
test/unit/utils/settings-redaction.spec.tsUnit tests for secret/path redaction utilities.
test/unit/utils/settings-config.spec.tsAligns imports for settings-config test coverage.
test/unit/routes/admin-settings.spec.tsEnd-to-end unit tests for the new admin settings API routes (auth, patch, validate, backups/restore).
test/unit/app/maintenance-worker.spec.tsUpdates maintenance worker tests to stub new telemetry shutdown behavior.
src/utils/settings.tsAdjusts settings file watching to watch the config directory for settings changes.
src/utils/settings-redaction.tsAdds utilities to redact sensitive settings values and paths.
src/utils/settings-guided-schema.tsExpands/adjusts guided schema categories and exposed editable settings.
src/utils/settings-config.tsAdds backups + audit log support, atomic save, backup restore/listing, and schema validation tweaks.
src/schemas/admin-settings-schema.tsAdds zod schemas for admin settings patch/restore request bodies.
src/routes/admin/index.tsRegisters new authenticated admin settings routes in the admin router.
src/factories/controllers/post-admin-settings-validate-controller-factory.tsFactory wiring for validate controller.
src/factories/controllers/post-admin-settings-restore-controller-factory.tsFactory wiring for restore controller.
src/factories/controllers/patch-admin-settings-controller-factory.tsFactory wiring for patch controller.
src/factories/controllers/get-admin-settings-schema-controller-factory.tsFactory wiring for schema controller.
src/factories/controllers/get-admin-settings-controller-factory.tsFactory wiring for settings controller.
src/factories/controllers/get-admin-settings-backups-controller-factory.tsFactory wiring for backups controller.
src/controllers/admin/post-settings-validate-controller.tsImplements “validate merged settings” endpoint.
src/controllers/admin/post-settings-restore-controller.tsImplements restore-from-backup endpoint + audit entry.
src/controllers/admin/patch-settings-controller.tsImplements validated patch/apply flow + audit logging + redacted responses.
src/controllers/admin/get-settings-schema-controller.tsServes guided schema for UI editor.
src/controllers/admin/get-settings-controller.tsServes merged settings with secret redaction.
src/controllers/admin/get-settings-backups-controller.tsServes settings backup listing for restore UI.
resources/admin/dashboard.htmlAdds Settings tab markup and UI layout containers.
resources/admin/assets/dashboard.jsImplements settings editor UX: load schema/settings, stage changes, diff preview, apply/discard/restore/reload, and validate-all.
resources/admin/assets/dashboard.cssStyles settings editor layout, diff preview, and toolbar controls.
.changeset/admin-settings-ui.mdChangeset for UI feature release notes.
.changeset/admin-settings-api.mdChangeset for API feature release notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +9
public async handleRequest(_request: Request, response: Response): Promise<void> {
response.status(200).setHeader('content-type', 'application/json').send({ categories: guidedSettingCategories })
}
Comment on lines +651 to +670
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
@cameri
cameri merged commit 841833f into cameri:mainJul 27, 2026
16 of 18 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Ferryx349@coveralls@cameri@github-advanced-security