Merge pull request #4697 from feitianbubu/fix/ops-system-log-cleanup-error-toast
fix(ops): 系统日志清理被拒绝时展示具体原因
This commit is contained in:
@@ -72,6 +72,7 @@ export default {
|
||||
runtimeConfigResetFailed: 'Failed to reset log configuration',
|
||||
cleanupConfirm: 'Clean up system logs matching the current filters? This cannot be undone.',
|
||||
cleanupSuccess: 'Cleanup complete. Deleted {count} log entries.',
|
||||
cleanupFilterRequired: 'Cleanup requires at least one filter condition (start/end time or another field)',
|
||||
cleanupFailed: 'Failed to clean up system logs'
|
||||
},
|
||||
requestsTotal: 'Requests (total)',
|
||||
|
||||
@@ -72,6 +72,7 @@ export default {
|
||||
runtimeConfigResetFailed: '重置日志配置失败',
|
||||
cleanupConfirm: '确定要清理匹配当前筛选条件的系统日志吗?此操作不可撤销。',
|
||||
cleanupSuccess: '清理完成,已删除 {count} 条日志。',
|
||||
cleanupFilterRequired: '清理需要至少一个筛选条件(起止时间或其他字段)',
|
||||
cleanupFailed: '清理系统日志失败'
|
||||
},
|
||||
requestsTotal: '请求(总计)',
|
||||
|
||||
@@ -6,6 +6,7 @@ import { opsAPI, type OpsRuntimeLogConfig, type OpsSystemLog, type OpsSystemLogS
|
||||
import Pagination from '@/components/common/Pagination.vue'
|
||||
import Select from '@/components/common/Select.vue'
|
||||
import { useAppStore } from '@/stores'
|
||||
import { extractApiErrorMessage } from '@/utils/apiError'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const { t } = useI18n()
|
||||
@@ -312,7 +313,11 @@ const cleanupCurrentFilter = async () => {
|
||||
await Promise.all([fetchLogs(), fetchHealth()])
|
||||
} catch (err: any) {
|
||||
console.error('[OpsSystemLogTable] Failed to cleanup logs', err)
|
||||
appStore.showError(err?.response?.data?.detail || t('admin.ops.systemLogs.cleanupFailed'))
|
||||
appStore.showError(
|
||||
extractApiErrorMessage(err, t('admin.ops.systemLogs.cleanupFailed'), {
|
||||
OPS_SYSTEM_LOG_CLEANUP_FILTER_REQUIRED: t('admin.ops.systemLogs.cleanupFilterRequired')
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user