fix(ops): 修复错误列表用户显示并区分上游错误和请求错误

- 修复错误列表中用户列显示 \n 的问题
- 上游错误显示账号(account),请求错误显示用户(user)
- 错误详情模态框同步调整显示逻辑
- 添加 accountId 国际化翻译
This commit is contained in:
IanShaw027
2026-01-15 00:11:44 +08:00
parent 2daf13c4c8
commit 5354ba3662
4 changed files with 36 additions and 9 deletions

View File

@@ -2022,6 +2022,7 @@ export default {
user: 'User',
userId: 'User ID',
account: 'Account',
accountId: 'Account ID',
status: 'Status',
message: 'Message',
latency: 'Request Duration',

View File

@@ -2166,6 +2166,7 @@ export default {
user: '用户',
userId: '用户 ID',
account: '账号',
accountId: '账号 ID',
status: '状态码',
message: '响应内容',
latency: '请求时长',

View File

@@ -29,9 +29,16 @@
</div>
<div class="rounded-xl bg-gray-50 p-4 dark:bg-dark-900">
<div class="text-xs font-bold uppercase tracking-wider text-gray-400">{{ t('admin.ops.errorDetail.user') }}</div>
<div class="text-xs font-bold uppercase tracking-wider text-gray-400">
{{ isUpstreamError(detail) ? t('admin.ops.errorDetail.account') : t('admin.ops.errorDetail.user') }}
</div>
<div class="mt-1 text-sm font-medium text-gray-900 dark:text-white">
{{ detail.user_email || (detail.user_id != null ? String(detail.user_id) : '—') }}
<template v-if="isUpstreamError(detail)">
{{ detail.account_name || (detail.account_id != null ? String(detail.account_id) : '') }}
</template>
<template v-else>
{{ detail.user_email || (detail.user_id != null ? String(detail.user_id) : '') }}
</template>
</div>
</div>
@@ -202,6 +209,13 @@ const title = computed(() => {
const emptyText = computed(() => t('admin.ops.errorDetail.noErrorSelected'))
function isUpstreamError(d: OpsErrorDetail | null): boolean {
if (!d) return false
const phase = String(d.phase || '').toLowerCase()
const owner = String(d.error_owner || '').toLowerCase()
return phase === 'upstream' && owner === 'provider'
}
const correlatedUpstream = ref<OpsErrorDetail[]>([])
const correlatedUpstreamLoading = ref(false)

View File

@@ -101,13 +101,24 @@
<span v-else class="text-xs text-gray-400">-</span>
</td>
<!-- User -->\n <td class="px-4 py-2">
<el-tooltip v-if="log.user_id" :content="t('admin.ops.errorLog.userId') + ' ' + log.user_id" placement="top" :show-after="500">
<span class="max-w-[100px] truncate text-xs font-medium text-gray-900 dark:text-gray-200">
{{ log.user_email || '-' }}
</span>
</el-tooltip>
<span v-else class="text-xs text-gray-400">-</span>
<!-- User / Account -->
<td class="px-4 py-2">
<template v-if="isUpstreamRow(log)">
<el-tooltip v-if="log.account_id" :content="t('admin.ops.errorLog.accountId') + ' ' + log.account_id" placement="top" :show-after="500">
<span class="max-w-[100px] truncate text-xs font-medium text-gray-900 dark:text-gray-200">
{{ log.account_name || '-' }}
</span>
</el-tooltip>
<span v-else class="text-xs text-gray-400">-</span>
</template>
<template v-else>
<el-tooltip v-if="log.user_id" :content="t('admin.ops.errorLog.userId') + ' ' + log.user_id" placement="top" :show-after="500">
<span class="max-w-[100px] truncate text-xs font-medium text-gray-900 dark:text-gray-200">
{{ log.user_email || '-' }}
</span>
</el-tooltip>
<span v-else class="text-xs text-gray-400">-</span>
</template>
</td>
<!-- Status -->