From 9f6192c4012c03c5fc28af22e3a499e22e819d4b Mon Sep 17 00:00:00 2001 From: Andy Anderson Date: Fri, 30 Oct 2026 21:24:09 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20keep=20running=20fleet=20?= =?UTF-8?q?costs=20readable=20below=20the=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andy Anderson --- changelog.d/fixed-running-cost-layout.md | 1 + src/pkg/dashboard/fleet_cost_rotor.test.js | 39 ++++++++++++++----- src/pkg/dashboard/static-src/css/governor.css | 20 ++++------ src/pkg/dashboard/static-src/js/agent-now.js | 8 ++-- src/pkg/dashboard/static/index.html | 28 ++++++------- 5 files changed, 55 insertions(+), 41 deletions(-) create mode 100644 changelog.d/fixed-running-cost-layout.md diff --git a/changelog.d/fixed-running-cost-layout.md b/changelog.d/fixed-running-cost-layout.md new file mode 100644 index 0000000000..2f2e7b8f5f --- /dev/null +++ b/changelog.d/fixed-running-cost-layout.md @@ -0,0 +1 @@ +- Show the Activity Monitor's running fleet cost and its rotating period on a separate, wrapping line below the running count so narrow tiles and zoom no longer truncate the amount or period. diff --git a/src/pkg/dashboard/fleet_cost_rotor.test.js b/src/pkg/dashboard/fleet_cost_rotor.test.js index 65e2a070c8..f7988c1221 100644 --- a/src/pkg/dashboard/fleet_cost_rotor.test.js +++ b/src/pkg/dashboard/fleet_cost_rotor.test.js @@ -1,6 +1,6 @@ // The RUNNING tile's cost rotor (#15614): "$X this hour" → "$Y today" → // "$Z this week" → "$W this month", ~4s each, pausing while hovered or -// hidden, instant under prefers-reduced-motion, never a second line. The +// hidden, instant under prefers-reduced-motion, below the running count. The // rotor block is lifted straight out of index.html so this runs against the // shipped source. const test = require('node:test'); @@ -150,7 +150,7 @@ test('prefers-reduced-motion swaps instantly with no outgoing phrase', () => { test('markup: fixed agent count, four phrases in one rotor, tooltip lists all four', () => { const env = makeEnv(); const r = env.rendered; - assert.match(r, /3 · <\/span>3<\/span> { + const env = makeEnv(); + Object.assign(env.window._lastStatus.fleetRun, { + running: 4, hourUSD: 11675.25, dayUSD: 1234567, weekUSD: 9876543, monthUSD: 123456789, + }); + for (const rendered of [env.api.fleetRunStatHtml(), env.api.fleetRunStripHtml()]) { + assert.match(rendered, /4<\/span>${phrase.amount} ${phrase.label}`)); + } + assert.match(rendered, /aria-live="off"/); + assert.strictEqual((rendered.match(/aria-hidden="true"/g) || []).length, 3); + } + env.window._lastStatus.fleetRun = null; + assert.strictEqual(env.api.fleetRunStatHtml(), ''); + assert.strictEqual(env.api.fleetRunStripHtml(), ''); +}); diff --git a/src/pkg/dashboard/static-src/css/governor.css b/src/pkg/dashboard/static-src/css/governor.css index 28ebfc3b7c..06db9ad540 100644 --- a/src/pkg/dashboard/static-src/css/governor.css +++ b/src/pkg/dashboard/static-src/css/governor.css @@ -17,17 +17,14 @@ the "N Issues" / on-hold indicators. */ .gov-stat .val.planning-alert { color: var(--yellow); } /* RUNNING tile cost rotor (#15614): the four window phrases share one - grid cell, so the tile is always as wide as its widest phrase and the - amount + window crossfades in place while the agent count stays put. - The host is a flex row — count fixed, rotor shrinks — so the host - itself never overflows: a text-overflow ellipsis on the host would be - painted at the rotor's left edge, showing up as a stray dot between - "$" and the digits ("$.1,010"). Only the phrase ellipsizes. */ - .fleet-run-stat .val, .fleet-run-stat .gm-val { display: flex; align-items: baseline; white-space: nowrap; overflow: hidden; min-width: 0; } - /* pre keeps the trailing space of "N · " that flex would otherwise trim. */ - .fleet-run-count { flex: none; white-space: pre; color: var(--text); } - .fleet-cost-rotor { display: inline-grid; grid-template-areas: 'phrase'; flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--text); } - .fleet-cost-rotor .fcr-phrase { grid-area: phrase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; opacity: 0; transform: translateY(0.5em); transition: opacity 360ms ease, transform 360ms ease; pointer-events: none; } + grid cell to reserve the tallest wrapped phrase while the amount + + window crossfades. Cost lives below the count and may wrap at narrow + widths or zoom levels; neither the amount nor its period is clipped. */ + .fleet-run-stat { min-width: 0; } + .fleet-run-stat .val, .fleet-run-stat .gm-val { display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-1); white-space: normal; overflow: visible; min-width: 0; } + .fleet-run-count { flex: none; overflow-wrap: anywhere; color: var(--text); } + .fleet-cost-rotor { display: inline-grid; grid-template-areas: 'phrase'; grid-template-columns: minmax(0, 1fr); min-width: 0; color: var(--text); font-size: var(--fs-sm); line-height: 1.4; } + .fleet-cost-rotor .fcr-phrase { grid-area: phrase; white-space: normal; overflow-wrap: anywhere; min-width: 0; opacity: 0; transform: translateY(0.5em); transition: opacity 360ms ease, transform 360ms ease; pointer-events: none; } .fleet-cost-rotor .fcr-phrase.is-cur { opacity: 1; transform: translateY(0); } .fleet-cost-rotor .fcr-phrase.is-out { opacity: 0; transform: translateY(-0.5em); } .fleet-cost-rotor .fcr-window { color: var(--amber); font-weight: 600; } @@ -134,4 +131,3 @@ display: none; } } - diff --git a/src/pkg/dashboard/static-src/js/agent-now.js b/src/pkg/dashboard/static-src/js/agent-now.js index 33e6e97ff8..c09df5ea3b 100644 --- a/src/pkg/dashboard/static-src/js/agent-now.js +++ b/src/pkg/dashboard/static-src/js/agent-now.js @@ -256,8 +256,8 @@ // The RUNNING tile rotates its cost window — this hour → today → this // week → this month — one phrase at a time (#15614). The agent count // stays put; only the amount + window phrase crossfades. All four - // phrases are rendered into the same grid cell so the tile is always as - // wide as its widest phrase and never shifts or wraps. The rotation + // phrases share a grid cell below the count, reserving room for the + // tallest wrapped phrase without shifting on rotation. The rotation // index is module state so a status repaint keeps the current phrase. // The hour window keeps cents (it is small and moves fast); the longer // windows round to whole dollars (fmtUSDWhole) so the figure stays short. @@ -339,13 +339,13 @@ const f = window._lastStatus?.fleetRun; if (!f) return ''; fleetCostRotorStart(); - return `
running
${f.running || 0} · ${fleetCostRotorHtml(f)}
`; + return `
running
${f.running || 0}${fleetCostRotorHtml(f)}
`; } function fleetRunStripHtml() { const f = window._lastStatus?.fleetRun; if (!f) return ''; fleetCostRotorStart(); - return `
running${f.running || 0} · ${fleetCostRotorHtml(f)}
`; + return `
running${f.running || 0}${fleetCostRotorHtml(f)}
`; } // Repaints every "Now:" line in place so "ago" keeps counting up (and diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 5951f202e7..a55163b066 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2282,17 +2282,14 @@ the "N Issues" / on-hold indicators. */ .gov-stat .val.planning-alert { color: var(--yellow); } /* RUNNING tile cost rotor (#15614): the four window phrases share one - grid cell, so the tile is always as wide as its widest phrase and the - amount + window crossfades in place while the agent count stays put. - The host is a flex row — count fixed, rotor shrinks — so the host - itself never overflows: a text-overflow ellipsis on the host would be - painted at the rotor's left edge, showing up as a stray dot between - "$" and the digits ("$.1,010"). Only the phrase ellipsizes. */ - .fleet-run-stat .val, .fleet-run-stat .gm-val { display: flex; align-items: baseline; white-space: nowrap; overflow: hidden; min-width: 0; } - /* pre keeps the trailing space of "N · " that flex would otherwise trim. */ - .fleet-run-count { flex: none; white-space: pre; color: var(--text); } - .fleet-cost-rotor { display: inline-grid; grid-template-areas: 'phrase'; flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--text); } - .fleet-cost-rotor .fcr-phrase { grid-area: phrase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; opacity: 0; transform: translateY(0.5em); transition: opacity 360ms ease, transform 360ms ease; pointer-events: none; } + grid cell to reserve the tallest wrapped phrase while the amount + + window crossfades. Cost lives below the count and may wrap at narrow + widths or zoom levels; neither the amount nor its period is clipped. */ + .fleet-run-stat { min-width: 0; } + .fleet-run-stat .val, .fleet-run-stat .gm-val { display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-1); white-space: normal; overflow: visible; min-width: 0; } + .fleet-run-count { flex: none; overflow-wrap: anywhere; color: var(--text); } + .fleet-cost-rotor { display: inline-grid; grid-template-areas: 'phrase'; grid-template-columns: minmax(0, 1fr); min-width: 0; color: var(--text); font-size: var(--fs-sm); line-height: 1.4; } + .fleet-cost-rotor .fcr-phrase { grid-area: phrase; white-space: normal; overflow-wrap: anywhere; min-width: 0; opacity: 0; transform: translateY(0.5em); transition: opacity 360ms ease, transform 360ms ease; pointer-events: none; } .fleet-cost-rotor .fcr-phrase.is-cur { opacity: 1; transform: translateY(0); } .fleet-cost-rotor .fcr-phrase.is-out { opacity: 0; transform: translateY(-0.5em); } .fleet-cost-rotor .fcr-window { color: var(--amber); font-weight: 600; } @@ -2399,7 +2396,6 @@ display: none; } } - /* ── ACMM level-up recommendation (advisory) + lifecycle timeline ── */ .reco-badge { display: inline-block; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.06em; @@ -14371,8 +14367,8 @@

Where to get help

// The RUNNING tile rotates its cost window — this hour → today → this // week → this month — one phrase at a time (#15614). The agent count // stays put; only the amount + window phrase crossfades. All four - // phrases are rendered into the same grid cell so the tile is always as - // wide as its widest phrase and never shifts or wraps. The rotation + // phrases share a grid cell below the count, reserving room for the + // tallest wrapped phrase without shifting on rotation. The rotation // index is module state so a status repaint keeps the current phrase. // The hour window keeps cents (it is small and moves fast); the longer // windows round to whole dollars (fmtUSDWhole) so the figure stays short. @@ -14454,13 +14450,13 @@

Where to get help

const f = window._lastStatus?.fleetRun; if (!f) return ''; fleetCostRotorStart(); - return `
running
${f.running || 0} · ${fleetCostRotorHtml(f)}
`; + return `
running
${f.running || 0}${fleetCostRotorHtml(f)}
`; } function fleetRunStripHtml() { const f = window._lastStatus?.fleetRun; if (!f) return ''; fleetCostRotorStart(); - return `
running${f.running || 0} · ${fleetCostRotorHtml(f)}
`; + return `
running${f.running || 0}${fleetCostRotorHtml(f)}
`; } // Repaints every "Now:" line in place so "ago" keeps counting up (and