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.

Keep installer lookup Last seen ticking on the shared clock

rcourtman1a3e62d33559
diff --git a/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx b/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx
index b7780a566f..3b4597d9e9 100644
--- a/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx
@@ -5,6 +5,7 @@ import { FormSelect } from '@/components/shared/FormSelect';
import SettingsPanel from '@/components/shared/SettingsPanel';
import { copyToClipboard } from '@/utils/clipboard';
import { formatAbsoluteTime, formatRelativeTime } from '@/utils/format';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import { notificationStore } from '@/stores/notifications';
import { getUnifiedAgentLookupStatusPresentation } from '@/utils/unifiedAgentStatusPresentation';
import {
@@ -130,6 +131,7 @@ export const InfrastructureInstallerSection: Component<InfrastructureInstallerSe
props,
) => {
const state = useInfrastructureOperationsContext();
+ const now = useRelativeTimeNow();
const [showAdvancedOptions, setShowAdvancedOptions] = createSignal(false);
const focus = createMemo<InfrastructureInstallerFocus>(() => props.focus ?? 'agent');
const presentation = createMemo(() => INSTALLER_FOCUS_PRESENTATION[focus()]);
@@ -821,7 +823,7 @@ export const InfrastructureInstallerSection: Component<InfrastructureInstallerSe
</div>
<div class="space-y-1">
<div>
- Last seen {formatRelativeTime(agent().lastSeen)} (
+ Last seen {formatRelativeTime(agent().lastSeen, { now: now() })} (
{formatAbsoluteTime(agent().lastSeen)})
</div>
<Show when={agent().agentVersion}>
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureInstallerSection.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureInstallerSection.test.tsx
new file mode 100644
index 0000000000..62e481aa55
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureInstallerSection.test.tsx
@@ -0,0 +1,53 @@
+import { render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { AgentLookupResponse } from '@/types/api';
+import { InfrastructureInstallerSection } from '../InfrastructureInstallerSection';
+
+const START = Date.parse('2026-10-16T22:00:00Z');
+
+const lookupResult: AgentLookupResponse = {
+ success: true,
+ agent: {
+ id: 'agent-1',
+ hostname: 'host-1',
+ status: 'offline',
+ connected: false,
+ lastSeen: START - 60_000,
+ },
+};
+
+// Only the fields the lookup result path reads are meaningful; every other
+// state accessor reads as unset so the rest of the panel stays collapsed.
+const stateOverrides: Record<string, unknown> = {
+ commandsUnlocked: () => true,
+ requiresToken: () => false,
+ commandSections: () => [],
+ getInstallProfileFlags: () => [],
+ lookupResult: () => lookupResult,
+};
+
+vi.mock('../useInfrastructureOperationsState', () => ({
+ useInfrastructureOperationsContext: () =>
+ new Proxy(stateOverrides, {
+ get: (target, key: string) => (key in target ? target[key] : () => undefined),
+ }),
+}));
+
+describe('InfrastructureInstallerSection', () => {
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ it('ages the lookup Last seen label on the shared clock', async () => {
+ vi.useFakeTimers({ now: START });
+ const view = render(() => <InfrastructureInstallerSection />);
+ const label = screen.getByText(/^Last seen/);
+ expect(label).toHaveTextContent('Last seen 1 min ago');
+
+ await vi.advanceTimersByTimeAsync(2 * 3_600_000);
+
+ expect(screen.getByText(/^Last seen/)).toBe(label);
+ expect(label).toHaveTextContent('Last seen 2 hours ago');
+ view.unmount();
+ });
+});