From 51974b2669321448dd78014924c2b914f3ae4d53 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Sat, 21 Mar 2026 00:27:37 +0700 Subject: [PATCH] fix(vps): disambiguate account filter labels across hosters Made-with: Cursor --- src/pages/VpsPage.jsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/pages/VpsPage.jsx b/src/pages/VpsPage.jsx index 4316bc0..6221338 100644 --- a/src/pages/VpsPage.jsx +++ b/src/pages/VpsPage.jsx @@ -76,6 +76,14 @@ function loadFilterPresets() { } } +/** Подпись аккаунта в select: при фильтре по одному хостеру — только имя, иначе «хостер / аккаунт». */ +function accountSelectLabel(account, providerById, scopedProviderId) { + const name = account.name?.trim() || '—' + if (scopedProviderId) return name + const providerName = providerById.get(account.providerId)?.name ?? '—' + return `${providerName} / ${name}` +} + function vpsMonthlyEstimateInBase(item, baseCurrency, ratesData) { if (item.status !== 'active') return 0 const tariffType = item.tariffType || (Number(item.dailyRate || 0) > 0 ? 'daily' : 'monthly') @@ -135,6 +143,11 @@ export function VpsPage({ db, actions, settings, ratesData }) { () => db.providerAccounts.filter((a) => a.apiType === 'billmanager' && a.apiBaseUrl), [db.providerAccounts], ) + + const providerById = useMemo( + () => new Map(db.providers.map((p) => [p.id, p])), + [db.providers], + ) const [filters, setFilters] = useState({ search: '', providerId: '', @@ -742,7 +755,7 @@ export function VpsPage({ db, actions, settings, ratesData }) { {accountFilterOptions.map((account) => ( ))} @@ -1452,7 +1465,7 @@ export function VpsPage({ db, actions, settings, ratesData }) { {accountOptions.map((account) => ( ))}