feat(accounts): «Хостер / аккаунт» в журнале синхронизации; журнал баланса — только имя аккаунта
Made-with: Cursor
This commit is contained in:
@@ -1,10 +1,17 @@
|
|||||||
|
import { useMemo } from 'react'
|
||||||
import { EmptyState } from './EmptyState'
|
import { EmptyState } from './EmptyState'
|
||||||
import { formatSyncSummaryLine } from '../lib/inventory-health'
|
import { formatSyncSummaryLine } from '../lib/inventory-health'
|
||||||
|
import { accountSelectLabel } from '../lib/account-select-label'
|
||||||
|
|
||||||
export function SyncLogTable({ syncLog = [], providerAccounts = [] }) {
|
export function SyncLogTable({ syncLog = [], providerAccounts = [], providers = [] }) {
|
||||||
const getAccountName = (accountId) => {
|
const providerById = useMemo(
|
||||||
|
() => new Map((providers || []).map((p) => [p.id, p])),
|
||||||
|
[providers],
|
||||||
|
)
|
||||||
|
const labelForAccountId = (accountId) => {
|
||||||
const account = providerAccounts.find((a) => a.id === accountId)
|
const account = providerAccounts.find((a) => a.id === accountId)
|
||||||
return account?.name || accountId
|
if (!account) return accountId
|
||||||
|
return accountSelectLabel(account, providerById, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatDate = (dateStr) => {
|
const formatDate = (dateStr) => {
|
||||||
@@ -33,7 +40,7 @@ export function SyncLogTable({ syncLog = [], providerAccounts = [] }) {
|
|||||||
<table className="table card-table table-vcenter">
|
<table className="table card-table table-vcenter">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Аккаунт</th>
|
<th>Хостер / аккаунт</th>
|
||||||
<th>Начало</th>
|
<th>Начало</th>
|
||||||
<th>Окончание</th>
|
<th>Окончание</th>
|
||||||
<th>Статус</th>
|
<th>Статус</th>
|
||||||
@@ -46,7 +53,7 @@ export function SyncLogTable({ syncLog = [], providerAccounts = [] }) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{syncLog.map((row) => (
|
{syncLog.map((row) => (
|
||||||
<tr key={row.id || `${row.accountId}-${row.startedAt}`}>
|
<tr key={row.id || `${row.accountId}-${row.startedAt}`}>
|
||||||
<td>{getAccountName(row.accountId)}</td>
|
<td>{labelForAccountId(row.accountId)}</td>
|
||||||
<td>{formatDate(row.startedAt)}</td>
|
<td>{formatDate(row.startedAt)}</td>
|
||||||
<td>{formatDate(row.finishedAt)}</td>
|
<td>{formatDate(row.finishedAt)}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -449,7 +449,11 @@ export function AccountsPage({ db, actions, settings, ratesData }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-12 mt-3">
|
<div className="col-12 mt-3">
|
||||||
<SyncLogTable syncLog={syncLog} providerAccounts={db.providerAccounts} />
|
<SyncLogTable
|
||||||
|
syncLog={syncLog}
|
||||||
|
providerAccounts={db.providerAccounts}
|
||||||
|
providers={db.providers}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -152,11 +152,7 @@ export function BalancePage({ db, actions, settings, ratesData }) {
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>{account?.name || '-'}</div>
|
||||||
{account
|
|
||||||
? accountSelectLabel(account, providerById, '')
|
|
||||||
: '-'}
|
|
||||||
</div>
|
|
||||||
<div className="text-secondary">{vps?.dns || vps?.ip || '-'}</div>
|
<div className="text-secondary">{vps?.dns || vps?.ip || '-'}</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user