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.

Distribute infrastructure full-width columns

rcourtman280b3dd5f7e7
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 015a240116..cff59ceac4 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -288,6 +288,12 @@ regression protection.
2. Update this contract when a new protected hot path is adopted
3. Route runtime changes through the explicit performance proof policies in `registry.json`; default fallback proof routing is not allowed
4. Record the evidence source for any claimed performance improvement
+5. Keep wide-desktop infrastructure table layout proof on the shared owner.
+ Changes to `frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts`
+ that affect host, PBS, or PMG desktop column widths must ship with shared
+ model verification plus desktop Playwright proof that full-width shells
+ distribute surplus width across peer columns instead of stretching only the
+ `Resource` column.
## Current State
@@ -684,6 +690,12 @@ and apply those values through classes and width/height attributes, not inline
`style=` maps on the live table DOM. Future hot-path table work must not
reintroduce inline width, min/max width, or row-height styles into the render
shell just to land a local layout tweak.
+That same shared sizing contract now also owns wide-desktop width
+distribution. In full-width shells, host, PBS, and PMG tables must keep an
+explicit desktop `Resource` column width in the shared presentation owner so
+surplus width is redistributed across peer metric, source, uptime, and action
+columns instead of being dumped into the first column and wasting operator
+visible table density.
That hot-path contract now includes policy badge rendering on resource rows.
The infrastructure summary hot path is now explicit shared ownership too:
`InfrastructureSummary.tsx` stays a render shell,
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index c79db9f8c2..225a7fa278 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -859,6 +859,11 @@ consume the shared column presentation owner and render canonical table sizing
through classes plus DOM width/height attributes rather than lane-local inline
style objects, so the same unified-resource dataset can reach the public demo
without transport-specific DOM drift.
+That same consumer contract now also owns full-width desktop balance for the
+infrastructure tables. The shared column presentation owner must publish an
+explicit desktop `Resource` width for host, PBS, and PMG sections so wide
+shells redistribute surplus width across the remaining columns instead of
+turning the first column into blank filler that hides metric density.
The canonical unified-resource change and relationship presenters now also
share the same elapsed-time and "ago" wording utilities, so `observed`,
`last seen`, and `ago` fragments stay consistent without each formatter
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
index 868551bd00..7f2b2cd25c 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
@@ -113,6 +113,8 @@ describe('unifiedResourceTableStateModel', () => {
expect(mobileColumns.resourceColumn.width).toBe('100%');
expect(mobileColumns.metricColumn.width).toBe(70);
expect(desktopColumns.resourceColumn.className).toContain('min-w-[220px]');
+ expect(desktopColumns.resourceColumn.className).toContain('max-w-[220px]');
+ expect(desktopColumns.resourceColumn.width).toBe(220);
expect(desktopColumns.metricColumn.width).toBe(144);
expect(desktopColumns.ioColumn.width).toBe(192);
expect(desktopColumns.sourceColumn.width).toBe(144);
diff --git a/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts b/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
index d42c6108c0..698ca9ef46 100644
--- a/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
+++ b/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
@@ -194,7 +194,7 @@ export const getUnifiedResourceTableColumnPresentations = (
): UnifiedResourceTableColumnPresentations => ({
resourceColumn: isMobile
? buildUnifiedResourceTableColumnPresentation('w-full min-w-[120px]', '100%')
- : buildUnifiedResourceTableColumnPresentation('min-w-[220px]'),
+ : buildUnifiedResourceTableColumnPresentation('min-w-[220px] max-w-[220px]', 220),
metricColumn: isMobile
? buildUnifiedResourceTableColumnPresentation('min-w-[65px]', 70)
: buildUnifiedResourceTableColumnPresentation('min-w-[144px] max-w-[144px]', 144),
diff --git a/tests/integration/tests/61-infrastructure-column-layout.spec.ts b/tests/integration/tests/61-infrastructure-column-layout.spec.ts
new file mode 100644
index 0000000000..513dea87d0
--- /dev/null
+++ b/tests/integration/tests/61-infrastructure-column-layout.spec.ts
@@ -0,0 +1,165 @@
+import { expect, test as base, type Page } from '@playwright/test';
+
+import { getMockMode, setMockMode } from './helpers';
+
+type InfrastructureHeaderMetric = {
+ text: string;
+ width: number;
+ attrWidth: number | null;
+};
+
+type InfrastructureTableMetric = {
+ kind: 'host' | 'pbs' | 'pmg' | 'unknown';
+ wrapperClientWidth: number;
+ wrapperScrollWidth: number;
+ tableScrollWidth: number;
+ headers: InfrastructureHeaderMetric[];
+};
+
+type InfrastructureColumnLayout = {
+ tables: InfrastructureTableMetric[];
+};
+
+let mockModeWasEnabled: boolean | null = null;
+
+const HTTP_CREDENTIALS = {
+ username: 'admin',
+ password: 'adminadminadmin',
+};
+
+const test = base;
+
+test.use({
+ httpCredentials: HTTP_CREDENTIALS,
+});
+
+async function ensureMockModeEnabled(page: Page): Promise<void> {
+ const state = await getMockMode(page);
+ if (mockModeWasEnabled === null) {
+ mockModeWasEnabled = state.enabled;
+ }
+ if (!state.enabled) {
+ await setMockMode(page, true);
+ }
+}
+
+async function readInfrastructureColumnLayout(page: Page): Promise<InfrastructureColumnLayout> {
+ return page.evaluate(() => {
+ const tables = Array.from(
+ document.querySelectorAll<HTMLTableElement>('[data-testid="infrastructure-table-surface"] table'),
+ );
+
+ const classifyTable = (headers: string[]): InfrastructureTableMetric['kind'] => {
+ if (headers.includes('CPU') && headers.includes('Net I/O')) return 'host';
+ if (headers.includes('Datastores') && headers.includes('Jobs')) return 'pbs';
+ if (headers.includes('Queue') && headers.includes('Deferred')) return 'pmg';
+ return 'unknown';
+ };
+
+ return {
+ tables: tables.map((table) => {
+ const wrapper = table.closest<HTMLDivElement>('div.overflow-x-auto');
+ const headers = Array.from(table.querySelectorAll<HTMLTableCellElement>('thead th')).map(
+ (header) => {
+ const rawAttrWidth = header.getAttribute('width');
+ return {
+ text: header.textContent?.replace(/\s+/g, ' ').trim() ?? '',
+ width: Math.round(header.getBoundingClientRect().width),
+ attrWidth:
+ rawAttrWidth === null || Number.isNaN(Number(rawAttrWidth))
+ ? null
+ : Number(rawAttrWidth),
+ };
+ },
+ );
+
+ return {
+ kind: classifyTable(headers.map((header) => header.text)),
+ wrapperClientWidth: wrapper?.clientWidth ?? 0,
+ wrapperScrollWidth: wrapper?.scrollWidth ?? 0,
+ tableScrollWidth: table.scrollWidth,
+ headers,
+ };
+ }),
+ };
+ });
+}
+
+test.describe.serial('Infrastructure column layout', () => {
+ test.afterAll(async ({ browser }) => {
+ if (mockModeWasEnabled === null) {
+ return;
+ }
+
+ const context = await browser.newContext({ httpCredentials: HTTP_CREDENTIALS });
+ const page = await context.newPage();
+ try {
+ const current = await getMockMode(page);
+ if (current.enabled !== mockModeWasEnabled) {
+ await setMockMode(page, mockModeWasEnabled);
+ }
+ } finally {
+ await context.close();
+ }
+ });
+
+ test('distributes full-width desktop space across infrastructure columns', async ({
+ page,
+ }, testInfo) => {
+ test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop runtime proof');
+
+ await page.setViewportSize({ width: 1920, height: 1200 });
+ await page.addInitScript(() => {
+ localStorage.setItem('pulse_whats_new_v2_shown', 'true');
+ localStorage.setItem('fullWidthMode', 'full-width');
+ });
+
+ await ensureMockModeEnabled(page);
+ await page.goto('/infrastructure', { waitUntil: 'domcontentloaded' });
+ await expect(page.locator('.pulse-shell--full-width').first()).toBeVisible();
+ await expect(page.getByTestId('infrastructure-table-surface')).toBeVisible();
+ await expect(page.locator('[data-testid="infrastructure-table-surface"] [data-summary-series-id]').first()).toBeVisible();
+ await page.waitForTimeout(1000);
+
+ const layout = await readInfrastructureColumnLayout(page);
+ const hostTable = layout.tables.find((table) => table.kind === 'host');
+
+ expect(hostTable, 'Expected the infrastructure host table to be visible in mock mode').toBeDefined();
+ expect(layout.tables.length, 'Expected visible infrastructure tables to validate').toBeGreaterThan(0);
+
+ for (const table of layout.tables) {
+ const resourceHeader = table.headers[0];
+ const fixedPeerHeaders = table.headers.slice(1).filter((header) => header.attrWidth !== null);
+ const widestPeerWidth = Math.max(...fixedPeerHeaders.map((header) => header.width));
+
+ expect(
+ table.tableScrollWidth,
+ `${table.kind} table should fit the full-width desktop shell without horizontal scrolling`,
+ ).toBeLessThanOrEqual(table.wrapperClientWidth + 1);
+
+ expect(
+ table.wrapperScrollWidth,
+ `${table.kind} wrapper should not need extra horizontal scroll room in full-width mode`,
+ ).toBeLessThanOrEqual(table.wrapperClientWidth + 1);
+
+ expect(
+ fixedPeerHeaders.length,
+ `Expected ${table.kind} table to expose fixed-width peer columns for validation`,
+ ).toBeGreaterThan(0);
+
+ expect(
+ resourceHeader.width / widestPeerWidth,
+ `${table.kind} resource column should not monopolize the full-width layout`,
+ ).toBeLessThanOrEqual(1.8);
+
+ const underExpandedPeers = fixedPeerHeaders.filter(
+ (header) => header.width <= (header.attrWidth ?? 0) + 5,
+ );
+
+ expect(
+ underExpandedPeers,
+ `${table.kind} table should distribute extra full-width space across peer columns: ${JSON.stringify(table.headers)}`,
+ ).toEqual([]);
+ }
+ });
+});