feat(frontend): reorganize system settings into tabbed sections

Group global settings by product area (access, tenant, runtime, security),
add overview summary badges and inline save feedback, surface high-risk
keys, and collapse config-priority docs into a disclosure panel.
This commit is contained in:
wizardchen
2026-07-13 19:39:33 +08:00
committed by lyingbug
parent 87ba3fc2de
commit 8554c422dc
5 changed files with 619 additions and 61 deletions
+45
View File
@@ -3485,18 +3485,60 @@ export default {
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',
autoSaveHint: 'Changes save automatically',
saving: 'Saving',
saved: 'Saved',
saveAnnouncement: '{label} saved',
badgeRequiresRestart: 'Restart required',
badgeSecret: 'Secret',
badgeHighRisk: 'High risk',
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',
disclosure: 'Configuration source and 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.',
},
summary: {
overridden: '{count} overridden',
restart: '{count} require restart',
},
sections: {
access: {
tab: 'Accounts & access {count}',
title: 'Accounts & access',
description: 'Manage system administrators, public registration, and workspace-creation rules.',
},
tenant: {
tab: 'Tenant defaults {count}',
title: 'Tenant defaults',
description: 'Set initial quotas and compatibility behavior for new tenants without rewriting existing tenants.',
},
runtime: {
tab: 'Runtime & concurrency {count}',
title: 'Runtime & concurrency',
description: 'Configure concurrency capacity for background worker pools and model services.',
restartHint: 'Worker settings require restart',
},
security: {
tab: 'Network security {count}',
title: 'Network security',
description: 'Manage trusted hosts, IPs, and networks that may bypass SSRF protection.',
},
other: {
tab: 'Other {count}',
title: 'Other settings',
description: 'Settings in this deployment that are not part of a standard product group.',
},
},
runtimeTable: {
setting: 'Setting and purpose',
value: 'Current value',
},
runtime: {
title: "Task Queue Runtime",
description: "Live background-queue load and per-process capacity for each isolated worker pool. Read-only; auto-refreshes every 5s.",
@@ -3608,6 +3650,7 @@ export default {
max_owned_per_user: 'Max tenants owned per user',
self_service_creation_enabled: 'Allow self-service workspace creation',
default_storage_quota_gb: 'Default storage quota for new tenants (GB)',
auto_create_api_key: 'Automatically create an API key for new tenants',
},
asynq: {
core_concurrency: 'Guaranteed core parse concurrency',
@@ -3639,6 +3682,8 @@ export default {
'Whether non-superusers may create workspaces themselves. When disabled, regular users can only join existing workspaces by invitation; cross-tenant superusers remain exempt. Takes effect immediately.',
default_storage_quota_gb:
'Default storage quota (GB) assigned when a new tenant is created, covering vectors, originals, text, indexes, and related data. Read only at creation time — changes apply to newly created tenants only and do not retroactively update existing tenants. 0 or a negative value uses the built-in default of 10 GB.',
auto_create_api_key:
'Automatically creates a full_access API key for a new tenant and returns its plaintext token in the create response. Use only for integrations that depend on the legacy behavior; it is disabled by default and explicit API-key creation is recommended.',
},
asynq: {
core_concurrency: 'Guaranteed per-process concurrency for document and manual parsing. Core may also borrow the shared elastic pool. Minimum 1; requires a service restart.',
+45
View File
@@ -2470,18 +2470,60 @@ export default {
description: "플랫폼 전역 런타임 설정입니다. 저장하면 모든 테넌트에 즉시 적용됩니다. 시스템 관리자만 보고 수정할 수 있습니다.",
loading: "로딩 중...",
empty: "설정 가능한 시스템 항목이 없습니다",
autoSaveHint: "변경 내용은 자동으로 저장됩니다",
saving: "저장 중",
saved: "저장됨",
saveAnnouncement: "{label} 저장됨",
badgeRequiresRestart: "재시작 필요",
badgeSecret: "민감",
badgeHighRisk: "고위험",
badgeOverride: "재정의됨",
badgeOverrideTooltip: "이 값은 관리자가 DB에 저장하여 환경 변수 및 기본값을 덮어썼습니다.",
modifiedAt: "마지막 수정: {value}",
tagInputPlaceholder: "엔터로 항목 추가. 예: example.com / *.foo.com / 10.0.0.0/8",
priorityHint: {
title: "우선순위 안내",
disclosure: "설정 소스 및 우선순위",
tier1: "이 페이지에서 저장한 항목(\"재정의됨\" 배지가 붙은 항목)은 항상 우선 적용되며, 환경 변수는 무시됩니다.",
tier2: "여기서 저장하지 않은 항목은 환경 변수를 따르며, 환경 변수도 없으면 내장 기본값을 사용합니다.",
tier3: "특정 항목을 다시 환경 변수 기반으로 되돌리려면 해당 행의 \"초기화\" 버튼을 누르세요.",
},
summary: {
overridden: "재정의 {count}개",
restart: "재시작 필요 {count}개",
},
sections: {
access: {
tab: "계정 및 액세스 {count}",
title: "계정 및 액세스",
description: "시스템 관리자, 공개 가입, 공간 생성 규칙을 관리합니다.",
},
tenant: {
tab: "테넌트 기본값 {count}",
title: "테넌트 기본값",
description: "기존 테넌트를 변경하지 않고 신규 테넌트의 초기 할당량과 호환 동작을 설정합니다.",
},
runtime: {
tab: "런타임 및 동시성 {count}",
title: "런타임 및 동시성",
description: "백그라운드 워커 풀과 모델 서비스의 동시 처리 용량을 설정합니다.",
restartHint: "워커 설정은 재시작 후 적용",
},
security: {
tab: "네트워크 보안 {count}",
title: "네트워크 보안",
description: "SSRF 보호를 우회할 수 있는 신뢰 호스트, IP, 네트워크를 관리합니다.",
},
other: {
tab: "기타 {count}",
title: "기타 설정",
description: "표준 제품 그룹에 포함되지 않은 현재 배포의 설정입니다.",
},
},
runtimeTable: {
setting: "설정 및 용도",
value: "현재 값",
},
runtime: {
title: "작업 큐 런타임",
description: "백그라운드 작업 큐의 실시간 부하와 각 독립 워커 풀의 프로세스별 동시성 설정입니다. 5초마다 자동 새로고침됩니다.",
@@ -2593,6 +2635,7 @@ export default {
max_owned_per_user: "사용자당 최대 테넌트 수",
self_service_creation_enabled: "사용자 공간 직접 생성 허용",
default_storage_quota_gb: "신규 테넌트 기본 저장 용량 (GB)",
auto_create_api_key: "신규 테넌트 API Key 자동 생성",
},
asynq: {
core_concurrency: "핵심 파싱 보장 동시성",
@@ -2624,6 +2667,8 @@ export default {
"비슈퍼유저가 공간을 직접 만들 수 있는지 설정합니다. 비활성화하면 일반 사용자는 초대로만 기존 공간에 참여할 수 있으며, 크로스 테넌트 슈퍼유저는 계속 만들 수 있습니다.",
default_storage_quota_gb:
"신규 테넌트 생성 시 기본으로 할당되는 저장 용량(GB)으로, 벡터·원본·텍스트·인덱스 등을 포함합니다. 생성 시에만 읽으며, 변경은 이후 생성되는 테넌트에만 적용되고 기존 테넌트에는 소급되지 않습니다. 0 또는 음수는 내장 기본값 10GB를 사용합니다.",
auto_create_api_key:
"신규 테넌트에 full_access API Key를 자동 생성하고 생성 응답에 평문 token을 반환합니다. 기존 동작에 의존하는 연동에만 사용하세요. 기본값은 비활성화입니다.",
},
asynq: {
core_concurrency: "문서 및 수동 파싱의 프로세스별 보장 동시성입니다. 공유 탄력 풀도 사용할 수 있습니다. 최소 1, 서비스 재시작이 필요합니다.",
+45
View File
@@ -2168,18 +2168,60 @@ export default {
description: 'Настройки платформы, применяемые в режиме реального времени. Изменения сразу действуют для всех тенантов. Доступны только системным администраторам.',
loading: 'Загрузка...',
empty: 'Нет доступных для настройки параметров',
autoSaveHint: 'Изменения сохраняются автоматически',
saving: 'Сохранение',
saved: 'Сохранено',
saveAnnouncement: '{label} сохранено',
badgeRequiresRestart: 'Нужен перезапуск',
badgeSecret: 'Конфиденциально',
badgeHighRisk: 'Высокий риск',
badgeOverride: 'Переопределено',
badgeOverrideTooltip: 'Это значение сохранено администратором в БД и переопределяет переменную окружения и значение по умолчанию.',
modifiedAt: 'Последнее изменение: {value}',
tagInputPlaceholder: 'Нажмите Enter, чтобы добавить запись, например: example.com / *.foo.com / 10.0.0.0/8',
priorityHint: {
title: 'О приоритете',
disclosure: 'Источник и приоритет конфигурации',
tier1: 'Параметры, сохранённые на этой странице (с пометкой «Переопределено»), всегда имеют приоритет — переменная окружения для них игнорируется.',
tier2: 'Параметры, не сохранённые здесь, берутся из переменной окружения, а если её нет — из встроенного значения по умолчанию.',
tier3: 'Чтобы вернуть параметр под управление переменной окружения, нажмите кнопку «Сбросить» в его строке.',
},
summary: {
overridden: 'Переопределено: {count}',
restart: 'Нужен перезапуск: {count}',
},
sections: {
access: {
tab: 'Учётные записи и доступ {count}',
title: 'Учётные записи и доступ',
description: 'Системные администраторы, открытая регистрация и правила создания пространств.',
},
tenant: {
tab: 'Значения тенанта {count}',
title: 'Значения тенанта по умолчанию',
description: 'Начальные квоты и режимы совместимости для новых тенантов.',
},
runtime: {
tab: 'Среда и параллелизм {count}',
title: 'Среда и параллелизм',
description: 'Параллелизм фоновых пулов и сервисов моделей.',
restartHint: 'Настройки воркеров требуют перезапуска',
},
security: {
tab: 'Сетевая безопасность {count}',
title: 'Сетевая безопасность',
description: 'Доверенные хосты, IP-адреса и сети, обходящие SSRF-защиту.',
},
other: {
tab: 'Другое {count}',
title: 'Другие настройки',
description: 'Настройки этого развёртывания вне стандартных групп.',
},
},
runtimeTable: {
setting: 'Параметр и назначение',
value: 'Текущее значение',
},
runtime: {
title: "Среда выполнения очередей",
description: "Текущая нагрузка фоновых очередей и ёмкость каждого изолированного пула на процесс. Автообновление каждые 5 сек.",
@@ -2291,6 +2333,7 @@ export default {
max_owned_per_user: 'Максимум тенантов на пользователя',
self_service_creation_enabled: 'Разрешить самостоятельное создание пространств',
default_storage_quota_gb: 'Квота хранилища для новых тенантов по умолчанию (ГБ)',
auto_create_api_key: 'Автоматически создавать API-ключ для новых тенантов',
},
asynq: {
core_concurrency: 'Гарантированный параллелизм разбора',
@@ -2322,6 +2365,8 @@ export default {
'Разрешает обычным пользователям самостоятельно создавать пространства. Если отключено, они могут только присоединяться по приглашению; межтенантные суперпользователи не ограничены.',
default_storage_quota_gb:
'Квота хранилища по умолчанию (ГБ) для нового тенанта: векторы, оригиналы, текст, индексы и т.д. Читается только при создании — изменения применяются только к новым тенантам и не перезаписывают существующие. 0 или отрицательное значение — встроенное значение по умолчанию 10 ГБ.',
auto_create_api_key:
'Автоматически создаёт API-ключ full_access и возвращает его открытый токен при создании тенанта. Включайте только для старых интеграций; по умолчанию отключено.',
},
asynq: {
core_concurrency: 'Гарантированный параллелизм разбора документов на процесс; также может использовать общий эластичный пул. Минимум 1; требуется перезапуск.',
+46
View File
@@ -2473,18 +2473,60 @@ export default {
description: "平台级运行时配置,保存后立即对所有租户生效。仅系统管理员可见可改。",
loading: "加载中...",
empty: "暂无可配置的系统设置",
autoSaveHint: "修改后自动保存",
saving: "保存中",
saved: "已保存",
saveAnnouncement: "{label} 已保存",
badgeRequiresRestart: "需重启",
badgeSecret: "敏感",
badgeHighRisk: "高风险",
badgeOverride: "已覆盖",
badgeOverrideTooltip: "该值已由管理员保存到数据库,覆盖了环境变量与默认值",
modifiedAt: "上次修改:{value}",
tagInputPlaceholder: "回车添加条目,例:example.com / *.foo.com / 10.0.0.0/8",
priorityHint: {
title: "关于优先级",
disclosure: "配置来源与优先级",
tier1: "在此页面保存过的项(带「已覆盖」徽章)— 始终以这里的值为准,环境变量会被忽略。",
tier2: "未在此处保存过的项 — 如果环境变量里有就用环境变量,否则用程序内置默认值。",
tier3: "若想让某项重新由环境变量控制,点击该行的「重置」按钮即可清除当前 UI 设置。",
},
summary: {
overridden: "已覆盖 {count}",
restart: "需重启 {count}",
},
sections: {
access: {
tab: "账户与访问 {count}",
title: "账户与访问",
description: "管理系统管理员、公开注册与用户创建空间的规则。",
},
tenant: {
tab: "租户默认值 {count}",
title: "租户默认值",
description: "设置新租户的初始配额与兼容性行为,不会自动改写已有租户。",
},
runtime: {
tab: "运行与并发 {count}",
title: "运行与并发",
description: "配置后台任务池与模型服务的并发容量。",
restartHint: "Worker 配置需重启生效",
},
security: {
tab: "网络安全 {count}",
title: "网络安全",
description: "管理可绕过 SSRF 防护的受信主机、IP 与网段。",
},
other: {
tab: "其他 {count}",
title: "其他配置",
description: "当前部署中未归入标准分组的配置项。",
},
},
runtimeTable: {
setting: "配置项与用途",
value: "当前值",
},
runtime: {
title: "任务队列运行时",
description: "后台任务队列的实时负载,以及各独立 worker 池的每实例并发配置。仅供观察,每 5 秒自动刷新。",
@@ -2596,6 +2638,7 @@ export default {
max_owned_per_user: "每用户最大租户数",
self_service_creation_enabled: "允许用户自助创建空间",
default_storage_quota_gb: "新租户默认存储配额 (GB)",
auto_create_api_key: "创建租户时自动生成 API Key",
},
asynq: {
core_concurrency: "核心解析保底并发数",
@@ -2634,6 +2677,9 @@ export default {
"新建租户时默认分配的存储配额(GB),包含向量、原文、文本、索引等。" +
"仅在创建时读取,修改后只对之后新建的租户生效,不会回写已存在的租户。" +
"0 或负数表示使用内置默认值 10GB。",
auto_create_api_key:
"为新租户自动生成 full_access API Key,并在创建响应中返回明文 token。" +
"仅用于兼容依赖旧行为的集成;默认关闭,建议通过 API Key 管理显式创建。",
},
asynq: {
core_concurrency: "文档解析与手工重解析的每实例保底并发,可额外借用共享弹性池;修改后需重启。",
+438 -61
View File
@@ -55,29 +55,6 @@
</p>
</div>
<!--
Priority hint. We surface the 3-tier resolver semantics inline so
operators don't have to dig through code to figure out why a value
they set in env "doesn't show up" — once a row is overridden in
the UI, env is shadowed until the row is cleared. The "已覆盖"
badge per row is the per-key signal; this block is the global key.
Hand-rolled panel rather than t-alert because the default alert
slot rendering hid most of the body text in TDesign's layout.
-->
<div class="priority-hint">
<div class="priority-hint-header">
<t-icon name="info-circle-filled" class="priority-hint-icon" />
<span class="priority-hint-title">
{{ t('system.globalSettings.priorityHint.title') }}
</span>
</div>
<ul class="priority-hint-list">
<li>{{ t('system.globalSettings.priorityHint.tier1') }}</li>
<li>{{ t('system.globalSettings.priorityHint.tier2') }}</li>
<li>{{ t('system.globalSettings.priorityHint.tier3') }}</li>
</ul>
</div>
<div v-if="loading && settings.length === 0" class="loading-state">
<t-loading :text="t('system.globalSettings.loading')" />
</div>
@@ -87,7 +64,77 @@
<span>{{ t('system.globalSettings.empty') }}</span>
</div>
<div v-else class="settings-group">
<template v-else>
<div class="settings-overview">
<div class="auto-save-note">
<t-icon name="check-circle" />
<span>{{ t('system.globalSettings.autoSaveHint') }}</span>
</div>
<div class="settings-overview-tags" aria-live="polite">
<t-tag theme="success" variant="light" size="small">
{{ t('system.globalSettings.summary.overridden', { count: overriddenCount }) }}
</t-tag>
<t-tag theme="warning" variant="light" size="small">
{{ t('system.globalSettings.summary.restart', { count: restartRequiredCount }) }}
</t-tag>
</div>
</div>
<!-- Resolver details matter, but are secondary to finding the setting
itself. Keep them one click away instead of occupying the first
viewport on every visit. Native details/summary also gives us a
keyboard-accessible disclosure without extra state. -->
<details class="config-source-details">
<summary>
<span class="config-source-summary">
<t-icon name="info-circle" />
{{ t('system.globalSettings.priorityHint.disclosure') }}
</span>
<t-icon name="chevron-down" class="config-source-chevron" />
</summary>
<ul class="priority-hint-list">
<li>{{ t('system.globalSettings.priorityHint.tier1') }}</li>
<li>{{ t('system.globalSettings.priorityHint.tier2') }}</li>
<li>{{ t('system.globalSettings.priorityHint.tier3') }}</li>
</ul>
</details>
<t-tabs v-model="activeSettingsSection" class="settings-section-tabs">
<t-tab-panel value="access" :label="sectionTabLabel('access')" />
<t-tab-panel value="tenant" :label="sectionTabLabel('tenant')" />
<t-tab-panel value="runtime" :label="sectionTabLabel('runtime')" />
<t-tab-panel value="security" :label="sectionTabLabel('security')" />
<t-tab-panel
v-if="hasUnknownSettings"
value="other"
:label="sectionTabLabel('other')"
/>
</t-tabs>
<section class="settings-section-panel" :aria-labelledby="`settings-section-${activeSettingsSection}`">
<div class="settings-section-intro">
<div>
<h3 :id="`settings-section-${activeSettingsSection}`">{{ activeSectionTitle }}</h3>
<p>{{ activeSectionDescription }}</p>
</div>
<t-tag v-if="activeSettingsSection === 'runtime'" theme="warning" variant="light" size="small">
{{ t('system.globalSettings.sections.runtime.restartHint') }}
</t-tag>
</div>
<div
v-if="activeSettingsSection === 'runtime'"
class="runtime-table-header"
aria-hidden="true"
>
<span>{{ t('system.globalSettings.runtimeTable.setting') }}</span>
<span>{{ t('system.globalSettings.runtimeTable.value') }}</span>
</div>
<div
class="settings-group"
:class="{ 'settings-group--runtime': activeSettingsSection === 'runtime' }"
>
<!--
System-admins management. Visually identical to SSRF whitelist
(a tag-input with one entry per email). NOT a system_setting
@@ -98,11 +145,14 @@
tags (they can't revoke themselves anyway, and showing a tag
that can't be removed is worse than not showing it).
-->
<div class="setting-row">
<div v-if="activeSettingsSection === 'access'" class="setting-row setting-row--admin">
<div class="setting-info">
<label class="setting-label">
<div class="setting-label">
<span>{{ t('system.globalSettings.admins.label') }}</span>
</label>
<t-tag theme="danger" variant="light" size="small" class="setting-badge">
{{ t('system.globalSettings.badgeHighRisk') }}
</t-tag>
</div>
<p class="desc">{{ t('system.globalSettings.admins.description') }}</p>
</div>
<div class="setting-control">
@@ -123,6 +173,7 @@
<t-tag-input
v-model="adminEmails"
:placeholder="t('system.globalSettings.admins.placeholder')"
:aria-label="t('system.globalSettings.admins.label')"
:disabled="adminBusy"
class="setting-input setting-input--wide"
clearable
@@ -130,25 +181,21 @@
/>
</div>
</t-popconfirm>
<t-loading v-if="adminBusy" size="small" class="setting-saving" />
<div v-if="adminBusy" class="setting-save-state" role="status">
<t-loading size="small" />
<span>{{ t('system.globalSettings.saving') }}</span>
</div>
</div>
</div>
</div>
<!--
Flat list — no category grouping. The registry is small enough
(single digits) that section headers add visual noise without
helping discovery; if it grows past ~10 keys we'll bring back
grouping with a real visual treatment instead of a tiny caps
label.
-->
<div
v-for="item in settings"
v-for="item in activeSectionSettings"
:key="item.key"
class="setting-row"
>
<div class="setting-info">
<label class="setting-label">
<div class="setting-label">
<span>{{ keyLabel(item.key) }}</span>
<t-tag
v-if="item.requires_restart"
@@ -165,6 +212,13 @@
class="setting-badge"
>{{ t('system.globalSettings.badgeSecret') }}</t-tag>
<t-tag
v-if="isHighImpactKey(item.key)"
theme="danger"
variant="light"
size="small"
class="setting-badge"
>{{ t('system.globalSettings.badgeHighRisk') }}</t-tag>
<t-tag
v-if="hasOverride(item)"
theme="success"
variant="light"
@@ -172,7 +226,7 @@
class="setting-badge"
:title="t('system.globalSettings.badgeOverrideTooltip')"
>{{ t('system.globalSettings.badgeOverride') }}</t-tag>
</label>
</div>
<p v-if="settingDescription(item)" class="desc">{{ settingDescription(item) }}</p>
<div v-if="modifiedMeta(item)" class="setting-meta">
{{ t('system.globalSettings.modifiedAt', { value: modifiedMeta(item) }) }}
@@ -207,6 +261,7 @@
<t-select
v-model="editValues[item.key]"
:options="enumOptions(item)"
:aria-label="keyLabel(item.key)"
:disabled="savingKey === item.key"
class="setting-input"
@change="onHighRiskSelectChange(item)"
@@ -217,6 +272,7 @@
v-else-if="hasEnum(item)"
v-model="editValues[item.key]"
:options="enumOptions(item)"
:aria-label="keyLabel(item.key)"
:disabled="savingKey === item.key"
class="setting-input"
@change="onChange(item)"
@@ -224,6 +280,7 @@
<t-switch
v-else-if="item.value_type === 'bool'"
v-model="editValues[item.key]"
:aria-label="keyLabel(item.key)"
:disabled="savingKey === item.key"
@change="onChange(item)"
/>
@@ -231,6 +288,7 @@
v-else-if="item.value_type === 'int'"
v-model="editValues[item.key]"
:placeholder="placeholderFor(item)"
:aria-label="keyLabel(item.key)"
:disabled="savingKey === item.key"
theme="normal"
:step="1"
@@ -256,6 +314,7 @@
:key="`ssrf-tag-${ssrfTagInputKey()}`"
:model-value="ssrfWhitelistModelValue()"
:placeholder="emptyListPlaceholder"
:aria-label="keyLabel(item.key)"
:disabled="savingKey === item.key"
class="setting-input setting-input--wide"
clearable
@@ -267,6 +326,7 @@
v-else
v-model="editValues[item.key]"
:placeholder="placeholderFor(item)"
:aria-label="keyLabel(item.key)"
:disabled="savingKey === item.key"
class="setting-input"
clearable
@@ -278,11 +338,18 @@
a PUT is in flight; the controls stay disabled (see
:disabled bindings above) so concurrent edits can't race.
-->
<t-loading
v-if="savingKey === item.key"
size="small"
class="setting-saving"
/>
<div v-if="savingKey === item.key" class="setting-save-state" role="status">
<t-loading size="small" />
<span>{{ t('system.globalSettings.saving') }}</span>
</div>
<div
v-else-if="savedKey === item.key"
class="setting-save-state setting-save-state--success"
role="status"
>
<t-icon name="check-circle-filled" />
<span>{{ t('system.globalSettings.saved') }}</span>
</div>
</div>
<!--
@@ -350,7 +417,10 @@
</div>
</div>
</div>
</div>
</div>
</section>
<div class="sr-only" role="status" aria-live="polite">{{ saveAnnouncement }}</div>
</template>
<!-- Platform audit-log drawer. Lazy-loaded on first open; closing
and reopening doesn't re-fetch (refresh is explicit via the
@@ -542,10 +612,20 @@ const HIGH_RISK_KEYS = new Set<string>([
'auth.registration_mode',
])
const HIGH_IMPACT_KEYS = new Set<string>([
'auth.registration_mode',
'tenant.auto_create_api_key',
'ssrf.whitelist',
])
function isHighRiskKey(key: string): boolean {
return HIGH_RISK_KEYS.has(key)
}
function isHighImpactKey(key: string): boolean {
return HIGH_IMPACT_KEYS.has(key)
}
type PopconfirmBtn = { content: string; theme?: 'primary' | 'danger' | 'warning' }
// TDesign popconfirm defaults to trigger:click on its inner Popup. Inputs
@@ -614,6 +694,86 @@ const emptyListPlaceholder = computed(() => t('system.globalSettings.tagInputPla
const settings = ref<SystemSettingItem[]>([])
const loading = ref(false)
const savingKey = ref<string | null>(null)
const savedKey = ref<string | null>(null)
const saveAnnouncement = ref('')
let savedKeyTimer: ReturnType<typeof setTimeout> | null = null
type SettingsSection = 'access' | 'tenant' | 'runtime' | 'security' | 'other'
// Product-oriented order, rather than the registry's alphabetical key order.
// Unknown/out-of-band rows remain visible in a conditional "Other" tab so the
// backend's diagnostic contract is preserved when a deployment contains an
// unexpected key.
const SETTINGS_SECTION_KEYS: Record<Exclude<SettingsSection, 'other'>, readonly string[]> = {
access: [
'auth.registration_mode',
'auth.default_tenant_mode',
'tenant.self_service_creation_enabled',
'tenant.max_owned_per_user',
],
tenant: [
'tenant.default_storage_quota_gb',
'tenant.auto_create_api_key',
],
runtime: [
'asynq.core_concurrency',
'asynq.enrichment_concurrency',
'asynq.postprocess_concurrency',
'asynq.maintenance_concurrency',
'asynq.shared_concurrency',
'asynq.wiki_concurrency',
'model.max_concurrency',
],
security: ['ssrf.whitelist'],
}
const activeSettingsSection = ref<SettingsSection>('access')
const knownSettingKeys = new Set(Object.values(SETTINGS_SECTION_KEYS).flat())
const settingsByKey = computed(() => new Map(settings.value.map((item) => [item.key, item])))
const unknownSettings = computed(() => settings.value.filter((item) => !knownSettingKeys.has(item.key)))
const hasUnknownSettings = computed(() => unknownSettings.value.length > 0)
watch(hasUnknownSettings, (hasUnknown) => {
if (!hasUnknown && activeSettingsSection.value === 'other') {
activeSettingsSection.value = 'access'
}
})
const activeSectionSettings = computed(() => {
if (activeSettingsSection.value === 'other') return unknownSettings.value
return SETTINGS_SECTION_KEYS[activeSettingsSection.value]
.map((key) => settingsByKey.value.get(key))
.filter((item): item is SystemSettingItem => Boolean(item))
})
const activeSectionTitle = computed(() =>
t(`system.globalSettings.sections.${activeSettingsSection.value}.title`),
)
const activeSectionDescription = computed(() =>
t(`system.globalSettings.sections.${activeSettingsSection.value}.description`),
)
const overriddenCount = computed(() => settings.value.filter(hasOverride).length)
const restartRequiredCount = computed(() => settings.value.filter((item) => item.requires_restart).length)
function sectionTabLabel(section: SettingsSection): string {
const count = section === 'other'
? unknownSettings.value.length
: SETTINGS_SECTION_KEYS[section].filter((key) => settingsByKey.value.has(key)).length + (section === 'access' ? 1 : 0)
return t(`system.globalSettings.sections.${section}.tab`, { count })
}
function markSettingSaved(item: SystemSettingItem) {
savedKey.value = item.key
saveAnnouncement.value = t('system.globalSettings.saveAnnouncement', {
label: keyLabel(item.key),
})
if (savedKeyTimer) clearTimeout(savedKeyTimer)
savedKeyTimer = setTimeout(() => {
if (savedKey.value === item.key) savedKey.value = null
savedKeyTimer = null
}, 2000)
}
// Admin management state. We keep two parallel structures:
// - adminEmails: the v-model bound to the t-tag-input (excludes
@@ -942,6 +1102,7 @@ function bulkActionConfirmBody(item: SystemSettingItem): string {
async function runBulkAction(item: SystemSettingItem) {
if (!hasBulkAction(item)) return
savedKey.value = null
savingKey.value = item.key
try {
const result = await applyDefaultStorageQuotaToAllTenants()
@@ -951,8 +1112,10 @@ async function runBulkAction(item: SystemSettingItem) {
gb: result.quota_gb,
}),
)
markSettingSaved(item)
} catch (err: any) {
const msg = err?.message || t('system.globalSettings.bulkApply.failed')
saveAnnouncement.value = msg
MessagePlugin.error(msg)
} finally {
savingKey.value = null
@@ -966,13 +1129,16 @@ async function runBulkAction(item: SystemSettingItem) {
// settings array and re-running it keeps the modified-by enrichment
// consistent for every row in the table.
async function resetSetting(item: SystemSettingItem) {
savedKey.value = null
savingKey.value = item.key
try {
await resetSystemSetting(item.key)
await loadSettings()
markSettingSaved(item)
MessagePlugin.success(t('system.globalSettings.reset.success'))
} catch (err: any) {
const msg = err?.message || t('system.globalSettings.reset.failed')
saveAnnouncement.value = msg
MessagePlugin.error(msg)
} finally {
savingKey.value = null
@@ -981,6 +1147,7 @@ async function resetSetting(item: SystemSettingItem) {
async function persistSetting(item: SystemSettingItem) {
const newValue = editValues[item.key]
savedKey.value = null
savingKey.value = item.key
try {
const updated = await updateSystemSetting(item.key, newValue)
@@ -993,9 +1160,11 @@ async function persistSetting(item: SystemSettingItem) {
editValues[item.key] = Array.isArray(updated.value)
? [...(updated.value as unknown[])]
: updated.value
markSettingSaved(updated)
MessagePlugin.success(t('system.globalSettings.messages.saveSuccess'))
} catch (err: any) {
const msg = err?.message || t('system.globalSettings.messages.saveFailed')
saveAnnouncement.value = msg
MessagePlugin.error(msg)
// Roll the input back to the canonical value on failure. Without
// this an invalid edit (e.g. SSRF whitelist with a malformed CIDR
@@ -1119,10 +1288,12 @@ async function onAdminsChange(next: string[]) {
}
await loadAdmins()
if (applied > 0) {
saveAnnouncement.value = t('system.globalSettings.admins.saveSuccess')
MessagePlugin.success(t('system.globalSettings.admins.saveSuccess'))
}
} catch (err: any) {
const msg = err?.message || t('system.globalSettings.admins.saveFailed')
saveAnnouncement.value = msg
MessagePlugin.error(msg)
await loadAdmins()
} finally {
@@ -1481,7 +1652,10 @@ watch(
{ flush: 'post' },
)
onUnmounted(() => detachAuditInfiniteScroll())
onUnmounted(() => {
detachAuditInfiniteScroll()
if (savedKeyTimer) clearTimeout(savedKeyTimer)
})
</script>
<style lang="less" scoped>
@@ -1829,35 +2003,182 @@ onUnmounted(() => detachAuditInfiniteScroll())
}
}
.priority-hint {
margin-bottom: 24px;
padding: 14px 16px;
border-radius: 6px;
background: var(--td-bg-color-container-hover);
border-left: 3px solid var(--td-brand-color);
.settings-overview {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
min-height: 24px;
}
.priority-hint-header {
.auto-save-note {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
color: var(--td-text-color-secondary);
.t-icon {
color: var(--td-success-color);
}
}
.settings-overview-tags {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 6px;
}
.priority-hint-icon {
color: var(--td-brand-color);
font-size: 16px;
.config-source-details {
margin-bottom: 18px;
border: 1px solid var(--td-component-stroke);
border-radius: 6px;
background: var(--td-bg-color-container);
summary {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
min-height: 38px;
padding: 0 12px;
cursor: pointer;
color: var(--td-text-color-secondary);
font-size: 13px;
list-style: none;
&::-webkit-details-marker {
display: none;
}
&:focus-visible {
outline: 2px solid var(--td-brand-color-focus);
outline-offset: 2px;
}
}
&[open] {
background: var(--td-bg-color-secondarycontainer);
.config-source-chevron {
transform: rotate(180deg);
}
}
}
.priority-hint-title {
font-size: 14px;
.config-source-summary {
display: inline-flex;
align-items: center;
gap: 7px;
font-weight: 500;
color: var(--td-text-color-primary);
.t-icon {
color: var(--td-brand-color);
}
}
.config-source-chevron {
flex-shrink: 0;
transition: transform 0.2s ease;
}
.settings-section-tabs {
position: sticky;
top: 0;
z-index: 3;
margin: 0 0 18px;
background: var(--td-bg-color-container);
box-shadow: 0 1px 0 var(--td-component-stroke);
&:deep(.t-tabs__nav-item) {
font-weight: 500;
}
}
.settings-section-panel {
min-width: 0;
}
.settings-section-intro {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
padding: 0 0 12px;
border-bottom: 1px solid var(--td-component-stroke);
h3 {
margin: 0 0 4px;
font-size: 16px;
line-height: 1.4;
color: var(--td-text-color-primary);
}
p {
margin: 0;
font-size: 13px;
line-height: 1.5;
color: var(--td-text-color-secondary);
}
}
.runtime-table-header {
display: grid;
grid-template-columns: minmax(0, 1fr) 280px;
gap: 24px;
padding: 10px 16px;
font-size: 12px;
font-weight: 500;
color: var(--td-text-color-secondary);
background: var(--td-bg-color-secondarycontainer);
border: 1px solid var(--td-component-stroke);
border-bottom: none;
border-radius: 8px 8px 0 0;
span:last-child {
text-align: right;
}
}
.settings-group--runtime {
border: 1px solid var(--td-component-stroke);
border-radius: 0 0 8px 8px;
overflow: hidden;
.setting-row {
display: grid;
grid-template-columns: minmax(0, 1fr) 280px;
gap: 24px;
padding: 14px 16px;
}
.setting-info {
max-width: none;
padding-right: 0;
}
.setting-label {
font-size: 14px;
}
.desc {
max-width: 620px;
font-size: 12px;
}
.setting-control {
min-width: 0;
}
.setting-input {
width: 210px;
}
}
.priority-hint-list {
margin: 4px 0 0;
padding-left: 22px;
margin: 0;
padding: 0 36px 12px 34px;
font-size: 13px;
line-height: 1.65;
color: var(--td-text-color-primary);
@@ -1868,6 +2189,32 @@ onUnmounted(() => detachAuditInfiniteScroll())
}
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.setting-save-state {
display: inline-flex;
align-items: center;
gap: 5px;
flex-shrink: 0;
min-width: 52px;
font-size: 12px;
color: var(--td-text-color-secondary);
}
.setting-save-state--success {
color: var(--td-success-color);
}
.setting-reset-btn {
// Sit flush with the input on the right; size="small" gives it the
// right footprint to read as secondary action next to the primary
@@ -1993,11 +2340,41 @@ onUnmounted(() => detachAuditInfiniteScroll())
}
@media (max-width: 860px) {
.settings-overview,
.settings-section-intro {
align-items: flex-start;
flex-direction: column;
}
.runtime-table-header {
display: none;
}
.settings-group--runtime {
border-radius: 8px;
.setting-row {
display: flex;
flex-direction: column;
gap: 12px;
}
.setting-input {
width: 100%;
}
}
.setting-row {
flex-direction: column;
gap: 12px;
}
.setting-info {
width: 100%;
max-width: none;
padding-right: 0;
}
.setting-control {
width: 100%;
align-items: flex-start;