diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index e017520..2699063 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -1,4 +1,4 @@ -import { useQueryClient } from '@tanstack/react-query' +import { useQueryClient } from '@tanstack/react-query' import { Alert, Button, @@ -24,10 +24,10 @@ import { useTags } from '../api/tags' import { useDashboardMonitorSSE } from '../hooks/useDashboardMonitorSSE' 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 == 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)}м` } function scopeToSearch(scope: DashboardScope): string { @@ -91,9 +91,9 @@ export function HomePage() { const handleRunNow = async () => { try { await runNow.mutateAsync({ ...scope, force: true }) - message.success(' ') + message.success('Мониторинг запущен') } catch { - message.error(' ') + message.error('Не удалось запустить мониторинг') } } @@ -203,13 +203,13 @@ export function HomePage() { NOC Dashboard - SLA, , + SLA, покрытие мониторингом, инциденты и очередь действий - + @@ -219,7 +219,7 @@ export function HomePage() { ({ value: c, label: c }))} @@ -240,7 +240,7 @@ export function HomePage() { - - - - - - + + + + + + {monitorStatus?.last_error ? : null} @@ -276,9 +276,9 @@ export function HomePage() { - + {incidentObjects.length === 0 ? ( - + ) : ( navigate(`/home/objects/${item.object_id}${scopeToSearch(scope)}`)}> - + Открыть , ]} > @@ -301,17 +301,17 @@ export function HomePage() { title={ {item.object_name} - {item.city ?? ''} - {item.client ?? ''} - health {item.health_score ?? ''} + {item.city ?? '—'} + {item.client ?? '—'} + health {item.health_score ?? '—'} } description={ - } wrap> + •} wrap> offline: {offline} unknown: {unknown} disk warn/failed: {diskWarn}/{diskFailed} - : {item.device_count} + устройств: {item.device_count} age ping: {formatAge(ping?.max_age_sec)} } @@ -323,15 +323,15 @@ export function HomePage() { )} - + {stalePingObjects.length === 0 ? ( - + ) : ( ( - navigate(`/home/objects/${item.obj.object_id}${scopeToSearch(scope)}`)}>]}> + navigate(`/home/objects/${item.obj.object_id}${scopeToSearch(scope)}`)}>Открыть]}> {item.obj.object_name} @@ -351,28 +351,28 @@ export function HomePage() { - +
- (online) - {availabilityPct != null ? `${availabilityPct}%` : ''} + Доступность (online) + {availabilityPct != null ? `${availabilityPct}%` : '—'}
- - {coveragePct != null ? `${coveragePct}%` : ''} + Покрытие мониторингом + {coveragePct != null ? `${coveragePct}%` : '—'}
- - {freshnessPct != null ? `${freshnessPct}%` : ''} + Свежесть данных + {freshnessPct != null ? `${freshnessPct}%` : '—'}
@@ -381,16 +381,16 @@ export function HomePage() { online: {onlineTotal} offline: {offlineTotal} unknown: {unknownTotal} - ping: {monitoredTotal} + по ping: {monitoredTotal}
- + - {monitorStatus?.status ?? '-'} - {summary?.included_count ?? totals.allowed_objects} - {monitorStatus?.last_success_at ? dayjs(monitorStatus.last_success_at).format('DD.MM HH:mm:ss') : ''} + Статус{monitorStatus?.status ?? '-'} + Объекты в мониторинге{summary?.included_count ?? totals.allowed_objects} + Последний успех{monitorStatus?.last_success_at ? dayjs(monitorStatus.last_success_at).format('DD.MM HH:mm:ss') : '—'} {lastCounts ? ( @@ -405,7 +405,7 @@ export function HomePage() { {actionQueue.length === 0 ? ( - + ) : ( navigate(`/home/objects/${row.obj.object_id}${scopeToSearch(scope)}`)}> - + Открыть , ]} > @@ -427,7 +427,7 @@ export function HomePage() {
- {row.reasons.join(' ')} + {row.reasons.join(' • ')} )} @@ -440,3 +440,4 @@ export function HomePage() { ) } +