Skip to content

Commit 0edaaf0

Browse files
committed
fix(frontend): restore bulk delete handlers and email provider form types
Unblock CI image builds by defining handleBulkDeleteFiltered and making email_provider fields required on SettingsForm for vue-tsc.
1 parent bf42dce commit 0edaaf0

2 files changed

Lines changed: 54 additions & 15 deletions

File tree

frontend/src/views/admin/AccountsView.vue

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,23 +1788,53 @@ const toggleSelectAllVisible = (event: Event) => {
17881788
}
17891789
const handleBulkDelete = async () => {
17901790
const accountIds = [...selIds.value]
1791-
if (!confirm(t('admin.accounts.bulkActions.confirmDelete', { count: accountIds.length }))) return
1791+
1792+
if (accountIds.length === 0) return
1793+
if (!confirm(t('admin.accounts.bulkDeleteConfirm', { count: accountIds.length }))) return
17921794
try {
1793-
const result = await adminAPI.accounts.batchDelete(accountIds)
1794-
if (result.failed > 0) {
1795-
appStore.showError(t('admin.accounts.bulkActions.partialSuccess', {
1796-
success: result.success,
1797-
failed: result.failed
1798-
}))
1799-
setSelectedIds(result.failed_ids?.length ? result.failed_ids : accountIds)
1800-
} else {
1801-
appStore.showSuccess(t('admin.accounts.bulkActions.deleteSuccess', { count: result.success }))
1795+
const result = await adminAPI.accounts.bulkDelete(accountIds)
1796+
const success = result.success || 0
1797+
const failed = result.failed || 0
1798+
if (success > 0 && failed === 0) {
1799+
appStore.showSuccess(t('admin.accounts.bulkDeleteSuccess', { count: success }))
18021800
clearSelection()
1801+
} else if (success > 0) {
1802+
appStore.showError(t('admin.accounts.bulkDeletePartial', { success, failed }))
1803+
setSelectedIds(result.failed_ids && result.failed_ids.length > 0 ? result.failed_ids : accountIds)
1804+
} else {
1805+
appStore.showError(t('admin.accounts.bulkDeleteFailed'))
18031806
}
1804-
await reload()
1805-
} catch (error) {
1807+
reload()
1808+
} catch (error: any) {
18061809
console.error('Failed to bulk delete accounts:', error)
1807-
appStore.showError(String(error))
1810+
appStore.showError(error.message || t('admin.accounts.bulkDeleteFailed'))
1811+
}
1812+
}
1813+
const handleBulkDeleteFiltered = async () => {
1814+
const filters = buildBulkEditFilterSnapshot()
1815+
const count = pagination.total || 0
1816+
if (count <= 0) {
1817+
appStore.showError(t('admin.accounts.bulkEdit.noSelection'))
1818+
return
1819+
}
1820+
if (!confirm(t('admin.accounts.bulkDeleteConfirm', { count }))) return
1821+
try {
1822+
const result = await adminAPI.accounts.bulkDelete({ filters })
1823+
const success = result.success || 0
1824+
const failed = result.failed || 0
1825+
if (success > 0 && failed === 0) {
1826+
appStore.showSuccess(t('admin.accounts.bulkDeleteSuccess', { count: success }))
1827+
clearSelection()
1828+
} else if (success > 0) {
1829+
appStore.showError(t('admin.accounts.bulkDeletePartial', { success, failed }))
1830+
} else {
1831+
appStore.showError(t('admin.accounts.bulkDeleteFailed'))
1832+
}
1833+
reload()
1834+
} catch (error: any) {
1835+
console.error('Failed to bulk delete filtered accounts:', error)
1836+
appStore.showError(error.message || t('admin.accounts.bulkDeleteFailed'))
1837+
18081838
}
18091839
}
18101840
const handleBulkResetStatus = async () => {

frontend/src/views/admin/SettingsView.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8272,7 +8272,7 @@
82728272
<div class="space-y-6 p-6">
82738273
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
82748274
<div>
8275-
8275+
82768276
<div class="form-group">
82778277
<label class="label">{{ t("admin.settings.smtp.provider") }}</label>
82788278
<select v-model="form.email_provider" class="input">
@@ -8918,7 +8918,7 @@ function emailApiUrlPlaceholder(provider: EmailProvider | string): string {
89188918

89198919
function effectiveEmailApiUrl(): string {
89208920
const url = (form.email_api_url || "").trim();
8921-
return url || defaultEmailApiUrl(form.email_provider);
8921+
return url || defaultEmailApiUrl(form.email_provider || "smtp");
89228922
}
89238923

89248924
const smtpPasswordManuallyEdited = ref(false);
@@ -9458,9 +9458,17 @@ type SettingsForm = Omit<
94589458
| "wechat_connect_open_enabled"
94599459
| "wechat_connect_mp_enabled"
94609460
| "wechat_connect_mobile_enabled"
9461+
| "email_provider"
9462+
| "email_api_url"
9463+
| "email_api_key"
9464+
| "email_api_key_configured"
94619465
> & {
94629466
/** Form always binds a concrete boolean (SystemSettings marks this optional). */
94639467
channel_monitor_hide_throughput: boolean;
9468+
email_provider: EmailProvider;
9469+
email_api_url: string;
9470+
email_api_key: string;
9471+
email_api_key_configured: boolean;
94649472
smtp_password: string;
94659473
turnstile_secret_key: string;
94669474
tencent_captcha_app_secret_key: string;
@@ -9591,6 +9599,7 @@ const form = reactive<SettingsForm>({
95919599
email_provider: "smtp" as EmailProvider,
95929600
email_api_url: "",
95939601
email_api_key: "",
9602+
email_api_key_configured: false,
95949603
smtp_host: "",
95959604
smtp_port: 587,
95969605
smtp_username: "",

0 commit comments

Comments
 (0)