Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): make the LLM Usage body scrollable inside the locked shell
Mb7dce6edd96f
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.cssindex 8827633cc..1de8b7e78 100644--- a/control-ui/app/globals.css+++ b/control-ui/app/globals.css@@ -1141,6 +1141,16 @@ body.cu-body {overflow: auto;}+/* The usage dashboard's body is the flexed child of a viewport-fill card whose+ ancestors are all height-capped or overflow-hidden (.cu-main is locked to+ 100vh with overflow hidden, .cu-card clips). Without its own scroll, content+ past the fold — the breakdown list under the fixed-height chart — is clipped+ with no scrollbar anywhere. The body owns the overflow, so the panel header+ stays visible while the content scrolls. */+.cu-card--viewport-fill > .cu-card__body.cu-usage-body {+ overflow: auto;+}+.cu-not-found {text-align: center;}diff --git a/control-ui/components/__tests__/UsageDashboard.test.tsx b/control-ui/components/__tests__/UsageDashboard.test.tsxindex 36e58a645..8fc9fb3f2 100644--- a/control-ui/components/__tests__/UsageDashboard.test.tsx+++ b/control-ui/components/__tests__/UsageDashboard.test.tsx@@ -192,4 +192,31 @@ describe('UsageDashboard', () => {fireEvent.click(screen.getByRole('button', { name: /refresh/i }))await waitFor(() => expect(mockFetchSeries).toHaveBeenCalledTimes(2))})++ it('keeps overflowing breakdown rows inside the designated scroll pane', async () => {+ // Regression (BUG-134): every ancestor of the usage body is height-capped+ // or overflow-hidden, so the body itself is the page's only scroll+ // container. The overflowing rows must live inside that pane — the+ // stylesheet contract making it scrollable is locked in+ // lib/__tests__/usageScrollStyles.test.ts.+ mockFetchTotals.mockResolvedValueOnce({+ from: '',+ to: '',+ interval: '5min',+ groupBy: 'team_id',+ rows: Array.from({ length: 10 }, (_, index) => ({+ group: `team-${index}`,+ input_tokens: 10,+ output_tokens: 10,+ total_tokens: 20,+ request_count: 2,+ })),+ })+ const { container } = render(<UsageDashboard />)+ fireEvent.change(screen.getByLabelText('Break down by'), { target: { value: 'team_id' } })+ expect(await screen.findByText(/team-9/)).toBeTruthy()+ const pane = container.querySelector('.cu-card--viewport-fill > .cu-card__body.cu-usage-body')+ expect(pane).not.toBeNull()+ expect(pane?.contains(screen.getByText(/team-9/))).toBe(true)+ })})diff --git a/control-ui/lib/__tests__/usageScrollStyles.test.ts b/control-ui/lib/__tests__/usageScrollStyles.test.tsnew file mode 100644index 000000000..6a77e17fd--- /dev/null+++ b/control-ui/lib/__tests__/usageScrollStyles.test.ts@@ -0,0 +1,42 @@+import { describe, expect, it } from 'vitest'+import { readFileSync } from 'node:fs'+import { resolve } from 'node:path'++const css = readFileSync(resolve(__dirname, '../../app/globals.css'), 'utf8')++function cssRuleBody(selector: string) {+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')+ const match = css.match(new RegExp(`(?:^|\\n)${escaped}\\s*\\{([^}]*)\\}`, 'm'))+ if (!match) throw new Error(`Missing CSS rule for ${selector}`)+ return match[1]+}++// A selector can appear in several rules (alone and inside comma groups);+// assert on the first rule whose body carries the declaration.+function someRuleDeclares(selector: string, declaration: RegExp): boolean {+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')+ return [...css.matchAll(new RegExp(`(?:^|\\n)${escaped}\\s*\\{([^}]*)\\}`, 'gm'))].some(match =>+ declaration.test(match[1])+ )+}++// The /cost/usage shell locks scrolling: .cu-main is height:100vh with+// overflow:hidden, .cu-cost-layout is height:100% without overflow, and the+// viewport-fill card clips (.cu-card { overflow: hidden }). The usage body is+// the flexed child of that card (flex:1; min-height:0), so unless it scrolls+// itself, content past the fold is unreachable — the LLM Usage page could not+// scroll (BUG-134). Sibling cost pages scroll through .cu-table-wrap; the+// usage page has no table wrap, so its body owns the overflow.+describe('LLM Usage scroll contract', () => {+ it('makes the flexed usage body the scroll container inside the height-capped shell', () => {+ expect(cssRuleBody('.cu-card--viewport-fill > .cu-card__body.cu-usage-body')).toMatch(+ /overflow:\s*auto/+ )+ })++ it('keeps the body a shrinkable flex child so it can actually overflow', () => {+ expect(someRuleDeclares('.cu-card--viewport-fill > .cu-card__body', /min-height:\s*0/)).toBe(+ true+ )+ })+})diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex b51d90ec0..59b7e35ff 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.665",+ "version": "0.1.666","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.665",+ "version": "0.1.666","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/frontend-components": "file:../packages/frontend-components",diff --git a/control-ui/package.json b/control-ui/package.jsonindex d14ca7a0f..d782553c7 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.665",+ "version": "0.1.666","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",