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.

Delete orphaned Ceph summary card and storage banner machinery

rcourtmancc07c1e5803a
diff --git a/frontend-modern/src/components/Storage/StorageCephSummaryCard.tsx b/frontend-modern/src/components/Storage/StorageCephSummaryCard.tsx
deleted file mode 100644
index 24909c3e93..0000000000
--- a/frontend-modern/src/components/Storage/StorageCephSummaryCard.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import { Component, For, Show } from 'solid-js';
-import { Card } from '@/components/shared/Card';
-import { EnhancedStorageBar } from '@/components/Storage/EnhancedStorageBar';
-import type { CephSummaryStats } from '@/features/storageBackups/cephSummaryPresentation';
-import {
- CEPH_SUMMARY_CARD_BAR_WRAP_CLASS,
- CEPH_SUMMARY_CARD_CLASS,
- CEPH_SUMMARY_CARD_CLUSTER_COUNT_CLASS,
- CEPH_SUMMARY_CARD_GRID_CLASS,
- CEPH_SUMMARY_CARD_HEADER_CLASS,
- CEPH_SUMMARY_CARD_HEALTH_BADGE_CLASS,
- CEPH_SUMMARY_CARD_HEADING_CLASS,
- CEPH_SUMMARY_CARD_INFO_WRAP_CLASS,
- CEPH_SUMMARY_CARD_MESSAGE_CLASS,
- CEPH_SUMMARY_CARD_TOP_LEFT_CLASS,
- CEPH_SUMMARY_CARD_TOP_RIGHT_CLASS,
- CEPH_SUMMARY_CARD_TOP_ROW_CLASS,
- CEPH_SUMMARY_CARD_TOTAL_CLASS,
- CEPH_SUMMARY_CARD_TITLE_CLASS,
- CEPH_SUMMARY_CARD_USAGE_CLASS,
-} from '@/features/storageBackups/cephSummaryCardPresentation';
-import { useStorageCephSummaryCardModel } from './useStorageCephSummaryCardModel';
-
-type StorageCephSummaryCardProps = {
- summary: CephSummaryStats;
-};
-
-export const StorageCephSummaryCard: Component<StorageCephSummaryCardProps> = (props) => {
- const model = useStorageCephSummaryCardModel({
- summary: () => props.summary,
- });
-
- return (
- <Card padding="md" tone="card">
- <div class={CEPH_SUMMARY_CARD_TOP_ROW_CLASS}>
- <div class={CEPH_SUMMARY_CARD_TOP_LEFT_CLASS}>
- <div class={CEPH_SUMMARY_CARD_HEADING_CLASS}>
- {model.header().heading}
- </div>
- <div class={CEPH_SUMMARY_CARD_CLUSTER_COUNT_CLASS}>
- {model.header().clusterCountLabel}
- </div>
- </div>
- <div class={CEPH_SUMMARY_CARD_TOP_RIGHT_CLASS}>
- <div class={CEPH_SUMMARY_CARD_TOTAL_CLASS}>
- {model.header().totalLabel}
- </div>
- <div class={CEPH_SUMMARY_CARD_USAGE_CLASS}>
- {model.header().usageLabel}
- </div>
- </div>
- </div>
- <div class={CEPH_SUMMARY_CARD_GRID_CLASS}>
- <For each={model.clusterCards()}>
- {(cluster) => (
- <div class={CEPH_SUMMARY_CARD_CLASS}>
- <div class={CEPH_SUMMARY_CARD_HEADER_CLASS}>
- <div class={CEPH_SUMMARY_CARD_INFO_WRAP_CLASS}>
- <div class={CEPH_SUMMARY_CARD_TITLE_CLASS}>
- {cluster.title}
- </div>
- <Show when={cluster.healthMessage}>
- <div class={CEPH_SUMMARY_CARD_MESSAGE_CLASS} title={cluster.healthMessage}>
- {cluster.healthMessage}
- </div>
- </Show>
- </div>
- <span class={`${CEPH_SUMMARY_CARD_HEALTH_BADGE_CLASS} ${cluster.healthClass}`}>
- {cluster.healthLabel}
- </span>
- </div>
- <div class={CEPH_SUMMARY_CARD_BAR_WRAP_CLASS}>
- <EnhancedStorageBar
- used={cluster.usedBytes}
- free={cluster.freeBytes}
- total={cluster.totalBytes}
- />
- </div>
- </div>
- )}
- </For>
- </div>
- </Card>
- );
-};
-
-export default StorageCephSummaryCard;
diff --git a/frontend-modern/src/components/Storage/StoragePageControls.tsx b/frontend-modern/src/components/Storage/StoragePageControls.tsx
index f9b90d2cd2..e055ad192b 100644
--- a/frontend-modern/src/components/Storage/StoragePageControls.tsx
+++ b/frontend-modern/src/components/Storage/StoragePageControls.tsx
@@ -67,20 +67,17 @@ type StoragePageControlsProps = {
selectedNodeId: () => string;
setSelectedNodeId: (value: string) => void;
storageFilterGroupBy: () => StorageGroupKey;
- // Mirrors the WorkloadsFilter `suppressPlatformFilter` contract: when a
- // platform page mounts StorageSurface with `forcedSourceFilter`, the
- // Source filter chip is redundant (it is already locked by the page)
- // and would render as a user-visible pinned filter. Setting this drops
- // the Source chip from the rendered filter row.
+ // When a platform page mounts StorageSurface with `forcedSourceFilter`
+ // the Source chip is already locked by the page and would otherwise
+ // render as a redundant pinned filter. Setting this drops it from the
+ // rendered filter row.
suppressSourceFilter?: boolean;
- // Platform-owned storage tabs use the search box for host/node scoping,
- // matching the overview-page filter contract. Standalone /storage keeps
- // the explicit Node filter so canonical node query links remain visible.
+ // Platform-embedded storage tabs use the search box for host/node
+ // scoping, matching the platform overview filter contract.
suppressNodeFilter?: boolean;
- // Enables the SavedViews menu in the FilterBar. Caller is responsible for
- // picking a key that namespaces views per platform context so saved
- // queries from a platform-embedded tab do not leak into standalone
- // /storage and vice versa.
+ // Enables the SavedViews menu in the FilterBar. Caller is responsible
+ // for picking a key that namespaces views per platform context so
+ // saved queries from one platform do not leak into another.
savedViewsKey?: string;
};
diff --git a/frontend-modern/src/components/Storage/__tests__/useStorageCephSummaryCardModel.test.ts b/frontend-modern/src/components/Storage/__tests__/useStorageCephSummaryCardModel.test.ts
deleted file mode 100644
index eb40c18d03..0000000000
--- a/frontend-modern/src/components/Storage/__tests__/useStorageCephSummaryCardModel.test.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import { createRoot } from 'solid-js';
-import { useStorageCephSummaryCardModel } from '@/components/Storage/useStorageCephSummaryCardModel';
-
-describe('useStorageCephSummaryCardModel', () => {
- it('returns canonical ceph header and card state', () => {
- createRoot((dispose) => {
- const model = useStorageCephSummaryCardModel({
- summary: () => ({
- clusters: [
- {
- id: 'cluster-1',
- instance: 'cluster-main',
- name: 'cluster-main Ceph',
- health: 'HEALTH_OK',
- healthMessage: 'Healthy',
- totalBytes: 300,
- usedBytes: 120,
- availableBytes: 180,
- usagePercent: 40,
- numMons: 3,
- numMgrs: 2,
- numOsds: 6,
- numOsdsUp: 6,
- numOsdsIn: 6,
- numPGs: 128,
- pools: undefined,
- services: undefined,
- lastUpdated: Date.now(),
- },
- ],
- totalBytes: 300,
- usedBytes: 120,
- availableBytes: 180,
- usagePercent: 40,
- }),
- });
-
- expect(model.header()).toMatchObject({
- heading: 'Ceph Summary',
- clusterCountLabel: '1 cluster detected',
- totalLabel: '300 B',
- });
- expect(model.clusterCards()).toHaveLength(1);
- expect(model.clusterCards()[0]).toMatchObject({
- id: 'cluster-1',
- title: 'cluster-main Ceph',
- healthLabel: 'OK',
- });
- dispose();
- });
- });
-});
diff --git a/frontend-modern/src/components/Storage/__tests__/useStoragePageStatus.test.ts b/frontend-modern/src/components/Storage/__tests__/useStoragePageStatus.test.ts
index b44eb546b7..00760b4d01 100644
--- a/frontend-modern/src/components/Storage/__tests__/useStoragePageStatus.test.ts
+++ b/frontend-modern/src/components/Storage/__tests__/useStoragePageStatus.test.ts
@@ -4,78 +4,51 @@ import { describe, expect, it } from 'vitest';
import { useStoragePageStatus } from '@/components/Storage/useStoragePageStatus';
describe('useStoragePageStatus', () => {
- it('derives reconnecting banner and pool loading state when the storage surface is offline', () => {
+ it('flags pool loading when the surface is fetching and has no pools yet on the pools view', () => {
const [loading] = createSignal(true);
- const [error] = createSignal<unknown>(null);
const [filteredRecordCount] = createSignal(0);
- const [connected] = createSignal(false);
- const [initialDataReceived] = createSignal(true);
- const [reconnecting] = createSignal(true);
const [view] = createSignal<'pools' | 'disks'>('pools');
const { result } = renderHook(() =>
useStoragePageStatus({
loading,
- error,
filteredRecordCount,
- connected,
- initialDataReceived,
- reconnecting,
view,
}),
);
- expect(result.activeBannerKind()).toBe('reconnecting');
expect(result.isLoadingPools()).toBe(true);
});
- it('treats disk view loading separately from pool-table loading', () => {
+ it('treats the disks view as not loading even while the surface fetches', () => {
const [loading] = createSignal(true);
- const [error] = createSignal<unknown>(null);
const [filteredRecordCount] = createSignal(0);
- const [connected] = createSignal(true);
- const [initialDataReceived] = createSignal(true);
- const [reconnecting] = createSignal(false);
const [view] = createSignal<'pools' | 'disks'>('disks');
const { result } = renderHook(() =>
useStoragePageStatus({
loading,
- error,
filteredRecordCount,
- connected,
- initialDataReceived,
- reconnecting,
view,
}),
);
- expect(result.activeBannerKind()).toBeNull();
expect(result.isLoadingPools()).toBe(false);
});
- it('suppresses reconnecting banners when the storage surface remains connected', () => {
+ it('does not flag pool loading when records are already present', () => {
const [loading] = createSignal(false);
- const [error] = createSignal<unknown>(null);
const [filteredRecordCount] = createSignal(1);
- const [connected] = createSignal(true);
- const [initialDataReceived] = createSignal(true);
- const [reconnecting] = createSignal(true);
const [view] = createSignal<'pools' | 'disks'>('pools');
const { result } = renderHook(() =>
useStoragePageStatus({
loading,
- error,
filteredRecordCount,
- connected,
- initialDataReceived,
- reconnecting,
view,
}),
);
- expect(result.activeBannerKind()).toBeNull();
expect(result.isLoadingPools()).toBe(false);
});
});
diff --git a/frontend-modern/src/components/Storage/useStorageCephSummaryCardModel.ts b/frontend-modern/src/components/Storage/useStorageCephSummaryCardModel.ts
deleted file mode 100644
index 963a025e48..0000000000
--- a/frontend-modern/src/components/Storage/useStorageCephSummaryCardModel.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { createMemo } from 'solid-js';
-import type { CephSummaryStats } from '@/features/storageBackups/cephSummaryPresentation';
-import {
- getCephSummaryClusterCards,
- getCephSummaryHeaderPresentation,
-} from '@/features/storageBackups/cephSummaryCardPresentation';
-
-type UseStorageCephSummaryCardModelOptions = {
- summary: () => CephSummaryStats;
-};
-
-export const useStorageCephSummaryCardModel = (
- options: UseStorageCephSummaryCardModelOptions,
-) => {
- const header = createMemo(() => getCephSummaryHeaderPresentation(options.summary()));
- const clusterCards = createMemo(() => getCephSummaryClusterCards(options.summary()));
-
- return {
- header,
- clusterCards,
- };
-};
-
diff --git a/frontend-modern/src/components/Storage/useStoragePageModel.ts b/frontend-modern/src/components/Storage/useStoragePageModel.ts
index dc7bb6b62d..6d9509ab77 100644
--- a/frontend-modern/src/components/Storage/useStoragePageModel.ts
+++ b/frontend-modern/src/components/Storage/useStoragePageModel.ts
@@ -61,7 +61,6 @@ export const useStoragePageModel = (options: UseStoragePageModelOptions = {}) =>
const {
state,
activeAlerts,
- reconnecting,
reconnect,
storageRecoveryResources,
nodes,
@@ -389,13 +388,9 @@ export const useStoragePageModel = (options: UseStoragePageModelOptions = {}) =>
groupBy,
});
- const { activeBannerKind, isLoadingPools } = useStoragePageStatus({
+ const { isLoadingPools } = useStoragePageStatus({
loading: storageRecoveryResources.loading,
- error: storageRecoveryResources.error,
filteredRecordCount: () => filteredRecords().length,
- connected: surfaceConnected,
- initialDataReceived: surfaceInitialDataReceived,
- reconnecting,
view,
});
@@ -474,7 +469,6 @@ export const useStoragePageModel = (options: UseStoragePageModelOptions = {}) =>
storageFilterGroupBy,
sourceFilterOptions,
nodeFilterOptions,
- activeBannerKind,
connected: surfaceConnected,
filteredRecords,
initialDataReceived: surfaceInitialDataReceived,
diff --git a/frontend-modern/src/components/Storage/useStoragePageStatus.ts b/frontend-modern/src/components/Storage/useStoragePageStatus.ts
index 64a56b52b8..0814d0a42f 100644
--- a/frontend-modern/src/components/Storage/useStoragePageStatus.ts
+++ b/frontend-modern/src/components/Storage/useStoragePageStatus.ts
@@ -1,41 +1,19 @@
import { Accessor, createMemo } from 'solid-js';
-import {
- getStoragePageBannerKind,
- isStoragePoolLoading,
-} from '@/features/storageBackups/storagePageStatus';
+import { isStoragePoolLoading } from '@/features/storageBackups/storagePageStatus';
import type { StorageView } from './storagePageState';
type UseStoragePageStatusOptions = {
loading: Accessor<boolean>;
- error: Accessor<unknown>;
filteredRecordCount: Accessor<number>;
- connected: Accessor<boolean>;
- initialDataReceived: Accessor<boolean>;
- reconnecting: Accessor<boolean>;
view: Accessor<StorageView>;
};
export const useStoragePageStatus = (options: UseStoragePageStatusOptions) => {
- const hasFetchError = createMemo(() => Boolean(options.error()));
-
- const activeBannerKind = createMemo(() =>
- getStoragePageBannerKind({
- loading: options.loading(),
- filteredRecordCount: options.filteredRecordCount(),
- connected: options.connected(),
- initialDataReceived: options.initialDataReceived(),
- reconnecting: options.reconnecting(),
- hasFetchError: hasFetchError(),
- }),
- );
-
const isLoadingPools = createMemo(() =>
isStoragePoolLoading(options.loading(), options.view(), options.filteredRecordCount()),
);
return {
- hasFetchError,
- activeBannerKind,
isLoadingPools,
};
};
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 8d1d5fddda..fafca67ec5 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -76,7 +76,6 @@ import configuredNodeTablesSource from '@/components/Settings/ConfiguredNodeTabl
import selectionCardGroupSource from '@/components/shared/SelectionCardGroup.tsx?raw';
import selectionCardGroupModelSource from '@/components/shared/selectionCardGroupModel.ts?raw';
import summaryMetricCardSource from '@/components/shared/SummaryMetricCard.tsx?raw';
-import summaryPanelSource from '@/components/shared/SummaryPanel.tsx?raw';
import summaryChartLayoutSource from '@/components/shared/summaryChartLayout.ts?raw';
import summarySynchronizedReadoutSource from '@/components/shared/SummarySynchronizedReadout.tsx?raw';
import tagBadgesSource from '@/components/shared/TagBadges.tsx?raw';
@@ -1270,11 +1269,6 @@ describe('shared primitive guardrails', () => {
});
it('keeps summary density control inside the shared summary primitives', () => {
- expect(summaryPanelSource).toContain("density?: 'default' | 'compact'");
- expect(summaryPanelSource).toContain("props.density === 'compact'");
- expect(summaryPanelSource).toContain('grid-cols-2 lg:grid-cols-4');
- expect(summaryPanelSource).not.toContain('Recovery Posture');
- expect(summaryPanelSource).not.toContain('stale items');
expect(summaryMetricCardSource).toContain("density?: 'default' | 'compact'");
expect(summaryMetricCardSource).toContain("props.density === 'compact'");
diff --git a/frontend-modern/src/features/storageBackups/__tests__/cephSummaryCardPresentation.test.ts b/frontend-modern/src/features/storageBackups/__tests__/cephSummaryCardPresentation.test.ts
deleted file mode 100644
index 4631f3eacc..0000000000
--- a/frontend-modern/src/features/storageBackups/__tests__/cephSummaryCardPresentation.test.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import {
- CEPH_SUMMARY_CARD_BAR_WRAP_CLASS,
- CEPH_SUMMARY_CARD_CLASS,
- CEPH_SUMMARY_CARD_CLUSTER_COUNT_CLASS,
- CEPH_SUMMARY_CARD_GRID_CLASS,
- CEPH_SUMMARY_CARD_HEADER_CLASS,
- CEPH_SUMMARY_CARD_HEALTH_BADGE_CLASS,
- CEPH_SUMMARY_CARD_HEADING_CLASS,
- CEPH_SUMMARY_CARD_INFO_WRAP_CLASS,
- CEPH_SUMMARY_CARD_MESSAGE_CLASS,
- CEPH_SUMMARY_CARD_TOP_LEFT_CLASS,
- CEPH_SUMMARY_CARD_TOP_RIGHT_CLASS,
- CEPH_SUMMARY_CARD_TOP_ROW_CLASS,
- CEPH_SUMMARY_CARD_TOTAL_CLASS,
- CEPH_SUMMARY_CARD_TITLE_CLASS,
- CEPH_SUMMARY_CARD_USAGE_CLASS,
- getCephSummaryClusterCards,
- getCephSummaryHeaderPresentation,
-} from '@/features/storageBackups/cephSummaryCardPresentation';
-import type { CephSummaryStats } from '@/features/storageBackups/cephSummaryPresentation';
-
-const summary: CephSummaryStats = {
- clusters: [
- {
- id: 'cluster-1',
- instance: 'cluster-main',
- name: 'cluster-main Ceph',
- health: 'HEALTH_OK',
- healthMessage: 'Healthy',
- totalBytes: 300,
- usedBytes: 120,
- availableBytes: 180,
- usagePercent: 40,
- numMons: 3,
- numMgrs: 2,
- numOsds: 6,
- numOsdsUp: 6,
- numOsdsIn: 6,
- numPGs: 128,
- pools: undefined,
- services: undefined,
- lastUpdated: Date.now(),
- },
- ],
- totalBytes: 300,
- usedBytes: 120,
- availableBytes: 180,
- usagePercent: 40,
-};
-
-describe('cephSummaryCardPresentation', () => {
- it('builds canonical ceph summary header and cards', () => {
- expect(CEPH_SUMMARY_CARD_TOP_ROW_CLASS).toContain('justify-between');
- expect(CEPH_SUMMARY_CARD_TOP_LEFT_CLASS).toContain('space-y-0.5');
- expect(CEPH_SUMMARY_CARD_HEADING_CLASS).toContain('uppercase');
- expect(CEPH_SUMMARY_CARD_CLUSTER_COUNT_CLASS).toBe('text-sm text-muted');
- expect(CEPH_SUMMARY_CARD_TOP_RIGHT_CLASS).toBe('text-right');
- expect(CEPH_SUMMARY_CARD_TOTAL_CLASS).toContain('font-semibold');
- expect(CEPH_SUMMARY_CARD_USAGE_CLASS).toBe('text-[11px] text-muted');
- expect(CEPH_SUMMARY_CARD_GRID_CLASS).toContain('sm:grid-cols-2');
- expect(CEPH_SUMMARY_CARD_CLASS).toContain('border-border');
- expect(CEPH_SUMMARY_CARD_HEADER_CLASS).toContain('justify-between');
- expect(CEPH_SUMMARY_CARD_INFO_WRAP_CLASS).toBe('min-w-0');
- expect(CEPH_SUMMARY_CARD_TITLE_CLASS).toContain('truncate');
- expect(CEPH_SUMMARY_CARD_MESSAGE_CLASS).toContain('max-w-[240px]');
- expect(CEPH_SUMMARY_CARD_HEALTH_BADGE_CLASS).toContain('text-[10px]');
- expect(CEPH_SUMMARY_CARD_BAR_WRAP_CLASS).toBe('mt-2');
-
- expect(getCephSummaryHeaderPresentation(summary)).toEqual({
- heading: 'Ceph Summary',
- clusterCountLabel: '1 cluster detected',
- totalLabel: '300 B',
- usageLabel: '40% used',
- });
-
- expect(getCephSummaryClusterCards(summary)).toEqual([
- expect.objectContaining({
- id: 'cluster-1',
- title: 'cluster-main Ceph',
- healthLabel: 'OK',
- usedBytes: 120,
- freeBytes: 180,
- totalBytes: 300,
- }),
- ]);
- });
-});
diff --git a/frontend-modern/src/features/storageBackups/__tests__/storagePagePresentation.test.ts b/frontend-modern/src/features/storageBackups/__tests__/storagePagePresentation.test.ts
index 483c675bb8..117faf7555 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/storagePagePresentation.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/storagePagePresentation.test.ts
@@ -1,85 +1,14 @@
import { describe, expect, it } from 'vitest';
-import type { StorageRecord } from '@/features/storageBackups/models';
import {
- getCephClusterCardTitle,
- getCephSummaryClusterCountLabel,
- getCephSummaryHeading,
- getCephSummaryTotalLabel,
- getCephSummaryUsageLabel,
- getStorageLoadingMessage,
- getStorageEmptyStateMessage,
- getStoragePageBannerActionLabel,
- getStoragePageBannerMessage,
getStoragePoolTableColumns,
getStorageTableHeading,
- STORAGE_BANNER_ACTION_BUTTON_CLASS,
- STORAGE_CONTENT_CARD_BODY_CLASS,
- STORAGE_CONTENT_CARD_HEADER_CLASS,
- STORAGE_CONTROLS_NODE_DIVIDER_CLASS,
- STORAGE_CONTROLS_NODE_SELECT_CLASS,
- STORAGE_PAGE_BANNER_ROW_CLASS,
- STORAGE_PAGE_BANNER_TEXT_CLASS,
- STORAGE_POOLS_BODY_CLASS,
- STORAGE_POOLS_EMPTY_STATE_CLASS,
- STORAGE_POOLS_HEADER_ROW_CLASS,
- STORAGE_POOLS_LOADING_STATE_CLASS,
- STORAGE_POOLS_TABLE_CLASS,
STORAGE_VIEW_OPTIONS,
- shouldShowCephSummaryCard,
} from '@/features/storageBackups/storagePagePresentation';
-const makeRecord = (): StorageRecord =>
- ({
- id: 'storage-1',
- name: 'ceph-store',
- category: 'pool',
- health: 'healthy',
- location: { label: 'cluster-main', scope: 'cluster' },
- capacity: { totalBytes: 100, usedBytes: 40, freeBytes: 60, usagePercent: 40 },
- capabilities: ['capacity'],
- source: {
- platform: 'proxmox-pve',
- family: 'virtualization',
- origin: 'resource',
- adapterId: 'resource-storage',
- },
- observedAt: Date.now(),
- refs: { platformEntityId: '' },
- }) as StorageRecord;
-
describe('storagePagePresentation', () => {
- it('formats ceph summary card labels canonically', () => {
- expect(getCephSummaryHeading()).toBe('Ceph Summary');
- expect(getCephSummaryClusterCountLabel(1)).toBe('1 cluster detected');
- expect(getCephSummaryClusterCountLabel(2)).toBe('2 clusters detected');
- expect(getCephSummaryTotalLabel(1024)).toContain('1.00 KB');
- expect(getCephSummaryUsageLabel(40)).toBe('40% used');
- expect(getCephClusterCardTitle('')).toBe('Ceph Cluster');
- expect(getCephClusterCardTitle('homelab')).toBe('homelab');
- });
-
- it('formats storage page banners and table copy canonically', () => {
- expect(getStoragePageBannerMessage('reconnecting')).toBe(
- 'Reconnecting to backend data stream…',
- );
- expect(getStoragePageBannerActionLabel('reconnecting')).toBe('Retry now');
- expect(getStoragePageBannerActionLabel('fetch-error')).toBeNull();
- expect(STORAGE_BANNER_ACTION_BUTTON_CLASS).toContain('border-amber-300');
- expect(STORAGE_PAGE_BANNER_ROW_CLASS).toContain('justify-between');
- expect(STORAGE_PAGE_BANNER_TEXT_CLASS).toContain('text-amber-800');
- expect(STORAGE_CONTROLS_NODE_SELECT_CLASS).toContain('focus:ring-blue-500');
- expect(STORAGE_CONTROLS_NODE_DIVIDER_CLASS).toBe('h-5 w-px bg-surface-hover hidden sm:block');
- expect(STORAGE_CONTENT_CARD_HEADER_CLASS).toContain('uppercase');
- expect(STORAGE_CONTENT_CARD_BODY_CLASS).toBe('p-2');
- expect(STORAGE_POOLS_EMPTY_STATE_CLASS).toBe('p-6 text-sm text-muted');
- expect(STORAGE_POOLS_LOADING_STATE_CLASS).toBe('p-6 text-sm text-muted');
- expect(STORAGE_POOLS_TABLE_CLASS).toBe('w-full table-fixed text-xs');
- expect(STORAGE_POOLS_HEADER_ROW_CLASS).toContain('bg-surface-alt');
- expect(STORAGE_POOLS_BODY_CLASS).toBe('divide-y divide-border');
+ it('formats storage table headings canonically', () => {
expect(getStorageTableHeading('pools')).toBe('Storage');
expect(getStorageTableHeading('disks')).toBe('Physical Disks');
- expect(getStorageLoadingMessage()).toBe('Loading storage resources...');
- expect(getStorageEmptyStateMessage()).toBe('No storage records match the current filters.');
});
it('exports canonical storage view and table column contracts', () => {
@@ -105,20 +34,4 @@ describe('storagePagePresentation', () => {
'hidden xl:table-cell',
);
});
-
- it('shows the ceph summary card only for pool views with visible ceph records', () => {
- const summary = {
- clusters: [{ id: 'cluster-1' }] as any[],
- totalBytes: 100,
- usedBytes: 40,
- availableBytes: 60,
- usagePercent: 40,
- };
- const record = makeRecord();
- expect(shouldShowCephSummaryCard('pools', summary, [record], () => true)).toBe(true);
- expect(shouldShowCephSummaryCard('disks', summary, [record], () => true)).toBe(false);
- expect(
- shouldShowCephSummaryCard('pools', { ...summary, clusters: [] }, [record], () => true),
- ).toBe(false);
- });
});
diff --git a/frontend-modern/src/features/storageBackups/__tests__/storagePageStatus.test.ts b/frontend-modern/src/features/storageBackups/__tests__/storagePageStatus.test.ts
index 2677c94add..3d8816c784 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/storagePageStatus.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/storagePageStatus.test.ts
@@ -1,67 +1,7 @@
import { describe, expect, it } from 'vitest';
-import {
- getStoragePageBannerKind,
- isStoragePoolLoading,
-} from '@/features/storageBackups/storagePageStatus';
+import { isStoragePoolLoading } from '@/features/storageBackups/storagePageStatus';
describe('storagePageStatus', () => {
- it('chooses the canonical storage banner kind', () => {
- expect(
- getStoragePageBannerKind({
- loading: false,
- filteredRecordCount: 3,
- connected: false,
- initialDataReceived: true,
- reconnecting: true,
- hasFetchError: false,
- }),
- ).toBe('reconnecting');
-
- expect(
- getStoragePageBannerKind({
- loading: false,
- filteredRecordCount: 3,
- connected: true,
- initialDataReceived: true,
- reconnecting: false,
- hasFetchError: true,
- }),
- ).toBe('fetch-error');
-
- expect(
- getStoragePageBannerKind({
- loading: false,
- filteredRecordCount: 3,
- connected: false,
- initialDataReceived: true,
- reconnecting: false,
- hasFetchError: false,
- }),
- ).toBe('disconnected');
-
- expect(
- getStoragePageBannerKind({
- loading: true,
- filteredRecordCount: 0,
- connected: false,
- initialDataReceived: false,
- reconnecting: false,
- hasFetchError: false,
- }),
- ).toBe('waiting-for-data');
-
- expect(
- getStoragePageBannerKind({
- loading: false,
- filteredRecordCount: 2,
- connected: true,
- initialDataReceived: true,
- reconnecting: false,
- hasFetchError: false,
- }),
- ).toBeNull();
- });
-
it('identifies pool-loading state canonically', () => {
expect(isStoragePoolLoading(true, 'pools', 0)).toBe(true);
expect(isStoragePoolLoading(true, 'disks', 0)).toBe(false);
diff --git a/frontend-modern/src/features/storageBackups/cephSummaryCardPresentation.ts b/frontend-modern/src/features/storageBackups/cephSummaryCardPresentation.ts
deleted file mode 100644
index e97b67b5ff..0000000000
--- a/frontend-modern/src/features/storageBackups/cephSummaryCardPresentation.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import type { CephSummaryStats } from '@/features/storageBackups/cephSummaryPresentation';
-import { getCephHealthLabel, getCephHealthStyles } from '@/features/storageBackups/storageDomain';
-import {
- getCephClusterCardTitle,
- getCephSummaryClusterCountLabel,
- getCephSummaryHeading,
- getCephSummaryTotalLabel,
- getCephSummaryUsageLabel,
-} from '@/features/storageBackups/storagePagePresentation';
-import type { CephCluster } from '@/types/api';
-
-export type CephSummaryHeaderPresentation = {
- heading: string;
- clusterCountLabel: string;
- totalLabel: string;
- usageLabel: string;
-};
-
-export type CephSummaryClusterCardPresentation = {
- id: string;
- title: string;
- healthLabel: string;
- healthClass: string;
- healthMessage: string;
- usedBytes: number;
- freeBytes: number;
- totalBytes: number;
-};
-
-export const CEPH_SUMMARY_CARD_TOP_ROW_CLASS = 'flex flex-wrap items-center justify-between gap-3';
-export const CEPH_SUMMARY_CARD_TOP_LEFT_CLASS = 'space-y-0.5';
-export const CEPH_SUMMARY_CARD_HEADING_CLASS = 'text-xs font-semibold uppercase tracking-wide text-muted';
-export const CEPH_SUMMARY_CARD_CLUSTER_COUNT_CLASS = 'text-sm text-muted';
-export const CEPH_SUMMARY_CARD_TOP_RIGHT_CLASS = 'text-right';
-export const CEPH_SUMMARY_CARD_TOTAL_CLASS = 'text-sm font-semibold text-base-content';
-export const CEPH_SUMMARY_CARD_USAGE_CLASS = 'text-[11px] text-muted';
-export const CEPH_SUMMARY_CARD_GRID_CLASS = 'mt-3 grid gap-3 sm:grid-cols-2';
-export const CEPH_SUMMARY_CARD_CLASS = 'rounded-md border border-border bg-surface p-3';
-export const CEPH_SUMMARY_CARD_HEADER_CLASS = 'flex items-start justify-between gap-2';
-export const CEPH_SUMMARY_CARD_INFO_WRAP_CLASS = 'min-w-0';
-export const CEPH_SUMMARY_CARD_TITLE_CLASS = 'text-sm font-semibold text-base-content truncate';
-export const CEPH_SUMMARY_CARD_MESSAGE_CLASS = 'text-[11px] text-muted truncate max-w-[240px]';
-export const CEPH_SUMMARY_CARD_HEALTH_BADGE_CLASS = 'px-1.5 py-0.5 rounded text-[10px] font-medium';
-export const CEPH_SUMMARY_CARD_BAR_WRAP_CLASS = 'mt-2';
-
-export const getCephSummaryHeaderPresentation = (
- summary: CephSummaryStats,
-): CephSummaryHeaderPresentation => ({
- heading: getCephSummaryHeading(),
- clusterCountLabel: getCephSummaryClusterCountLabel(summary.clusters.length),
- totalLabel: getCephSummaryTotalLabel(summary.totalBytes),
- usageLabel: getCephSummaryUsageLabel(summary.usagePercent),
-});
-
-export const getCephSummaryClusterCardPresentation = (
- cluster: CephCluster,
-): CephSummaryClusterCardPresentation => ({
- id: cluster.id,
- title: getCephClusterCardTitle(cluster.name),
- healthLabel: getCephHealthLabel(cluster.health),
- healthClass: getCephHealthStyles(cluster.health),
- healthMessage: cluster.healthMessage || '',
- usedBytes: cluster.usedBytes,
- freeBytes: cluster.availableBytes,
- totalBytes: cluster.totalBytes,
-});
-
-export const getCephSummaryClusterCards = (
- summary: CephSummaryStats,
-): CephSummaryClusterCardPresentation[] =>
- summary.clusters.map(getCephSummaryClusterCardPresentation);
diff --git a/frontend-modern/src/features/storageBackups/storagePagePresentation.ts b/frontend-modern/src/features/storageBackups/storagePagePresentation.ts
index c4ab568cf6..ce26648344 100644
--- a/frontend-modern/src/features/storageBackups/storagePagePresentation.ts
+++ b/frontend-modern/src/features/storageBackups/storagePagePresentation.ts
@@ -1,14 +1,5 @@
-import { formatBytes, formatPercent } from '@/utils/format';
-import type { StorageRecord } from './models';
-import type { CephSummaryStats } from './cephSummaryPresentation';
import type { StorageSortKey } from './storageModelCore';
-export type StoragePageBannerKind =
- | 'reconnecting'
- | 'fetch-error'
- | 'disconnected'
- | 'waiting-for-data';
-
export type StorageViewOption = {
value: 'pools' | 'disks';
label: string;
@@ -91,11 +82,6 @@ export const getStoragePoolTableColumns = (
},
];
-export const STORAGE_BANNER_ACTION_BUTTON_CLASS =
- 'rounded border border-amber-300 bg-amber-100 px-2 py-1 text-xs font-medium text-amber-800 hover:bg-amber-200 dark:border-amber-700 dark:bg-amber-900 dark:text-amber-200 dark:hover:bg-amber-900';
-export const STORAGE_PAGE_BANNER_ROW_CLASS = 'flex items-center justify-between gap-3';
-export const STORAGE_PAGE_BANNER_TEXT_CLASS = 'text-xs text-amber-800 dark:text-amber-200';
-
export const STORAGE_CONTROLS_NODE_SELECT_CLASS =
'px-2 py-1 text-xs border border-border rounded-md bg-surface text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500';
@@ -111,47 +97,6 @@ export const STORAGE_POOLS_TABLE_CLASS = 'w-full table-fixed text-xs';
export const STORAGE_POOLS_HEADER_ROW_CLASS = 'bg-surface-alt text-muted border-b border-border';
export const STORAGE_POOLS_BODY_CLASS = 'divide-y divide-border';
-export const shouldShowCephSummaryCard = (
- view: 'pools' | 'disks',
- cephSummary: CephSummaryStats,
- filteredRecords: StorageRecord[],
- isCephRecord: (record: StorageRecord) => boolean,
-): boolean =>
- view === 'pools' &&
- cephSummary.clusters.length > 0 &&
- filteredRecords.some((record) => isCephRecord(record));
-
-export const getCephSummaryClusterCountLabel = (count: number): string =>
- `${count} cluster${count !== 1 ? 's' : ''} detected`;
-
-export const getCephSummaryHeading = (): string => 'Ceph Summary';
-
-export const getCephSummaryTotalLabel = (totalBytes: number): string => formatBytes(totalBytes);
-
-export const getCephSummaryUsageLabel = (usagePercent: number): string =>
- `${formatPercent(usagePercent)} used`;
-
-export const getCephClusterCardTitle = (name: string): string => name || 'Ceph Cluster';
-
-export const getStoragePageBannerMessage = (kind: StoragePageBannerKind): string => {
- switch (kind) {
- case 'reconnecting':
- return 'Reconnecting to backend data stream…';
- case 'fetch-error':
- return 'Unable to refresh storage resources. Showing latest available data.';
- case 'disconnected':
- return 'Storage data stream disconnected. Data may be stale.';
- case 'waiting-for-data':
- return 'Waiting for storage data from connected platforms.';
- }
-};
-
-export const getStoragePageBannerActionLabel = (kind: StoragePageBannerKind): string | null => {
- if (kind === 'reconnecting') return 'Retry now';
- if (kind === 'disconnected') return 'Reconnect';
- return null;
-};
-
export const getStorageTableHeading = (view: 'pools' | 'disks'): string =>
view === 'pools' ? 'Storage' : 'Physical Disks';
diff --git a/frontend-modern/src/features/storageBackups/storagePageStatus.ts b/frontend-modern/src/features/storageBackups/storagePageStatus.ts
index 05d8685b8e..e5dd457422 100644
--- a/frontend-modern/src/features/storageBackups/storagePageStatus.ts
+++ b/frontend-modern/src/features/storageBackups/storagePageStatus.ts
@@ -1,31 +1,3 @@
-import type { StoragePageBannerKind } from './storagePagePresentation';
-
-export type StoragePageBannerStateInput = {
- loading: boolean;
- filteredRecordCount: number;
- connected: boolean;
- initialDataReceived: boolean;
- reconnecting: boolean;
- hasFetchError: boolean;
-};
-
-export const getStoragePageBannerKind = (
- input: StoragePageBannerStateInput,
-): StoragePageBannerKind | null => {
- if (input.hasFetchError) return 'fetch-error';
- if (input.reconnecting && !input.connected) return 'reconnecting';
- if (!input.connected && input.initialDataReceived) return 'disconnected';
- if (
- input.loading &&
- input.filteredRecordCount === 0 &&
- !input.connected &&
- !input.initialDataReceived
- ) {
- return 'waiting-for-data';
- }
- return null;
-};
-
export const isStoragePoolLoading = (
loading: boolean,
view: 'pools' | 'disks',
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index e1efbdafe3..bd1aafa047 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -229,8 +229,6 @@ import storagePageControlsSource from '@/components/Storage/StoragePageControls.
import storageContentCardSource from '@/components/Storage/StorageContentCard.tsx?raw';
import storagePageSource from '@/components/Storage/Storage.tsx?raw';
import storageSummaryCacheSource from '@/utils/storageSummaryCache.ts?raw';
-import storageCephSummaryCardSource from '@/components/Storage/StorageCephSummaryCard.tsx?raw';
-import useStorageCephSummaryCardModelSource from '@/components/Storage/useStorageCephSummaryCardModel.ts?raw';
import useStorageContentCardModelSource from '@/components/Storage/useStorageContentCardModel.ts?raw';
import useZFSHealthMapModelSource from '@/components/Storage/useZFSHealthMapModel.ts?raw';
import storagePoolsTableSource from '@/components/Storage/StoragePoolsTable.tsx?raw';
@@ -334,7 +332,6 @@ import storageAdapterCoreSource from '@/features/storageBackups/storageAdapterCo
import storageAlertStateSource from '@/features/storageBackups/storageAlertState.ts?raw';
import cephRecordPresentationSource from '@/features/storageBackups/cephRecordPresentation.ts?raw';
import cephSummaryPresentationSource from '@/features/storageBackups/cephSummaryPresentation.ts?raw';
-import cephSummaryCardPresentationSource from '@/features/storageBackups/cephSummaryCardPresentation.ts?raw';
import storageDomainSource from '@/features/storageBackups/storageDomain.ts?raw';
import storagePoolDetailPresentationSource from '@/features/storageBackups/storagePoolDetailPresentation.ts?raw';
import storageBarPresentationSource from '@/features/storageBackups/storageBarPresentation.ts?raw';
@@ -1669,21 +1666,6 @@ describe('frontend resource type boundaries', () => {
"props.view() === 'pools' ? props.storageFilterGroupBy : undefined",
);
expect(storagePageControlsSource).toContain('const sortDisabled = () => !isPoolsView()');
- expect(storageCephSummaryCardSource).toContain('useStorageCephSummaryCardModel');
- expect(storageCephSummaryCardSource).toContain('CEPH_SUMMARY_CARD_GRID_CLASS');
- expect(storageCephSummaryCardSource).toContain('CEPH_SUMMARY_CARD_HEALTH_BADGE_CLASS');
- expect(storageCephSummaryCardSource).not.toContain('const summary = () => props.summary');
- expect(storageCephSummaryCardSource).not.toContain(
- 'rounded-md border border-border bg-surface p-3',
- );
- expect(storageCephSummaryCardSource).not.toContain(
- 'text-[11px] text-muted truncate max-w-[240px]',
- );
- expect(storageCephSummaryCardSource).not.toContain(
- 'flex flex-wrap items-center justify-between gap-3',
- );
- expect(useStorageCephSummaryCardModelSource).toContain('getCephSummaryHeaderPresentation');
- expect(useStorageCephSummaryCardModelSource).toContain('getCephSummaryClusterCards');
expect(storageContentCardSource).toContain('export const StorageContentCard');
expect(storageContentCardSource).toContain('useStorageContentCardModel');
expect(storageContentCardSource).toContain('DiskList');
@@ -1818,13 +1800,6 @@ describe('frontend resource type boundaries', () => {
expect(zfsHealthMapSource).not.toContain(
'bg-surface text-base-content text-[10px] rounded-md shadow-sm px-2 py-1.5 min-w-[120px] border border-border',
);
- expect(cephSummaryCardPresentationSource).toContain(
- 'export const getCephSummaryHeaderPresentation',
- );
- expect(cephSummaryCardPresentationSource).toContain('export const getCephSummaryClusterCards');
- expect(cephSummaryCardPresentationSource).toContain(
- 'export const CEPH_SUMMARY_CARD_GRID_CLASS',
- );
expect(zfsPresentationSource).toContain('export const getZfsPoolStateTextClass');
expect(diskPresentationSource).toContain('export function getPhysicalDiskHealthStatus');
expect(diskPresentationSource).toContain('export function getPhysicalDiskHealthSummary');