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.

Remove storage row inline styles from live demo

rcourtmancb257180ae8e
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index c56b63071a..2474d6fa24 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -228,7 +228,7 @@ work extends shared components instead of creating new local variants.
reset action stays as one compact header-level `Clear` control with an
accessible `Clear selection` label, not a second page-level scope strip,
search-row accessory, or filter-bar badge.
-13. Keep summary-linked table row emphasis on the shared primitive contract. Workloads, infrastructure, and storage rows that mirror the active summary entity must expose that state through `data-summary-row-active` and let the shared presentation in `frontend-modern/src/index.css` render the row emphasis, rather than carrying page-local sky or blue fill classes inside each row renderer. Group-scoped preview and pin must use that same shared presentation boundary: child rows that belong to a hovered or pinned summary group should expose `data-summary-group-member-active="preview|pinned"` so the block-level emphasis stays subtle, consistent, and reversible instead of each table inventing its own outline, badge, or full-strength fill treatment.
+13. Keep summary-linked table row emphasis on the shared primitive contract. Workloads, infrastructure, and storage rows that mirror the active summary entity must expose that state through `data-summary-row-active` and let the shared presentation in `frontend-modern/src/index.css` render the row emphasis, rather than carrying page-local sky or blue fill classes inside each row renderer. Group-scoped preview and pin must use that same shared presentation boundary: child rows that belong to a hovered or pinned summary group should expose `data-summary-group-member-active="preview|pinned"` so the block-level emphasis stays subtle, consistent, and reversible instead of each table inventing its own outline, badge, or full-strength fill treatment. Storage-backed reusable row presenters under `frontend-modern/src/features/storageBackups/` must also keep row height and alert accents on class/data-attribute presentation instead of runtime inline style maps, so the shared table contract stays CSP-safe on both steady-state and alert-highlighted routes.
14. Keep retained-value data loading honest at the ownership boundary. Helpers
that prevent a feature surface from falling through the app-level Suspense
boundary during in-flight refresh should stay feature-local until multiple
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 8e728cf9f5..0c7099e6f5 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -448,6 +448,10 @@ querying, and the operator-facing storage health presentation layer.
users still must not inherit synthetic hover branches, and storage must
not keep a special trailing expand column once the shared leading action
contract exists.
+ Storage pool rows must also keep sizing and alert accents on canonical
+ class/data-attribute presentation rather than row-local inline style maps,
+ so the public storage page stays CSP-safe under both normal and
+ alert-highlighted demo/runtime states.
21. Keep recovery transport refreshes inside the recovery-owned feature state.
`frontend-modern/src/features/recovery/useRecoverySurfaceState.ts` and the
recovery data hooks may retain the last fulfilled rollups, points, facets,
diff --git a/frontend-modern/src/components/Storage/StoragePoolRow.tsx b/frontend-modern/src/components/Storage/StoragePoolRow.tsx
index f4ae366619..29d4e9f7a6 100644
--- a/frontend-modern/src/components/Storage/StoragePoolRow.tsx
+++ b/frontend-modern/src/components/Storage/StoragePoolRow.tsx
@@ -9,6 +9,7 @@ import {
getStoragePoolImpactTextClass,
STORAGE_POOL_ROW_CLASS,
STORAGE_POOL_ROW_EXPANDED_CLASS,
+ STORAGE_POOL_ROW_HEIGHT_CLASS,
STORAGE_POOL_ROW_PLACEHOLDER_CLASS,
STORAGE_POOL_ROW_HOST_CELL_CLASS,
STORAGE_POOL_ROW_IMPACT_CELL_CLASS,
@@ -20,7 +21,6 @@ import {
STORAGE_POOL_ROW_PROTECTION_TEXT_CLASS,
STORAGE_POOL_ROW_SOURCE_BADGE_CLASS,
STORAGE_POOL_ROW_SOURCE_CELL_CLASS,
- STORAGE_POOL_ROW_STYLE,
STORAGE_POOL_ROW_TEXT_TRUNCATE_CLASS,
STORAGE_POOL_ROW_TYPE_CELL_CLASS,
STORAGE_POOL_ROW_USAGE_FALLBACK_CLASS,
@@ -47,7 +47,6 @@ interface StoragePoolRowProps {
onToggleExpand: () => void;
onHoverChange?: (recordId: string | null) => void;
rowClass: string;
- rowStyle: Record<string, string>;
physicalDisks: Resource[];
alertDataAttrs: {
'data-row-id': string;
@@ -70,8 +69,7 @@ export const StoragePoolRow: Component<StoragePoolRowProps> = (props) => {
return (
<>
<tr
- class={`${STORAGE_POOL_ROW_CLASS} ${props.rowClass} ${props.expanded ? STORAGE_POOL_ROW_EXPANDED_CLASS : ''}`.trim()}
- style={{ ...props.rowStyle, ...STORAGE_POOL_ROW_STYLE }}
+ class={`${STORAGE_POOL_ROW_CLASS} ${STORAGE_POOL_ROW_HEIGHT_CLASS} ${props.rowClass} ${props.expanded ? STORAGE_POOL_ROW_EXPANDED_CLASS : ''}`.trim()}
onClick={props.onToggleExpand}
{...interactiveRowHandlers}
data-summary-series-id={props.summarySeriesId}
diff --git a/frontend-modern/src/components/Storage/StoragePoolsTable.tsx b/frontend-modern/src/components/Storage/StoragePoolsTable.tsx
index a93cf6ee8d..fdf6f91677 100644
--- a/frontend-modern/src/components/Storage/StoragePoolsTable.tsx
+++ b/frontend-modern/src/components/Storage/StoragePoolsTable.tsx
@@ -119,7 +119,6 @@ export const StoragePoolsTable: Component<StoragePoolsTableProps> = (props) => {
onToggleExpand={() => model.togglePool(record().id)}
onHoverChange={props.onHoverChange}
rowClass={rowModel().rowClass}
- rowStyle={rowModel().rowStyle}
physicalDisks={props.physicalDisks}
alertDataAttrs={rowModel().alertDataAttrs}
/>
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index 8923e7e927..9a3ccbf40d 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -1004,7 +1004,8 @@ describe('Storage', () => {
const row = screen.getByText('Alerted-Store').closest('tr');
expect(row).toHaveAttribute('data-alert-state', 'unacknowledged');
expect(row).toHaveAttribute('data-alert-severity', 'critical');
- expect(row?.getAttribute('style')).toContain('#ef4444');
+ expect(row).not.toHaveAttribute('style');
+ expect(row?.className).toContain('shadow-[inset_4px_0_0_0_#ef4444]');
});
});
@@ -1020,7 +1021,8 @@ describe('Storage', () => {
const row = screen.getByText('Acknowledged-Store').closest('tr');
expect(row).toHaveAttribute('data-alert-state', 'acknowledged');
expect(row).toHaveAttribute('data-alert-severity', 'none');
- expect(row?.getAttribute('style')).toContain('156, 163, 175');
+ expect(row).not.toHaveAttribute('style');
+ expect(row?.className).toContain('shadow-[inset_4px_0_0_0_rgba(156,163,175,0.8)]');
});
});
diff --git a/frontend-modern/src/features/storageBackups/__tests__/storagePoolRowPresentation.test.ts b/frontend-modern/src/features/storageBackups/__tests__/storagePoolRowPresentation.test.ts
index b360195df8..20f189b3ac 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/storagePoolRowPresentation.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/storagePoolRowPresentation.test.ts
@@ -5,6 +5,7 @@ import {
getStoragePoolImpactTextClass,
STORAGE_POOL_ROW_CLASS,
STORAGE_POOL_ROW_EXPANDED_CLASS,
+ STORAGE_POOL_ROW_HEIGHT_CLASS,
STORAGE_POOL_ROW_NAME_TEXT_CLASS,
STORAGE_POOL_ROW_PLACEHOLDER_CLASS,
STORAGE_POOL_ROW_SOURCE_BADGE_CLASS,
@@ -41,6 +42,7 @@ const baseRecord = (overrides: Partial<StorageRecord> = {}): StorageRecord =>
describe('storage pool row presentation', () => {
it('builds canonical row identity and summary fields', () => {
expect(STORAGE_POOL_ROW_CLASS).toContain('cursor-pointer');
+ expect(STORAGE_POOL_ROW_HEIGHT_CLASS).toBe('h-[38px]');
expect(STORAGE_POOL_ROW_NAME_TEXT_CLASS).toContain('font-semibold');
expect(STORAGE_POOL_ROW_SOURCE_BADGE_CLASS).toContain('text-[9px]');
expect(STORAGE_POOL_ROW_EXPANDED_CLASS).toBe('bg-surface-alt');
diff --git a/frontend-modern/src/features/storageBackups/__tests__/storagePoolsTablePresentation.test.ts b/frontend-modern/src/features/storageBackups/__tests__/storagePoolsTablePresentation.test.ts
index 47e53bff6b..4cf0bb0f6c 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/storagePoolsTablePresentation.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/storagePoolsTablePresentation.test.ts
@@ -92,5 +92,6 @@ describe('storage pools table presentation', () => {
'data-resource-highlighted': 'false',
});
expect(row.rowClass).toContain('bg-surface-alt');
+ expect(Object.prototype.hasOwnProperty.call(row, 'rowStyle')).toBe(false);
});
});
diff --git a/frontend-modern/src/features/storageBackups/__tests__/storageRowAlertPresentation.test.ts b/frontend-modern/src/features/storageBackups/__tests__/storageRowAlertPresentation.test.ts
index 7e80d6f573..25a548545d 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/storageRowAlertPresentation.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/storageRowAlertPresentation.test.ts
@@ -21,7 +21,7 @@ describe('storageRowAlertPresentation', () => {
});
expect(result.rowClass).toContain('bg-red-50');
- expect(result.rowStyle['box-shadow']).toContain('#ef4444');
+ expect(result.rowClass).toContain('shadow-[inset_4px_0_0_0_#ef4444]');
expect(result.dataAlertState).toBe('unacknowledged');
});
@@ -42,7 +42,7 @@ describe('storageRowAlertPresentation', () => {
});
expect(result.rowClass).toContain('bg-surface-alt');
- expect(result.rowStyle['box-shadow']).toContain('rgba(156, 163, 175, 0.8)');
+ expect(result.rowClass).toContain('shadow-[inset_4px_0_0_0_rgba(156,163,175,0.8)]');
expect(result.dataAlertState).toBe('acknowledged');
});
});
diff --git a/frontend-modern/src/features/storageBackups/storagePoolRowPresentation.ts b/frontend-modern/src/features/storageBackups/storagePoolRowPresentation.ts
index 9281600e30..950a09ec3f 100644
--- a/frontend-modern/src/features/storageBackups/storagePoolRowPresentation.ts
+++ b/frontend-modern/src/features/storageBackups/storagePoolRowPresentation.ts
@@ -31,8 +31,8 @@ export interface StoragePoolRowModel {
}
export const STORAGE_POOL_ROW_CLASS = 'group cursor-pointer';
+export const STORAGE_POOL_ROW_HEIGHT_CLASS = 'h-[38px]';
export const STORAGE_POOL_ROW_EXPANDED_CLASS = 'bg-surface-alt';
-export const STORAGE_POOL_ROW_STYLE = { height: '38px' } as const;
export const STORAGE_POOL_ROW_NAME_CELL_CLASS = 'px-2 py-1 align-middle text-base-content';
export const STORAGE_POOL_ROW_NAME_TEXT_CLASS = 'block truncate text-[12px] font-semibold';
export const STORAGE_POOL_ROW_SOURCE_CELL_CLASS = 'px-2 py-1 align-middle text-[11px]';
diff --git a/frontend-modern/src/features/storageBackups/storagePoolsTablePresentation.ts b/frontend-modern/src/features/storageBackups/storagePoolsTablePresentation.ts
index bbb8efa12e..00e386485b 100644
--- a/frontend-modern/src/features/storageBackups/storagePoolsTablePresentation.ts
+++ b/frontend-modern/src/features/storageBackups/storagePoolsTablePresentation.ts
@@ -13,7 +13,6 @@ export type StoragePoolsTableRowModel = {
expanded: boolean;
parentNodeOnline: boolean;
rowClass: string;
- rowStyle: Record<string, string>;
alertDataAttrs: {
'data-row-id': string;
'data-alert-state': string;
@@ -57,7 +56,6 @@ export const buildStoragePoolsTableRowModel = (
expanded,
parentNodeOnline,
rowClass: rowAlertPresentation.rowClass,
- rowStyle: rowAlertPresentation.rowStyle,
alertDataAttrs: {
'data-row-id': record.id,
'data-alert-state': rowAlertPresentation.dataAlertState,
diff --git a/frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts b/frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts
index 81ea5692ba..1f7f2b654b 100644
--- a/frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts
+++ b/frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts
@@ -2,13 +2,16 @@ import type { StorageAlertRowState } from './storageAlertState';
export interface StorageRowAlertPresentation {
rowClass: string;
- rowStyle: Record<string, string>;
dataAlertState: 'unacknowledged' | 'acknowledged' | 'none';
dataAlertSeverity: string;
dataResourceHighlighted: 'true' | 'false';
}
const BASE_ROW_CLASSES = ['transition-all duration-200', 'hover:bg-surface-hover'];
+const STORAGE_ROW_CRITICAL_ALERT_ACCENT_CLASS = 'shadow-[inset_4px_0_0_0_#ef4444]';
+const STORAGE_ROW_WARNING_ALERT_ACCENT_CLASS = 'shadow-[inset_4px_0_0_0_#eab308]';
+const STORAGE_ROW_ACKNOWLEDGED_ALERT_ACCENT_CLASS =
+ 'shadow-[inset_4px_0_0_0_rgba(156,163,175,0.8)]';
export const getStorageRowAlertPresentation = (options: {
alertState: StorageAlertRowState;
@@ -28,32 +31,23 @@ export const getStorageRowAlertPresentation = (options: {
? 'bg-red-50 dark:bg-red-950'
: 'bg-yellow-50 dark:bg-yellow-950',
);
+ classes.push(
+ options.alertState.severity === 'critical'
+ ? STORAGE_ROW_CRITICAL_ALERT_ACCENT_CLASS
+ : STORAGE_ROW_WARNING_ALERT_ACCENT_CLASS,
+ );
} else if (options.isResourceHighlighted) {
classes.push('bg-blue-50 dark:bg-blue-900 ring-1 ring-blue-300 dark:ring-blue-600');
} else if (hasAcknowledgedOnlyAlert) {
- classes.push('bg-surface-alt');
+ classes.push('bg-surface-alt', STORAGE_ROW_ACKNOWLEDGED_ALERT_ACCENT_CLASS);
}
if (options.isExpanded) {
classes.push('bg-surface-alt');
}
- let rowStyle: Record<string, string> = {};
- if (showAlertHighlight) {
- rowStyle = {
- 'box-shadow': `inset 4px 0 0 0 ${
- options.alertState.severity === 'critical' ? '#ef4444' : '#eab308'
- }`,
- };
- } else if (hasAcknowledgedOnlyAlert) {
- rowStyle = {
- 'box-shadow': 'inset 4px 0 0 0 rgba(156, 163, 175, 0.8)',
- };
- }
-
return {
rowClass: classes.join(' '),
- rowStyle,
dataAlertState: showAlertHighlight
? 'unacknowledged'
: hasAcknowledgedOnlyAlert