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:
wizardchen
2026-05-26 20:03:35 +08:00
committed by lyingbug
parent 311a033523
commit 9cce0c8e5e
31 changed files with 2207 additions and 753 deletions
+18 -23
View File
@@ -140,32 +140,27 @@ const router = createRouter({
component: () => import("../views/organization/OrganizationList.vue"),
meta: { requiresInit: true, requiresAuth: true }
},
// System administration area — gated to users with
// user.is_system_admin === true. The route guard below honours
// the meta.requiresSystemAdmin flag; non-admins are bounced to
// /platform/knowledge-bases. Real authorisation lives server-side.
// Compatibility redirects for legacy /platform/system/* URLs.
// The whole system administration surface — global settings
// and the system-admin roster — now lives as a single section
// inside the standard Settings modal. We keep the routes
// around so old bookmarks / external links don't 404.
{
path: "system",
component: () => import("../views/system/SystemLayout.vue"),
redirect: { path: "/platform/settings", query: { section: "system-global" } },
meta: { requiresInit: true, requiresAuth: true, requiresSystemAdmin: true },
},
{
path: "system/settings",
name: "systemSettings",
redirect: { path: "/platform/settings", query: { section: "system-global" } },
meta: { requiresInit: true, requiresAuth: true, requiresSystemAdmin: true },
},
{
path: "system/admins",
name: "systemAdmins",
redirect: { path: "/platform/settings", query: { section: "system-global" } },
meta: { requiresInit: true, requiresAuth: true, requiresSystemAdmin: true },
redirect: "/platform/system/admins",
children: [
{
// Kept as a compatibility URL. Global settings now live in
// the standard settings modal rather than a standalone
// routed page.
path: "settings",
name: "systemSettings",
redirect: { path: "/platform/settings", query: { section: "system-global" } },
meta: { requiresInit: true, requiresAuth: true, requiresSystemAdmin: true }
},
{
path: "admins",
name: "systemAdmins",
component: () => import("../views/system/SystemAdmins.vue"),
meta: { requiresInit: true, requiresAuth: true, requiresSystemAdmin: true }
},
],
},
],
},