fix(veesp): IP и характеристики VPS при синке, валюта аккаунта
Docker / build (push) Failing after 21s
Docker / build (push) Failing after 21s
Парсинг object-map ответов API (vms/ips), cpus, memory в МБ, IP-массив. Приоритет валюты аккаунта над baseCurrency хостера; поле в UI для Veesp. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -22,6 +22,7 @@ const EMPTY: ProviderAccountFormValues = {
|
||||
apiLogin: '',
|
||||
apiPassword: '',
|
||||
billingMode: 'monthly',
|
||||
currency: '',
|
||||
balanceAlertBelow: '',
|
||||
notes: '',
|
||||
}
|
||||
@@ -182,6 +183,21 @@ export function ProviderAccountEditSheet({
|
||||
]}
|
||||
/>
|
||||
</FormField>
|
||||
{provider?.apiType === 'veesp' ? (
|
||||
<FormField
|
||||
label="Валюта аккаунта"
|
||||
htmlFor="acc-cur"
|
||||
error={errors.currency?.message}
|
||||
description="USD, EUR и т.д. — у каждого аккаунта Veesp может быть своя валюта. Если пусто — берётся валюта хостера."
|
||||
>
|
||||
<Input
|
||||
id="acc-cur"
|
||||
placeholder="EUR"
|
||||
aria-invalid={!!errors.currency}
|
||||
{...register('currency')}
|
||||
/>
|
||||
</FormField>
|
||||
) : null}
|
||||
<FormField label="Порог низкого баланса" htmlFor="acc-alert" description="Уведомление на дашборде, если баланс API ниже">
|
||||
<Input
|
||||
id="acc-alert"
|
||||
|
||||
@@ -175,10 +175,10 @@ export function toIsoCurrency(currency?: string | null): string {
|
||||
}
|
||||
|
||||
export function effectiveVpsTariffCurrency(vps: Vps, provider?: Provider | null): string {
|
||||
const provRaw = (provider?.baseCurrency || '').trim()
|
||||
if (provRaw) return toIsoCurrency(provRaw)
|
||||
const ownRaw = (vps?.currency || '').trim()
|
||||
if (ownRaw) return toIsoCurrency(ownRaw)
|
||||
const provRaw = (provider?.baseCurrency || '').trim()
|
||||
if (provRaw) return toIsoCurrency(provRaw)
|
||||
return 'RUB'
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export const providerAccountSchema = z.object({
|
||||
apiLogin: z.string().optional().default(''),
|
||||
apiPassword: z.string().optional().default(''),
|
||||
billingMode: billingModeSchema.default('monthly'),
|
||||
currency: z.string().optional().default(''),
|
||||
balanceAlertBelow: z.union([z.coerce.number().min(0), z.literal('')]).optional(),
|
||||
notes: z.string().optional().default(''),
|
||||
})
|
||||
|
||||
@@ -164,6 +164,7 @@ function AccountsPage() {
|
||||
apiLogin: a.apiLogin ?? a.login ?? '',
|
||||
apiPassword: '',
|
||||
billingMode: a.billingMode ?? 'monthly',
|
||||
currency: a.currency ?? '',
|
||||
balanceAlertBelow: ext.balanceAlertBelow != null ? ext.balanceAlertBelow : '',
|
||||
notes: a.notes ?? '',
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user