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.

Surface endpoint monitoring in active infrastructure settings

rcourtman48017e349a79
diff --git a/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx b/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
index dfa2cc934e..71a275e64f 100644
--- a/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
@@ -8,7 +8,7 @@ import {
type Accessor,
type Component,
} from 'solid-js';
-import { Cpu, Plus, RotateCw, Search, SlidersHorizontal } from 'lucide-solid';
+import { Activity, Cpu, Plus, RotateCw, Search, SlidersHorizontal } from 'lucide-solid';
import SettingsPanel from '@/components/shared/SettingsPanel';
import {
Table,
@@ -360,6 +360,9 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
);
const connectedSystemCount = createMemo(() => props.rows().length);
const discoveredCandidateCount = createMemo(() => props.discoveredNodes().length);
+ const availabilityEndpointCount = createMemo(
+ () => props.rows().filter((row) => row.ownerType === 'availability').length,
+ );
// Scoped to Proxmox VE: PBS/PMG/TrueNAS/etc. are fully covered by their
// own API and don't benefit from a paired agent in the way PVE hosts do
// (where the agent adds temps, SMART, host identity). Counting them here
@@ -457,6 +460,14 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
label: 'Systems',
value: formatCount(connectedSystemCount(), 'system'),
},
+ ...(availabilityEndpointCount() > 0
+ ? [
+ {
+ label: 'Endpoints',
+ value: formatCount(availabilityEndpointCount(), 'endpoint'),
+ },
+ ]
+ : []),
{
label: 'Live',
value: formatCount(liveFleetSystemCount(), 'system'),
@@ -514,6 +525,14 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
});
const useCardLayout = createMemo(() => layoutWidth() <= CARD_LAYOUT_MAX_WIDTH_PX);
+ const handleMonitorEndpointShortcut = () => {
+ if (props.onAddSourceStep) {
+ props.onAddSourceStep('availability');
+ return;
+ }
+ props.onAddSource?.('availability');
+ };
+
const headerActions = () => (
<Show when={!props.readOnly}>
<div class="border-b border-border bg-surface px-4 py-3">
@@ -528,6 +547,17 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
Add infrastructure
</button>
</Show>
+ <Show when={props.onAddSourceStep || props.onAddSource}>
+ <button
+ type="button"
+ onClick={handleMonitorEndpointShortcut}
+ class={workspaceSecondaryButtonClass}
+ title="Monitor a device or service with ICMP, TCP, or HTTP availability checks."
+ >
+ <Activity class="h-4 w-4" />
+ Monitor endpoint
+ </button>
+ </Show>
{/* Discovery actions stay utility-tier but must remain explicit:
manual scans are an operator command, not an icon-hunt. */}
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx
index 2da4ea6fbc..ed610bd0bb 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx
@@ -96,6 +96,7 @@ describe('InfrastructureSourceManager setup summary', () => {
it('renders manual discovery as a visible operator action', () => {
const onRunDiscovery = vi.fn();
const onOpenDiscoverySettings = vi.fn();
+ const onAddSourceStep = vi.fn();
render(() => (
<InfrastructureSourceManager
@@ -104,11 +105,15 @@ describe('InfrastructureSourceManager setup summary', () => {
discoveryEnabled
discoveryScanStatus={() => ({ scanning: false })}
readOnly={false}
+ onAddSourceStep={onAddSourceStep}
onRunDiscovery={onRunDiscovery}
onOpenDiscoverySettings={onOpenDiscoverySettings}
/>
));
+ fireEvent.click(screen.getByRole('button', { name: /^Monitor endpoint$/i }));
+ expect(onAddSourceStep).toHaveBeenCalledWith('availability');
+
fireEvent.click(screen.getByRole('button', { name: /^Run discovery$/i }));
expect(onRunDiscovery).toHaveBeenCalledTimes(1);
@@ -120,6 +125,26 @@ describe('InfrastructureSourceManager setup summary', () => {
render(() => (
<InfrastructureSourceManager
rows={() => [
+ row({
+ id: 'availability:meter',
+ ownerType: 'availability',
+ name: 'MQTT power meter',
+ subtitle: 'via availability probe',
+ source: 'probe',
+ host: 'power-meter-01.lab.local',
+ coverageLabels: ['Availability'],
+ connection: connectionFixture({
+ id: 'availability:meter',
+ type: 'availability',
+ name: 'MQTT power meter',
+ address: 'power-meter-01.lab.local',
+ source: 'manual',
+ surfaces: ['availability'],
+ scope: { availability: true },
+ }),
+ fleetSignals: [signal({ key: 'liveness', label: 'Live', tone: 'ok' })],
+ fleetHighlights: [],
+ }),
row({
fleetSignals: [
signal({ key: 'liveness', label: 'Live', tone: 'ok' }),
@@ -159,6 +184,8 @@ describe('InfrastructureSourceManager setup summary', () => {
expect(screen.getByText('Setup status')).toBeInTheDocument();
expect(screen.getByText('Systems')).toBeInTheDocument();
+ expect(screen.getByText('Endpoints')).toBeInTheDocument();
+ expect(screen.getByText('1 endpoint')).toBeInTheDocument();
expect(screen.getByText('Live')).toBeInTheDocument();
expect(screen.getByText('Needs attention')).toBeInTheDocument();
expect(screen.getByText('Needs agent')).toBeInTheDocument();
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
index a08b034fc6..ad77d11793 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
@@ -342,6 +342,11 @@ describe('InfrastructureWorkspace', () => {
expect(navigateSpy).toHaveBeenLastCalledWith('/settings/infrastructure?add=pick', {
scroll: false,
});
+
+ fireEvent.click(screen.getByRole('button', { name: /^Monitor endpoint$/i }));
+ expect(navigateSpy).toHaveBeenLastCalledWith('/settings/infrastructure?add=availability', {
+ scroll: false,
+ });
});
it('keeps source groups in the catalog order instead of count order', async () => {
diff --git a/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx b/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
index 77da31a3f5..c20dd31103 100644
--- a/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
+++ b/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
@@ -4,12 +4,13 @@ import { buildInfrastructureOnboardingPath } from '@/components/Settings/infrast
import { EmptyState } from '@/components/shared/EmptyState';
import { Card } from '@/components/shared/Card';
import { FilterBar, type FilterDef } from '@/components/shared/FilterBar';
-import { ChartVisibilityToggleButton } from '@/components/shared/FilterToolbar';
+import { ChartVisibilityToggleButton, FilterActionButton } from '@/components/shared/FilterToolbar';
import { GroupedTableModeSegmentedControl } from '@/components/shared/GroupedTableModeSegmentedControl';
import { PageHeader } from '@/components/shared/PageHeader';
import { StickySummarySection } from '@/components/shared/StickySummarySection';
import { UnifiedResourceTable } from '@/components/Infrastructure/UnifiedResourceTable';
import { InfrastructureSummary } from '@/components/Infrastructure/InfrastructureSummary';
+import ActivityIcon from 'lucide-solid/icons/activity';
import ServerIcon from 'lucide-solid/icons/server';
import RefreshCwIcon from 'lucide-solid/icons/refresh-cw';
import SettingsIcon from 'lucide-solid/icons/settings';
@@ -77,6 +78,12 @@ export function InfrastructurePageSurface() {
const infrastructureEmptyState = () => getInfrastructureEmptyState();
const infrastructureFilterEmptyState = () => getInfrastructureFilterEmptyState();
const infrastructureLoadFailureState = () => getInfrastructureLoadFailureState();
+ const hasAvailabilitySource = () =>
+ sourceOptions().some((source) => source.key === 'availability');
+ const availabilitySourceActive = () => selectedSource() === 'availability';
+ const toggleAvailabilitySource = () => {
+ setSelectedSource(availabilitySourceActive() ? '' : 'availability');
+ };
return (
<div ref={setSummaryClearSurfaceRootRef} data-testid="infrastructure-page" class="space-y-4">
@@ -181,6 +188,28 @@ export function InfrastructurePageSurface() {
historyKey: STORAGE_KEYS.RESOURCES_SEARCH_HISTORY,
emptyMessage: 'Recent infrastructure searches appear here.',
}}
+ searchTrailing={
+ <Show when={hasAvailabilitySource()}>
+ <FilterActionButton
+ active={availabilitySourceActive()}
+ aria-label={
+ availabilitySourceActive()
+ ? 'Show all infrastructure sources'
+ : 'Show availability endpoints'
+ }
+ aria-pressed={availabilitySourceActive()}
+ title={
+ availabilitySourceActive()
+ ? 'Show all infrastructure sources'
+ : 'Show availability endpoints'
+ }
+ onClick={toggleAvailabilitySource}
+ >
+ <ActivityIcon class="h-3 w-3" />
+ Endpoints
+ </FilterActionButton>
+ </Show>
+ }
filters={
[
{
diff --git a/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.test.tsx b/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.test.tsx
new file mode 100644
index 0000000000..140d2250e1
--- /dev/null
+++ b/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.test.tsx
@@ -0,0 +1,146 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { Resource } from '@/types/resource';
+import { InfrastructurePageSurface } from '../InfrastructurePageSurface';
+
+const mocks = vi.hoisted(() => ({
+ navigate: vi.fn(),
+ useInfrastructurePageState: vi.fn(),
+}));
+
+vi.mock('@solidjs/router', () => ({
+ useLocation: () => ({
+ hash: '',
+ pathname: '/infrastructure',
+ search: '',
+ }),
+ useNavigate: () => mocks.navigate,
+}));
+
+vi.mock('../useInfrastructurePageState', () => ({
+ useInfrastructurePageState: mocks.useInfrastructurePageState,
+}));
+
+vi.mock('@/components/Infrastructure/InfrastructureSummary', () => ({
+ InfrastructureSummary: () => <div data-testid="infrastructure-summary" />,
+}));
+
+vi.mock('@/components/Infrastructure/UnifiedResourceTable', () => ({
+ UnifiedResourceTable: (props: { resources: Resource[] }) => (
+ <div data-testid="infrastructure-table" data-resource-count={props.resources.length} />
+ ),
+}));
+
+vi.mock('@/components/Infrastructure/AgentDeployModal', () => ({
+ AgentDeployModal: () => <div data-testid="agent-deploy-modal" />,
+}));
+
+vi.mock('@/components/shared/ScrollToTopButton', () => ({
+ ScrollToTopButton: () => <button type="button">Scroll to top</button>,
+}));
+
+const makeResource = (overrides: Partial<Resource> = {}): Resource => ({
+ id: 'resource-availability-1',
+ name: 'mqtt-meter',
+ displayName: 'MQTT power meter',
+ platformId: 'mock-availability-mqtt-meter',
+ platformType: 'availability',
+ sourceType: 'api',
+ status: 'online',
+ type: 'network-endpoint',
+ lastSeen: 1_700_000_000_000,
+ platformData: { sources: ['availability'] },
+ tags: [],
+ ...overrides,
+});
+
+const createPageState = (overrides: Record<string, unknown> = {}) => ({
+ activeSummaryResourceGroupScope: () => null,
+ activeSummaryResourceId: () => null,
+ chartHoverSync: () => null,
+ clearFilters: vi.fn(),
+ clearPinnedSummaryScope: vi.fn(),
+ deployCluster: () => null,
+ error: () => null,
+ expandedResourceId: () => null,
+ filteredResources: () => [makeResource()],
+ focusedSummaryResourceGroupId: () => null,
+ focusedSummaryResourceGroupScope: () => null,
+ groupingMode: () => 'grouped',
+ hasActiveFilters: () => false,
+ hasFilteredResources: () => true,
+ highlightedResourceId: () => null,
+ hoveredResourceId: () => null,
+ hoveredSummaryResourceGroupScope: () => null,
+ infrastructureSummaryRange: () => '1h',
+ initialLoadComplete: () => true,
+ isMobile: () => false,
+ jumpToActiveResourceRow: vi.fn(),
+ kioskMode: () => false,
+ loading: () => false,
+ refetch: vi.fn(),
+ revealedResourceId: () => null,
+ searchQuery: () => '',
+ selectedSource: () => '',
+ selectedStatus: () => '',
+ setChartHoverSync: vi.fn(),
+ setDeployCluster: vi.fn(),
+ setExpandedResourceId: vi.fn(),
+ setFocusedResourceGroupId: vi.fn(),
+ setHoveredResourceGroupScope: vi.fn(),
+ setHoveredResourceId: vi.fn(),
+ setInfrastructureSummaryRange: vi.fn(),
+ setGroupingMode: vi.fn(),
+ setSearchQuery: vi.fn(),
+ setSelectedSource: vi.fn(),
+ setSelectedStatus: vi.fn(),
+ setSummaryClearSurfaceRootRef: vi.fn(),
+ setSummaryCollapsed: vi.fn(),
+ setSummaryTableRootRef: vi.fn(),
+ shouldShowJumpToActiveResourceRow: () => false,
+ showNoResources: () => false,
+ sourceOptions: () => [{ key: 'availability', label: 'Availability' }],
+ statusOptions: () => [{ key: 'online', label: 'Online' }],
+ summaryCollapsed: () => false,
+ ...overrides,
+});
+
+afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+});
+
+describe('InfrastructurePageSurface', () => {
+ it('surfaces availability endpoint rows through a visible source shortcut', () => {
+ const setSelectedSource = vi.fn();
+ mocks.useInfrastructurePageState.mockReturnValue(createPageState({ setSelectedSource }));
+
+ render(() => <InfrastructurePageSurface />);
+
+ const button = screen.getByRole('button', { name: 'Show availability endpoints' });
+ expect(button).toHaveTextContent('Endpoints');
+
+ fireEvent.click(button);
+
+ expect(setSelectedSource).toHaveBeenCalledWith('availability');
+ });
+
+ it('clears the availability source shortcut when it is active', () => {
+ const setSelectedSource = vi.fn();
+ mocks.useInfrastructurePageState.mockReturnValue(
+ createPageState({
+ selectedSource: () => 'availability',
+ setSelectedSource,
+ }),
+ );
+
+ render(() => <InfrastructurePageSurface />);
+
+ const button = screen.getByRole('button', { name: 'Show all infrastructure sources' });
+ expect(button).toHaveAttribute('aria-pressed', 'true');
+
+ fireEvent.click(button);
+
+ expect(setSelectedSource).toHaveBeenCalledWith('');
+ });
+});