feat(system): consolidate system admin and settings into one Settings panel
Replace the standalone /platform/system/* routes with a single
"系统设置" section inside the canonical Settings modal. The previous
SystemLayout.vue / SystemAdmins.vue surfaces are removed and their
functionality (system admin roster, global settings) is hosted directly
in SystemSettings.vue under the standard `.section-header` /
`.settings-group` skeleton. Legacy URLs redirect to the modal section
so external bookmarks don't 404.
Backend:
- SystemSettingService.Reset + repo.Delete: drop the DB override for a
key so the 3-tier resolver falls back to ENV / built-in default.
Idempotent (resetting a never-persisted key returns nil); emits an
audit row only on real deletions, invalidates the local cache, and
publishes to peers via the existing pubsub channel.
- TenantService.BulkSetStorageQuota: overwrite every tenant's
storage_quota in one statement. Powers POST /system/admin/tenants/
apply-default-storage-quota; bypasses the per-tenant whitelist on
PUT /tenants/:id which intentionally forbids storage_quota edits.
- AuditAction{SystemAdminPromoted,SystemAdminRevoked} constants and
emitAdminAudit() in SystemHandler — promote / revoke now leave an
audit trail with TenantID=0 and {target_email,target_username,
idempotent|changed} in details.
- SystemSetting.LastModifiedByName: derived per-request display label
(username, email fallback) so the UI shows "wizardchen" instead of
a UUID prefix without storing a denormalised column.
Frontend:
- SystemSettings.vue rewritten against the Settings modal skeleton with
auto-persisting controls (switch/select @change, input/inputnumber
@blur, tag-input + per-delta popconfirm for SSRF whitelist and admin
roster). auth.registration_mode change goes through an inline
popconfirm; cancel rolls back. Reset / bulk-apply also inline
popconfirms — no dialog modal for these per-row affordances.
- Priority hint panel surfaces the DB > ENV > default resolver order
so operators can reason about "I set the env but it doesn't show up".
- Router: /platform/system, /platform/system/settings, /platform/system/
admins are now compatibility redirects to /platform/settings?section=
system-global.
- Settings modal sized 900x700 → 1080x780 and content-wrapper 600 → 760
so the wider tables (members, system settings) breathe; <1100px
viewport still flexes to the screen.
- i18n: system.globalSettings.* keys for title / description / loading /
empty / badges / priority hint / per-key labels / reset / bulkApply /
admins (label, placeholder, save messages, popconfirm copy) across
zh-CN, en-US, ko-KR, ru-RU.
Misc:
- internal/utils/filesize.go doc: clarify MAX_FILE_SIZE_MB is a
deploy-time-only knob (nginx + docreader + frontend each cache the
env at startup); a SystemAdmin UI override would mislead operators
because nginx would still 413. Until all four layers can hot-reload
the limit in lockstep, this stays env-only.
- internal/utils/security.go: SSRF whitelist parser/runtime now drives
off SystemSettingService for live updates; ENV remains the fallback
for never-overridden deployments.
This commit is contained in:
@@ -688,7 +688,7 @@ export default {
|
||||
parserEngine: 'Parser Engine',
|
||||
storageEngine: 'Storage Engine',
|
||||
mcpService: 'MCP Service',
|
||||
systemSettings: 'System Settings',
|
||||
versionInfo: 'Version Info',
|
||||
tenantInfo: 'Tenant Info',
|
||||
apiInfo: 'API Info',
|
||||
navGroups: {
|
||||
@@ -2571,6 +2571,109 @@ export default {
|
||||
messages: {
|
||||
fetchFailed: 'Failed to fetch system information',
|
||||
networkError: 'Network error, please try again later'
|
||||
},
|
||||
globalSettings: {
|
||||
title: 'System Settings',
|
||||
description: 'Platform-wide runtime configuration. Saves take effect immediately for every tenant. Visible and editable by system administrators only.',
|
||||
loading: 'Loading...',
|
||||
empty: 'No configurable system settings available',
|
||||
badgeRequiresRestart: 'Restart required',
|
||||
badgeSecret: 'Secret',
|
||||
badgeOverride: 'Overridden',
|
||||
badgeOverrideTooltip: 'This value has been saved to the database by an administrator, overriding the environment variable and built-in default.',
|
||||
modifiedAt: 'Last modified: {value}',
|
||||
tagInputPlaceholder: 'Press Enter to add an entry, e.g. example.com / *.foo.com / 10.0.0.0/8',
|
||||
priorityHint: {
|
||||
title: 'About priority',
|
||||
tier1: 'Items saved on this page (marked "Overridden") always win — the environment variable is ignored for them.',
|
||||
tier2: 'Items not saved here fall back to the environment variable, or to the built-in default if no env var is set.',
|
||||
tier3: 'To put an item back under environment-variable control, click the "Reset" button on its row.',
|
||||
},
|
||||
keyLabels: {
|
||||
auth: {
|
||||
registration_mode: 'Self-service registration mode',
|
||||
},
|
||||
ssrf: {
|
||||
whitelist: 'SSRF protection allowlist',
|
||||
},
|
||||
tenant: {
|
||||
max_owned_per_user: 'Max tenants owned per user',
|
||||
default_storage_quota_gb: 'Default storage quota for new tenants (GB)',
|
||||
},
|
||||
},
|
||||
enumLabels: {
|
||||
auth: {
|
||||
registration_mode: {
|
||||
self_serve: 'Self-service (anyone can register)',
|
||||
invite_only: 'Invite only (public registration disabled)',
|
||||
},
|
||||
},
|
||||
},
|
||||
confirm: {
|
||||
header: 'Confirm high-risk action',
|
||||
confirmBtn: 'Confirm save',
|
||||
cancelBtn: 'Cancel',
|
||||
emptyValue: '(empty)',
|
||||
defaultBody: 'About to change "{label}" to: {value}',
|
||||
bodyAuthRegistrationMode: 'About to change "{label}" to: {value}\n\nIf switched to self_serve, anyone on the public internet can register an account — please confirm this is intended.',
|
||||
},
|
||||
listConfirm: {
|
||||
ssrf: {
|
||||
whitelist: {
|
||||
add: {
|
||||
header: 'Add SSRF allowlist entry',
|
||||
body: 'Add {entry} to the SSRF allowlist? Hosts / IPs / CIDRs that match this entry will bypass SSRF protection and may let agents reach internal services. Only add entries you fully trust.',
|
||||
confirmBtn: 'Add',
|
||||
},
|
||||
remove: {
|
||||
header: 'Remove SSRF allowlist entry',
|
||||
body: 'Remove {entry} from the SSRF allowlist? After removal this entry will be blocked by SSRF protection again.',
|
||||
confirmBtn: 'Remove',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
loadFailed: 'Failed to load system settings',
|
||||
saveSuccess: 'Saved',
|
||||
saveFailed: 'Save failed',
|
||||
},
|
||||
reset: {
|
||||
label: 'Reset',
|
||||
tooltip: 'Clear the UI override and fall back to the environment variable or the built-in default',
|
||||
confirmBtn: 'Confirm reset',
|
||||
confirmBody: 'Reset "{label}"? This deletes the database override and falls back to the environment variable or the built-in default.',
|
||||
success: 'Reset to default',
|
||||
failed: 'Reset failed',
|
||||
},
|
||||
admins: {
|
||||
label: 'System administrators',
|
||||
description: 'Users with platform-level privileges. Type an email and press Enter to promote a user; click × on a tag to revoke. You (yourself) are an administrator and are not shown in the list — you cannot revoke your own access.',
|
||||
placeholder: 'Type a user email and press Enter',
|
||||
loadFailed: 'Failed to load system administrators',
|
||||
saveSuccess: 'System administrators updated',
|
||||
saveFailed: 'Failed to update system administrators',
|
||||
confirm: {
|
||||
promote: {
|
||||
header: 'Promote to system administrator',
|
||||
body: 'Promote {email} to system administrator? This user will gain platform-level privileges: access to every tenant, system settings, and the admin roster itself.',
|
||||
confirmBtn: 'Promote',
|
||||
},
|
||||
revoke: {
|
||||
header: 'Revoke system administrator',
|
||||
body: 'Revoke system-administrator privileges from {email}? They will lose access to all system-level features.',
|
||||
confirmBtn: 'Revoke',
|
||||
},
|
||||
},
|
||||
},
|
||||
bulkApply: {
|
||||
label: 'Apply to all existing tenants',
|
||||
tooltip: 'Saving the value only affects new tenants by default; click here to also overwrite every existing tenant.',
|
||||
confirmBtn: 'Confirm apply',
|
||||
confirmBody: 'Overwrite the storage quota of every existing tenant to {value} GB. Tenants whose quota was tuned manually by operations will also be overwritten. Continue?',
|
||||
success: 'Updated storage quota for {count} tenants to {gb} GB',
|
||||
failed: 'Failed to apply to all tenants',
|
||||
},
|
||||
}
|
||||
},
|
||||
mcp: {
|
||||
|
||||
Reference in New Issue
Block a user