Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Render Machines network detail tooltip
rcourtman334dd00125c0
diff --git a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsxindex 9e8a94ec2c..65efe32485 100644--- a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx+++ b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx@@ -41,11 +41,13 @@ import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';import { getSimpleStatusIndicator } from '@/utils/status';import { asTrimmedString } from '@/utils/stringUtils';import { formatTemperature as formatTemperatureValue } from '@/utils/temperature';+import { getWorkloadsGuestNetworkEmptyState } from '@/utils/workloadGuestPresentation';import {AGENT_MACHINE_COLUMNS,getAgentMachineCpuPercent,getAgentMachineDiskIOTotal,getAgentMachineIpValues,+ getAgentMachineNetworkInterfaceDetails,getAgentMachineNetworkTotal,getAgentMachinePrimaryIp,getAgentMachineRaidSummary,@@ -57,6 +59,7 @@ import {timestampMillisFrom,type AgentMachineColumn,type AgentMachineColumnId,+ type AgentMachineNetworkInterfaceDetail,type AgentMachineSortKey,type AgentMachineTemperatureDetailSection,} from './agentMachineTableModel';@@ -97,18 +100,26 @@ const finiteMetric = (value: number | undefined): number | undefined =>const hasPositiveTemperature = (celsius: number | undefined): celsius is number =>typeof celsius === 'number' && Number.isFinite(celsius) && celsius > 0;-const AgentMachineTemperatureCell: Component<{- celsius: number | undefined;- sections: AgentMachineTemperatureDetailSection[];- title: string;+const AgentMachineMetricTooltip: Component<{+ triggerDataAttribute: string;+ tooltipDataAttribute: string;+ triggerClass: string;+ tooltipClass: string;+ enabled: boolean;+ ariaLabel?: string;+ title?: string;+ maxWidth: number;+ trigger: JSX.Element;+ children: JSX.Element;}> = (props) => {const [visible, setVisible] = createSignal(false);const [position, setPosition] = createSignal({ x: 0, y: 0 });- const hasDetails = () => props.sections.length > 0;- const positiveTemperature = () =>- hasPositiveTemperature(props.celsius) ? props.celsius : undefined;+ const triggerDataAttributes = () => ({ [props.triggerDataAttribute]: 'true' });+ const tooltipDataAttributes = () => ({ [props.tooltipDataAttribute]: 'true' });+ const enabled = () => props.enabled;+ const label = () => props.ariaLabel || props.title || undefined;const open = (event: MouseEvent | FocusEvent) => {- if (!hasDetails()) return;+ if (!enabled()) return;const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();setPosition({ x: rect.left + rect.width / 2, y: rect.top });setVisible(true);@@ -118,10 +129,11 @@ const AgentMachineTemperatureCell: Component<{return (<><span- data-agent-machine-temperature-trigger="true"- class="inline-flex min-w-[2.25rem] justify-end text-xs tabular-nums"- aria-label={props.title || undefined}- tabIndex={hasDetails() ? 0 : undefined}+ {...triggerDataAttributes()}+ class={props.triggerClass}+ aria-label={label()}+ title={!enabled() ? props.title || undefined : undefined}+ tabIndex={enabled() ? 0 : undefined}onMouseEnter={open}onMouseOver={open}onMouseLeave={close}@@ -132,52 +144,192 @@ const AgentMachineTemperatureCell: Component<{open(event);}}>- <Show when={positiveTemperature()} fallback={<span class="text-muted">—</span>}>- {(value) => formatTemperatureValue(value())}- </Show>+ {props.trigger}</span><TooltipPortal- when={visible() && hasDetails()}+ when={visible() && enabled()}x={position().x}y={position().y}- maxWidth={320}+ maxWidth={props.maxWidth}>- <div- data-agent-machine-temperature-tooltip="true"- class="min-w-[190px] max-w-[300px] space-y-2"- >- <For each={props.sections}>- {(section) => (- <section>- <div class="mb-1 border-b border-border pb-1 font-semibold text-muted">- {section.heading}+ <div {...tooltipDataAttributes()} class={props.tooltipClass}>+ {props.children}+ </div>+ </TooltipPortal>+ </>+ );+};++const AgentMachineTemperatureCell: Component<{+ celsius: number | undefined;+ sections: AgentMachineTemperatureDetailSection[];+ title: string;+}> = (props) => {+ const hasDetails = () => props.sections.length > 0;+ const positiveTemperature = () =>+ hasPositiveTemperature(props.celsius) ? props.celsius : undefined;++ return (+ <AgentMachineMetricTooltip+ triggerDataAttribute="data-agent-machine-temperature-trigger"+ tooltipDataAttribute="data-agent-machine-temperature-tooltip"+ triggerClass="inline-flex min-w-[2.25rem] justify-end text-xs tabular-nums"+ tooltipClass="min-w-[190px] max-w-[300px] space-y-2"+ enabled={hasDetails()}+ ariaLabel={props.title || undefined}+ maxWidth={320}+ trigger={+ <Show when={positiveTemperature()} fallback={<span class="text-muted">—</span>}>+ {(value) => formatTemperatureValue(value())}+ </Show>+ }+ >+ <For each={props.sections}>+ {(section) => (+ <section>+ <div class="mb-1 border-b border-border pb-1 font-semibold text-muted">+ {section.heading}+ </div>+ <div class="space-y-0.5">+ <For each={section.rows}>+ {(row) => (+ <div class="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3">+ <span class="min-w-0 truncate text-muted" title={row.label}>+ {row.label}+ </span>+ <span+ classList={{+ 'text-base-content': !row.muted,+ 'text-muted': row.muted,+ }}+ class="font-mono tabular-nums"+ >+ {row.value}+ </span>+ </div>+ )}+ </For>+ </div>+ </section>+ )}+ </For>+ </AgentMachineMetricTooltip>+ );+};++const AgentMachineNetworkCell: Component<{+ network: Resource['network'] | undefined;+ interfaces: AgentMachineNetworkInterfaceDetail[];+ title: string;+}> = (props) => {+ const hasDetails = () => props.interfaces.length > 0;+ const shownInterfaces = () => props.interfaces.slice(0, 8);+ const hiddenInterfaceCount = () =>+ Math.max(0, props.interfaces.length - shownInterfaces().length);+ const ariaLabel = () => props.title.replace(/\n/g, ', ') || 'Network throughput';++ return (+ <AgentMachineMetricTooltip+ triggerDataAttribute="data-agent-machine-network-trigger"+ tooltipDataAttribute="data-agent-machine-network-tooltip"+ triggerClass="grid w-full grid-cols-[0.75rem_minmax(0,1fr)] grid-rows-2 items-center gap-x-1 gap-y-0.5 text-[11px] leading-tight tabular-nums"+ tooltipClass="min-w-[230px] max-w-[360px] space-y-2"+ enabled={hasDetails()}+ ariaLabel={ariaLabel()}+ title={props.title}+ maxWidth={380}+ trigger={+ <>+ <span class="inline-flex w-3 justify-center text-emerald-500">↓</span>+ <span class="min-w-0 truncate">{formatSpeed(props.network?.rxBytes ?? 0)}</span>+ <span class="inline-flex w-3 justify-center text-orange-400">↑</span>+ <span class="min-w-0 truncate">{formatSpeed(props.network?.txBytes ?? 0)}</span>+ </>+ }+ >+ <section>+ <div class="mb-1 border-b border-border pb-1 font-semibold text-muted">+ Network Interfaces+ </div>+ <div class="max-h-[280px] space-y-1.5 overflow-y-auto pr-1">+ <For each={shownInterfaces()}>+ {(iface, index) => (+ <div class="min-w-0" classList={{ 'border-t border-border pt-1.5': index() > 0 }}>+ <div class="flex min-w-0 items-center gap-2">+ <span class="min-w-0 truncate font-semibold text-base-content" title={iface.name}>+ {iface.name}+ </span>+ <Show when={iface.mac}>+ {(mac) => (+ <span+ class="max-w-[150px] shrink-0 truncate font-mono text-[9px] text-muted"+ title={mac()}+ >+ {mac()}+ </span>+ )}+ </Show></div>- <div class="space-y-0.5">- <For each={section.rows}>- {(row) => (- <div class="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3">- <span class="min-w-0 truncate text-muted" title={row.label}>- {row.label}- </span>+ <Show+ when={iface.addresses.length > 0}+ fallback={+ <div class="mt-0.5 text-[9px] text-muted">+ {getWorkloadsGuestNetworkEmptyState()}+ </div>+ }+ >+ <div class="mt-1 flex flex-wrap gap-1">+ <For each={iface.addresses.slice(0, 4)}>+ {(address) => (<span- classList={{- 'text-base-content': !row.muted,- 'text-muted': row.muted,- }}- class="font-mono tabular-nums"+ class="max-w-full truncate rounded border border-border bg-surface-alt px-1.5 py-0.5 font-mono text-[9px] text-base-content"+ title={address}>- {row.value}+ {address}</span>- </div>- )}- </For>- </div>- </section>+ )}+ </For>+ <Show when={iface.addresses.length > 4}>+ <span class="rounded border border-border px-1.5 py-0.5 text-[9px] text-muted">+ +{iface.addresses.length - 4}+ </span>+ </Show>+ </div>+ </Show>+ <Show+ when={+ iface.rxBytes !== undefined ||+ iface.txBytes !== undefined ||+ iface.speedMbps !== undefined+ }+ >+ <div class="mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-[9px] text-muted">+ <Show when={iface.rxBytes !== undefined || iface.txBytes !== undefined}>+ <span>+ <span class="font-mono text-emerald-500">RX</span>{' '}+ {formatSpeed(iface.rxBytes ?? 0)}+ </span>+ <span>+ <span class="font-mono text-orange-400">TX</span>{' '}+ {formatSpeed(iface.txBytes ?? 0)}+ </span>+ </Show>+ <Show when={iface.speedMbps !== undefined}>+ <span>{iface.speedMbps} Mbps</span>+ </Show>+ </div>+ </Show>+ </div>)}</For>+ <Show when={hiddenInterfaceCount() > 0}>+ <div class="border-t border-border pt-1 text-[9px] text-muted">+ +{hiddenInterfaceCount()} more interfaces+ </div>+ </Show></div>- </TooltipPortal>- </>+ </section>+ </AgentMachineMetricTooltip>);};@@ -504,6 +656,7 @@ export const AgentsMachinesTable: Component<{const hasDiskMetric = () =>aggregateDisk() !== undefined || (disks()?.length ?? 0) > 0;const networkTotal = () => getAgentMachineNetworkTotal(machine);+ const networkInterfaces = () => getAgentMachineNetworkInterfaceDetails(machine);const diskIOTotal = () => getAgentMachineDiskIOTotal(machine);const primaryIp = () => getAgentMachinePrimaryIp(machine);const ipValues = () => getAgentMachineIpValues(machine);@@ -620,23 +773,11 @@ export const AgentsMachinesTable: Component<{when={canRenderMetrics() && networkTotal() !== undefined}fallback={metricFallback()}>- <div- class="grid w-full grid-cols-[0.75rem_minmax(0,1fr)_0.75rem_minmax(0,1fr)] items-center gap-x-1 text-[11px] tabular-nums"+ <AgentMachineNetworkCell+ network={machine.network}+ interfaces={networkInterfaces()}title={networkTitleFor(machine)}- >- <span class="inline-flex w-3 justify-center text-emerald-500">- ↓- </span>- <span class="min-w-0 truncate">- {formatSpeed(machine.network?.rxBytes ?? 0)}- </span>- <span class="inline-flex w-3 justify-center text-orange-400">- ↑- </span>- <span class="min-w-0 truncate">- {formatSpeed(machine.network?.txBytes ?? 0)}- </span>- </div>+ /></Show></TableCell></Show>diff --git a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsxindex 9995a49a1b..433bf41556 100644--- a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx+++ b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx@@ -103,6 +103,16 @@ describe('AgentsMachinesTable', () => {osVersion: '7.2.2',architecture: 'x86_64',kernelVersion: '6.12.24',+ networkInterfaces: [+ {+ name: 'br0',+ mac: 'aa:bb:cc:dd:ee:ff',+ addresses: ['192.168.0.10'],+ rxBytes: 1024,+ txBytes: 2048,+ speedMbps: 1000,+ },+ ],raid: [{device: '/dev/md0',@@ -140,6 +150,52 @@ describe('AgentsMachinesTable', () => {expect(screen.getByText('1 clean')).toBeInTheDocument();});+ it('shows structured agent network interface details from the Net I/O value', async () => {+ const { container } = render(() => (+ <AgentsMachinesTable+ resources={[+ resource({+ id: 'network-host',+ name: 'Network Host',+ network: { rxBytes: 1024, txBytes: 2048 },+ agent: {+ networkInterfaces: [+ {+ name: 'en0',+ mac: '10:20:30:40:50:60',+ addresses: ['192.168.0.20', 'fe80::1'],+ rxBytes: 1024,+ txBytes: 2048,+ speedMbps: 1000,+ },+ ],+ },+ }),+ ]}+ emptyIcon={emptyIcon}+ emptyTitle="No machines"+ emptyDescription="Install Pulse Agent."+ />+ ));++ const trigger = container.querySelector('[data-agent-machine-network-trigger="true"]');+ expect(trigger).not.toBeNull();+ if (!trigger) return;++ await fireEvent.mouseEnter(trigger);++ expect(await screen.findByText('Network Interfaces')).toBeInTheDocument();+ expect(screen.getByText('en0')).toBeInTheDocument();+ expect(screen.getByText('10:20:30:40:50:60')).toBeInTheDocument();+ expect(screen.getByText('192.168.0.20')).toBeInTheDocument();+ expect(screen.getByText('fe80::1')).toBeInTheDocument();+ expect(screen.getByText('RX')).toBeInTheDocument();+ expect(screen.getByText('TX')).toBeInTheDocument();+ expect(screen.getAllByText('1.00 KB/s').length).toBeGreaterThan(0);+ expect(screen.getAllByText('2.00 KB/s').length).toBeGreaterThan(0);+ expect(screen.getByText('1000 Mbps')).toBeInTheDocument();+ });+it('sorts machines by operational metrics from the column headers', async () => {const { container } = render(() => (<AgentsMachinesTablediff --git a/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts b/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.tsindex 656be38774..7413d6e224 100644--- a/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts+++ b/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from 'vitest';import type { Resource } from '@/types/resource';import {+ getAgentMachineNetworkInterfaceDetails,getAgentMachineTemperatureCelsius,getAgentMachineTemperatureTitle,sortAgentMachines,@@ -21,6 +22,48 @@ const resource = (overrides: Partial<Resource>): Resource =>}) as Resource;describe('agentMachineTableModel', () => {+ it('normalizes agent network interface details for table inspection', () => {+ const details = getAgentMachineNetworkInterfaceDetails(+ resource({+ agent: {+ networkInterfaces: [+ {+ name: ' en0 ',+ mac: ' 10:20:30:40:50:60 ',+ addresses: [' 192.168.0.20 ', '192.168.0.20', '', ' fe80::1 '],+ rxBytes: 1024,+ txBytes: 2048,+ speedMbps: 1000,+ },+ {+ name: ' ',+ addresses: ['10.0.0.2'],+ txBytes: 512,+ speedMbps: 0,+ },+ { name: '' },+ ],+ },+ }),+ );++ expect(details).toEqual([+ {+ name: 'en0',+ mac: '10:20:30:40:50:60',+ addresses: ['192.168.0.20', 'fe80::1'],+ rxBytes: 1024,+ txBytes: 2048,+ speedMbps: 1000,+ },+ {+ name: 'eth1',+ addresses: ['10.0.0.2'],+ txBytes: 512,+ },+ ]);+ });+it('falls back to active SMART disk temperatures when machine sensors are absent', () => {const machine = resource({agent: {diff --git a/frontend-modern/src/features/standalone/agentMachineTableModel.ts b/frontend-modern/src/features/standalone/agentMachineTableModel.tsindex c33a00ff63..a48aa99224 100644--- a/frontend-modern/src/features/standalone/agentMachineTableModel.ts+++ b/frontend-modern/src/features/standalone/agentMachineTableModel.ts@@ -129,6 +129,15 @@ export type AgentMachineTemperatureDetailSection = {rows: AgentMachineTemperatureDetailRow[];};+export type AgentMachineNetworkInterfaceDetail = {+ name: string;+ mac?: string;+ addresses: string[];+ rxBytes?: number;+ txBytes?: number;+ speedMbps?: number;+};+const positiveTemperature = (value: number | undefined): number | undefined => {const metric = finiteMetric(value);return metric !== undefined && metric > 0 ? metric : undefined;@@ -229,6 +238,61 @@ export const getAgentMachineNetworkTotal = (machine: Resource): number | undefinreturn (rx ?? 0) + (tx ?? 0);};+const positiveMetric = (value: number | undefined): number | undefined => {+ const metric = finiteMetric(value);+ return metric !== undefined && metric > 0 ? metric : undefined;+};++const uniqueTrimmedValues = (values: readonly string[] | undefined): string[] => {+ const seen = new Set<string>();+ const result: string[] = [];++ for (const candidate of values ?? []) {+ const value = asTrimmedString(candidate);+ if (!value || seen.has(value)) continue;+ seen.add(value);+ result.push(value);+ }++ return result;+};++export const getAgentMachineNetworkInterfaceDetails = (+ machine: Resource,+): AgentMachineNetworkInterfaceDetail[] =>+ (machine.agent?.networkInterfaces ?? []).reduce<AgentMachineNetworkInterfaceDetail[]>(+ (details, iface, index) => {+ const name = asTrimmedString(iface.name);+ const mac = asTrimmedString(iface.mac);+ const addresses = uniqueTrimmedValues(iface.addresses);+ const rxBytes = finiteMetric(iface.rxBytes);+ const txBytes = finiteMetric(iface.txBytes);+ const speedMbps = positiveMetric(iface.speedMbps);++ if (+ !name &&+ !mac &&+ addresses.length === 0 &&+ rxBytes === undefined &&+ txBytes === undefined &&+ speedMbps === undefined+ ) {+ return details;+ }++ details.push({+ name: name ?? `eth${index}`,+ ...(mac ? { mac } : {}),+ addresses,+ ...(rxBytes !== undefined ? { rxBytes } : {}),+ ...(txBytes !== undefined ? { txBytes } : {}),+ ...(speedMbps !== undefined ? { speedMbps } : {}),+ });+ return details;+ },+ [],+ );+export const getAgentMachineDiskIOTotal = (machine: Resource): number | undefined => {const read = finiteMetric(machine.diskIO?.readRate);const write = finiteMetric(machine.diskIO?.writeRate);@@ -317,16 +381,7 @@ export const getAgentMachineIpValues = (machine: Resource): string[] => {...(machine.identity?.ips ?? []),...(machine.agent?.networkInterfaces ?? []).flatMap((iface) => iface.addresses ?? []),];- const seen = new Set<string>();- const result: string[] = [];-- for (const candidate of candidates) {- const value = asTrimmedString(candidate);- if (!value || seen.has(value)) continue;- seen.add(value);- result.push(value);- }- return result;+ return uniqueTrimmedValues(candidates);};export const getAgentMachinePrimaryIp = (machine: Resource): string =>