feat(nodes-ui): agent 行地址纯文本显示 IP+更新徽标防误亮(第13条)
地址列: agent 行渲染 ipv4/ipv6 纯文本(两行), 不再是面板 URL 链接; 传统行保持链接。面板版本列: agent 行不参与"有可用更新"判定 (版本比较对 "agent x.y" 字符串走不等回退会恒亮)。
This commit is contained in:
@@ -363,7 +363,24 @@ export default function NodeList({
|
||||
),
|
||||
dataIndex: 'url',
|
||||
ellipsis: true,
|
||||
render: (_value, record) => (
|
||||
render: (_value, record) => {
|
||||
if (record.nodeType === 'agent') {
|
||||
// Agent nodes have no panel to link to: show the host IPs the
|
||||
// agent reports with its heartbeat as plain text (P13).
|
||||
const ips = [record.ipv4, record.ipv6].filter(Boolean) as string[];
|
||||
return (
|
||||
<span className={showAddress ? 'address-visible' : 'address-hidden'}>
|
||||
{ips.length > 0
|
||||
? ips.map((ip) => (
|
||||
<span key={ip} style={{ display: 'block' }}>
|
||||
{ip}
|
||||
</span>
|
||||
))
|
||||
: '-'}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<a
|
||||
href={record.url}
|
||||
target="_blank"
|
||||
@@ -372,7 +389,8 @@ export default function NodeList({
|
||||
>
|
||||
{record.url}
|
||||
</a>
|
||||
),
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('pages.nodes.status'),
|
||||
@@ -418,7 +436,12 @@ export default function NodeList({
|
||||
dataIndex: 'panelVersion',
|
||||
align: 'center',
|
||||
render: (_value, record) => {
|
||||
// Agent rows carry an "agent <version>" label, not an upstream
|
||||
// panel version: the update badge must never light up for them
|
||||
// (the version comparator falls back to string inequality for
|
||||
// unparseable versions, which would always differ) (P13).
|
||||
const canUpdate =
|
||||
record.nodeType !== 'agent' &&
|
||||
isUpdateEligible(record) &&
|
||||
isPanelUpdateAvailable(latestVersion, record.panelVersion || '');
|
||||
return (
|
||||
|
||||
@@ -47,6 +47,10 @@ export const NodeRecordSchema = z
|
||||
// P7: node kind, annotated by the backend for nodes registered by an
|
||||
// agent. Absent/traditional for classic panel-to-panel nodes.
|
||||
nodeType: z.enum(['traditional', 'agent']).optional(),
|
||||
// P13: host IPv4/IPv6 an agent reports with its heartbeat telemetry.
|
||||
// Rendered as plain text in the address column for agent rows.
|
||||
ipv4: z.string().optional(),
|
||||
ipv6: z.string().optional(),
|
||||
})
|
||||
.loose();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user