Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(control-ui): surface the GFS listing page cap with a count and notice

M0132c147e0f3
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 1de8b7e78..c8d34488b 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -12361,6 +12361,16 @@ button.cu-gfs-tree__button:focus-visible,
opacity: 0.55;
}
+.cu-gfs-list-count {
+ margin: var(--cu-space-2) 0 0;
+ color: var(--cu-text-soft);
+ font-size: var(--cu-font-size-xs);
+}
+
+.cu-gfs-list-count--truncated {
+ margin-top: var(--cu-space-05);
+}
+
.cu-gfs__load-more {
justify-self: start;
}
diff --git a/control-ui/components/GfsBrowser.tsx b/control-ui/components/GfsBrowser.tsx
index 275fbfa24..ed6e98cd5 100644
--- a/control-ui/components/GfsBrowser.tsx
+++ b/control-ui/components/GfsBrowser.tsx
@@ -1738,6 +1738,26 @@ export function GfsBrowser(): React.JSX.Element {
</div>
)}
+ {!loading && items.length > 0 ? (
+ <p className="cu-gfs-list-count">
+ Showing{' '}
+ {nextCursor ? (
+ <>
+ {items.length} of {items.length}+
+ </>
+ ) : (
+ <>all {items.length}</>
+ )}{' '}
+ items.
+ </p>
+ ) : null}
+
+ {nextCursor && !loading ? (
+ <p className="cu-gfs-list-count cu-gfs-list-count--truncated">
+ The listing is truncated at the page cap — Load more fetches the next page.
+ </p>
+ ) : null}
+
{nextCursor && !loading ? (
<Button
className="cu-gfs__load-more"
diff --git a/control-ui/components/__tests__/GfsBrowser.test.tsx b/control-ui/components/__tests__/GfsBrowser.test.tsx
index 32498ae00..4c6a9c1e5 100644
--- a/control-ui/components/__tests__/GfsBrowser.test.tsx
+++ b/control-ui/components/__tests__/GfsBrowser.test.tsx
@@ -2570,4 +2570,57 @@ describe('GfsBrowser', () => {
expect((await screen.findByText('escalation_rejected')).getAttribute('role')).toBe('alert')
})
+
+ it('shows the loaded count and the truncation notice while a page cap holds more rows', async () => {
+ mockApiGet.mockResolvedValueOnce({
+ items: [child('a.md', 'file', 1), child('b.md', 'file', 2)],
+ nextCursor: 'cursor-1',
+ })
+ renderBrowser()
+
+ expect(await screen.findByText('Showing 2 of 2+ items.')).toBeTruthy()
+ expect(
+ screen.getByText(
+ 'The listing is truncated at the page cap — Load more fetches the next page.'
+ )
+ ).toBeTruthy()
+ expect(screen.getByRole('button', { name: 'Load more' })).toBeTruthy()
+ })
+
+ it('announces the complete count and drops the notice after the last page loads', async () => {
+ mockApiGet.mockImplementation((_path: string, query?: Record<string, string>) => {
+ if (query?.cursor === 'cursor-1') {
+ return Promise.resolve({ items: [child('c.md', 'file', 3)], nextCursor: null })
+ }
+ return Promise.resolve({
+ items: [child('a.md', 'file', 1), child('b.md', 'file', 2)],
+ nextCursor: 'cursor-1',
+ })
+ })
+ renderBrowser()
+
+ expect(await screen.findByText('Showing 2 of 2+ items.')).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: 'Load more' }))
+
+ expect(await screen.findByText('Showing all 3 items.')).toBeTruthy()
+ expect(
+ screen.queryByText(
+ 'The listing is truncated at the page cap — Load more fetches the next page.'
+ )
+ ).toBeNull()
+ expect(screen.queryByRole('button', { name: 'Load more' })).toBeNull()
+ expect(mockApiGet).toHaveBeenCalledWith('/api/v1/gfs/tree', {
+ drive: 'main',
+ cursor: 'cursor-1',
+ })
+ })
+
+ it('states the complete count without a truncation notice on a short listing', async () => {
+ mockApiGet.mockResolvedValueOnce({ items: [child('a.md', 'file', 1)], nextCursor: null })
+ renderBrowser()
+
+ expect(await screen.findByText('Showing all 1 items.')).toBeTruthy()
+ expect(screen.queryByText(/truncated at the page cap/)).toBeNull()
+ expect(screen.queryByRole('button', { name: 'Load more' })).toBeNull()
+ })
})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 59b7e35ff..341555ebf 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.666",
+ "version": "0.1.667",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.666",
+ "version": "0.1.667",
"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.json
index d782553c7..0e8b91f31 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.666",
+ "version": "0.1.667",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",