From 2373ed388bc491fb2107025dd41cb5248c497770 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Fri, 10 Apr 2026 01:02:05 +0700 Subject: [PATCH] Replace KpiTrendCard with KpiStatCard for incident metrics display, enhancing visual consistency and user experience. Update empty state messages in the data table and adjust layout properties for improved responsiveness. --- web/src/routes/incidents/+page.svelte | 79 ++++++++++++--------------- 1 file changed, 34 insertions(+), 45 deletions(-) diff --git a/web/src/routes/incidents/+page.svelte b/web/src/routes/incidents/+page.svelte index 69684ac..a3102bf 100644 --- a/web/src/routes/incidents/+page.svelte +++ b/web/src/routes/incidents/+page.svelte @@ -10,11 +10,10 @@ type IncidentsData } from '$lib/api/client.js'; import * as Card from '$lib/components/ui/card/index.js'; - import KpiTrendCard from '$lib/components/kpi-trend-card.svelte'; + import KpiStatCard from '$lib/components/kpi-stat-card.svelte'; import DataTableCard from '$lib/components/data-table/data-table-card.svelte'; import DataTableToolbar from '$lib/components/data-table/data-table-toolbar.svelte'; import SortableTh from '$lib/components/data-table/sortable-th.svelte'; - import TableEmpty from '$lib/components/data-table/table-empty.svelte'; import { ScrollArea } from '$lib/components/ui/scroll-area/index.js'; import SearchIcon from '@lucide/svelte/icons/search'; import { nextSortDir, compareStrings, compareNum, type SortDir } from '$lib/table-sort.js'; @@ -31,6 +30,9 @@ import FleetRefreshInput from '$lib/components/fleet/fleet-refresh-input.svelte'; import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw'; import InfoIcon from '@lucide/svelte/icons/info'; + import SirenIcon from '@lucide/svelte/icons/siren'; + import TriangleAlertIcon from '@lucide/svelte/icons/triangle-alert'; + import InfoIconBadge from '@lucide/svelte/icons/info'; type TriageState = { ack?: boolean; @@ -56,9 +58,6 @@ let staleTimer: ReturnType | null = null; let triageById = $state>({}); - type IncKpiPrev = { critical: number; warning: number; info: number }; - let kpiPrev = $state(null); - let incSearch = $state(''); let incSortKey = $state<'sev' | 'title' | null>(null); let incSortDir = $state(null); @@ -153,18 +152,9 @@ err = null; try { const activeAlias = aliasOverride ?? aliasFilter; - const prev = - data != null - ? { - critical: data.critical_total ?? 0, - warning: data.warning_total ?? 0, - info: data.info_total ?? 0 - } - : null; const env = await fetchAggIncidents({ aliases: activeAlias === 'all' ? undefined : activeAlias }); - kpiPrev = prev; data = env.data ?? null; partial = !!env.partial; generatedAt = env.generated_at; @@ -336,29 +326,24 @@ {/snippet} {#snippet children()}
- - - + + {#snippet icon()} + + + {#snippet icon()} + + + {#snippet icon()} +
@@ -382,7 +367,7 @@ >Сброс {/snippet} - + @@ -419,14 +404,14 @@ {#if (data?.items.length ?? 0) === 0} - - + + Инцидентов нет {:else if filteredIncidents.length === 0} - - + + Нет строк по фильтру {:else} @@ -456,22 +441,26 @@ {/each} - + {@const triage = triageFor(item.id)}