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.

Preserve Machines seen context when column hidden

rcourtman2550d1fc8681
diff --git a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
index b69c91bee2..7606f069ad 100644
--- a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
+++ b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
@@ -756,11 +756,13 @@ const appendUniqueMachineSubtitlePart = (parts: string[], value: string | undefi
parts.push(value?.trim() ?? '');
};
-const machineIdentitySubtitleFor = (
+const machineRowSubtitleFor = (
name: string,
hostname: string | undefined,
primaryIp: string,
+ lastSeen: string,
includePrimaryIp: boolean,
+ includeLastSeen: boolean,
): string => {
const parts: string[] = [];
@@ -770,6 +772,9 @@ const machineIdentitySubtitleFor = (
if (includePrimaryIp) {
appendUniqueMachineSubtitlePart(parts, primaryIp);
}
+ if (includeLastSeen && lastSeen && lastSeen !== '—') {
+ appendUniqueMachineSubtitlePart(parts, `seen ${lastSeen}`);
+ }
return parts.slice(0, 2).join(' | ');
};
@@ -1032,12 +1037,20 @@ export const AgentsMachinesTable: Component<{
const diskIOTotal = () => getAgentMachineDiskIOTotal(machine);
const diskIODetails = () => getAgentMachineDiskIODetails(machine);
const primaryIp = () => getAgentMachinePrimaryIp(machine);
+ const lastSeenLabel = () =>
+ formatLastSeen(
+ isAgentlessMachine(machine)
+ ? availabilityFor(machine)?.lastChecked
+ : machine.lastSeen,
+ );
const machineSubtitle = () =>
- machineIdentitySubtitleFor(
+ machineRowSubtitleFor(
name(),
hostname(),
primaryIp(),
+ lastSeenLabel(),
!columnVisibility.isColumnVisible('ip'),
+ !columnVisibility.isColumnVisible('lastSeen'),
);
const ipValues = () => getAgentMachineIpValues(machine);
const raidArrays = () => getAgentMachineRaidArrayDetails(machine);
@@ -1220,11 +1233,7 @@ export const AgentsMachinesTable: Component<{
<TableCell
class={`${getPlatformTableCellClassForKind('numeric-value')} ${machineColumnWidthClass('lastSeen')} text-base-content`}
>
- {formatLastSeen(
- isAgentlessMachine(machine)
- ? availabilityFor(machine)?.lastChecked
- : machine.lastSeen,
- )}
+ {lastSeenLabel()}
</TableCell>
</Show>
<Show when={columnVisibility.isColumnVisible('ip')}>
diff --git a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
index 23533a8595..cbe1f850d6 100644
--- a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
+++ b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
@@ -171,6 +171,33 @@ describe('AgentsMachinesTable', () => {
expect(screen.getByText('richard-mac-mini.local | 192.168.0.98')).toBeInTheDocument();
});
+ it('preserves last-seen context in the machine subtitle when that column is hidden', async () => {
+ vi.spyOn(Date, 'now').mockReturnValue(1_700_000_600_000);
+
+ render(() => (
+ <AgentsMachinesTable
+ resources={[
+ resource({
+ id: 'recent-machine',
+ name: 'Recent Machine',
+ lastSeen: 1_700_000_300_000,
+ identity: { ips: ['192.168.0.21'] },
+ }),
+ ]}
+ emptyIcon={emptyIcon}
+ emptyTitle="No machines"
+ emptyDescription="Install Pulse Agent."
+ />
+ ));
+
+ expect(screen.queryByText('192.168.0.21 | seen 5m')).not.toBeInTheDocument();
+
+ await fireEvent.click(screen.getByTitle('Choose which columns to display'));
+ await fireEvent.click(screen.getByLabelText('Last seen'));
+
+ expect(screen.getByText('192.168.0.21 | seen 5m')).toBeInTheDocument();
+ });
+
it('shows a row expansion affordance for machine details', async () => {
const { container } = render(() => (
<AgentsMachinesTable