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.

Give Alert History's free width to the message

rcourtman31c799fbc8b8
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 3be8530484..0ca824b116 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -8858,6 +8858,23 @@ muted, and leave the parent cells empty, so one parent never reads as several
identical ones. The rows must already be grouped; the Backups "Backup server"
table follows this through `BackupServerRow.continuesServer`.
+### Fixed-layout tables give free width to the column that varies
+
+In a fixed-layout table whose columns change with the container, columns
+whose content has a fixed size (a time, a badge, a row of buttons) take exact
+pixels, columns of truncating names take a plain percentage, and the column
+that says what happened takes no width so it absorbs the rest. Percentages for
+every track hand most of each extra pixel to content that already fits.
+Hidden tracks are collapsed and also zero-width, with the table at 100%:
+WebKit (Safari) keeps a collapsed column's width in a fixed layout, so
+widening the table to compensate scrolls sideways there, and `display: none`
+on a column makes Chromium lay it out as an auto column that shares the free
+width. A `max()` or `calc()` of a length and a percentage on a column is laid
+out as auto. The Alerts History table follows this; App.architecture.test.ts
+pins the pixel floors, zero-width hidden tracks and Message's 18% floor, and
+a WebKit and Chromium probe measured no horizontal overflow from 1280px to
+1920px windows.
+
### A refused setting reports the state the server kept
When a write is refused because the server owns the value (an environment
diff --git a/frontend-modern/browser-verification/5b02ae1be951ae9b.json b/frontend-modern/browser-verification/5b02ae1be951ae9b.json
new file mode 100644
index 0000000000..c18e52d90f
--- /dev/null
+++ b/frontend-modern/browser-verification/5b02ae1be951ae9b.json
@@ -0,0 +1,48 @@
+{
+ "version": 1,
+ "base_sha": "7c136b646c67319f2c4fdec39160136d70bf8f79",
+ "verified_at": "2026-10-16T11:50:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/index.css"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/index.css": "c11a24a45d5c04e413b67c6f3b8c75e7728dd61e1dfe99b776a2fcaef110bf12"
+ },
+ "routes": [
+ "/alerts/history"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 800
+ },
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 1600,
+ "height": 900
+ },
+ {
+ "width": 1920,
+ "height": 1080
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "Before (main values on the same page): Message 154px at a 835px card (1280 window), 182px at 982px (1440), 215px at 1134px (1600), 398px at 1436px (1920); WebKit scrolled sideways at 1280 and 1440 (table 1027px and 1208px in the card)",
+ "After: Message 180px, 310px, 278px and 457px; no horizontal overflow in WebKit or Chromium at any of the four widths",
+ "Clipped Message cells fell from 20 to 8 at 1280 and from 10 to 5 at 1440 (Linux fonts); other columns hold their content (Mac Chromium: 0 Type clips at 120px)",
+ "Rows keep one height per density (49px under an 80rem card, 39px from it), as the windowing hook needs",
+ "At 375px History still shows its card list (no table rendered), page scrollWidth 375"
+ ],
+ "interactions": [
+ "Signed in to a private mock stack and opened Alerts > History in the in-app browser at 1280, 1440, 1484, 1600 and 1920 widths; measured column widths, clipped cells and row heights, with main track values applied as a constructable stylesheet for the before reading",
+ "Repeated the before/after measurement in WebKit and Chromium on pulse-dev through a tunnel to the same stack"
+ ]
+}
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index 37fd949a33..1d82003bf8 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -1125,10 +1125,13 @@ describe('Docker phone update reflow boundary', () => {
});
describe('Alert History column widths', () => {
- // Fixed layout sizes all nine tracks against the table width before the
- // collapsed ones are removed, so at each density the visible tracks must sum
- // to 100% and the table width must be the sum of all nine; otherwise the
- // visible columns stop filling the card or overflow it.
+ // Hidden tracks are collapsed and zero-width so the table is always the
+ // card's width: WebKit keeps a collapsed column's width in a fixed layout,
+ // so widening the table to compensate made Safari scroll sideways. The base
+ // density (an unmeasured card under 800px) gives every visible track a
+ // percentage summing to 100%. From an 800px card the fixed-content columns
+ // take exact pixels, resource and node a plain share of the card, and
+ // message has no width so it takes the rest.
const columns = [
'timestamp',
'resource',
@@ -1140,7 +1143,8 @@ describe('Alert History column widths', () => {
'node',
'actions',
] as const;
- const densities: Array<{ name: string; visible: readonly (typeof columns)[number][] }> = [
+ type Column = (typeof columns)[number];
+ const densities: Array<{ name: string; visible: readonly Column[] }> = [
{
name: 'base',
visible: ['timestamp', 'resource', 'severity', 'message', 'status', 'actions'],
@@ -1154,43 +1158,35 @@ describe('Alert History column widths', () => {
];
const blocks = [
...appStylesSource.matchAll(
- /table\.alert-history-responsive-table \{\s*((?:--alert-history-[a-z]+-width: [\d.]+%;\s*)+)width: ([\d.]+)%;/g,
+ /table\.alert-history-responsive-table \{\s*((?:--alert-history-[a-z]+-width: [^;]+;\s*)+)width: ([^;]+);/g,
),
];
-
- it('declares every track width at each density', () => {
- expect(blocks).toHaveLength(densities.length);
- for (const column of columns) {
- expect(appStylesSource).toContain(
- `col.alert-history-${column}-track {\n width: var(--alert-history-${column}-width);`,
- );
- }
- });
-
- it('fills the card exactly with the visible tracks', () => {
- blocks.forEach((block, index) => {
- const widths = Object.fromEntries(
- [...block[1].matchAll(/--alert-history-([a-z]+)-width: ([\d.]+)%;/g)].map((match) => [
- match[1],
- Number(match[2]),
- ]),
- );
- expect(Object.keys(widths).sort()).toEqual([...columns].sort());
- const visibleSum = densities[index].visible.reduce((sum, column) => sum + widths[column], 0);
- const allSum = columns.reduce((sum, column) => sum + widths[column], 0);
- expect(visibleSum).toBeCloseTo(100, 6);
- expect(Number(block[2])).toBeCloseTo(allSum, 6);
- });
- });
+ const parse = (block: RegExpMatchArray) =>
+ Object.fromEntries(
+ [...block[1].matchAll(/--alert-history-([a-z]+)-width: ([^;]+);/g)].map((match) => [
+ match[1],
+ match[2].trim(),
+ ]),
+ ) as Record<Column, string>;
+ const percent = (value: string) => {
+ const match = /^(\d+(?:\.\d+)?)%$/.exec(value);
+ if (!match) throw new Error(`expected a percentage, got ${value}`);
+ return Number(match[1]);
+ };
+ const pixels = (value: string) => {
+ const match = /^(\d+(?:\.\d+)?)px$/.exec(value);
+ if (!match) throw new Error(`expected pixels, got ${value}`);
+ return Number(match[1]);
+ };
// Each density is sized for the narrowest card it serves, from the natural
// widths measured in a real browser (padding included): "08:27 AM" in a 14px
// monospace, the Severity/Duration/Resource headers, a 119px "acknowledged"
// badge, and the three row actions on one line (177px). Below 800px the
// actions stack, so the base density only needs the widest single button.
- // Message, the column that says what happened, takes what is left and may
- // never fall under 18% of the card: equal shares had held it to the width
- // of the timestamp. Type and Node, which appear from 1024px, get a floor too.
+ // Message, the column that says what happened, may never fall under 18% of
+ // the card. Type and Node, which appear from 1024px, get a floor too: the
+ // longest type label, "Container Health", needs 119px with its padding.
const wideNeeds = {
timestamp: 84,
resource: 93,
@@ -1202,7 +1198,7 @@ describe('Alert History column widths', () => {
const pixelNeeds: Array<{
name: string;
cardWidth: number;
- needs: Partial<Record<(typeof columns)[number], number>>;
+ needs: Partial<Record<Column, number>>;
}> = [
{
name: 'base',
@@ -1210,10 +1206,78 @@ describe('Alert History column widths', () => {
needs: { timestamp: 84, resource: 93, severity: 86, status: 119, actions: 80 },
},
{ name: '50rem', cardWidth: 800, needs: wideNeeds },
- { name: '64rem', cardWidth: 1024, needs: { ...wideNeeds, type: 108, node: 68 } },
- { name: '80rem', cardWidth: 1280, needs: { ...wideNeeds, type: 108, node: 68 } },
+ { name: '64rem', cardWidth: 1024, needs: { ...wideNeeds, type: 120, node: 68 } },
+ { name: '80rem', cardWidth: 1280, needs: { ...wideNeeds, type: 120, node: 68 } },
];
+ // The rendered width of each visible track at a given card width.
+ const trackWidths = (index: number, cardWidth: number): Record<string, number> => {
+ const widths = parse(blocks[index]);
+ const visible = densities[index].visible;
+ if (index === 0) {
+ return Object.fromEntries(
+ visible.map((column) => [column, (percent(widths[column]) / 100) * cardWidth]),
+ );
+ }
+ const tableWidth = cardWidth;
+ const resolved: Record<string, number> = {};
+ for (const column of visible) {
+ if (column === 'message') continue;
+ resolved[column] = widths[column].endsWith('%')
+ ? (percent(widths[column]) / 100) * tableWidth
+ : pixels(widths[column]);
+ }
+ resolved.message = cardWidth - Object.values(resolved).reduce((sum, width) => sum + width, 0);
+ return resolved;
+ };
+
+ it('declares every track width at each density', () => {
+ expect(blocks).toHaveLength(densities.length);
+ for (const column of columns) {
+ expect(appStylesSource).toContain(
+ `col.alert-history-${column}-track {\n width: var(--alert-history-${column}-width);`,
+ );
+ }
+ });
+
+ it('keeps the table at the card width with zero-width hidden tracks', () => {
+ blocks.forEach((block, index) => {
+ const widths = parse(block);
+ const { name, visible } = densities[index];
+ expect(block[2].trim(), `${name}: table width`).toBe('100%');
+ for (const column of columns.filter((candidate) => !visible.includes(candidate))) {
+ expect(widths[column], `${name}: hidden ${column}`).toMatch(/^0(?:px|%)$/);
+ }
+ });
+ });
+
+ it('fills the narrow card exactly with the base density percentages', () => {
+ const widths = parse(blocks[0]);
+ const visibleSum = densities[0].visible.reduce(
+ (sum, column) => sum + percent(widths[column]),
+ 0,
+ );
+ expect(visibleSum).toBeCloseTo(100, 6);
+ });
+
+ it('lets message take what the fixed tracks leave from an 800px card', () => {
+ blocks.slice(1).forEach((block, offset) => {
+ const index = offset + 1;
+ const widths = parse(block);
+ expect(widths.message, `${densities[index].name}: message`).toBe('auto');
+ // Content with a fixed size takes pixels. Resource and node, which hold
+ // truncating names, may take a plain share of the card; never a
+ // max() or calc() on a column, which Chromium lays out as auto.
+ for (const column of columns) {
+ if (column === 'message') continue;
+ const shared = column === 'resource' || column === 'node';
+ const read = () =>
+ shared && widths[column].endsWith('%') ? percent(widths[column]) : pixels(widths[column]);
+ expect(read, `${densities[index].name}: ${column}`).not.toThrow();
+ }
+ });
+ });
+
it('declares each density block inside its 50rem, 64rem and 80rem container query', () => {
const enclosing = blocks.slice(1).map((block) => {
const start = block.index as number;
@@ -1248,32 +1312,37 @@ describe('Alert History column widths', () => {
});
it('gives every column the pixels its content needs at the narrowest card of each density', () => {
- blocks.forEach((block, index) => {
- const widths = Object.fromEntries(
- [...block[1].matchAll(/--alert-history-([a-z]+)-width: ([\d.]+)%;/g)].map((match) => [
- match[1],
- Number(match[2]),
- ]),
- );
- const { name, cardWidth, needs } = pixelNeeds[index];
+ pixelNeeds.forEach(({ name, cardWidth, needs }, index) => {
+ const widths = trackWidths(index, cardWidth);
for (const [column, need] of Object.entries(needs)) {
- const pixels = (widths[column] / 100) * cardWidth;
- expect(pixels, `${name}: ${column} track at ${cardWidth}px`).toBeGreaterThanOrEqual(
+ expect(widths[column], `${name}: ${column} track at ${cardWidth}px`).toBeGreaterThanOrEqual(
need - 0.5,
);
}
});
});
- it('keeps Message at least 18% of the card at every density', () => {
- blocks.forEach((block, index) => {
- const widths = Object.fromEntries(
- [...block[1].matchAll(/--alert-history-([a-z]+)-width: ([\d.]+)%;/g)].map((match) => [
- match[1],
- Number(match[2]),
- ]),
- );
- expect(widths.message, `${densities[index].name}: message share`).toBeGreaterThanOrEqual(18);
+ it('keeps Message at least 18% of the card at the narrowest card of every density', () => {
+ pixelNeeds.forEach(({ name, cardWidth }, index) => {
+ expect(
+ trackWidths(index, cardWidth).message / cardWidth,
+ `${name}: message share`,
+ ).toBeGreaterThanOrEqual(0.18);
});
});
+
+ // Percentages handed most of every extra pixel to a badge and three buttons
+ // that already fit: at a 982px card message held 182px. Pixel tracks give
+ // the extra width to message.
+ it('gives message most of the extra width of a wider card', () => {
+ for (const [index, narrow, wide] of [
+ [1, 800, 1023],
+ [2, 1024, 1279],
+ [3, 1280, 1600],
+ ] as const) {
+ const growth = trackWidths(index, wide).message - trackWidths(index, narrow).message;
+ expect(growth, densities[index].name).toBeGreaterThanOrEqual(0.75 * (wide - narrow));
+ }
+ expect(trackWidths(1, 982).message).toBeGreaterThan(300);
+ });
});
diff --git a/frontend-modern/src/index.css b/frontend-modern/src/index.css
index d103000646..cb90db1f64 100644
--- a/frontend-modern/src/index.css
+++ b/frontend-modern/src/index.css
@@ -486,18 +486,29 @@
can be much narrower than the viewport. Exact time stays with the six core
fields whenever the desktop table is active. Duration is secondary context
at 800px, while type and node remain reserved for a 1024px table shell.
- Fixed-layout tables calculate all nine tracks before collapsed columns are
- removed, so the table width compensates at each density to let the six,
- seven, or nine visible tracks fill the card without creating a scrollbar:
- it is the sum of all nine track widths over the sum of the visible ones.
- Visible tracks sum to 100%. Each density is sized for the narrowest card
- it serves (600px, 800px, 1024px and 1280px): time ("08:27 AM" in a 14px
- monospace), severity, duration, status ("acknowledged" needs 119px with its
- cell padding), the resource header, the type badge (from 1024px) and the
- three actions on one line (177px) get the pixels their content and header
- need at that width, and message, the column that says what happened, takes
- what is left.
- App.architecture.test.ts holds those minimums. Below 800px the three
+ Hidden tracks are collapsed and also given zero width, so the table is
+ always 100% of the card. Chromium removes collapsed columns, but WebKit
+ (Safari) keeps their width in a fixed-layout table: the earlier approach of
+ widening the table by the hidden tracks' share made the History table
+ scroll sideways in Safari from an 800px to a 1024px card. `display: none`
+ on a column is no better: Chromium then lays it out as an auto column that
+ shares the free width with message.
+ The base density (an unmeasured card under 800px) sizes every visible
+ track as a percentage summing to 100%. From an 800px card the columns
+ whose content has a fixed size take exactly the pixels it needs: time
+ ("08:27 AM" in a 14px monospace), severity, duration, status
+ ("acknowledged" needs 119px with its cell padding), the type label (from
+ 1024px; "Container Health" needs 119px, and from 1280px it takes 128px for
+ wider Linux fonts) and the three actions on one line
+ (177px). Resource and node hold names that truncate, so they keep a plain
+ share of the card, at least their header at the narrowest card (a max()
+ of a length and a percentage would be laid out as an auto column).
+ Message, the column that says what happened, has no width so it takes all
+ the rest. Percentages for every track gave the fixed columns most of each
+ extra pixel: at a 982px card message held 182px while status and actions
+ held 364px for a badge and three buttons.
+ App.architecture.test.ts holds those minimums and message's 18% floor at
+ the narrowest card of each density. Below 800px the three
actions stack, which makes those rows taller than the rest.
Below an 80rem card, resource and message wrap inside their cells
instead of ending in an ellipsis after one line. Message then occupies two
@@ -520,14 +531,14 @@
.table-scroll-shell table.alert-history-responsive-table {
--alert-history-timestamp-width: 14%;
--alert-history-resource-width: 15.6%;
- --alert-history-type-width: 11.8%;
+ --alert-history-type-width: 0%;
--alert-history-severity-width: 14.4%;
--alert-history-message-width: 22.7%;
- --alert-history-duration-width: 11.5%;
+ --alert-history-duration-width: 0%;
--alert-history-status-width: 19.9%;
- --alert-history-node-width: 11.2%;
+ --alert-history-node-width: 0%;
--alert-history-actions-width: 13.4%;
- width: 134.5%;
+ width: 100%;
}
.table-scroll-shell col.alert-history-timestamp-track {
@@ -625,16 +636,16 @@
}
.table-scroll-shell table.alert-history-responsive-table {
- --alert-history-timestamp-width: 10.5%;
+ --alert-history-timestamp-width: 84px;
--alert-history-resource-width: 11.7%;
- --alert-history-type-width: 11.8%;
- --alert-history-severity-width: 10.8%;
- --alert-history-message-width: 18.5%;
- --alert-history-duration-width: 11.4%;
- --alert-history-status-width: 14.9%;
- --alert-history-node-width: 11.2%;
- --alert-history-actions-width: 22.2%;
- width: 123%;
+ --alert-history-type-width: 0px;
+ --alert-history-severity-width: 86px;
+ --alert-history-message-width: auto;
+ --alert-history-duration-width: 91px;
+ --alert-history-status-width: 119px;
+ --alert-history-node-width: 0px;
+ --alert-history-actions-width: 177px;
+ width: 100%;
}
.table-scroll-shell :is(th, td).agent-doctor-target-column {
@@ -669,30 +680,30 @@
}
.table-scroll-shell table.alert-history-responsive-table {
- --alert-history-timestamp-width: 8.2%;
+ --alert-history-timestamp-width: 84px;
--alert-history-resource-width: 9.1%;
- --alert-history-type-width: 10.7%;
- --alert-history-severity-width: 8.4%;
- --alert-history-message-width: 19%;
- --alert-history-duration-width: 8.9%;
- --alert-history-status-width: 11.6%;
- --alert-history-node-width: 6.8%;
- --alert-history-actions-width: 17.3%;
+ --alert-history-type-width: 120px;
+ --alert-history-severity-width: 86px;
+ --alert-history-message-width: auto;
+ --alert-history-duration-width: 91px;
+ --alert-history-status-width: 119px;
+ --alert-history-node-width: 6.7%;
+ --alert-history-actions-width: 177px;
width: 100%;
}
}
@container (min-width: 80rem) {
.table-scroll-shell table.alert-history-responsive-table {
- --alert-history-timestamp-width: 6.6%;
- --alert-history-resource-width: 11.5%;
- --alert-history-type-width: 8.5%;
- --alert-history-severity-width: 6.8%;
- --alert-history-message-width: 27.7%;
- --alert-history-duration-width: 7.2%;
- --alert-history-status-width: 9.3%;
+ --alert-history-timestamp-width: 84px;
+ --alert-history-resource-width: 12%;
+ --alert-history-type-width: 128px;
+ --alert-history-severity-width: 86px;
+ --alert-history-message-width: auto;
+ --alert-history-duration-width: 91px;
+ --alert-history-status-width: 119px;
--alert-history-node-width: 8.5%;
- --alert-history-actions-width: 13.9%;
+ --alert-history-actions-width: 177px;
width: 100%;
}