From 171fbd0dcabb17f3ee832a41666f59294db67f14 Mon Sep 17 00:00:00 2001
From: wizardchen
Date: Tue, 21 Jul 2026 15:39:07 +0800
Subject: [PATCH] feat(i18n): add drawer localization for audit log details
Enhance internationalization support by adding new localization entries for the audit log detail drawer in English, Korean, Russian, and Chinese. This includes sections for event summary, related IDs, request information, and method.
---
frontend/src/i18n/locales/en-US.ts | 7 +
frontend/src/i18n/locales/ko-KR.ts | 7 +
frontend/src/i18n/locales/ru-RU.ts | 7 +
frontend/src/i18n/locales/zh-CN.ts | 7 +
frontend/src/views/system/SystemAuditLog.vue | 326 ++++++++++++++-----
frontend/src/views/system/SystemSettings.vue | 115 ++-----
6 files changed, 301 insertions(+), 168 deletions(-)
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 5a808ec8..da620f66 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -4045,6 +4045,13 @@ export default {
targetId: 'Target ID',
details: 'Raw details',
},
+ drawer: {
+ sectionSummary: 'Event summary',
+ sectionIdentifiers: 'Related IDs',
+ sectionRequest: 'Request',
+ targetChange: 'Change',
+ requestMethod: 'Method',
+ },
},
}
},
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index 3a8bbf75..d0209398 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -3042,6 +3042,13 @@ export default {
targetId: "대상 ID",
details: "원본 상세",
},
+ drawer: {
+ sectionSummary: "이벤트 요약",
+ sectionIdentifiers: "관련 식별자",
+ sectionRequest: "요청 정보",
+ targetChange: "변경 내용",
+ requestMethod: "요청 메서드",
+ },
},
},
},
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 37d36c48..8c23aa58 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -2729,6 +2729,13 @@ export default {
targetType: 'Тип цели',
targetId: 'ID цели',
details: 'Сырые детали'
+ },
+ drawer: {
+ sectionSummary: 'Сводка события',
+ sectionIdentifiers: 'Связанные идентификаторы',
+ sectionRequest: 'Запрос',
+ targetChange: 'Изменение',
+ requestMethod: 'Метод'
}
}
}
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 021574a6..ba7b7bfd 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -3054,6 +3054,13 @@ export default {
targetId: "目标 ID",
details: "原始详情",
},
+ drawer: {
+ sectionSummary: "事件概要",
+ sectionIdentifiers: "关联标识",
+ sectionRequest: "请求信息",
+ targetChange: "变更内容",
+ requestMethod: "请求方法",
+ },
},
},
},
diff --git a/frontend/src/views/system/SystemAuditLog.vue b/frontend/src/views/system/SystemAuditLog.vue
index ad22a34c..61be2eb5 100644
--- a/frontend/src/views/system/SystemAuditLog.vue
+++ b/frontend/src/views/system/SystemAuditLog.vue
@@ -46,9 +46,7 @@
:columns="auditColumns"
size="medium"
hover
- expand-on-row-click
- :expanded-row-keys="auditExpandedRowKeys"
- @expand-change="onAuditExpandChange"
+ @row-click="openAuditDetail"
>
@@ -84,32 +82,6 @@
{{ t('system.globalSettings.audit.outcome.' + row.outcome) }}
-
-
-
-
- {{ t('system.globalSettings.audit.expanded.actorId') }}
- {{ row.actor_user_id || '—' }}
-
-
- {{ t('system.globalSettings.audit.expanded.targetUserId') }}
- {{ row.target_user_id }}
-
-
- {{ t('system.globalSettings.audit.expanded.targetType') }}
- {{ row.target_type }}
-
-
- {{ t('system.globalSettings.audit.expanded.targetId') }}
- {{ row.target_id }}
-
-
-
-
{{ t('system.globalSettings.audit.expanded.details') }}
-
{{ auditDetailsJSON(row) }}
-
-
-
@@ -125,6 +97,76 @@
+
+
+
+
+
+ {{ t('system.globalSettings.audit.drawer.sectionSummary') }}
+
+
+
+
- {{ field.label }}
+ - {{ field.value }}
+
+
+
+
+
+
+ {{ t('system.globalSettings.audit.drawer.sectionIdentifiers') }}
+
+
+
+
- {{ field.label }}
+ - {{ field.value }}
+
+
+
+
+
+
+ {{ t('system.globalSettings.audit.drawer.sectionRequest') }}
+
+
+
+
- {{ field.label }}
+ - {{ field.value }}
+
+
+
+
+
+
+ {{ t('system.globalSettings.audit.expanded.details') }}
+
+ {{ auditDetailsJSON(selectedAuditEntry) }}
+
+
+
@@ -137,8 +179,15 @@ import {
type AuditLog,
type AuditOutcome,
} from '@/api/system'
+import SettingDrawer from '@/components/settings/SettingDrawer.vue'
import { useAuthStore } from '@/stores/auth'
+interface AuditDetailField {
+ key: string
+ label: string
+ value: string
+}
+
const authStore = useAuthStore()
const { t, tm, te, locale } = useI18n()
@@ -153,6 +202,9 @@ const auditScrollRoot = ref(null)
const auditLoadSentinelEl = ref(null)
let auditScrollObserver: IntersectionObserver | null = null
+const auditDetailVisible = ref(false)
+const selectedAuditEntry = ref(null)
+
const auditColumns = computed(() => [
{ colKey: 'created_at', title: t('system.globalSettings.audit.columns.time'), width: 120 },
{ colKey: 'actor', title: t('system.globalSettings.audit.columns.actor'), width: 180 },
@@ -343,12 +395,129 @@ function formatSettingDiff(details: Record): string {
return `${oldStr} → ${newStr}`
}
-const auditExpandedRowKeys = ref([])
+function formatAuditDateTime(s: string | undefined): string {
+ if (!s) return '—'
+ const date = formatAuditDatePart(s)
+ const time = formatAuditTimePart(s)
+ return time ? `${date} ${time}` : date
+}
-function onAuditExpandChange(value: (string | number)[]) {
- auditExpandedRowKeys.value = value
- .map((v) => (typeof v === 'number' ? v : Number(v)))
- .filter((v) => Number.isFinite(v))
+function auditActorDisplay(row: AuditLog): string {
+ if (!row.actor_user_id) {
+ return t('system.globalSettings.audit.systemActor')
+ }
+ const name = auditActorLabel(row.actor_user_id)
+ return row.actor_role ? `${name} (${auditActorRoleLabel(row.actor_role)})` : name
+}
+
+function auditSummaryFields(row: AuditLog): AuditDetailField[] {
+ const fields: AuditDetailField[] = [
+ {
+ key: 'time',
+ label: t('system.globalSettings.audit.columns.time'),
+ value: formatAuditDateTime(row.created_at),
+ },
+ {
+ key: 'actor',
+ label: t('system.globalSettings.audit.columns.actor'),
+ value: auditActorDisplay(row),
+ },
+ {
+ key: 'action',
+ label: t('system.globalSettings.audit.columns.action'),
+ value: formatAuditAction(row.action),
+ },
+ {
+ key: 'outcome',
+ label: t('system.globalSettings.audit.columns.outcome'),
+ value: t('system.globalSettings.audit.outcome.' + row.outcome),
+ },
+ ]
+
+ const targetKey = auditTargetKey(row)
+ if (targetKey) {
+ fields.push({
+ key: 'target',
+ label: t('system.globalSettings.audit.columns.target'),
+ value: targetKey,
+ })
+ }
+
+ const diff = auditTargetDiff(row)
+ if (diff) {
+ fields.push({
+ key: 'targetDiff',
+ label: t('system.globalSettings.audit.drawer.targetChange'),
+ value: diff,
+ })
+ }
+
+ return fields
+}
+
+function auditIdentifierFields(row: AuditLog): AuditDetailField[] {
+ const fields: AuditDetailField[] = []
+ if (row.actor_user_id) {
+ fields.push({
+ key: 'actorId',
+ label: t('system.globalSettings.audit.expanded.actorId'),
+ value: row.actor_user_id,
+ })
+ }
+ if (row.target_user_id) {
+ fields.push({
+ key: 'targetUserId',
+ label: t('system.globalSettings.audit.expanded.targetUserId'),
+ value: row.target_user_id,
+ })
+ }
+ if (row.target_type) {
+ fields.push({
+ key: 'targetType',
+ label: t('system.globalSettings.audit.expanded.targetType'),
+ value: row.target_type,
+ })
+ }
+ if (row.target_id) {
+ fields.push({
+ key: 'targetId',
+ label: t('system.globalSettings.audit.expanded.targetId'),
+ value: row.target_id,
+ })
+ }
+ return fields
+}
+
+function auditRequestFields(row: AuditLog): AuditDetailField[] {
+ const fields: AuditDetailField[] = []
+ if (row.request_method) {
+ fields.push({
+ key: 'method',
+ label: t('system.globalSettings.audit.drawer.requestMethod'),
+ value: row.request_method,
+ })
+ }
+ if (row.request_path) {
+ fields.push({
+ key: 'path',
+ label: t('system.globalSettings.audit.columns.path'),
+ value: row.request_path,
+ })
+ }
+ return fields
+}
+
+const auditDetailTitle = computed(() =>
+ selectedAuditEntry.value ? formatAuditAction(selectedAuditEntry.value.action) : '',
+)
+
+const auditDetailDescription = computed(() =>
+ selectedAuditEntry.value ? formatAuditDateTime(selectedAuditEntry.value.created_at) : '',
+)
+
+function openAuditDetail(context: { row: AuditLog }) {
+ selectedAuditEntry.value = context.row
+ auditDetailVisible.value = true
}
function auditDetailsJSON(row: AuditLog): string {
@@ -651,59 +820,49 @@ onUnmounted(() => {
}
}
-.audit-expanded {
+.audit-detail-fields {
display: flex;
flex-direction: column;
- gap: 12px;
- padding: 12px 16px;
- background: var(--td-bg-color-container-hover);
-}
-
-.audit-expanded-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
- gap: 10px 18px;
-}
-
-.audit-expanded-cell {
- display: flex;
- flex-direction: column;
- gap: 2px;
- min-width: 0;
-}
-
-.audit-expanded-label {
- font-size: 11px;
- font-weight: 600;
- color: var(--td-text-color-secondary);
- text-transform: uppercase;
- letter-spacing: 0.04em;
-}
-
-.audit-expanded-value {
- font-size: 12px;
- color: var(--td-text-color-primary);
- word-break: break-all;
-}
-
-.audit-expanded-details {
- display: flex;
- flex-direction: column;
- gap: 4px;
-}
-
-.audit-expanded-json {
+ gap: 10px;
margin: 0;
- padding: 10px 12px;
+}
+
+.audit-detail-field {
+ display: grid;
+ grid-template-columns: 88px minmax(0, 1fr);
+ gap: 12px;
+ align-items: baseline;
+ margin: 0;
+
+ dt {
+ margin: 0;
+ color: var(--td-text-color-placeholder);
+ font-size: 12px;
+ line-height: 1.45;
+ white-space: nowrap;
+ }
+
+ dd {
+ margin: 0;
+ color: var(--td-text-color-primary);
+ font-size: 13px;
+ line-height: 1.55;
+ word-break: break-all;
+ }
+}
+
+.audit-detail-json {
+ margin: 0;
+ padding: 12px 14px;
font-size: 12px;
line-height: 1.55;
color: var(--td-text-color-primary);
background: var(--td-bg-color-container);
border: 1px solid var(--td-component-stroke);
- border-radius: 6px;
+ border-radius: 8px;
white-space: pre-wrap;
word-break: break-all;
- max-height: 280px;
+ max-height: min(420px, 50vh);
overflow: auto;
}
@@ -739,17 +898,12 @@ onUnmounted(() => {
box-shadow: inset 0 -1px 0 var(--td-component-stroke);
}
+ &:deep(.t-table tbody tr) {
+ cursor: pointer;
+ }
+
&:deep(.t-table tbody tr:hover > td) {
background-color: var(--td-bg-color-container-hover);
}
-
- &:deep(.t-table tbody tr.t-table__expanded-row > td) {
- padding: 0 !important;
- background-color: transparent;
- }
-
- &:deep(.t-table__expandable-icon-cell) {
- width: 36px;
- }
}
diff --git a/frontend/src/views/system/SystemSettings.vue b/frontend/src/views/system/SystemSettings.vue
index 23566663..7b69bfde 100644
--- a/frontend/src/views/system/SystemSettings.vue
+++ b/frontend/src/views/system/SystemSettings.vue
@@ -49,29 +49,17 @@
-
-
- {{ t('system.globalSettings.autoSaveHint') }}
-
-
-
-
-
-
-
- {{ t('system.globalSettings.priorityHint.disclosure') }}
-
-
-
+
+
+
+ {{ t('system.globalSettings.priorityHint.disclosure') }}
+
- {{ t('system.globalSettings.priorityHint.tier1') }}
- {{ t('system.globalSettings.priorityHint.tier2') }}
- {{ t('system.globalSettings.priorityHint.tier3') }}
-
+
@@ -86,7 +74,10 @@
-
+
{{ activeSectionTitle }}
{{ activeSectionDescription }}
@@ -1322,70 +1313,39 @@ onUnmounted(() => {
}
-.auto-save-note {
- display: flex;
- align-items: center;
- gap: 6px;
- margin-bottom: 10px;
- font-size: 13px;
- color: var(--td-text-color-secondary);
-
- .t-icon {
- color: var(--td-success-color);
- }
-}
-
-.config-source-details {
+.settings-intro-panel {
margin-bottom: 18px;
+ padding: 12px 14px;
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);
- }
- }
+ background: var(--td-bg-color-secondarycontainer);
}
-.config-source-summary {
- display: inline-flex;
+.priority-hint-title {
+ display: flex;
align-items: center;
gap: 7px;
+ margin-bottom: 8px;
+ font-size: 13px;
font-weight: 500;
+ color: var(--td-text-color-secondary);
.t-icon {
color: var(--td-brand-color);
}
}
-.config-source-chevron {
- flex-shrink: 0;
- transition: transform 0.2s ease;
+.priority-hint-list {
+ margin: 0;
+ padding: 0 0 0 20px;
+ font-size: 13px;
+ line-height: 1.65;
+ color: var(--td-text-color-primary);
+ list-style: disc;
+
+ li + li {
+ margin-top: 4px;
+ }
}
.settings-section-tabs {
@@ -1428,6 +1388,10 @@ onUnmounted(() => {
}
}
+.settings-section-intro--runtime {
+ border-bottom: none;
+}
+
.runtime-table-header {
display: grid;
grid-template-columns: minmax(0, 1fr) 280px;
@@ -1481,19 +1445,6 @@ onUnmounted(() => {
}
}
-.priority-hint-list {
- margin: 0;
- padding: 0 36px 12px 34px;
- font-size: 13px;
- line-height: 1.65;
- color: var(--td-text-color-primary);
- list-style: disc;
-
- li + li {
- margin-top: 4px;
- }
-}
-
.sr-only {
position: absolute;
width: 1px;