Skip to content

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

TypeScript

fix(gfs): match control access list to desktop

Miguelon Peluchon15a55b0f8d27
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index cc5788424..a39d5e812 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -12298,22 +12298,19 @@ button.cu-gfs-tree__button:focus-visible,
.cu-gfs-existing-access {
display: grid;
- gap: var(--cu-space-2);
- padding: var(--cu-space-3) 0;
- border-top: 1px solid var(--cu-border);
- border-bottom: 1px solid var(--cu-border);
+ gap: var(--cu-space-3);
}
-.cu-gfs-existing-access__header h3,
+.cu-gfs-existing-access__header h4,
.cu-gfs-existing-access__header p,
.cu-gfs-existing-access__empty,
.cu-gfs-existing-access__error p {
margin: 0;
}
-.cu-gfs-existing-access__header h3 {
+.cu-gfs-existing-access__header h4 {
color: var(--cu-text);
- font-size: 0.875rem;
+ font-size: 1.05rem;
font-weight: 600;
}
@@ -12325,7 +12322,7 @@ button.cu-gfs-tree__button:focus-visible,
.cu-gfs-existing-access__list {
display: grid;
- gap: var(--cu-space-2);
+ gap: var(--cu-space-1);
margin: 0;
padding: 0;
list-style: none;
@@ -12334,34 +12331,86 @@ button.cu-gfs-tree__button:focus-visible,
.cu-gfs-existing-access__item {
display: flex;
align-items: center;
- justify-content: space-between;
- gap: var(--cu-space-3);
+ gap: var(--cu-space-2);
+ min-width: 0;
padding: var(--cu-space-2);
border: 1px solid var(--cu-border);
border-radius: var(--cu-radius-sm);
- background: var(--cu-bg-elevated);
+ background: var(--cu-surface);
}
-.cu-gfs-existing-access__copy {
+.cu-gfs-existing-access__identity {
min-width: 0;
display: grid;
- gap: var(--cu-space-1);
-}
-
-.cu-gfs-existing-access__subject,
-.cu-gfs-existing-access__detail {
- overflow-wrap: anywhere;
+ gap: calc(var(--cu-space-1) / 2);
+ flex: 1 1 auto;
}
.cu-gfs-existing-access__subject {
+ overflow: hidden;
color: var(--cu-text);
font-size: 0.8125rem;
- font-weight: 600;
+ font-weight: 500;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
.cu-gfs-existing-access__detail {
+ overflow: hidden;
color: var(--cu-text-soft);
font-size: 0.75rem;
+ text-overflow: ellipsis;
+ text-transform: capitalize;
+ white-space: nowrap;
+}
+
+.cu-gfs-existing-access__meta {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: var(--cu-space-1);
+}
+
+.cu-gfs-existing-access__chips {
+ display: inline-flex;
+ flex-wrap: wrap;
+ gap: var(--cu-space-1);
+}
+
+.cu-gfs-existing-access__permission,
+.cu-gfs-existing-access__inherit {
+ display: inline-flex;
+ align-items: center;
+ min-height: 1.25rem;
+ padding: 0 var(--cu-space-1);
+ border-radius: var(--cu-radius-pill);
+ font-size: 0.68rem;
+ line-height: 1.2;
+ white-space: nowrap;
+}
+
+.cu-gfs-existing-access__permission {
+ border: 1px solid var(--cu-border);
+ background: var(--cu-bg-elevated);
+ color: var(--cu-text-muted);
+}
+
+.cu-gfs-existing-access__inherit {
+ gap: calc(var(--cu-space-1) / 2);
+ border: 1px solid rgba(var(--cu-success-rgb), 0.24);
+ background: rgba(var(--cu-success-rgb), 0.055);
+ color: var(--cu-success);
+}
+
+.cu-gfs-existing-access__inherit svg {
+ width: var(--cu-space-2);
+ height: var(--cu-space-2);
+ flex: 0 0 var(--cu-space-2);
+}
+
+.cu-gfs-existing-access__item > .cu-btn {
+ flex: 0 0 auto;
+ white-space: nowrap;
}
.cu-gfs-existing-access__error {
@@ -12371,6 +12420,18 @@ button.cu-gfs-tree__button:focus-visible,
gap: var(--cu-space-2);
}
+@media (max-width: 560px) {
+ .cu-gfs-existing-access__item {
+ align-items: flex-start;
+ flex-wrap: wrap;
+ }
+
+ .cu-gfs-existing-access__meta {
+ flex: 1 1 100%;
+ order: 3;
+ }
+}
+
@media (max-width: 780px) {
.cu-gfs-panel__toolbar,
.cu-gfs-panel__actions {
diff --git a/control-ui/components/GfsGrantPanel.tsx b/control-ui/components/GfsGrantPanel.tsx
index a88a584c6..bb161244d 100644
--- a/control-ui/components/GfsGrantPanel.tsx
+++ b/control-ui/components/GfsGrantPanel.tsx
@@ -3,10 +3,11 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useConfirmDialog } from '@components/ConfirmDialog'
import { GfsPermissionDropdown } from '@components/GfsPermissionDropdown'
+import { GFS_PERMISSION_LABELS } from '@components/GfsPermissionDropdown/constants'
import { GfsSubjectPicker } from '@components/GfsSubjectPicker'
import type { SelectionDropdownOption } from '@components/SelectionDropdown/types'
+import { IconFolder } from '@components/Sidebar/icons'
import { useToast } from '@components/Toast'
-import { IconTrash } from '@components/icons'
import { Button, CheckboxField } from '@components/ui'
import { GFS_MAX_BULK_SUBJECTS } from '@constants/gfsGrantSubjects'
import {
@@ -378,14 +379,36 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
removed.
</p>
) : null}
- <section className="cu-gfs-existing-access" aria-label="Existing access">
+ {canIncludeDescendants ? (
+ <CheckboxField
+ className="cu-gfs-grant__scope"
+ label="Include contents of this folder"
+ checked={includeDescendants}
+ onChange={() => setIncludeDescendants(current => !current)}
+ disabled={actionPending}
+ />
+ ) : null}
+ <div className="cu-gfs-grant__actions">
+ <Button variant="primary" disabled={!canSubmit} onClick={() => submit('grant')}>
+ Grant access
+ </Button>
+ <Button disabled={!canSubmit || !canCreateShare} onClick={() => submit('share')}>
+ Create share
+ </Button>
+ </div>
+ {error ? (
+ <p role="alert" className="cu-field__error">
+ {error}
+ </p>
+ ) : null}
+ <section className="cu-gfs-existing-access" aria-label="Who has access">
<div className="cu-gfs-existing-access__header">
- <h3>Existing access</h3>
- <p>Direct grants and shares configured on this resource.</p>
+ <h4>Who has access</h4>
+ <p>Existing grants on this resource. Revoking is immediate.</p>
</div>
{existingAccessLoading ? (
<p className="cu-gfs-existing-access__empty" role="status">
- Loading existing access…
+ Loading access…
</p>
) : existingAccessError ? (
<div className="cu-gfs-existing-access__error">
@@ -397,32 +420,50 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
</Button>
</div>
) : existingAccess.length === 0 ? (
- <p className="cu-gfs-existing-access__empty">No direct access configured.</p>
+ <p className="cu-gfs-existing-access__empty">No direct grants or shares yet.</p>
) : (
- <ul className="cu-gfs-existing-access__list">
+ <ul className="cu-gfs-existing-access__list" aria-label="Resource access">
{existingAccess.map(item => {
const label = subjectLabel(item)
const coversDescendants =
item.kind === 'grant' ? item.inherit : item.includeDescendants
return (
- <li className="cu-gfs-existing-access__item" key={`${item.kind}:${item.id}`}>
- <div className="cu-gfs-existing-access__copy">
+ <li
+ className="cu-gfs-existing-access__item"
+ data-testid={`gfs-access-row-${item.kind}-${item.id}`}
+ key={`${item.kind}:${item.id}`}
+ >
+ <span className="cu-gfs-existing-access__identity">
<span className="cu-gfs-existing-access__subject">{label}</span>
<span className="cu-gfs-existing-access__detail">
- {item.kind === 'grant' ? 'Grant' : 'Share'} · {item.permissions.join(', ')} ·{' '}
- {coversDescendants ? 'resource and descendants' : 'resource only'}
+ {item.kind === 'grant' ? 'Direct grant' : 'Direct share'} ·{' '}
+ {item.subject.type}
+ </span>
+ </span>
+ <span className="cu-gfs-existing-access__meta">
+ <span className="cu-gfs-existing-access__chips" aria-label="Permissions">
+ {item.permissions.map(permission => (
+ <span className="cu-gfs-existing-access__permission" key={permission}>
+ {GFS_PERMISSION_LABELS[permission] ?? permission}
+ </span>
+ ))}
</span>
- </div>
+ {coversDescendants ? (
+ <span className="cu-gfs-existing-access__inherit">
+ <IconFolder />
+ Includes contents
+ </span>
+ ) : null}
+ </span>
<Button
aria-label={`Remove ${item.kind} access for ${label}`}
+ data-testid={`gfs-revoke-${item.kind}-${item.id}`}
title={`Remove ${item.kind} access for ${label}`}
- variant="danger"
size="sm"
disabled={actionPending}
onClick={() => void revokeAccess(item)}
>
- <IconTrash width={15} height={15} />
- Remove
+ Revoke
</Button>
</li>
)
@@ -430,29 +471,6 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
</ul>
)}
</section>
- {canIncludeDescendants ? (
- <CheckboxField
- className="cu-gfs-grant__scope"
- label="Include descendants"
- description="Apply this grant or share to the full folder tree."
- checked={includeDescendants}
- onChange={() => setIncludeDescendants(current => !current)}
- disabled={actionPending}
- />
- ) : null}
- <div className="cu-gfs-grant__actions">
- <Button variant="primary" disabled={!canSubmit} onClick={() => submit('grant')}>
- Grant access
- </Button>
- <Button disabled={!canSubmit || !canCreateShare} onClick={() => submit('share')}>
- Create share
- </Button>
- </div>
- {error ? (
- <p role="alert" className="cu-field__error">
- {error}
- </p>
- ) : null}
{confirmDialog}
</div>
)
diff --git a/control-ui/components/GfsPermissionDropdown/constants.ts b/control-ui/components/GfsPermissionDropdown/constants.ts
new file mode 100644
index 000000000..92d70340c
--- /dev/null
+++ b/control-ui/components/GfsPermissionDropdown/constants.ts
@@ -0,0 +1,7 @@
+export const GFS_PERMISSION_LABELS: Record<string, string> = {
+ read: 'Read',
+ write: 'Write',
+ delete: 'Delete',
+ manage_acl: 'Manage access',
+ share: 'Share',
+}
diff --git a/control-ui/components/GfsPermissionDropdown/index.tsx b/control-ui/components/GfsPermissionDropdown/index.tsx
index 8f03f7439..867fc4028 100644
--- a/control-ui/components/GfsPermissionDropdown/index.tsx
+++ b/control-ui/components/GfsPermissionDropdown/index.tsx
@@ -2,16 +2,9 @@
import { useEffect, useRef, useState } from 'react'
import { Button } from '@components/ui'
+import { GFS_PERMISSION_LABELS } from './constants'
import type { GfsPermissionDropdownProps } from './types'
-const PERMISSION_LABELS: Record<string, string> = {
- read: 'Read',
- write: 'Write',
- delete: 'Delete',
- manage_acl: 'Manage access',
- share: 'Share',
-}
-
export function GfsPermissionDropdown({
disabled = false,
onChange,
@@ -56,7 +49,7 @@ export function GfsPermissionDropdown({
value.length === 0
? 'Permissions'
: value.length === 1
- ? (PERMISSION_LABELS[value[0] ?? ''] ?? value[0])
+ ? (GFS_PERMISSION_LABELS[value[0] ?? ''] ?? value[0])
: `${value.length} permissions`
return (
@@ -88,7 +81,7 @@ export function GfsPermissionDropdown({
<span className="cu-gfs-permission-dropdown__check" aria-hidden="true">
{selected ? '✓' : null}
</span>
- <span>{PERMISSION_LABELS[permission] ?? permission}</span>
+ <span>{GFS_PERMISSION_LABELS[permission] ?? permission}</span>
</Button>
)
})}
diff --git a/control-ui/components/__tests__/GfsBrowser.test.tsx b/control-ui/components/__tests__/GfsBrowser.test.tsx
index 76ebd3041..44c2a5481 100644
--- a/control-ui/components/__tests__/GfsBrowser.test.tsx
+++ b/control-ui/components/__tests__/GfsBrowser.test.tsx
@@ -976,8 +976,9 @@ describe('GfsBrowser', () => {
await openManage('team-folder')
expect(screen.queryByText('Manage folder')).toBeNull()
await waitFor(() => expect(mockGetAdminUsers).toHaveBeenCalledWith(''))
- expect(await screen.findByRole('checkbox', { name: /Include descendants/ })).toBeChecked()
- expect(screen.getByText('Apply this grant or share to the full folder tree.')).toBeTruthy()
+ expect(
+ await screen.findByRole('checkbox', { name: /Include contents of this folder/ })
+ ).toBeChecked()
expect(screen.getByRole('button', { name: 'Create share' })).toBeDisabled()
await openSubjectPicker()
fireEvent.click(await screen.findByRole('option', { name: 'Ada Lovelace' }))
diff --git a/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx b/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
index 9d8f9716c..97b9f1db4 100644
--- a/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
+++ b/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
@@ -160,9 +160,11 @@ describe('GfsGrantPanel bulk access', () => {
.mockResolvedValueOnce({ items: [] })
renderPanel()
- const existing = await screen.findByRole('region', { name: 'Existing access' })
+ const existing = await screen.findByRole('region', { name: 'Who has access' })
expect(within(existing).getByText('Ada Lovelace')).toBeTruthy()
- expect(within(existing).getByText('Grant · read, write · resource only')).toBeTruthy()
+ expect(within(existing).getByText('Direct grant · user')).toBeTruthy()
+ expect(within(existing).getByText('Read')).toBeTruthy()
+ expect(within(existing).getByText('Write')).toBeTruthy()
fireEvent.click(
within(existing).getByRole('button', { name: 'Remove grant access for Ada Lovelace' })
@@ -174,7 +176,7 @@ describe('GfsGrantPanel bulk access', () => {
expect(mockDeleteGfsGrant).toHaveBeenCalledWith('33333333-3333-3333-3333-333333333333')
)
await waitFor(() =>
- expect(within(existing).getByText('No direct access configured.')).toBeTruthy()
+ expect(within(existing).getByText('No direct grants or shares yet.')).toBeTruthy()
)
expect(mockGetGfsGrants).toHaveBeenCalledTimes(2)
expect(mockGetGfsShares).toHaveBeenCalledTimes(2)
@@ -202,7 +204,7 @@ describe('GfsGrantPanel bulk access', () => {
})
)
renderPanel()
- const existing = await screen.findByRole('region', { name: 'Existing access' })
+ const existing = await screen.findByRole('region', { name: 'Who has access' })
fireEvent.click(
within(existing).getByRole('button', { name: 'Remove grant access for Ada Lovelace' })
)
@@ -211,7 +213,7 @@ describe('GfsGrantPanel bulk access', () => {
expect(await screen.findByText('Access was already removed.')).toBeTruthy()
await waitFor(() =>
- expect(within(existing).getByText('No direct access configured.')).toBeTruthy()
+ expect(within(existing).getByText('No direct grants or shares yet.')).toBeTruthy()
)
expect(screen.queryByRole('alert')).toBeNull()
expect(mockGetGfsGrants).toHaveBeenCalledTimes(2)
@@ -237,7 +239,7 @@ describe('GfsGrantPanel bulk access', () => {
})
)
renderPanel()
- const existing = await screen.findByRole('region', { name: 'Existing access' })
+ const existing = await screen.findByRole('region', { name: 'Who has access' })
fireEvent.click(
within(existing).getByRole('button', { name: 'Remove grant access for Ada Lovelace' })
)
@@ -275,15 +277,13 @@ describe('GfsGrantPanel bulk access', () => {
selectPermission('Read')
await submit('Grant access')
- const existing = await screen.findByRole('region', { name: 'Existing access' })
- expect(await within(existing).findByText('Grant · read · resource only')).toBeTruthy()
+ const existing = await screen.findByRole('region', { name: 'Who has access' })
+ expect(await within(existing).findByText('Direct grant · user')).toBeTruthy()
expect(initialSignal?.aborted).toBe(true)
resolveInitialGrants({ items: [] })
- await waitFor(() =>
- expect(within(existing).getByText('Grant · read · resource only')).toBeTruthy()
- )
- expect(within(existing).queryByText('No direct access configured.')).toBeNull()
+ await waitFor(() => expect(within(existing).getByText('Direct grant · user')).toBeTruthy())
+ expect(within(existing).queryByText('No direct grants or shares yet.')).toBeNull()
})
it('aborts the active access hydration when the panel unmounts', async () => {
diff --git a/control-ui/e2e/support/gfs-bulk-operator-journey.test.ts b/control-ui/e2e/support/gfs-bulk-operator-journey.test.ts
index 80f27dcc2..008a8acd7 100644
--- a/control-ui/e2e/support/gfs-bulk-operator-journey.test.ts
+++ b/control-ui/e2e/support/gfs-bulk-operator-journey.test.ts
@@ -86,7 +86,9 @@ export async function exerciseGfsBulkOperatorJourney(page: Page): Promise<void>
const panel = grantPanel()
await expect(panel).toBeVisible()
await expect(panel.getByLabel('Subject ID')).toHaveCount(0)
- await expect(panel.getByRole('checkbox', { name: 'Include descendants' })).toBeChecked()
+ await expect(
+ panel.getByRole('checkbox', { name: 'Include contents of this folder' })
+ ).toBeChecked()
await chooseGrantSubject(panel, E2E_TEST_EMAIL, E2E_TEST_NAME)
await chooseGrantSubject(panel, targetTeam.name, targetTeam.name)
@@ -194,7 +196,7 @@ export async function exerciseGfsBulkOperatorJourney(page: Page): Promise<void>
await page.getByRole('menuitem', { name: 'Manage access' }).click()
const reopenedPanel = grantPanel()
await expect(reopenedPanel).toBeVisible()
- const existingAccess = reopenedPanel.getByRole('region', { name: 'Existing access' })
+ const existingAccess = reopenedPanel.getByRole('region', { name: 'Who has access' })
await expect(existingAccess.getByText(E2E_TEST_NAME, { exact: true })).toBeVisible()
await expect(existingAccess.getByText(targetTeam.name, { exact: true })).toBeVisible()
await expect(existingAccess.getByText('chatllm (Stateful)', { exact: true })).toBeVisible()
@@ -202,9 +204,7 @@ export async function exerciseGfsBulkOperatorJourney(page: Page): Promise<void>
existingAccess.getByText('chatllm-stateless (Stateless)', { exact: true })
).toBeVisible()
await expect(existingAccess.getByText(workflowRecipe.name, { exact: true })).toBeVisible()
- await expect(
- existingAccess.getByText('Grant · read, write · resource and descendants')
- ).toHaveCount(5)
+ await expect(existingAccess.getByText('Direct grant · host')).toHaveCount(5)
const revokeResponsePromise = page.waitForResponse(
response =>
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index e1f64bb94..5037093b5 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index b9acd05fc..40c5592f7 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",