From f58a6f13f95f1f337cb9274b39d539b541ddcba2 Mon Sep 17 00:00:00 2001 From: dv Date: Tue, 5 May 2026 15:02:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BA=D0=BE=D0=B4=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D0=B0=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/HomeObjectDetail.tsx | 77 +++++++++++++------------ 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/frontend/src/pages/HomeObjectDetail.tsx b/frontend/src/pages/HomeObjectDetail.tsx index 69acba5..0535423 100644 --- a/frontend/src/pages/HomeObjectDetail.tsx +++ b/frontend/src/pages/HomeObjectDetail.tsx @@ -18,12 +18,12 @@ import { useDashboardMonitorSSE } from '../hooks/useDashboardMonitorSSE' function reasonLabel(reason: string): string { const map: Record = { - object_include_policy: ' ', - object_exclude_policy: ' ', - inherit_default: ' ', - tag_policy_enabled: ' ', - tag_policy_disabled: ' ', - scope_filtered: ' ', + object_include_policy: 'Включен политикой объекта', + object_exclude_policy: 'Исключен политикой объекта', + inherit_default: 'Наследование по умолчанию', + tag_policy_enabled: 'Включен политикой тегов', + tag_policy_disabled: 'Исключен политикой тегов', + scope_filtered: 'Вне текущего фильтра', } return map[reason] ?? reason } @@ -58,9 +58,9 @@ function healthColor(score: number | null | undefined): string { function formatAge(seconds: number | null | undefined): string { if (seconds == null) return '-' - if (seconds < 60) return `${seconds}` - if (seconds < 3600) return `${Math.floor(seconds / 60)}` - return `${Math.floor(seconds / 3600)} ${Math.floor((seconds % 3600) / 60)}` + if (seconds < 60) return `${seconds}с` + if (seconds < 3600) return `${Math.floor(seconds / 60)}м` + return `${Math.floor(seconds / 3600)}ч ${Math.floor((seconds % 3600) / 60)}м` } function uptimeColor(point: DashboardAvailabilityPoint): string { @@ -71,7 +71,7 @@ function uptimeColor(point: DashboardAvailabilityPoint): string { function UptimeBars({ points, compact = false }: { points: DashboardAvailabilityPoint[]; compact?: boolean }) { if (!points.length) { - return + return Нет точек в выбранном окне } return ( @@ -80,7 +80,7 @@ function UptimeBars({ points, compact = false }: { points: DashboardAvailability {points.map((point, idx) => (
online offline - + нет данных ) : null}
@@ -158,15 +158,15 @@ export function HomeObjectDetailPage() { warn += 1 } - const rackName = row.rack_name && row.rack_name.trim() ? row.rack_name : ' ' + const rackName = row.rack_name && row.rack_name.trim() ? row.rack_name : 'Без стойки' if (!byRack.has(rackName)) byRack.set(rackName, []) byRack.get(rackName)?.push(row) } const rackGroups = Array.from(byRack.entries()) .sort((a, b) => { - if (a[0] === ' ') return 1 - if (b[0] === ' ') return -1 + if (a[0] === 'Без стойки') return 1 + if (b[0] === 'Без стойки') return -1 return a[0].localeCompare(b[0]) }) .map(([rack, rowsInRack]) => ({ @@ -194,13 +194,13 @@ export function HomeObjectDetailPage() { {row.ip} - {row.hostname ?? ''} + {row.hostname ?? '—'} ), }, { - title: '', + title: 'Категория', dataIndex: 'category', key: 'category', width: 130, @@ -213,8 +213,8 @@ export function HomeObjectDetailPage() { {row.ping_status} - {row.ping_checked_at ? dayjs(row.ping_checked_at).format('DD.MM HH:mm:ss') : ''} - {row.last_ping_ms != null ? ` ${row.last_ping_ms}ms` : ''} + {row.ping_checked_at ? dayjs(row.ping_checked_at).format('DD.MM HH:mm:ss') : '—'} + {row.last_ping_ms != null ? ` • ${row.last_ping_ms}ms` : ''} ), @@ -227,24 +227,24 @@ export function HomeObjectDetailPage() { const availability = availabilityByDevice.get(Number(row.device_id)) if (availabilityLoading) { - return ... + return Загрузка... } if (!availability?.points?.length) { - return + return Нет данных } return ( - {availability.availability != null ? `${availability.availability}%` : ''} + {availability.availability != null ? `${availability.availability}%` : '—'} ) }, }, { - title: '', + title: 'Свежесть', key: 'freshness', width: 110, render: (_, row) => {formatAge(row.ping_age_sec)}, @@ -260,14 +260,14 @@ export function HomeObjectDetailPage() { {row.disk_max_pct != null ? ` (${row.disk_max_pct}%)` : ''} ) : ( - '' + '—' ), }, { - title: '', + title: 'Проблема', key: 'problem', width: 100, - render: (_, row) => (row.has_problem ? : ), + render: (_, row) => (row.has_problem ? Да : Нет), }, ] @@ -277,18 +277,18 @@ export function HomeObjectDetailPage() { - {object?.object_name ?? ` #${objectId}`} + {object?.object_name ?? `Объект #${objectId}`} - {object?.allowed ? : } + {object?.allowed ? В мониторинге : Вне мониторинга} health {object?.health_score ?? '-'} - {window} + окно {window} @@ -304,14 +304,14 @@ export function HomeObjectDetailPage() { type="info" showIcon style={{ marginBottom: 12 }} - message=" . ." + message="По части устройств данных пока недостаточно. Для новых объектов это нормально." /> ) : null} - + Устройств {summary?.totals.devices ?? 0} @@ -319,7 +319,7 @@ export function HomeObjectDetailPage() { - + Проблемных {summary?.totals.problem_devices ?? 0} @@ -344,7 +344,7 @@ export function HomeObjectDetailPage() { setWindow(v as DashboardAvailabilityWindow)} options={[ - { value: '24h', label: '24' }, - { value: '3d', label: '3' }, - { value: '7d', label: '7' }, + { value: '24h', label: '24ч' }, + { value: '3d', label: '3д' }, + { value: '7d', label: '7д' }, ]} style={{ width: 120 }} /> } > {!grouped.rackGroups.length ? ( - + ) : ( {grouped.rackGroups.map((rackGroup) => ( @@ -388,3 +388,4 @@ export function HomeObjectDetailPage() { ) } +