From bc14a393350a9dec1e5dbd6110bc70d337ec39d9 Mon Sep 17 00:00:00 2001 From: Sanaei Date: Thu, 3 Dec 2026 18:54:40 +0330 Subject: [PATCH] fix(nodes): show the empty state when no node is registered An empty list page says so. ef99e675 (#7342) replaced the Ant Design table with a hand-rolled one and rendered it only when a remote node exists, so the Nodes page lost its "Nothing here yet" row and showed a blank body under the heading. The table now always renders its column headings, with the empty state as a row beneath them. The Master and All nodes rows stay hidden until a remote is registered; that part of #7342 was deliberate. The test that pinned "no table at all" asserted the regression together with the deliberate rule, so it now pins only the system rows. --- frontend/src/pages/nodes/NodeList.css | 11 ++ frontend/src/pages/nodes/NodeList.tsx | 115 ++++++++++-------- .../src/test/node-fleet-monitoring.test.tsx | 26 +++- 3 files changed, 98 insertions(+), 54 deletions(-) diff --git a/frontend/src/pages/nodes/NodeList.css b/frontend/src/pages/nodes/NodeList.css index e495fdfab..a3599f04e 100644 --- a/frontend/src/pages/nodes/NodeList.css +++ b/frontend/src/pages/nodes/NodeList.css @@ -172,6 +172,17 @@ border-radius: 12px; background: var(--node-card); } +/* Global class shared with the other list pages: re-declared here so a direct + /nodes load styles it, and kept identical so no page restyles another's. */ +.card-empty { + text-align: center; + color: var(--ant-color-text-secondary); + padding: 24px 12px; + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; +} .nodes-table-scroll { overflow-x: auto; container-type: inline-size; diff --git a/frontend/src/pages/nodes/NodeList.tsx b/frontend/src/pages/nodes/NodeList.tsx index 00da6117f..5bdb93761 100644 --- a/frontend/src/pages/nodes/NodeList.tsx +++ b/frontend/src/pages/nodes/NodeList.tsx @@ -16,6 +16,7 @@ import type { BadgeProps } from 'antd'; import { ApartmentOutlined, CloudDownloadOutlined, + ClusterOutlined, DeleteOutlined, EditOutlined, ExclamationCircleOutlined, @@ -667,6 +668,16 @@ export default function NodeList({ + {rows.length === 0 && ( + + +
+ +
{t('noData')}
+
+ + + )} {rows.map((row) => { const remote = row.kind === 'remote' ? row.node : undefined; const managed = remote && !remote.transitive ? remote : undefined; @@ -1049,58 +1060,58 @@ export default function NodeList({ {hasNodes && ( - <> -
- } - aria-label={t('search')} - placeholder={t('pages.nodes.fleet.searchNodes')} - allowClear - value={search} - onChange={(event) => setSearch(event.target.value)} - /> - } + aria-label={t('search')} + placeholder={t('pages.nodes.fleet.searchNodes')} + allowClear + value={search} + onChange={(event) => setSearch(event.target.value)} + /> +