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.

Default large availability estates to fleet view

pulse-triage[bot]d4bed850b9e7
diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurfaceUrlFilters.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurfaceUrlFilters.test.tsx
index 85d9bb0990..bb135bc22c 100644
--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurfaceUrlFilters.test.tsx
+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurfaceUrlFilters.test.tsx
@@ -86,7 +86,11 @@ describe('Kubernetes URL-backed shared toolbar filters', () => {
renderSurfaceAt('/kubernetes/overview');
expect(screen.queryByRole('region', { name: 'Kubernetes attention' })).not.toBeInTheDocument();
- expect(screen.getByRole('status')).toHaveTextContent('1 workload needs attention');
+ expect(
+ screen
+ .getAllByRole('status')
+ .find((status) => status.textContent?.includes('1 workload needs attention')),
+ ).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'Review' })).toHaveAttribute(
'href',
'/kubernetes/workloads',
diff --git a/frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx b/frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx
index 3bae026404..d9df74eafe 100644
--- a/frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx
+++ b/frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx
@@ -48,6 +48,22 @@ import { AvailabilityFleetView } from './AvailabilityFleetView';
export type AvailabilityChecksView = 'table' | 'fleet';
+// The fleet presentation exists to keep an estate-sized availability list
+// scannable. Small inventories still benefit from the table's extra columns,
+// while 20+ checks match the first scale at which operators have reported the
+// table becoming difficult to scan. An explicit route value always wins so a
+// chosen presentation remains shareable and stable across refreshes.
+export const AVAILABILITY_FLEET_DEFAULT_MIN_CHECKS = 20;
+
+export const resolveAvailabilityChecksView = (
+ routeValue: string | string[] | undefined,
+ checkCount: number,
+): AvailabilityChecksView => {
+ const selectedValue = Array.isArray(routeValue) ? routeValue[0] : routeValue;
+ if (selectedValue === 'table' || selectedValue === 'fleet') return selectedValue;
+ return checkCount >= AVAILABILITY_FLEET_DEFAULT_MIN_CHECKS ? 'fleet' : 'table';
+};
+
const settingsLinkClass =
'inline-flex min-h-8 items-center justify-center gap-1.5 rounded-md border border-border bg-surface px-2.5 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover';
diff --git a/frontend-modern/src/features/standalone/StandalonePageSurface.tsx b/frontend-modern/src/features/standalone/StandalonePageSurface.tsx
index 04f2dab883..6cde6f7ace 100644
--- a/frontend-modern/src/features/standalone/StandalonePageSurface.tsx
+++ b/frontend-modern/src/features/standalone/StandalonePageSurface.tsx
@@ -33,7 +33,11 @@ import {
import { updateStore } from '@/stores/updates';
import { formatRelativeTime } from '@/utils/format';
import { buildProbeAgentOptions } from '@/utils/availabilityProbeAgents';
-import { AvailabilityChecksTable, type AvailabilityChecksView } from './AvailabilityChecksTable';
+import {
+ AvailabilityChecksTable,
+ resolveAvailabilityChecksView,
+ type AvailabilityChecksView,
+} from './AvailabilityChecksTable';
import { AgentsMachinesTable } from './AgentsMachinesTable';
import { collectHostIdentityConflictHosts } from './hostIdentityConflict';
import { HostIdentityConflictNotice } from './HostIdentityConflictNotice';
@@ -170,11 +174,15 @@ export function StandalonePageSurface() {
);
};
const availabilityView = createMemo<AvailabilityChecksView>(() =>
- searchParams[STANDALONE_QUERY_PARAMS.view] === 'fleet' ? 'fleet' : 'table',
+ resolveAvailabilityChecksView(
+ searchParams[STANDALONE_QUERY_PARAMS.view],
+ model().availabilityChecks.length,
+ ),
);
const setAvailabilityView = (view: AvailabilityChecksView) => {
+ const defaultView = resolveAvailabilityChecksView(undefined, model().availabilityChecks.length);
setSearchParams(
- { [STANDALONE_QUERY_PARAMS.view]: view === 'table' ? null : view },
+ { [STANDALONE_QUERY_PARAMS.view]: view === defaultView ? null : view },
{ replace: true },
);
};
diff --git a/frontend-modern/src/features/standalone/__tests__/AvailabilityChecksTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AvailabilityChecksTable.test.tsx
index b052b1a06b..3a6566fbfb 100644
--- a/frontend-modern/src/features/standalone/__tests__/AvailabilityChecksTable.test.tsx
+++ b/frontend-modern/src/features/standalone/__tests__/AvailabilityChecksTable.test.tsx
@@ -3,7 +3,7 @@ import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
import { afterEach, describe, expect, it, vi } from 'vitest';
import type { Resource } from '@/types/resource';
import type { ProbeAgentOption } from '@/utils/availabilityProbeAgents';
-import { AvailabilityChecksTable } from '../AvailabilityChecksTable';
+import { AvailabilityChecksTable, resolveAvailabilityChecksView } from '../AvailabilityChecksTable';
const availabilityResource = (overrides: Partial<Resource> = {}): Resource =>
({
@@ -57,6 +57,14 @@ afterEach(() => {
});
describe('AvailabilityChecksTable', () => {
+ it('uses the fleet default only for estate-sized inventories without an explicit view', () => {
+ expect(resolveAvailabilityChecksView(undefined, 19)).toBe('table');
+ expect(resolveAvailabilityChecksView(undefined, 20)).toBe('fleet');
+ expect(resolveAvailabilityChecksView('table', 50)).toBe('table');
+ expect(resolveAvailabilityChecksView('fleet', 1)).toBe('fleet');
+ expect(resolveAvailabilityChecksView(['fleet'], 1)).toBe('fleet');
+ });
+
it('renders agentless check status from unified network endpoint resources', () => {
vi.spyOn(Date, 'now').mockReturnValue(1_700_000_600_000);
diff --git a/frontend-modern/src/features/standalone/__tests__/StandalonePageSurface.test.tsx b/frontend-modern/src/features/standalone/__tests__/StandalonePageSurface.test.tsx
index 1ebd37ca50..34532b89b1 100644
--- a/frontend-modern/src/features/standalone/__tests__/StandalonePageSurface.test.tsx
+++ b/frontend-modern/src/features/standalone/__tests__/StandalonePageSurface.test.tsx
@@ -21,9 +21,19 @@ const mocks = vi.hoisted(() => ({
onResetFilters?: () => void;
}) => <div data-testid="agents-machines-table" data-resource-count={props.resources.length} />,
),
- AvailabilityChecksTable: vi.fn((props: { resources: Resource[] }) => (
- <div data-testid="availability-checks-table" data-resource-count={props.resources.length} />
- )),
+ AvailabilityChecksTable: vi.fn(
+ (props: {
+ resources: Resource[];
+ view?: string;
+ onViewChange?: (value: 'table' | 'fleet') => void;
+ }) => (
+ <div
+ data-testid="availability-checks-table"
+ data-resource-count={props.resources.length}
+ data-view={props.view}
+ />
+ ),
+ ),
}));
vi.mock('@/hooks/useUnifiedResources', () => ({
@@ -59,6 +69,14 @@ vi.mock('../AgentsMachinesTable', () => ({
vi.mock('../AvailabilityChecksTable', () => ({
AvailabilityChecksTable: mocks.AvailabilityChecksTable,
+ resolveAvailabilityChecksView: (
+ routeValue: string | string[] | undefined,
+ checkCount: number,
+ ) => {
+ const selectedValue = Array.isArray(routeValue) ? routeValue[0] : routeValue;
+ if (selectedValue === 'table' || selectedValue === 'fleet') return selectedValue;
+ return checkCount >= 20 ? 'fleet' : 'table';
+ },
}));
vi.mock('@/features/platformPage/sharedPlatformPage', async () => {
@@ -270,6 +288,7 @@ describe('StandalonePageSurface', () => {
'data-resource-count',
'2',
);
+ expect(screen.getByTestId('availability-checks-table')).toHaveAttribute('data-view', 'table');
expect(screen.getByTestId('standalone-posture-summary')).toHaveTextContent(
'All 2 checks reporting normally',
);
@@ -279,6 +298,61 @@ describe('StandalonePageSurface', () => {
);
});
+ it('defaults estate-sized availability inventories to the fleet view', () => {
+ mocks.pathname = '/standalone/availability';
+ mocks.useUnifiedResources.mockReturnValue({
+ resources: () =>
+ Array.from({ length: 20 }, (_, index) =>
+ resource({
+ id: `availability:service-${index}`,
+ type: 'network-endpoint',
+ platformType: 'availability',
+ sources: ['availability'],
+ availability: freshAvailability({ targetId: `service-${index}` }),
+ }),
+ ),
+ loading: () => false,
+ error: () => null,
+ refetch: vi.fn(),
+ });
+
+ render(() => <StandalonePageSurface />);
+
+ expect(screen.getByTestId('availability-checks-table')).toHaveAttribute('data-view', 'fleet');
+ });
+
+ it('keeps an explicit table choice stable for an estate-sized inventory', () => {
+ mocks.pathname = '/standalone/availability';
+ mocks.searchParams = { view: 'table' };
+ mocks.useUnifiedResources.mockReturnValue({
+ resources: () =>
+ Array.from({ length: 20 }, (_, index) =>
+ resource({
+ id: `availability:service-${index}`,
+ type: 'network-endpoint',
+ platformType: 'availability',
+ sources: ['availability'],
+ availability: freshAvailability({ targetId: `service-${index}` }),
+ }),
+ ),
+ loading: () => false,
+ error: () => null,
+ refetch: vi.fn(),
+ });
+
+ render(() => <StandalonePageSurface />);
+
+ const table = screen.getByTestId('availability-checks-table');
+ expect(table).toHaveAttribute('data-view', 'table');
+
+ const props = mocks.AvailabilityChecksTable.mock.calls.at(-1)?.[0];
+ props?.onViewChange?.('fleet');
+ expect(mocks.setSearchParams).toHaveBeenCalledWith({ view: null }, { replace: true });
+
+ props?.onViewChange?.('table');
+ expect(mocks.setSearchParams).toHaveBeenCalledWith({ view: 'table' }, { replace: true });
+ });
+
it('counts every configured check when two attached services share one monitored host', () => {
mocks.pathname = '/standalone/availability';
mocks.useUnifiedResources.mockReturnValue({