diff --git a/backend/internal/handler/admin/account_handler.go b/backend/internal/handler/admin/account_handler.go index 358d71f6..cb3efff2 100644 --- a/backend/internal/handler/admin/account_handler.go +++ b/backend/internal/handler/admin/account_handler.go @@ -122,7 +122,7 @@ type UpdateAccountRequest struct { Priority *int `json:"priority"` RateMultiplier *float64 `json:"rate_multiplier"` LoadFactor *int `json:"load_factor"` - Status string `json:"status" binding:"omitempty,oneof=active inactive"` + Status string `json:"status" binding:"omitempty,oneof=active inactive error"` GroupIDs *[]int64 `json:"group_ids"` ExpiresAt *int64 `json:"expires_at"` AutoPauseOnExpired *bool `json:"auto_pause_on_expired"` diff --git a/frontend/src/components/account/EditAccountModal.vue b/frontend/src/components/account/EditAccountModal.vue index cf05a70d..148f95b6 100644 --- a/frontend/src/components/account/EditAccountModal.vue +++ b/frontend/src/components/account/EditAccountModal.vue @@ -1617,15 +1617,21 @@ const form = reactive({ load_factor: null as number | null, priority: 1, rate_multiplier: 1, - status: 'active' as 'active' | 'inactive', + status: 'active' as 'active' | 'inactive' | 'error', group_ids: [] as number[], expires_at: null as number | null }) -const statusOptions = computed(() => [ - { value: 'active', label: t('common.active') }, - { value: 'inactive', label: t('common.inactive') } -]) +const statusOptions = computed(() => { + const options = [ + { value: 'active', label: t('common.active') }, + { value: 'inactive', label: t('common.inactive') } + ] + if (form.status === 'error') { + options.push({ value: 'error', label: t('admin.accounts.status.error') }) + } + return options +}) const expiresAtInput = computed({ get: () => formatDateTimeLocal(form.expires_at), @@ -1651,7 +1657,7 @@ watch( form.load_factor = newAccount.load_factor ?? null form.priority = newAccount.priority form.rate_multiplier = newAccount.rate_multiplier ?? 1 - form.status = (newAccount.status === 'active' || newAccount.status === 'inactive') + form.status = (newAccount.status === 'active' || newAccount.status === 'inactive' || newAccount.status === 'error') ? newAccount.status : 'active' form.group_ids = newAccount.group_ids || [] @@ -2225,7 +2231,7 @@ const handleSubmit = async () => { if (!props.account) return const accountID = props.account.id - if (form.status !== 'active' && form.status !== 'inactive') { + if (form.status !== 'active' && form.status !== 'inactive' && form.status !== 'error') { appStore.showError(t('admin.accounts.pleaseSelectStatus')) return } diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index 243586bf..d6b91463 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -809,7 +809,7 @@ export interface UpdateAccountRequest { priority?: number rate_multiplier?: number // Account billing multiplier (>=0, 0 means free) schedulable?: boolean - status?: 'active' | 'inactive' + status?: 'active' | 'inactive' | 'error' group_ids?: number[] expires_at?: number | null auto_pause_on_expired?: boolean