Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Render Machines IP detail tooltip

rcourtman103e46ede1c8
diff --git a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
index c3a5c2a345..8cf65f4019 100644
--- a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
+++ b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
@@ -226,15 +226,104 @@ const AgentMachineTemperatureCell: Component<{
);
};
+const AgentMachineNetworkInterfacesList: Component<{
+ interfaces: AgentMachineNetworkInterfaceDetail[];
+ maxInterfaces?: number;
+ maxAddressesPerInterface?: number;
+}> = (props) => {
+ const maxInterfaces = () => props.maxInterfaces ?? 8;
+ const maxAddressesPerInterface = () => props.maxAddressesPerInterface ?? 4;
+ const shownInterfaces = () => props.interfaces.slice(0, maxInterfaces());
+ const hiddenInterfaceCount = () =>
+ Math.max(0, props.interfaces.length - shownInterfaces().length);
+
+ return (
+ <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>
+ <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, maxAddressesPerInterface())}>
+ {(address) => (
+ <span
+ 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}
+ >
+ {address}
+ </span>
+ )}
+ </For>
+ <Show when={iface.addresses.length > maxAddressesPerInterface()}>
+ <span class="rounded border border-border px-1.5 py-0.5 text-[9px] text-muted">
+ +{iface.addresses.length - maxAddressesPerInterface()}
+ </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>
+ );
+};
+
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 (
@@ -260,84 +349,91 @@ const AgentMachineNetworkCell: Component<{
<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>
- <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
- 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}
- >
- {address}
- </span>
- )}
- </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>
+ <AgentMachineNetworkInterfacesList interfaces={props.interfaces} />
+ </section>
+ </AgentMachineMetricTooltip>
+ );
+};
+
+const AgentMachineIpCell: Component<{
+ primaryIp: string;
+ ipValues: string[];
+ interfaces: AgentMachineNetworkInterfaceDetail[];
+}> = (props) => {
+ const hasDetails = () => props.ipValues.length > 0 || props.interfaces.length > 0;
+ const shownIps = () => props.ipValues.slice(0, 12);
+ const hiddenIpCount = () => Math.max(0, props.ipValues.length - shownIps().length);
+ const additionalIpCount = () => Math.max(0, props.ipValues.length - (props.primaryIp ? 1 : 0));
+ const title = () => props.ipValues.join('\n') || props.primaryIp || '—';
+ const ariaLabel = () =>
+ hasDetails() ? `IP details: ${props.ipValues.join(', ') || props.primaryIp}` : 'IP unavailable';
+
+ return (
+ <AgentMachineMetricTooltip
+ triggerDataAttribute="data-agent-machine-ip-trigger"
+ tooltipDataAttribute="data-agent-machine-ip-tooltip"
+ triggerClass="inline-flex max-w-full min-w-0 justify-start"
+ tooltipClass="min-w-[230px] max-w-[380px] space-y-2"
+ enabled={hasDetails()}
+ ariaLabel={ariaLabel()}
+ title={title()}
+ maxWidth={400}
+ trigger={
+ <span class="inline-flex max-w-full min-w-0 items-center gap-1.5">
+ <span
+ class="min-w-0 truncate font-mono text-[11px]"
+ classList={{
+ 'text-base-content': Boolean(props.primaryIp),
+ 'text-muted': !props.primaryIp,
+ }}
+ >
+ {props.primaryIp || '—'}
+ </span>
+ <Show when={additionalIpCount() > 0}>
+ <span class="shrink-0 rounded border border-border px-1 py-0.5 text-[9px] text-muted">
+ +{additionalIpCount()}
+ </span>
</Show>
- </div>
+ </span>
+ }
+ >
+ <section>
+ <div class="mb-1 border-b border-border pb-1 font-semibold text-muted">IP Addresses</div>
+ <Show
+ when={shownIps().length > 0}
+ fallback={<div class="text-[9px] text-muted">{getWorkloadsGuestNetworkEmptyState()}</div>}
+ >
+ <div class="flex max-h-[120px] flex-wrap gap-1 overflow-y-auto pr-1">
+ <For each={shownIps()}>
+ {(address) => (
+ <span
+ 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}
+ >
+ {address}
+ </span>
+ )}
+ </For>
+ <Show when={hiddenIpCount() > 0}>
+ <span class="rounded border border-border px-1.5 py-0.5 text-[9px] text-muted">
+ +{hiddenIpCount()}
+ </span>
+ </Show>
+ </div>
+ </Show>
</section>
+ <Show when={props.interfaces.length > 0}>
+ <section>
+ <div class="mb-1 border-b border-border pb-1 font-semibold text-muted">
+ Network Interfaces
+ </div>
+ <AgentMachineNetworkInterfacesList
+ interfaces={props.interfaces}
+ maxInterfaces={6}
+ maxAddressesPerInterface={4}
+ />
+ </section>
+ </Show>
</AgentMachineMetricTooltip>
);
};
@@ -1080,9 +1176,11 @@ export const AgentsMachinesTable: Component<{
<TableCell
class={`${getPlatformTableCellClassForKind('text')} ${machineColumnWidthClass('ip')} text-base-content`}
>
- <span class="truncate" title={ipValues().join('\n')}>
- {primaryIp() || '—'}
- </span>
+ <AgentMachineIpCell
+ primaryIp={primaryIp()}
+ ipValues={ipValues()}
+ interfaces={networkInterfaces()}
+ />
</TableCell>
</Show>
<Show when={columnVisibility.isColumnVisible('raid')}>
diff --git a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
index 2ebeff5dda..758f68ced7 100644
--- a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
+++ b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
@@ -196,6 +196,52 @@ describe('AgentsMachinesTable', () => {
expect(screen.getByText('1000 Mbps')).toBeInTheDocument();
});
+ it('shows structured agent IP details from the IP value', async () => {
+ const { container } = render(() => (
+ <AgentsMachinesTable
+ resources={[
+ resource({
+ id: 'ip-host',
+ name: 'IP Host',
+ identity: { ips: ['192.168.0.20', '10.0.0.20'] },
+ agent: {
+ networkInterfaces: [
+ {
+ name: 'en0',
+ mac: '10:20:30:40:50:60',
+ addresses: ['192.168.0.20', 'fe80::1'],
+ },
+ ],
+ },
+ }),
+ ]}
+ emptyIcon={emptyIcon}
+ emptyTitle="No machines"
+ emptyDescription="Install Pulse Agent."
+ />
+ ));
+
+ await fireEvent.click(screen.getByTitle('Choose which columns to display'));
+ await fireEvent.click(screen.getByLabelText('IP'));
+
+ const trigger = container.querySelector('[data-agent-machine-ip-trigger="true"]');
+ expect(trigger).not.toBeNull();
+ if (!trigger) return;
+
+ expect(trigger).toHaveTextContent('192.168.0.20');
+ expect(trigger).toHaveTextContent('+2');
+
+ await fireEvent.mouseEnter(trigger);
+
+ expect(await screen.findByText('IP Addresses')).toBeInTheDocument();
+ expect(screen.getAllByText('192.168.0.20').length).toBeGreaterThan(0);
+ expect(screen.getByText('10.0.0.20')).toBeInTheDocument();
+ expect(screen.getAllByText('fe80::1').length).toBeGreaterThan(0);
+ expect(screen.getByText('Network Interfaces')).toBeInTheDocument();
+ expect(screen.getByText('en0')).toBeInTheDocument();
+ expect(screen.getByText('10:20:30:40:50:60')).toBeInTheDocument();
+ });
+
it('shows structured agent disk I/O details from the Disk I/O value', async () => {
const { container } = render(() => (
<AgentsMachinesTable