From bfe20c1fe08a25045292436b9740034964465e79 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Wed, 20 May 2026 14:27:21 +0700 Subject: [PATCH] feat(web): enhance overview page with improved state management and UI components - Refactored state management for modules, revisions, peers, speakers, and jobs, enhancing loading and error handling. - Updated imports to utilize core UI components for better maintainability and consistency. - Introduced derived states for KPI cards, providing real-time insights into system metrics. - Improved loading function to fetch data efficiently and handle errors gracefully. - Enhanced UI layout with new icons and dynamic descriptions based on last updated timestamps. --- .../overview/OverviewRecentJobsCard.svelte | 94 +++++ .../OverviewRecentRevisionsCard.svelte | 89 +++++ web/src/routes/+page.svelte | 359 ++++++++++++------ 3 files changed, 420 insertions(+), 122 deletions(-) create mode 100644 web/src/lib/components/overview/OverviewRecentJobsCard.svelte create mode 100644 web/src/lib/components/overview/OverviewRecentRevisionsCard.svelte diff --git a/web/src/lib/components/overview/OverviewRecentJobsCard.svelte b/web/src/lib/components/overview/OverviewRecentJobsCard.svelte new file mode 100644 index 0000000..b5b8769 --- /dev/null +++ b/web/src/lib/components/overview/OverviewRecentJobsCard.svelte @@ -0,0 +1,94 @@ + + + + +
+ Последние задачи + Фоновые задачи ingest, refresh и apply +
+ +
+ + j.job_id} + loading={initialLoading || loading} + {error} + emptyTitle="Нет задач" + emptyDescription="Задачи появятся после refresh или деплоя." + > + {#snippet cell({ row: j, column })} + {#if column.id === 'kind'} + {jobKindTitle(j, moduleNameById)} + {:else if column.id === 'status'} + {jobStatusRu(j.status)} + {:else if column.id === 'created'} + + {formatDateTime(j.created_at)} + + {:else if column.id === 'actions'} + + {/if} + {/snippet} + + +
diff --git a/web/src/lib/components/overview/OverviewRecentRevisionsCard.svelte b/web/src/lib/components/overview/OverviewRecentRevisionsCard.svelte new file mode 100644 index 0000000..acc788b --- /dev/null +++ b/web/src/lib/components/overview/OverviewRecentRevisionsCard.svelte @@ -0,0 +1,89 @@ + + + + +
+ Последние ревизии + Снимки конфигурации BIRD после обновления модулей +
+ +
+ + rev.id} + loading={initialLoading || loading} + {error} + 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 === 'actions'} + + {/if} + {/snippet} + + +
diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 0c80c80..7dd7636 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -1,25 +1,36 @@
+ > + {#snippet actions()} + + {/snippet} + - - - - {#if healthy === null} -
- Проверка… - {:else if healthy} - - API работает - {:else} - - API недоступен - {/if} -
-
+ + + Панель управления EvoBGP + + Сводка по модулям, сети и фоновым задачам. Настройка префиксов — на странице + , деплой и + ревизии — + , + здоровье системы — + . + + + + {#if healthy === null} + + + Проверка API… + Запрос к /v1/health + + {:else if healthy} + + + API работает + Сервер отвечает на запросы health-check. + + {:else} + + + API недоступен + + Не удалось получить ответ от сервера. Проверьте подключение и статус API. + + + {/if} -
- {#each stats as stat (stat.label)} - {@const Icon = stat.icon} - {@const a = stat.accent} - - -
- - - {stat.label} - - -
- - {loading ? '—' : stat.value} - -
- -

{stat.description}

-
-
- {/each} + {#if initialLoading} + {#each Array(5) as _, i (i)} + + {/each} + {:else} + {#each kpiCards as card (card.id)} + {@const Icon = card.icon} + {@const a = card.accent} + + +
+ + + {card.label} + + +
+ {card.value} +
+ + {card.badge} +

{card.description}

+
+
+ {/each} + {/if} +
+ +
+ +
- - + Быстрые действия + Частые переходы к настройке и деплою - - - - - - + + + + + +