抑制配置页面重复错误提示
Some checks are pending
Security Checks / security (push) Waiting to run

This commit is contained in:
smail 2026-09-05 14:06:50 +08:00
parent 7cd24a2958
commit 80bcde5fc2
2 changed files with 13 additions and 1 deletions

View File

@ -59,6 +59,7 @@ export function usePage() {
const migrationToken = ref('')
const migrationRecord = ref(null)
const restartPreview = ref(null)
let initializationErrorShown = false
const canWrite = computed(() => globalStatus.hasCapability('config.write_global'))
const canRollback = computed(() => globalStatus.hasCapability('config.rollback'))
@ -271,10 +272,14 @@ export function usePage() {
}
const loadAll = async () => {
loading.value = true
initializationErrorShown = false
try {
await Promise.all([loadStatus(), loadSection(), loadBackups(), loadAudit()])
} catch (error) {
ElMessage.error(error.message || '配置管理数据读取失败')
if (!initializationErrorShown) {
initializationErrorShown = true
ElMessage.error(error.message || '配置管理数据读取失败')
}
} finally {
loading.value = false
}

View File

@ -49,6 +49,8 @@ export function usePage() {
const generatedCodes = ref([])
const externalEmails = ref([])
const externalLoading = ref(false)
let lastNotificationKey = ''
let lastNotificationAt = 0
const bindForm = reactive({ email: '', type: 'backup', challengeId: '', bindingId: 0, code: '' })
const ruleForm = reactive({ current_pwd: '', new_pwd: '', new_pwd2: '' })
@ -59,6 +61,11 @@ export function usePage() {
})
const notify = (message, type = 'error') => {
const notificationKey = `${type}:${String(message || '').trim()}`
const now = Date.now()
if (notificationKey === lastNotificationKey && now - lastNotificationAt < 1500) return
lastNotificationKey = notificationKey
lastNotificationAt = now
ElNotification({ title: type === 'success' ? '操作成功' : '操作失败', message, type })
}