diff --git a/frontend/src/pages/nodes/NodeList.css b/frontend/src/pages/nodes/NodeList.css index a3599f04e..425852ebd 100644 --- a/frontend/src/pages/nodes/NodeList.css +++ b/frontend/src/pages/nodes/NodeList.css @@ -1,179 +1,15 @@ -@font-face { - font-family: 'Source Sans Pro'; - src: url('./fonts/SourceSansPro-Regular.woff2') format('woff2'); - font-weight: 400; - font-display: swap; -} -@font-face { - font-family: 'Source Sans Pro'; - src: url('./fonts/SourceSansPro-Semibold.woff2') format('woff2'); - font-weight: 600; - font-display: swap; -} -@font-face { - font-family: 'Source Sans Pro'; - src: url('./fonts/SourceSansPro-Bold.woff2') format('woff2'); - font-weight: 700; - font-display: swap; -} -.nodes-page.is-dark:not(.is-ultra) { - --bg-page: #1c1e23; -} - -@media (min-width: 769px) { - .nodes-page .ant-sidebar:not(.sidebar-pinned) { - --sider-rail: 69px !important; - } - - .nodes-page .ant-sidebar:not(.sidebar-pinned) .ant-layout-sider-collapsed { - flex-basis: 69px !important; - width: 69px !important; - min-width: 69px !important; - max-width: 69px !important; - } - - .nodes-page .content-area { - padding-inline-start: 23px; - } -} .nodes-overview { - --node-fg: var(--node-text); - --node-secondary: var(--node-muted); - --node-card: var(--node-surface); - --node-field: var(--node-header-bg); - --node-line: var(--node-border); - --node-fleet: var(--node-fleet-bg); - --node-button: var(--node-accent); - --node-add-bg: #1269eb; - --node-link: #185ea8; - --node-good: #317a19; - --node-bad: #b42e35; - --node-purple: #722ed1; - --node-group-bg: #ebedf0; - --node-active-bg: #eef6e9; - --node-disabled-bg: #eeeff2; - --node-depleted-bg: #f9ebeb; - --node-online-bg: #e7f0fa; min-width: 0; - font: - 400 13px/1.25 'Source Sans Pro', - system-ui, - sans-serif; - color: var(--node-fg); } -.dark .nodes-overview, -.nodes-page.is-dark:not(.is-ultra) .nodes-overview { - --node-fg: #d6d9e0; - --node-secondary: #9296a0; - --node-card: #23252b; - --node-field: #2b2d32; - --node-line: #353841; - --node-fleet: #252b34; - --node-button: #1677ff; - --node-link: #8cb8ff; - --node-good: #66b740; - --node-bad: #eb6469; - --node-purple: #bb9df5; - --node-group-bg: #30333b; - --node-active-bg: #172d12; - --node-disabled-bg: #37393e; - --node-depleted-bg: #401a1c; - --node-online-bg: #102d4b; -} -.nodes-heading, -.nodes-toolbar, -.nodes-footnote { +/* card-toolbar and card-empty are global classes owned by lazily-loaded page + stylesheets: re-declared so a direct /nodes load is styled like the others. */ +.nodes-card .card-toolbar { display: flex; align-items: center; - gap: 12px; - margin-inline-start: 12px; -} -.nodes-heading { - align-items: start; - justify-content: space-between; - margin-block-end: 21px; -} -.nodes-heading h1 { - margin: 0; - font: - 600 25px/34px 'Source Sans Pro', - system-ui, - sans-serif; -} -.nodes-heading p { - margin: 1px 0 0; - color: var(--node-secondary); - font-size: 13px; - line-height: 21px; -} -.nodes-heading-actions { - display: flex; - gap: 12px; - padding-block-start: 4px; -} -.nodes-heading .ant-btn, -.nodes-toolbar .ant-btn { - font-family: inherit; - border-radius: 7px; -} -.nodes-heading .ant-btn { - height: 38px; -} -.nodes-heading .nodes-add { - width: 138px; - background: var(--node-add-bg); - font-weight: 600; -} -.nodes-heading .nodes-add:hover { - background: #145fd1; -} -.nodes-heading .nodes-mtls { - width: 145px; - background: var(--node-card); - border-color: var(--node-line); -} -.nodes-toolbar { - min-height: 36px; - margin-block-end: 13px; + gap: 8px; flex-wrap: wrap; + padding: 6px 0; } -.nodes-toolbar .ant-input-affix-wrapper { - width: min(278px, 100%); -} -.nodes-toolbar .ant-input-affix-wrapper, -.nodes-toolbar .ant-select { - height: 36px; - border-radius: 7px; - font: inherit; - color: var(--node-fg); - background: var(--node-field); - border-color: var(--node-line); -} -.nodes-toolbar .ant-input::placeholder, -.nodes-toolbar .ant-input-prefix, -.node-registered { - color: var(--node-secondary); -} -.nodes-toolbar .ant-input { - font: inherit; -} -.nodes-toolbar .ant-select { - width: 148px; -} -.nodes-toolbar .ant-select-selector { - background: transparent; -} -.node-registered { - margin-inline-start: auto; -} -.nodes-table-card { - padding: 15px 11px 30px; - border: 1px solid var(--node-line); - 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); @@ -183,86 +19,42 @@ align-items: center; gap: 8px; } +.nodes-card .nodes-search { + width: min(220px, 100%); +} +.nodes-card .nodes-status-filter { + width: 150px; +} +.node-registered { + margin-inline-start: auto; + color: var(--ant-color-text-secondary); + font-weight: 400; +} + .nodes-table-scroll { - overflow-x: auto; container-type: inline-size; } -.node-fleet-table { - width: 100%; - min-width: 920px; - table-layout: fixed; - border-spacing: 0; - color: var(--node-fg); +/* Not the Table `scroll` prop: its hidden measure row repeats the header's + select-all button, a focusable control inside aria-hidden content. */ +.nodes-table .ant-table-content { + overflow-x: auto; } -.node-fleet-table th, -.node-fleet-table td { - padding: 0 8px; - text-align: start; - vertical-align: middle; - overflow-wrap: anywhere; +.nodes-table .ant-table-content > table { + width: max-content; + min-width: 100%; } -.node-fleet-table thead th { - height: 44px; - padding-inline: 1px; - background: var(--node-field); - color: var(--node-secondary); +.nodes-table .ant-table-tbody > tr > th.node-name-cell { + background: transparent; + font-weight: inherit; +} +.nodes-table .ant-table-tbody > tr.node-row-fleet > .ant-table-cell { + background: var(--ant-color-fill-quaternary); +} +.nodes-table .node-enabled { text-align: center; - font-size: 12px; - font-weight: 600; -} -.node-fleet-table thead th:nth-child(6), -.node-fleet-table thead th:nth-child(8) { - font-weight: 700; -} -.node-fleet-table thead th:first-child { - border-start-start-radius: 8px; - border-end-start-radius: 8px; -} -.node-fleet-table thead th:last-child { - border-start-end-radius: 8px; - border-end-end-radius: 8px; -} -.node-fleet-table tbody > tr:not(.node-history-row) { - height: 70px; -} -.node-fleet-table td, -.node-fleet-table .node-name-cell { - border-block-end: 1px solid var(--node-line); -} -.node-row-remote > td:first-child { - padding-inline-end: 0; -} -.node-fleet-table .node-enabled { - text-align: center; - color: var(--node-secondary); -} -.node-fleet-table .node-enabled .ant-switch { - min-width: 34px; - height: 18px; -} -.node-fleet-table .node-enabled .ant-switch-handle { - width: 14px; - height: 14px; -} -.node-fleet-table .node-enabled .ant-switch.ant-switch-checked { - background: var(--node-button); -} -.node-row-fleet > * { - background: var(--node-fleet); -} -.node-row-fleet td:first-child { - box-shadow: inset 3px 0 var(--node-button); -} -.node-row-fleet > td:nth-child(5) { - padding-inline-end: 2px; -} -[dir='rtl'] .node-row-fleet td:first-child { - box-shadow: inset -3px 0 var(--node-button); } .node-actions-heading, .node-readonly-action, -.node-icon-action, -.node-expander, .node-status-button { border: 0; padding: 0; @@ -271,74 +63,23 @@ font: inherit; cursor: pointer; } -.node-actions, -.node-system-action, -.node-status-button { +.node-actions { display: flex; align-items: center; -} -.node-actions { - flex-wrap: wrap; - row-gap: 3px; + gap: 2px; } .node-actions > .ant-checkbox-wrapper { - margin-inline: 8px 5px; + margin-inline: 4px; } -.node-actions .ant-checkbox-inner { - width: 16px; - height: 16px; - background: var(--node-card); - border-color: #636b7b; -} -.node-actions .ant-checkbox-checked .ant-checkbox-inner { - background: var(--node-button); - border-color: var(--node-button); -} -.node-system-action { - gap: 12px; - padding-inline-start: 9px; - color: var(--node-secondary); -} -.node-system-badge { - min-width: 52px; - padding: 4px 12px; - border-radius: 4px; - color: var(--node-fg); - background: var(--node-group-bg); - font-size: 10px; - font-weight: 600; - text-align: center; - text-transform: uppercase; +.node-readonly-action .ant-tag, +.node-system-tag, +.node-client-counts .ant-tag { + margin: 0; } .node-sigma { - color: var(--node-link); - font-size: 18px; + margin-inline-end: 4px; font-weight: 600; } -.node-icon-action, -.node-expander { - display: inline-grid; - place-content: center; - width: 18px; - height: 24px; - font-size: 15px; -} -.node-icon-delete { - color: var(--node-bad); -} -.node-icon-action:disabled { - color: var(--node-secondary); - opacity: 0.5; - cursor: default; -} -.node-expander { - height: 18px; - border: 1px solid var(--node-line); - border-radius: 4px; - background: var(--node-field); - color: var(--node-secondary); - font-size: 13px; -} .node-name, .node-cell-stack { display: flex; @@ -346,9 +87,7 @@ min-width: 0; } .node-name { - gap: 4px; - font-size: 12px; - font-weight: 600; + max-width: 160px; } .node-name > span, .node-name > small { @@ -356,83 +95,37 @@ text-overflow: ellipsis; white-space: nowrap; } -.node-row-fleet .node-name > span, -.node-row-master .node-name > span { - font-size: 14px; +.node-name > span { + font-weight: 500; } -.node-row-fleet .node-name > small { - font-size: 11px; - white-space: normal; +.nodes-table small, +.node-memory-detail, +.node-connection-load { + color: var(--ant-color-text-secondary); + font-size: var(--ant-font-size-sm, 12px); } -.node-name small { - color: var(--node-secondary); - font-size: 10px; - font-weight: 400; -} -.node-open-link:any-link { - color: var(--node-link); - font-size: 10px; - white-space: nowrap; -} -.node-open-link:hover, -.node-open-link:focus-visible { - text-decoration: underline; -} -.node-open-link span { - font-size: 13px; - font-weight: 600; +.nodes-table .node-open-link { + height: auto; + padding: 0; } .node-status-button { - gap: 5px; - width: 100%; - text-align: start; - font-size: 11px; - font-weight: 600; -} -.node-status-button[data-status='online'] { - color: var(--node-good); -} -.node-status-button[data-status='offline'] { - color: var(--node-bad); + display: inline-flex; + align-items: center; + gap: 4px; + white-space: nowrap; } .node-status-button .online-dot, -.node-status-button .xray-error-dot, -.node-status-button .ant-badge-status-dot { - display: inline-block; - width: 8px; - height: 8px; - flex: 0 0 8px; - border-radius: 50%; -} -.node-status-button .online-dot { - background: var(--node-good); -} .node-status-button .xray-error-dot { - background: var(--node-purple); + margin-inline-end: 0; } .node-status-info { - margin-inline-start: auto; - color: var(--node-secondary); - font-size: 10px; -} -.node-status-popup .ant-tooltip-container { - width: min(258px, 90vw); - padding: 12px 14px; - border: 1px solid #414550; - border-radius: 8px; - color: #d6d9e0; - font: - 400 11px/1.4 'Source Sans Pro', - system-ui, - sans-serif; + color: var(--ant-color-text-tertiary); } .node-status-tooltip h3 { - margin: 0 0 5px; - color: #a6aab4; - font: - 600 11px 'Source Sans Pro', - system-ui, - sans-serif; + margin: 0 0 4px; + color: inherit; + font-size: inherit; + font-weight: 600; } .node-status-tooltip dl { margin: 0; @@ -440,224 +133,108 @@ .node-status-tooltip dl > div { display: flex; justify-content: space-between; - gap: 25px; - line-height: 23px; + gap: 24px; } .node-status-tooltip dd { margin: 0; - font-size: 12px; font-weight: 600; } -.node-status-tooltip dt { - color: #a6aab4; -} -.node-hardware { - gap: 6px; +.node-hardware, +.node-network-speed { font-variant-numeric: tabular-nums; } -.node-cpu { - font: - 400 11px/15px 'Source Sans Pro', - system-ui, - sans-serif; -} -.node-ram { - font: - 400 10px/13px 'Source Sans Pro', - system-ui, - sans-serif; -} -.node-memory-detail { - color: var(--node-secondary); - font-size: 9px; -} -.node-network-speed, -.node-runtime, -.node-connections, -.node-system-clients { - gap: 5px; - font-size: 10px; -} .node-network-speed { display: inline-grid; - font-variant-numeric: tabular-nums; -} -.node-network-direction { - display: flex; - align-items: center; - gap: 3px; -} -.node-network-up { - color: var(--node-link); -} -.node-row-fleet .node-network-speed, -.node-row-master .node-network-speed { - font-size: 12px; -} -.node-connections > span:nth-child(-n + 2) { - font-weight: 600; -} -.node-connection-load, -.node-runtime small { - color: var(--node-secondary); - font-size: 9px; + row-gap: 2px; } +.node-network-direction, .node-runtime .node-panel-line { display: flex; align-items: center; - gap: 3px; -} -.node-runtime .node-icon-action { - width: 13px; - height: 13px; - color: var(--node-link); - font-size: 11px; -} -.node-system-clients { - font-size: 11px; -} -.node-system-clients small { - color: var(--node-secondary); - font-size: 10px; + gap: 4px; } .node-client-counts { - display: grid; - grid-template-columns: 52fr 54fr 58fr; - grid-template-rows: repeat(2, 21px); - gap: 4px 6px; - align-items: center; -} -.node-count-total { - grid-column: 1; - grid-row: 1 / span 2; -} -.node-client-counts .ant-tag { - margin: 0; - padding-inline: 2px; - text-align: center; - line-height: 19px; - font: - 400 11px/19px 'Source Sans Pro', - system-ui, - sans-serif; - color: var(--node-fg); - background: var(--node-disabled-bg); -} -.node-client-counts .node-count-active { - grid-column: 2; - grid-row: 1; - background: var(--node-active-bg); - color: var(--node-good); -} -.node-client-counts .node-count-disabled { - grid-column: 3; - grid-row: 1; -} -.node-client-counts .node-count-depleted { - grid-column: 2; - grid-row: 2; - background: var(--node-depleted-bg); - color: var(--node-bad); -} -.node-client-counts .node-count-online { - grid-column: 3; - grid-row: 2; - background: var(--node-online-bg); - color: var(--node-link); -} -.node-history-row td { - padding: 12px; + display: flex; + flex-wrap: wrap; + gap: 4px; + max-width: 190px; } .nodes-footnote { + display: flex; + align-items: center; justify-content: space-between; - margin-block-start: 9px; - color: var(--node-secondary); - font-size: 11px; - line-height: 22px; + gap: 12px; + margin-block-start: 8px; + color: var(--ant-color-text-secondary); + font-size: var(--ant-font-size-sm, 12px); } -@container (max-width: 1205px) { - .node-actions > .ant-checkbox-wrapper { - margin-inline: 4px; - } - .node-actions > .node-icon-action { - width: 17px; - } -} @media (max-width: 650px) { - .nodes-heading { - flex-wrap: wrap; - } - .nodes-heading-actions { - flex-wrap: wrap; - } .node-registered { margin-inline-start: 0; } } -@container (width < 920px) { - .node-fleet-table, - .node-fleet-table thead, - .node-fleet-table tbody, - .node-fleet-table tr, - .node-fleet-table .node-history-row td { +@container (width < 720px) { + .nodes-table .ant-table-content > table { display: block; + width: auto; min-width: 0; } - .node-fleet-table colgroup { + .nodes-table .ant-table-thead, + .nodes-table .ant-table-tbody, + .nodes-table .ant-table-thead > tr, + .nodes-table .ant-table-tbody > tr, + .nodes-table .ant-table-tbody > tr:not(.ant-table-row) > td { + display: block; + } + .nodes-table colgroup { display: none; } - .node-fleet-table thead th:not(:first-child) { + .nodes-table .ant-table-thead > tr > th:not(:first-child) { position: absolute; width: 1px; height: 1px; + padding: 0; overflow: hidden; clip-path: inset(50%); } - .node-fleet-table thead th:first-child { - display: flex; - align-items: center; - padding-inline: 10px; + .nodes-table .ant-table-thead > tr > th:first-child { border-radius: 8px; } - .node-fleet-table tbody > tr:not(.node-history-row) { + .nodes-table .ant-table-tbody > tr.ant-table-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; - height: auto; margin-block-start: 8px; padding: 10px; - border: 1px solid var(--node-line); + border: 1px solid var(--ant-color-border-secondary); border-radius: 8px; } - .node-row-fleet { - background: var(--node-fleet); + .nodes-table .ant-table-tbody > tr.node-row-fleet { + background: var(--ant-color-fill-quaternary); } - .node-fleet-table tbody td, - .node-fleet-table .node-name-cell { + .nodes-table .ant-table-tbody > tr.ant-table-row > .ant-table-cell { min-width: 0; padding: 0; border: 0; + background: transparent; text-align: start; } - .node-fleet-table .node-name-cell, - .node-fleet-table tbody td:first-child { + .nodes-table .ant-table-row > .node-name-cell, + .nodes-table .ant-table-row > td:first-child { grid-column: 1 / -1; } - .node-fleet-table .node-name-cell { + .nodes-table .ant-table-row > .node-name-cell { grid-row: 1; } - .node-fleet-table td[data-label]::before { + .node-name { + max-width: none; + } + .nodes-table td[data-label]::before { display: block; margin-block-end: 4px; - color: var(--node-secondary); - font-size: 11px; + color: var(--ant-color-text-secondary); + font-size: var(--ant-font-size-sm, 12px); content: attr(data-label); } - .node-fleet-table .node-row-fleet td:first-child { - box-shadow: none; - } - .node-fleet-table .node-history-row td { - padding: 10px; - } } diff --git a/frontend/src/pages/nodes/NodeList.stories.tsx b/frontend/src/pages/nodes/NodeList.stories.tsx index 932e3c954..f0e76919c 100644 --- a/frontend/src/pages/nodes/NodeList.stories.tsx +++ b/frontend/src/pages/nodes/NodeList.stories.tsx @@ -155,8 +155,11 @@ export const Desktop: Story = { for (const viewport of [1280, 1440, 1664, 1920]) { const container = canvas.getByRole('region', { name: 'Nodes' }); container.style.width = `${viewport - 260}px`; - const table = container.querySelector('.nodes-table-scroll') as HTMLElement; - await expect(table.scrollWidth).toBeLessThanOrEqual(table.clientWidth + 1); + await expect(container.scrollWidth).toBeLessThanOrEqual(container.clientWidth + 1); + const table = container.querySelector('.ant-table-content') as HTMLElement; + if (viewport >= 1664) { + await expect(table.scrollWidth).toBeLessThanOrEqual(table.clientWidth + 1); + } container.style.width = ''; } await userEvent.type(input, 'Frankfurt'); diff --git a/frontend/src/pages/nodes/NodeList.tsx b/frontend/src/pages/nodes/NodeList.tsx index 5bdb93761..3e79db9cc 100644 --- a/frontend/src/pages/nodes/NodeList.tsx +++ b/frontend/src/pages/nodes/NodeList.tsx @@ -1,18 +1,20 @@ -import { Fragment, useMemo, useState, type CSSProperties, type ReactNode } from 'react'; +import { useMemo, useState, type ReactNode, type TdHTMLAttributes } from 'react'; import { useTranslation } from 'react-i18next'; import { Badge, - Checkbox, Button, + Card, + Checkbox, Dropdown, Input, Select, Switch, + Table, Tag, Tooltip, - theme, } from 'antd'; import type { BadgeProps } from 'antd'; +import type { ColumnsType } from 'antd/es/table'; import { ApartmentOutlined, CloudDownloadOutlined, @@ -24,9 +26,11 @@ import { EyeOutlined, LockOutlined, InfoCircleOutlined, + MinusSquareOutlined, SearchOutlined, MoreOutlined, PlusOutlined, + PlusSquareOutlined, ReloadOutlined, SafetyCertificateOutlined, TeamOutlined, @@ -211,7 +215,7 @@ function OnlineTag({ node }: { node: Pick - {counts.label} + {counts.label} ); } @@ -245,8 +249,6 @@ function HealthStatus({ const { tip, iconColor } = statusIssue(node); return ( @@ -394,22 +396,22 @@ function ClientCounts({ const { t } = useTranslation(); return (
- + {counts.clientCount ?? 0} {!!counts.activeCount && ( - {counts.activeCount} + {counts.activeCount} )} {!!counts.disabledCount && ( - {counts.disabledCount} + {counts.disabledCount} )} {!!counts.depletedCount && ( - {counts.depletedCount} + {counts.depletedCount} )} @@ -452,19 +454,6 @@ function sampleVersions( ]; } -const columnWidths = [ - { key: 'actions', px: 148 }, - { key: 'enabled', px: 52 }, - { key: 'node', px: 118 }, - { key: 'address', px: 54 }, - { key: 'status', px: 104 }, - { key: 'hardware', px: 160 }, - { key: 'traffic', px: 120 }, - { key: 'connections', px: 125 }, - { key: 'runtime', px: 145 }, - { key: 'clients', px: 200 }, -]; - function RowAction({ label, icon, @@ -479,22 +468,29 @@ function RowAction({ onClick: () => void; }) { return ( - + +
+ ); + }, + }, + { + key: 'address', + title: t('pages.nodes.address'), + onCell: labelled(t('pages.nodes.address')), + render: (_value, row) => { + const url = + row.kind === 'remote' + ? panelUrl(row.node) + : row.kind === 'master' + ? withBasePath('/panel/') + : undefined; + return url ? ( + + + + ) : ( + '—' + ); + }, + }, + { + key: 'status', + title: t('pages.nodes.status'), + onCell: labelled(t('pages.nodes.status')), + render: (_value, row) => { + if (row.kind !== 'fleet') { + const host = row.kind === 'remote' ? row.node : row.host; + return ( + + ); + } + const reporting = t('pages.nodes.fleet.reporting', { + live: row.reporting, + total: row.registered, + }); + return ( + +
{reporting}
+
+ {t('pages.nodes.cpu')} · {row.cpuHosts}/{row.registered} +
+
+ RAM · {row.memoryHosts}/{row.registered} +
+
{t('pages.nodes.fleet.hostMetrics')}
+ + } + > + +
+ ); + }, + }, + { + key: 'hardware', + title: t('pages.nodes.fleet.hardware'), + onCell: labelled(t('pages.nodes.fleet.hardware')), + render: (_value, row) => ( + + ), + }, + { + key: 'traffic', + title: t('pages.inbounds.traffic'), + onHeaderCell: () => ({ title: t('pages.nodes.networkSpeed') }), + onCell: labelled(t('pages.inbounds.traffic')), + render: (_value, row) => ( + + ), + }, + { + key: 'connections', + title: t('pages.nodes.fleet.connections'), + onCell: labelled(t('pages.nodes.fleet.connections')), + render: (_value, row) => ( + + ), + }, + { + key: 'runtime', + title: t('pages.nodes.fleet.runtime'), + onCell: labelled(t('pages.nodes.fleet.runtime')), + render: (_value, row) => { + if (row.kind === 'fleet') { + return ( +
+ + {row.panelVersions.length > 1 || row.xrayVersions.length > 1 + ? t('pages.nodes.fleet.mixed') + : [row.xrayVersions[0], row.panelVersions[0]].filter(Boolean).join(' / ') || + '—'} + + {t('pages.nodes.fleet.uptimeVaries')} +
+ ); + } + const host = row.kind === 'remote' ? row.node : row.host; + const managed = managedNode(row); + return ( +
+ + Xray {host.xrayVersion || '—'} + + + {t('pages.nodes.fleet.panel')} {host.panelVersion || '—'} + {managed && + isUpdateEligible(managed) && + isPanelUpdateAvailable(latestVersion, managed.panelVersion || '') && ( + } + onClick={() => onUpdateNode(managed)} + /> + )} + + + {t('pages.nodes.fleet.uptimeShort')}{' '} + + {formatUptime(row.telemetry?.uptimeSecs, row.telemetry?.uptimeSecs != null)} + + +
+ ); + }, + }, + { + key: 'clients', + title: t('clients'), + onCell: labelled(t('clients')), + render: (_value, row) => + row.kind === 'remote' ? ( + + ) : ( +
+ + {t('pages.nodes.fleet.clientRecords', { + records: nf.format( + row.kind === 'fleet' ? row.counts.clientCount : row.host.counts.clientCount, + ), + })} + + + {row.kind === 'fleet' + ? t('pages.nodes.fleet.acrossNodes', { total: row.registered }) + : nf.format(row.host.counts.inboundCount) + ' ' + t('pages.nodes.inboundTags')} + +
+ ), + }, + ]; + + return ( + + className="nodes-table" + rowKey="key" + size="small" + pagination={false} + columns={columns} + dataSource={rows} + rowClassName={(row) => 'node-row-' + row.kind} + expandable={{ + showExpandColumn: false, + expandedRowKeys: [...opened], + expandedRowClassName: 'node-history-row', + rowExpandable: (row) => managedNode(row) !== undefined, + expandedRowRender: (row) => + row.kind === 'remote' ? : null, + }} + locale={{ + emptyText: ( +
+ +
{t('noData')}
+
+ ), + }} + /> ); }, [ i18n.language, latestVersion, - loading, nameByGuid, onDelete, onEdit, @@ -1020,49 +1039,19 @@ export default function NodeList({ ]; const summary = rows.find((row) => row.kind === 'fleet'); - return ( -
-
-
-

{t('menu.nodes')}

- {hasNodes &&

{t('pages.nodes.fleet.subtitle')}

} -
-
- - -
-
+ const toolbar = ( +
+ + {hasNodes && ( -
+ <> } aria-label={t('search')} placeholder={t('pages.nodes.fleet.searchNodes')} @@ -1071,6 +1060,7 @@ export default function NodeList({ onChange={(event) => setSearch(event.target.value)} />