diff --git a/web/src/lib/components/operations/OperationsDiffTab.svelte b/web/src/lib/components/operations/OperationsDiffTab.svelte index 329b143..7379ca8 100644 --- a/web/src/lib/components/operations/OperationsDiffTab.svelte +++ b/web/src/lib/components/operations/OperationsDiffTab.svelte @@ -1,13 +1,15 @@ @@ -61,55 +76,45 @@ - -
- - - - ID - Создана - Префиксов - Хэш - - - - - {#each revisions as rev (rev.id)} - - {rev.id.slice(0, 8)}… - {formatDate(rev.created_at)} - {rev.materialized_prefix_count} - {rev.content_hash.slice(0, 12)}… - -
- - - -
-
-
- {:else} - - - {revLoading ? 'Загрузка…' : 'Нет ревизий'} - - - {/each} -
-
-
+ + rev.id} + loading={revLoading} + emptyTitle="Нет ревизий" + emptyDescription="Ревизии появятся после обновления модулей." + > + {#snippet cell({ row: rev, column })} + {#if column.id === 'id'} + {rev.id.slice(0, 8)}… + {:else if column.id === 'created'} + {formatDateTime(rev.created_at)} + {:else if column.id === 'prefixes'} + {rev.materialized_prefix_count} + {:else if column.id === 'hash'} + {rev.content_hash.slice(0, 12)}… + {:else if column.id === 'actions'} +
+ + + +
+ {/if} + {/snippet} +
diff --git a/web/src/lib/components/operations/job-report-table-block.svelte b/web/src/lib/components/operations/job-report-table-block.svelte index 3d43ff3..7df6ee9 100644 --- a/web/src/lib/components/operations/job-report-table-block.svelte +++ b/web/src/lib/components/operations/job-report-table-block.svelte @@ -6,9 +6,9 @@ getCoreRowModel, getPaginationRowModel } from '@tanstack/table-core'; - import { createSvelteTable, FlexRender } from '$lib/components/ui/data-table/index.js'; - import * as Table from '$lib/components/ui/table/index.js'; - import { Button } from '$lib/components/ui/button/index.js'; + import { createSvelteTable, FlexRender } from '$lib/ui/core/data-table/index.js'; + import * as Table from '$lib/ui/core/table/index.js'; + import { Button } from '$lib/ui/core/button/index.js'; type Props = { rows: RowData[]; diff --git a/web/src/lib/ui-labels.ts b/web/src/lib/ui-labels.ts index f7be516..79ca37d 100644 --- a/web/src/lib/ui-labels.ts +++ b/web/src/lib/ui-labels.ts @@ -1,5 +1,3 @@ -/** Русские подписи для enum из API (задачи, модули, логи refresh). */ - export function jobStatusRu(status: string): string { switch (status) { case 'queued': @@ -17,6 +15,18 @@ export function jobStatusRu(status: string): string { } } +/** Variant Badge для статуса задачи (shadcn). */ +export function jobStatusBadgeVariant( + status: string +): 'default' | 'secondary' | 'outline' | 'destructive' { + const lower = status.toLowerCase(); + if (lower === 'succeeded') return 'default'; + if (lower === 'running' || lower === 'queued') return 'secondary'; + if (lower === 'failed' || lower === 'error' || lower === 'canceled' || lower === 'cancelled') + return 'destructive'; + return 'outline'; +} + /** Подпись типа задачи для фильтров (значения API те же). */ export function jobKindFilterRu(kind: string): string { switch (kind) { diff --git a/web/src/lib/ui/app/layout/nav.ts b/web/src/lib/ui/app/layout/nav.ts index 35e4d90..e7a9e7a 100644 --- a/web/src/lib/ui/app/layout/nav.ts +++ b/web/src/lib/ui/app/layout/nav.ts @@ -7,8 +7,6 @@ import Gauge from '@lucide/svelte/icons/gauge'; import LayoutDashboard from '@lucide/svelte/icons/layout-dashboard'; import Network from '@lucide/svelte/icons/network'; import Settings from '@lucide/svelte/icons/settings'; -import Zap from '@lucide/svelte/icons/zap'; - export type NavItem = { href: string; label: string; @@ -20,8 +18,7 @@ export const mainNav: NavItem[] = [ { href: '/modules', label: 'Модули', icon: Boxes }, { href: '/directories', label: 'Справочники', icon: BookOpen }, { href: '/network', label: 'Сеть', icon: Network }, - { href: '/revisions', label: 'Ревизии', icon: Activity }, - { href: '/operations', label: 'Операции', icon: Zap }, + { href: '/operations', label: 'Ревизии', icon: Activity }, { href: '/schedule', label: 'Расписание', icon: CalendarClock }, { href: '/monitoring', label: 'Мониторинг', icon: Gauge } ]; diff --git a/web/src/routes/operations/+page.svelte b/web/src/routes/operations/+page.svelte index 6945713..4ea2a4f 100644 --- a/web/src/routes/operations/+page.svelte +++ b/web/src/routes/operations/+page.svelte @@ -1,5 +1,8 @@ diff --git a/web/src/routes/schedule/+page.svelte b/web/src/routes/schedule/+page.svelte index b944e6f..6fd25a3 100644 --- a/web/src/routes/schedule/+page.svelte +++ b/web/src/routes/schedule/+page.svelte @@ -9,7 +9,7 @@ moduleTypeBadgeVariant } from '$lib/modules/display.js'; import { jobKindTitle } from '$lib/operations/job-kind-label.js'; - import { jobStatusRu, moduleTypeRu } from '$lib/ui-labels.js'; + import { jobStatusRu, jobStatusBadgeVariant, moduleTypeRu } from '$lib/ui-labels.js'; import { Badge } from '$lib/ui/core/badge/index.js'; import { Button } from '$lib/ui/core/button/index.js'; import { @@ -158,14 +158,6 @@ } ]); - function jobStatusVariant(s: string): 'default' | 'secondary' | 'outline' | 'destructive' { - const lower = s.toLowerCase(); - if (lower === 'succeeded') return 'default'; - if (lower === 'running' || lower === 'queued') return 'secondary'; - if (lower === 'failed' || lower === 'error' || lower === 'canceled') return 'destructive'; - return 'outline'; - } - function truncateError(error: string | null | undefined, max = 120): string { if (!error) return ''; return error.length > max ? `${error.slice(0, max)}…` : error; @@ -385,7 +377,7 @@ {#if column.id === 'kind'} {jobKindTitle(j, moduleNameById)} {:else if column.id === 'status'} - {jobStatusRu(j.status)} + {jobStatusRu(j.status)} {:else if column.id === 'created'} {formatDateTime(j.created_at)}