Skip to content

Commit 6da5fa0

Browse files
committed
fix(frontend): 修复运维设置对话框保存按钮始终禁用的问题
后端默认 alert.enabled=true 但 recipients 为空,前端验证将其视为 错误并阻断保存按钮。移除该阻断性验证,改为保存时自动禁用无收件人 的邮件通知配置。
1 parent 616930f commit 6da5fa0

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

frontend/src/views/admin/ops/components/OpsSettingsDialog.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,7 @@ const validation = computed(() => {
131131
}
132132
}
133133
134-
// 验证邮件配置
135-
if (emailConfig.value) {
136-
if (emailConfig.value.alert.enabled && emailConfig.value.alert.recipients.length === 0) {
137-
errors.push(t('admin.ops.email.validation.alertRecipientsRequired'))
138-
}
139-
if (emailConfig.value.report.enabled && emailConfig.value.report.recipients.length === 0) {
140-
errors.push(t('admin.ops.email.validation.reportRecipientsRequired'))
141-
}
142-
}
134+
// 邮件配置: 启用但无收件人时不阻断保存, 保存时会自动禁用
143135
144136
// 验证高级设置
145137
if (advancedSettings.value) {
@@ -181,6 +173,15 @@ async function saveAllSettings() {
181173
182174
saving.value = true
183175
try {
176+
// 无收件人时自动禁用邮件通知
177+
if (emailConfig.value) {
178+
if (emailConfig.value.alert.enabled && emailConfig.value.alert.recipients.length === 0) {
179+
emailConfig.value.alert.enabled = false
180+
}
181+
if (emailConfig.value.report.enabled && emailConfig.value.report.recipients.length === 0) {
182+
emailConfig.value.report.enabled = false
183+
}
184+
}
184185
await Promise.all([
185186
runtimeSettings.value ? opsAPI.updateAlertRuntimeSettings(runtimeSettings.value) : Promise.resolve(),
186187
emailConfig.value ? opsAPI.updateEmailNotificationConfig(emailConfig.value) : Promise.resolve(),

0 commit comments

Comments
 (0)