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.

Improve Machines search affordances

rcourtman4ae0968fbe2e
diff --git a/frontend-modern/src/components/shared/SearchTipsPopover.tsx b/frontend-modern/src/components/shared/SearchTipsPopover.tsx
index 06e1fcd0b1..e1f3906c83 100644
--- a/frontend-modern/src/components/shared/SearchTipsPopover.tsx
+++ b/frontend-modern/src/components/shared/SearchTipsPopover.tsx
@@ -94,7 +94,7 @@ export const SearchTipsPopover: Component<SearchTipsPopoverProps> = (props) => {
<For each={props.tips}>
{(tip) => (
<div class="flex items-start gap-2">
- <code class="rounded bg-surface-alt px-2 py-0.5 font-mono text-[11px] text-base-content">
+ <code class="whitespace-nowrap rounded bg-surface-alt px-2 py-0.5 font-mono text-[11px] text-base-content">
{tip.code}
</code>
<span class="text-[12px] leading-snug text-muted">{tip.description}</span>
diff --git a/frontend-modern/src/components/shared/__tests__/SearchTipsPopover.test.tsx b/frontend-modern/src/components/shared/__tests__/SearchTipsPopover.test.tsx
index 8a95f7e354..de00ec414f 100644
--- a/frontend-modern/src/components/shared/__tests__/SearchTipsPopover.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/SearchTipsPopover.test.tsx
@@ -32,9 +32,7 @@ describe('SearchTipsPopover', () => {
it('toggles the popover on click by default', async () => {
render(() => (
- <SearchTipsPopover
- tips={[{ code: 'name:web', description: 'Filter by name' }]}
- />
+ <SearchTipsPopover tips={[{ code: 'name:web', description: 'Filter by name' }]} />
));
const trigger = screen.getByRole('button', { name: 'Search tips' });
@@ -42,6 +40,7 @@ describe('SearchTipsPopover', () => {
fireEvent.click(trigger);
expect(await screen.findByRole('dialog', { name: 'Search tips' })).toBeInTheDocument();
+ expect(screen.getByText('name:web')).toHaveClass('whitespace-nowrap');
fireEvent.click(trigger);
expect(screen.queryByRole('dialog', { name: 'Search tips' })).toBeNull();
@@ -49,10 +48,7 @@ describe('SearchTipsPopover', () => {
it('opens on hover when configured', async () => {
render(() => (
- <SearchTipsPopover
- openOnHover
- tips={[{ code: 'tag:web', description: 'Filter by tag' }]}
- />
+ <SearchTipsPopover openOnHover tips={[{ code: 'tag:web', description: 'Filter by tag' }]} />
));
const trigger = screen.getByRole('button', { name: 'Search tips' });
@@ -65,9 +61,7 @@ describe('SearchTipsPopover', () => {
it('closes on Escape while open', async () => {
render(() => (
- <SearchTipsPopover
- tips={[{ code: 'cpu>80', description: 'Filter by CPU threshold' }]}
- />
+ <SearchTipsPopover tips={[{ code: 'cpu>80', description: 'Filter by CPU threshold' }]} />
));
fireEvent.click(screen.getByRole('button', { name: 'Search tips' }));
diff --git a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
index ce50a18029..1ebbb1d949 100644
--- a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
+++ b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
@@ -6,7 +6,7 @@ import {
FilterButtonGroup,
type FilterOption as PlatformTableFilterOption,
} from '@/components/shared/FilterButtonGroup';
-import { SearchInput } from '@/components/shared/SearchInput';
+import { SearchInput, type SearchInputProps } from '@/components/shared/SearchInput';
import { TableCard } from '@/components/shared/TableCard';
import { UnifiedResourceTable } from '@/components/Infrastructure/UnifiedResourceTable';
import type { Resource, ResourceStatus } from '@/types/resource';
@@ -288,6 +288,8 @@ export function PlatformTableToolbar<T extends string | number>(props: {
search: () => string;
onSearchChange: (value: string) => void;
searchPlaceholder: string;
+ searchHistory?: SearchInputProps['history'];
+ searchTips?: SearchInputProps['tips'];
status: T;
onStatusChange: (value: T) => void;
statusOptions: PlatformTableFilterOption<T>[];
@@ -302,6 +304,9 @@ export function PlatformTableToolbar<T extends string | number>(props: {
value={props.search}
onChange={props.onSearchChange}
placeholder={props.searchPlaceholder}
+ title={props.searchPlaceholder}
+ history={props.searchHistory}
+ tips={props.searchTips}
/>
</div>
<FilterButtonGroup
diff --git a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
index 17940a8e14..e8e3033905 100644
--- a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
+++ b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
@@ -51,6 +51,7 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import type { Disk } from '@/types/api';
import type { Resource, ResourceAvailabilityMeta } from '@/types/resource';
import { formatBytes, formatSpeed, normalizeDiskArray } from '@/utils/format';
+import { STORAGE_KEYS } from '@/utils/localStorage';
import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
import {
getRaidDeviceBadgeClass,
@@ -71,6 +72,7 @@ import {
getAgentMachineDiskIODetails,
getAgentMachineDiskIOTotal,
getAgentMachineIpValues,
+ matchesAgentMachineSearch,
getAgentMachineNetworkInterfaceDetails,
getAgentMachineNetworkTotal,
getAgentMachinePrimaryIp,
@@ -872,6 +874,29 @@ const systemLabelFor = (machine: Resource): string => {
const agentVersionFor = (machine: Resource): string =>
isAgentlessMachine(machine) ? 'Agentless' : asTrimmedString(machine.agent?.agentVersion) || '—';
+const filterAgentMachineResources = (
+ resources: Resource[],
+ search: string,
+ status: PlatformResourceStatusFilter,
+): Resource[] =>
+ filterPlatformResources(resources, '', status).filter((machine) =>
+ matchesAgentMachineSearch(machine, search, systemLabelFor, agentVersionFor),
+ );
+
+const AGENT_MACHINE_SEARCH_TIPS = {
+ popoverId: 'machines-search-help',
+ intro: 'Filter Pulse Agent machines by identity, platform, or reported inventory.',
+ tips: [
+ { code: 'mac-mini', description: 'Match hostnames and display names' },
+ { code: '192.168.0.98', description: 'Find reported IP addresses' },
+ { code: 'macos', description: 'Find operating system names or versions' },
+ { code: 'arm64', description: 'Match CPU architecture' },
+ { code: 'darwin', description: 'Find kernel or platform details' },
+ ],
+ footerHighlight: 'Tip',
+ footerText: 'Hidden columns such as IP, RAID, Arch, and Kernel are still searchable.',
+};
+
const networkTitleFor = (machine: Resource): string => {
if (!machine.network) return '';
return `In ${formatSpeed(machine.network.rxBytes)}\nOut ${formatSpeed(machine.network.txBytes)}`;
@@ -998,7 +1023,7 @@ export const AgentsMachinesTable: Component<{
const tableState = createPlatformTableFilterState({
resources: () => props.resources,
initialStatus: 'all' as PlatformResourceStatusFilter,
- filter: filterPlatformResources,
+ filter: filterAgentMachineResources,
});
const [sortKey, setSortKey] = createSignal<AgentMachineSortKey>('name');
const [sortDirection, setSortDirection] = createSignal<'asc' | 'desc'>('asc');
@@ -1107,6 +1132,11 @@ export const AgentsMachinesTable: Component<{
search={tableState.search}
onSearchChange={tableState.setSearch}
searchPlaceholder="Search machines"
+ searchHistory={{
+ storageKey: STORAGE_KEYS.MACHINES_SEARCH_HISTORY,
+ emptyMessage: 'Machine searches you run will appear here.',
+ }}
+ searchTips={AGENT_MACHINE_SEARCH_TIPS}
status={tableState.status()}
onStatusChange={tableState.setStatus}
statusOptions={PLATFORM_HEALTH_FILTER_OPTIONS}
diff --git a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
index a403a5a4fe..cce24a4758 100644
--- a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
+++ b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
@@ -2,6 +2,7 @@ import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { AgentMetadataAPI } from '@/api/agentMetadata';
import type { Resource } from '@/types/resource';
+import { STORAGE_KEYS } from '@/utils/localStorage';
import { RESOURCE_METADATA_CHANGED_EVENT } from '@/utils/resourceMetadataEvents';
import { AgentsMachinesTable } from '../AgentsMachinesTable';
@@ -186,6 +187,72 @@ describe('AgentsMachinesTable', () => {
expect(screen.getByText('richard-mac-mini.local | 192.168.0.98')).toBeInTheDocument();
});
+ it('searches machine-native fields and exposes host-style search affordances', async () => {
+ render(() => (
+ <AgentsMachinesTable
+ resources={[
+ resource({
+ id: 'mac-mini',
+ name: 'Mac Mini',
+ identity: { hostname: 'richard-mac-mini.local', ips: ['192.168.0.98'] },
+ agent: {
+ osName: 'macOS',
+ osVersion: '15.5',
+ architecture: 'arm64',
+ kernelVersion: 'Darwin 24.5.0',
+ networkInterfaces: [
+ {
+ name: 'en0',
+ mac: '10:20:30:40:50:60',
+ addresses: ['10.0.0.98'],
+ },
+ ],
+ },
+ }),
+ resource({
+ id: 'windows-runner',
+ name: 'Windows Runner',
+ identity: { ips: ['192.168.0.49'] },
+ agent: {
+ osName: 'Windows',
+ osVersion: '11 Pro',
+ architecture: 'x86_64',
+ kernelVersion: '10.0.22631',
+ },
+ }),
+ ]}
+ emptyIcon={emptyIcon}
+ emptyTitle="No machines"
+ emptyDescription="Install Pulse Agent."
+ />
+ ));
+
+ const search = screen.getByPlaceholderText('Search machines');
+
+ await fireEvent.input(search, { target: { value: 'macos' } });
+ expect(screen.getByText('Mac Mini')).toBeInTheDocument();
+ expect(screen.queryByText('Windows Runner')).not.toBeInTheDocument();
+
+ await fireEvent.keyDown(search, { key: 'Enter' });
+ expect(window.localStorage.getItem(STORAGE_KEYS.MACHINES_SEARCH_HISTORY)).toContain('macos');
+
+ await fireEvent.input(search, { target: { value: '10.0.0.98' } });
+ expect(screen.getByText('Mac Mini')).toBeInTheDocument();
+ expect(screen.queryByText('Windows Runner')).not.toBeInTheDocument();
+
+ const historyToggle = screen.getByTitle('Show recent searches');
+ await fireEvent.click(historyToggle);
+ expect(screen.getByRole('button', { name: 'macos' })).toBeInTheDocument();
+
+ const tipsButton = screen.getByRole('button', { name: 'Search tips' });
+ await fireEvent.click(tipsButton);
+ expect(screen.getByRole('dialog', { name: 'Search tips' })).toBeInTheDocument();
+ expect(screen.getByText('arm64')).toBeInTheDocument();
+ expect(
+ screen.getByText('Hidden columns such as IP, RAID, Arch, and Kernel are still searchable.'),
+ ).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);
diff --git a/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts b/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts
index 5440de782e..3d8566e5ed 100644
--- a/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts
+++ b/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts
@@ -6,6 +6,7 @@ import {
getAgentMachineRaidArrayDetails,
getAgentMachineTemperatureCelsius,
getAgentMachineTemperatureTitle,
+ matchesAgentMachineSearch,
sortAgentMachines,
} from '../agentMachineTableModel';
@@ -271,4 +272,56 @@ describe('agentMachineTableModel', () => {
expect(sorted.map((machine) => machine.id)).toEqual(['warm', 'cool']);
});
+
+ it('matches machine-native search fields beyond the generic resource identity', () => {
+ const machine = resource({
+ id: 'richard-mac-mini',
+ name: 'Richard Mac Mini',
+ identity: { hostname: 'richard-mac-mini.local', ips: ['192.168.0.98'] },
+ agent: {
+ agentVersion: '6.0.0',
+ hostname: 'richard-mac-mini.local',
+ osName: 'macOS',
+ osVersion: '15.5',
+ kernelVersion: 'Darwin 24.5.0',
+ architecture: 'arm64',
+ networkInterfaces: [
+ {
+ name: 'en0',
+ mac: '10:20:30:40:50:60',
+ addresses: ['10.0.0.98'],
+ },
+ ],
+ raid: [
+ {
+ device: '/dev/md0',
+ level: 'raid1',
+ state: 'clean',
+ totalDevices: 2,
+ activeDevices: 2,
+ workingDevices: 2,
+ failedDevices: 0,
+ spareDevices: 0,
+ devices: [{ device: '/dev/disk3', state: 'active', slot: 0 }],
+ rebuildPercent: 0,
+ },
+ ],
+ },
+ });
+ const getSystemLabel = () => 'macOS 15.5';
+ const getAgentLabel = () => '6.0.0';
+
+ expect(matchesAgentMachineSearch(machine, 'macos', getSystemLabel, getAgentLabel)).toBe(true);
+ expect(matchesAgentMachineSearch(machine, '10.0.0.98', getSystemLabel, getAgentLabel)).toBe(
+ true,
+ );
+ expect(matchesAgentMachineSearch(machine, 'arm64', getSystemLabel, getAgentLabel)).toBe(true);
+ expect(matchesAgentMachineSearch(machine, 'darwin', getSystemLabel, getAgentLabel)).toBe(true);
+ expect(matchesAgentMachineSearch(machine, '/dev/disk3', getSystemLabel, getAgentLabel)).toBe(
+ true,
+ );
+ expect(matchesAgentMachineSearch(machine, 'windows', getSystemLabel, getAgentLabel)).toBe(
+ false,
+ );
+ });
});
diff --git a/frontend-modern/src/features/standalone/agentMachineTableModel.ts b/frontend-modern/src/features/standalone/agentMachineTableModel.ts
index e5310e6b6c..06cc1b3495 100644
--- a/frontend-modern/src/features/standalone/agentMachineTableModel.ts
+++ b/frontend-modern/src/features/standalone/agentMachineTableModel.ts
@@ -279,6 +279,36 @@ const uniqueTrimmedValues = (values: readonly string[] | undefined): string[] =>
return result;
};
+const searchableValue = (value: unknown): string | undefined => {
+ if (typeof value === 'string') return asTrimmedString(value);
+ if (typeof value === 'number' && Number.isFinite(value)) return String(value);
+ return undefined;
+};
+
+const appendSearchValue = (values: string[], value: unknown) => {
+ const normalized = searchableValue(value);
+ if (normalized) values.push(normalized);
+};
+
+const appendSearchValues = (values: string[], candidates: readonly unknown[]) => {
+ for (const candidate of candidates) appendSearchValue(values, candidate);
+};
+
+const sensorSearchValues = (machine: Resource): unknown[] => [
+ ...Object.keys(machine.agent?.sensors?.temperatureCelsius ?? {}),
+ ...Object.keys(machine.agent?.sensors?.fanRpm ?? {}),
+ ...Object.keys(machine.agent?.sensors?.additional ?? {}),
+ ...(machine.agent?.sensors?.smart ?? []).flatMap((disk) => [
+ disk.device,
+ disk.model,
+ disk.serial,
+ disk.wwn,
+ disk.type,
+ disk.health,
+ disk.standby ? 'standby' : undefined,
+ ]),
+];
+
export const getAgentMachineNetworkInterfaceDetails = (
machine: Resource,
): AgentMachineNetworkInterfaceDetail[] =>
@@ -537,6 +567,78 @@ export const getAgentMachineRaidSummary = (machine: Resource): string => {
return `${arrays.length} arrays`;
};
+export const matchesAgentMachineSearch = (
+ machine: Resource,
+ search: string,
+ getSystemLabel: (machine: Resource) => string,
+ getAgentLabel: (machine: Resource) => string,
+): boolean => {
+ const needle = search.trim().toLowerCase();
+ if (!needle) return true;
+
+ const values: string[] = [];
+ appendSearchValues(values, [
+ machine.name,
+ machine.displayName,
+ machine.id,
+ machine.parentName,
+ machine.platformId,
+ machine.platformType,
+ machine.status,
+ machine.technology,
+ machine.identity?.hostname,
+ machine.identity?.machineId,
+ machine.canonicalIdentity?.displayName,
+ machine.canonicalIdentity?.hostname,
+ machine.canonicalIdentity?.platformId,
+ machine.canonicalIdentity?.primaryId,
+ ...(machine.canonicalIdentity?.aliases ?? []),
+ ...(machine.identity?.ips ?? []),
+ ...(machine.tags ?? []),
+ getSystemLabel(machine),
+ getAgentLabel(machine),
+ machine.agent?.agentId,
+ machine.agent?.agentVersion,
+ machine.agent?.hostname,
+ machine.agent?.platform,
+ machine.agent?.hostProfile,
+ machine.agent?.osName,
+ machine.agent?.osVersion,
+ machine.agent?.kernelVersion,
+ machine.agent?.architecture,
+ machine.agent?.uptimeSeconds,
+ machine.agent?.cpuCount,
+ ]);
+ appendSearchValues(values, getAgentMachineIpValues(machine));
+ appendSearchValues(
+ values,
+ getAgentMachineNetworkInterfaceDetails(machine).flatMap((iface) => [
+ iface.name,
+ iface.mac,
+ ...iface.addresses,
+ iface.speedMbps,
+ ]),
+ );
+ appendSearchValues(
+ values,
+ getAgentMachineDiskIODetails(machine).map((disk) => disk.device),
+ );
+ appendSearchValues(
+ values,
+ getAgentMachineRaidArrayDetails(machine).flatMap((array) => [
+ array.device,
+ array.name,
+ array.level,
+ array.state,
+ array.rebuildSpeed,
+ ...array.devices.flatMap((device) => [device.device, device.state, device.slot]),
+ ]),
+ );
+ appendSearchValues(values, [getAgentMachineRaidSummary(machine), ...sensorSearchValues(machine)]);
+
+ return values.join(' ').toLowerCase().includes(needle);
+};
+
export const getNextAgentMachineSortState = (
currentKey: AgentMachineSortKey,
currentDirection: AgentMachineSortDirection,
diff --git a/frontend-modern/src/utils/localStorage.ts b/frontend-modern/src/utils/localStorage.ts
index a1c5579f60..a18d094be2 100644
--- a/frontend-modern/src/utils/localStorage.ts
+++ b/frontend-modern/src/utils/localStorage.ts
@@ -176,6 +176,9 @@ export const STORAGE_KEYS = {
WORKLOADS_METRIC_HISTORY_RANGE: 'workloadsMetricHistoryRange',
AGENTS_SEARCH_HISTORY: 'agentsSearchHistory',
+ // Machines settings
+ MACHINES_SEARCH_HISTORY: 'machinesSearchHistory',
+
// Storage search
STORAGE_SEARCH_HISTORY: 'storageSearchHistory',