Skip to content

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

TypeScript

fix(gfs): polish access role controls

Mbde1bfc37347
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 41052f425..e96aa525d 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -13476,13 +13476,26 @@ button.cu-gfs-tree__button:focus-visible,
grid-template-columns: minmax(0, 1fr);
}
-.cu-gfs-role-select.cu-input {
+.cu-gfs-role-select {
min-width: 8.5rem;
+}
+
+.cu-gfs-role-select .cu-selection-dropdown__button {
min-height: 2.875rem;
background-color: var(--cu-bg-elevated);
font-weight: 500;
}
+.cu-gfs-role-select .cu-selection-dropdown__option,
+.cu-gfs-existing-access__role .cu-selection-dropdown__option {
+ grid-template-columns: minmax(0, 1fr);
+}
+
+.cu-gfs-role-select .cu-selection-dropdown__option-leading,
+.cu-gfs-existing-access__role .cu-selection-dropdown__option-leading {
+ display: none;
+}
+
.cu-gfs-subject-picker,
.cu-gfs-permission-dropdown {
position: relative;
@@ -13838,16 +13851,21 @@ button.cu-gfs-tree__button:focus-visible,
gap: var(--cu-space-1);
}
-.cu-gfs-existing-access__role.cu-input {
+.cu-gfs-existing-access__role {
width: 7rem;
+ flex: 0 0 7rem;
+}
+
+.cu-gfs-existing-access__role .cu-selection-dropdown__button {
min-height: 2rem;
border-color: transparent;
background-color: transparent;
+ color: var(--cu-text);
font-weight: 500;
}
-.cu-gfs-existing-access__role.cu-input:hover,
-.cu-gfs-existing-access__role.cu-input:focus {
+.cu-gfs-existing-access__role .cu-selection-dropdown__button:hover,
+.cu-gfs-existing-access__role .cu-selection-dropdown__button[aria-expanded='true'] {
border-color: var(--cu-border);
background-color: var(--cu-bg-elevated);
}
@@ -13866,8 +13884,7 @@ button.cu-gfs-tree__button:focus-visible,
gap: var(--cu-space-1);
}
-.cu-gfs-existing-access__permission,
-.cu-gfs-existing-access__inherit {
+.cu-gfs-existing-access__permission {
display: inline-flex;
align-items: center;
min-height: 1.25rem;
@@ -13884,19 +13901,6 @@ button.cu-gfs-tree__button:focus-visible,
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;
@@ -13909,7 +13913,7 @@ button.cu-gfs-tree__button:focus-visible,
border: 0;
border-radius: 999px;
background: transparent;
- color: var(--cu-danger);
+ color: var(--cu-text);
font-size: 0.9rem;
font-weight: 700;
line-height: 1;
@@ -13918,7 +13922,7 @@ button.cu-gfs-tree__button:focus-visible,
.cu-gfs-existing-access__revoke.cu-btn:hover:not(:disabled) {
border-color: transparent;
background: transparent;
- color: var(--cu-danger-hover);
+ color: var(--cu-text);
}
.cu-gfs-existing-access__revoke.cu-btn:focus-visible {
diff --git a/control-ui/components/GfsGrantPanel.tsx b/control-ui/components/GfsGrantPanel.tsx
index 326dd1887..41f67d146 100644
--- a/control-ui/components/GfsGrantPanel.tsx
+++ b/control-ui/components/GfsGrantPanel.tsx
@@ -3,10 +3,10 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useConfirmDialog } from '@components/ConfirmDialog'
import { GfsSubjectPicker } from '@components/GfsSubjectPicker'
+import { SelectionDropdown } from '@components/SelectionDropdown'
import type { SelectionDropdownOption } from '@components/SelectionDropdown/types'
-import { IconFolder } from '@components/Sidebar/icons'
import { useToast } from '@components/Toast'
-import { Button, CheckboxField, SelectInput } from '@components/ui'
+import { Button, CheckboxField } from '@components/ui'
import { GFS_MAX_BULK_SUBJECTS } from '@constants/gfsGrantSubjects'
import {
type AdminUser,
@@ -63,6 +63,11 @@ const OPERATOR_OPTION: SelectionDropdownOption = {
badge: 'Operator',
}
+const ROLE_OPTIONS: SelectionDropdownOption[] = [
+ { value: 'read', label: 'Read' },
+ { value: 'editor', label: 'Editor' },
+]
+
export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Element {
const { showToast } = useToast()
const { confirm, confirmDialog } = useConfirmDialog()
@@ -355,16 +360,18 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
value={selectedValues}
/>
{subjectValid ? (
- <SelectInput
- aria-label="Access role for selected recipients"
+ <SelectionDropdown
+ ariaLabel="Access role for selected recipients"
className="cu-gfs-role-select"
disabled={actionPending}
- onChange={event => setRole(event.currentTarget.value as AccessRole)}
- value={role}
- >
- <option value="read">Read</option>
- <option value="editor">Editor</option>
- </SelectInput>
+ multiple={false}
+ onChange={next => setRole((next[0] ?? 'read') as AccessRole)}
+ options={ROLE_OPTIONS}
+ placeholder="Role"
+ searchable={false}
+ showSelectedChips={false}
+ value={[role]}
+ />
) : null}
</div>
{selectionError ? (
@@ -438,8 +445,6 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
<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"
@@ -455,30 +460,25 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
</span>
<span className="cu-gfs-existing-access__meta">
{item.kind === 'grant' ? (
- <SelectInput
- aria-label={`Access role for ${label}`}
+ <SelectionDropdown
+ ariaLabel={`Access role for ${label}`}
className="cu-gfs-existing-access__role"
- compact
disabled={actionPending}
- onChange={event =>
- void updateAccessRole(item, event.currentTarget.value as AccessRole)
+ multiple={false}
+ onChange={next =>
+ void updateAccessRole(item, (next[0] ?? 'read') as AccessRole)
}
- value={roleForPermissions(item.permissions)}
- >
- <option value="read">Read</option>
- <option value="editor">Editor</option>
- </SelectInput>
+ options={ROLE_OPTIONS}
+ placeholder="Role"
+ searchable={false}
+ showSelectedChips={false}
+ value={[roleForPermissions(item.permissions)]}
+ />
) : (
<span className="cu-gfs-existing-access__role-label">
{roleForPermissions(item.permissions) === 'editor' ? 'Editor' : 'Read'}
</span>
)}
- {coversDescendants ? (
- <span className="cu-gfs-existing-access__inherit">
- <IconFolder />
- Includes contents
- </span>
- ) : null}
</span>
<Button
aria-label={`Remove ${item.kind} access for ${label}`}
diff --git a/control-ui/components/SelectionDropdown/index.tsx b/control-ui/components/SelectionDropdown/index.tsx
index a610fcb3b..b8200e8d0 100644
--- a/control-ui/components/SelectionDropdown/index.tsx
+++ b/control-ui/components/SelectionDropdown/index.tsx
@@ -14,6 +14,7 @@ function optionMatches(option: SelectionDropdownOption, query: string): boolean
}
export function SelectionDropdown({
+ ariaLabel,
className,
disabled = false,
emptyLabel = 'No options available.',
@@ -25,6 +26,7 @@ export function SelectionDropdown({
onSearchQueryChange,
options,
placeholder,
+ searchable = true,
searchPlaceholder = 'Search...',
selectionLabel = 'Selected',
showSelectedChips = true,
@@ -70,13 +72,13 @@ export function SelectionDropdown({
}, [inline, open])
useEffect(() => {
- if (menuVisible) {
+ if (menuVisible && searchable) {
window.setTimeout(() => searchRef.current?.focus(), 0)
} else {
setQuery('')
onSearchQueryChange?.('')
}
- }, [menuVisible, onSearchQueryChange])
+ }, [menuVisible, onSearchQueryChange, searchable])
function toggleOption(optionValue: string) {
if (multiple) {
@@ -115,6 +117,7 @@ export function SelectionDropdown({
'cu-selection-dropdown__button',
selectedOptions.length === 0 && 'cu-selection-dropdown__button--placeholder'
)}
+ aria-label={ariaLabel}
aria-expanded={open}
aria-haspopup="listbox"
aria-invalid={invalid || undefined}
@@ -151,20 +154,22 @@ export function SelectionDropdown({
{menuVisible ? (
<div className="cu-selection-dropdown__menu">
- <input
- id={inline ? id : undefined}
- ref={searchRef}
- className="cu-selection-dropdown__search"
- value={query}
- onChange={event => {
- const nextQuery = event.target.value
- setQuery(nextQuery)
- onSearchQueryChange?.(nextQuery)
- }}
- placeholder={searchPlaceholder}
- aria-label={searchPlaceholder}
- disabled={disabled}
- />
+ {searchable ? (
+ <input
+ id={inline ? id : undefined}
+ ref={searchRef}
+ className="cu-selection-dropdown__search"
+ value={query}
+ onChange={event => {
+ const nextQuery = event.target.value
+ setQuery(nextQuery)
+ onSearchQueryChange?.(nextQuery)
+ }}
+ placeholder={searchPlaceholder}
+ aria-label={searchPlaceholder}
+ disabled={disabled}
+ />
+ ) : null}
<div
className="cu-selection-dropdown__list"
role="listbox"
diff --git a/control-ui/components/SelectionDropdown/types.ts b/control-ui/components/SelectionDropdown/types.ts
index 19d7b9749..888846d02 100644
--- a/control-ui/components/SelectionDropdown/types.ts
+++ b/control-ui/components/SelectionDropdown/types.ts
@@ -9,6 +9,7 @@ export type SelectionDropdownOption = {
}
export type SelectionDropdownProps = {
+ ariaLabel?: string
className?: string
id?: string
options: SelectionDropdownOption[]
@@ -22,6 +23,7 @@ export type SelectionDropdownProps = {
selectionLabel?: string
multiple?: boolean
inline?: boolean
+ searchable?: boolean
invalid?: boolean
showSelectedChips?: boolean
}
diff --git a/control-ui/components/__tests__/GfsBrowser.test.tsx b/control-ui/components/__tests__/GfsBrowser.test.tsx
index afcd52cc1..16dde8fce 100644
--- a/control-ui/components/__tests__/GfsBrowser.test.tsx
+++ b/control-ui/components/__tests__/GfsBrowser.test.tsx
@@ -94,9 +94,8 @@ async function openSubjectPicker() {
}
function selectPermission(label: string) {
- fireEvent.change(screen.getByRole('combobox', { name: 'Access role for selected recipients' }), {
- target: { value: label === 'Read' ? 'read' : 'editor' },
- })
+ fireEvent.click(screen.getByRole('button', { name: 'Access role for selected recipients' }))
+ fireEvent.click(screen.getByRole('option', { name: label === 'Read' ? 'Read' : 'Editor' }))
}
async function openResourceMenu(resourceName: string) {
diff --git a/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx b/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
index 9af4170bd..674ffecce 100644
--- a/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
+++ b/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
@@ -82,9 +82,8 @@ async function chooseSubjects(...names: string[]) {
}
function selectPermission(name: string) {
- fireEvent.change(screen.getByRole('combobox', { name: 'Access role for selected recipients' }), {
- target: { value: name === 'Read' ? 'read' : 'editor' },
- })
+ fireEvent.click(screen.getByRole('button', { name: 'Access role for selected recipients' }))
+ fireEvent.click(screen.getByRole('option', { name: name === 'Read' ? 'Read' : 'Editor' }))
}
async function submit(action: 'Share') {
@@ -148,8 +147,8 @@ describe('GfsGrantPanel bulk access', () => {
expect(within(existing).getByText('Ada Lovelace')).toBeTruthy()
expect(within(existing).getByText('Direct grant · user')).toBeTruthy()
expect(
- within(existing).getByRole('combobox', { name: 'Access role for Ada Lovelace' })
- ).toHaveValue('editor')
+ within(existing).getByRole('button', { name: 'Access role for Ada Lovelace' })
+ ).toHaveTextContent('Editor')
expect(within(existing).getByText('X')).toBeTruthy()
expect(
within(existing).getByRole('button', { name: 'Remove grant access for Ada Lovelace' })
@@ -187,9 +186,10 @@ describe('GfsGrantPanel bulk access', () => {
mockPutGfsGrant.mockResolvedValue(successfulMutation(userSubject))
renderPanel()
- const role = await screen.findByRole('combobox', { name: 'Access role for Ada Lovelace' })
- expect((role as HTMLSelectElement).value).toBe('editor')
- fireEvent.change(role, { target: { value: 'read' } })
+ const role = await screen.findByRole('button', { name: 'Access role for Ada Lovelace' })
+ expect(role).toHaveTextContent('Editor')
+ fireEvent.click(role)
+ fireEvent.click(screen.getByRole('option', { name: 'Read' }))
await waitFor(() =>
expect(mockPutGfsGrant).toHaveBeenCalledWith({
@@ -202,12 +202,8 @@ describe('GfsGrantPanel bulk access', () => {
)
await waitFor(() =>
expect(
- (
- screen.getByRole('combobox', {
- name: 'Access role for Ada Lovelace',
- }) as HTMLSelectElement
- ).value
- ).toBe('read')
+ screen.getByRole('button', { name: 'Access role for Ada Lovelace' })
+ ).toHaveTextContent('Read')
)
})
@@ -359,8 +355,8 @@ describe('GfsGrantPanel bulk access', () => {
expect(screen.getByText(/use read\/write access only/i)).toBeTruthy()
expect(
- screen.getByRole('combobox', { name: 'Access role for selected recipients' })
- ).toHaveValue('editor')
+ screen.getByRole('button', { name: 'Access role for selected recipients' })
+ ).toHaveTextContent('Editor')
await submit('Share')
await waitFor(() =>
@@ -390,8 +386,8 @@ describe('GfsGrantPanel bulk access', () => {
expect(screen.getByRole('button', { name: 'Share' })).toBeEnabled()
expect(screen.getByRole('checkbox', { name: /Include contents/ })).toBeChecked()
expect(
- screen.getByRole('combobox', { name: 'Access role for selected recipients' })
- ).toHaveValue('read')
+ screen.getByRole('button', { name: 'Access role for selected recipients' })
+ ).toHaveTextContent('Read')
})
it('keeps operator singular and prevents mixing it with bulk subjects', async () => {
@@ -436,15 +432,13 @@ describe('GfsGrantPanel bulk access', () => {
expect(screen.getByRole('button', { name: 'Remove Ada Lovelace' })).toBeTruthy()
expect(screen.getByRole('button', { name: 'Remove Research' })).toBeTruthy()
expect(
- screen.getByRole('combobox', { name: 'Access role for selected recipients' })
- ).toHaveValue('editor')
+ screen.getByRole('button', { name: 'Access role for selected recipients' })
+ ).toHaveTextContent('Editor')
await submit('Share')
await waitFor(() => expect(mockPutGfsGrant).toHaveBeenCalledTimes(2))
expect(screen.queryByRole('button', { name: 'Remove Ada Lovelace' })).toBeNull()
- expect(
- screen.queryByRole('combobox', { name: 'Access role for selected recipients' })
- ).toBeNull()
+ expect(screen.queryByRole('button', { name: 'Access role for selected recipients' })).toBeNull()
})
it('does not duplicate the machine code when the server message matches it', async () => {
@@ -474,8 +468,8 @@ describe('GfsGrantPanel bulk access', () => {
fireEvent.click(screen.getByRole('button', { name: 'Remove chatllm (Stateful)' }))
expect(
- screen.getByRole('combobox', { name: 'Access role for selected recipients' })
- ).toHaveValue('editor')
+ screen.getByRole('button', { name: 'Access role for selected recipients' })
+ ).toHaveTextContent('Editor')
selectPermission('Read')
})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 5884b4829..0da8b9466 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.505",
+ "version": "0.1.506",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.505",
+ "version": "0.1.506",
"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 2fcc63dcb..b8ff3b066 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.505",
+ "version": "0.1.506",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/desktop-app/ui/src/components/GfsResourceMenu/GfsResourceMenu.test.tsx b/desktop-app/ui/src/components/GfsResourceMenu/GfsResourceMenu.test.tsx
index 66daf832c..a77026fcc 100644
--- a/desktop-app/ui/src/components/GfsResourceMenu/GfsResourceMenu.test.tsx
+++ b/desktop-app/ui/src/components/GfsResourceMenu/GfsResourceMenu.test.tsx
@@ -16,6 +16,7 @@ describe('GfsResourceMenu', () => {
onDelete={vi.fn()}
onManage={onManage}
onPreview={vi.fn()}
+ onReplace={vi.fn()}
resourceName="report.txt"
/>
)
@@ -36,8 +37,8 @@ describe('GfsResourceMenu', () => {
const menu = screen.getByRole('menu', { name: 'Actions for report.txt' })
expect(menu.tagName).toBe('DIV')
expect(menu.classList.contains('da-gfs-resource-menu__panel')).toBe(true)
- expect(menu.querySelectorAll('[role="separator"]')).toHaveLength(1)
- expect(menu.querySelectorAll('.ui-menu-item__icon')).toHaveLength(3)
+ expect(menu.querySelectorAll('[role="separator"]')).toHaveLength(2)
+ expect(menu.querySelectorAll('.ui-menu-item__icon')).toHaveLength(4)
const shareItem = within(menu).getByRole('menuitem', { name: 'Share' })
expect(shareItem.getAttribute('aria-haspopup')).toBe('menu')
expect(shareItem.getAttribute('aria-expanded')).toBe('false')
@@ -46,6 +47,7 @@ describe('GfsResourceMenu', () => {
).toBe('M5 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0')
expect(within(menu).queryByRole('menuitem', { name: 'Copy link' })).toBeNull()
expect(within(menu).getByRole('menuitem', { name: 'Preview' })).toBeTruthy()
+ expect(within(menu).getByRole('menuitem', { name: 'Replace file' })).toBeTruthy()
fireEvent.click(shareItem)
const shareMenu = screen.getByRole('menu', { name: 'Share options for report.txt' })
diff --git a/desktop-app/ui/src/components/GfsResourceMenu/index.tsx b/desktop-app/ui/src/components/GfsResourceMenu/index.tsx
index 9f4f96c69..13490afbb 100644
--- a/desktop-app/ui/src/components/GfsResourceMenu/index.tsx
+++ b/desktop-app/ui/src/components/GfsResourceMenu/index.tsx
@@ -14,6 +14,7 @@ import {
IconPlus,
IconShare,
IconTrash,
+ IconUpload,
} from '@components/SidebarNav/icons'
import type { GfsResourceMenuProps } from './types'
@@ -53,6 +54,7 @@ export function GfsResourceMenu({
onDownload,
onRename,
onMove,
+ onReplace,
}: GfsResourceMenuProps) {
const [open, setOpen] = useState(false)
const [shareOpen, setShareOpen] = useState(false)
@@ -61,6 +63,7 @@ export function GfsResourceMenu({
const submenuRef = useRef<HTMLDivElement | null>(null)
const shareTriggerRef = useRef<HTMLButtonElement | null>(null)
const triggerRef = useRef<HTMLButtonElement | null>(null)
+ const replaceInputRef = useRef<HTMLInputElement | null>(null)
const [panelPosition, setPanelPosition] = useState<{ left: number; top: number } | null>(null)
const [submenuPosition, setSubmenuPosition] = useState<{ left: number; top: number } | null>(null)
const closeMenu = useCallback(() => {
@@ -267,7 +270,15 @@ export function GfsResourceMenu({
menuAction('rename', 'Rename', <IconEdit />, onRename),
menuAction('move', 'Move to…', <IconContexts />, onMove),
].filter(isMenuAction),
- [menuAction('download', 'Download', <IconDownload />, onDownload)].filter(isMenuAction),
+ [
+ menuAction('download', 'Download', <IconDownload />, onDownload),
+ menuAction(
+ 'replace',
+ 'Replace file',
+ <IconUpload />,
+ onReplace ? () => replaceInputRef.current?.click() : undefined
+ ),
+ ].filter(isMenuAction),
[menuAction('delete', 'Delete', <IconTrash />, onDelete, { color: 'danger' })].filter(
isMenuAction
),
@@ -381,6 +392,21 @@ export function GfsResourceMenu({
document.body
)
: null}
+ {onReplace ? (
+ <input
+ aria-label={`Replace ${resourceName}`}
+ className="visually-hidden"
+ ref={replaceInputRef}
+ type="file"
+ onChange={event => {
+ const file = event.currentTarget.files?.[0]
+ event.currentTarget.value = ''
+ if (!file) return
+ closeMenu()
+ onReplace(file)
+ }}
+ />
+ ) : null}
</span>
)
}
diff --git a/desktop-app/ui/src/components/GfsResourceMenu/types.ts b/desktop-app/ui/src/components/GfsResourceMenu/types.ts
index 5acded69f..332fcf9d9 100644
--- a/desktop-app/ui/src/components/GfsResourceMenu/types.ts
+++ b/desktop-app/ui/src/components/GfsResourceMenu/types.ts
@@ -14,6 +14,7 @@ export type GfsResourceMenuProps = {
onPreview?: () => void
onDownload?: () => void
onRename?: () => void
+ onReplace?: (file: File) => void
/** Open the move-to-folder flow. Move authority is parent-relative and
* enforced server-side, so callers do NOT gate this on local affordances. */
onMove?: () => void
diff --git a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
index 73cf403cb..90b372fa8 100644
--- a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
+++ b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
@@ -1,4 +1,4 @@
-import { Badge, IconButton, SelectInput, StatusBanner } from '@components/Common'
+import { DropdownSelect, IconButton, StatusBanner } from '@components/Common'
import type {
GfsAgentSubjectOption,
GfsDelegationSubjectOption,
@@ -42,6 +42,11 @@ function roleForPermissions(permissions: string[]): GfsAccessRole {
: 'read'
}
+const ROLE_OPTIONS = [
+ { value: 'read', label: 'Read' },
+ { value: 'editor', label: 'Editor' },
+]
+
export function GfsGrantList({
items,
shares = [],
@@ -101,27 +106,17 @@ export function GfsGrantList({
</span>
</span>
<span className="da-gfs-grant-list__meta">
- <SelectInput
- aria-label={`Access role for ${label}`}
+ <DropdownSelect
+ ariaLabel={`Access role for ${label}`}
className="da-gfs-grant-list__role"
- dense
disabled={updatingRole || !onChangeRole}
- onChange={event =>
- void onChangeRole?.(
- item,
- label,
- event.currentTarget.value as GfsAccessRole
- )
- }
+ onChange={value => void onChangeRole?.(item, label, value as GfsAccessRole)}
+ options={ROLE_OPTIONS}
+ placeholder="Role"
value={roleForPermissions(item.permissions)}
- >
- <option value="read">Read</option>
- <option value="editor">Editor</option>
- </SelectInput>
- {item.inherit ? <Badge tone="accent">Includes contents</Badge> : null}
+ />
</span>
<IconButton
- color="danger"
className="da-gfs-grant-list__revoke"
data-testid={`gfs-revoke-grant-${item.id}`}
disabled={revoking}
@@ -155,12 +150,8 @@ export function GfsGrantList({
<span className="da-gfs-grant-list__role-label">
{roleForPermissions(item.permissions) === 'editor' ? 'Editor' : 'Read'}
</span>
- {item.includeDescendants ? (
- <Badge tone="accent">Includes contents</Badge>
- ) : null}
</span>
<IconButton
- color="danger"
className="da-gfs-grant-list__revoke"
data-testid={`gfs-revoke-share-${item.id}`}
disabled={revokingShare || !onRevokeShare}
diff --git a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
index 2cefbff28..e39b4a123 100644
--- a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
+++ b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
@@ -44,7 +44,7 @@ function shareItem(overrides: Partial<GfsShareListItem>): GfsShareListItem {
}
describe('GfsGrantList', () => {
- it('renders resolved subject labels, grouped roles, and the inherit badge', () => {
+ it('renders resolved subject labels, grouped roles, and revoke controls', () => {
render(
<GfsGrantList
agents={agents}
@@ -64,13 +64,9 @@ describe('GfsGrantList', () => {
const agentRow = screen.getByText('Chat LLM').closest('li')!
expect(
- (
- within(agentRow).getByRole('combobox', {
- name: 'Access role for Chat LLM',
- }) as HTMLSelectElement
- ).value
- ).toBe('editor')
- expect(within(agentRow).getByText('Includes contents')).toBeTruthy()
+ within(agentRow).getByRole('button', { name: 'Access role for Chat LLM' }).textContent
+ ).toContain('Editor')
+ expect(within(agentRow).queryByText('Includes contents')).toBeNull()
expect(within(agentRow).getByText('X')).toBeTruthy()
expect(
within(agentRow).getByRole('button', { name: 'Revoke access for Chat LLM' }).className
@@ -78,12 +74,8 @@ describe('GfsGrantList', () => {
const userRow = screen.getByText('Test Two').closest('li')!
expect(
- (
- within(userRow).getByRole('combobox', {
- name: 'Access role for Test Two',
- }) as HTMLSelectElement
- ).value
- ).toBe('read')
+ within(userRow).getByRole('button', { name: 'Access role for Test Two' }).textContent
+ ).toContain('Read')
expect(within(userRow).queryByText('Includes contents')).toBeNull()
// Unresolvable subject ids stay visible as raw ids — never hidden.
@@ -135,9 +127,8 @@ describe('GfsGrantList', () => {
/>
)
- fireEvent.change(screen.getByRole('combobox', { name: 'Access role for Test Two' }), {
- target: { value: 'editor' },
- })
+ fireEvent.click(screen.getByRole('button', { name: 'Access role for Test Two' }))
+ fireEvent.click(screen.getByRole('option', { name: 'Editor' }))
expect(onChangeRole).toHaveBeenCalledWith(item, 'Test Two', 'editor')
})
@@ -158,7 +149,7 @@ describe('GfsGrantList', () => {
const shareRow = screen.getByTestId('gfs-access-row-share-share-1')
expect(within(shareRow).getByText('Share · team')).toBeTruthy()
- expect(within(shareRow).getByText('Includes contents')).toBeTruthy()
+ expect(within(shareRow).queryByText('Includes contents')).toBeNull()
fireEvent.click(
within(shareRow).getByRole('button', { name: 'Revoke shared access for Core Team' })
)
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsx
index 62739d0ef..f742dc89f 100644
--- a/desktop-app/ui/src/pages/FilesPage.tsx
+++ b/desktop-app/ui/src/pages/FilesPage.tsx
@@ -257,7 +257,6 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
const dragSessionRef = useRef(0)
const manageReturnCrumbsRef = useRef<GfsCrumb[] | null>(null)
const uploadInputRef = useRef<HTMLInputElement | null>(null)
- const replaceInputRef = useRef<HTMLInputElement | null>(null)
const uploadNameReservationsRef = useRef(new Map<string, Set<string>>())
const queryClient = useQueryClient()
const ctrl = useGfsBrowserController({ grantsListEnabled: manageOpen })
@@ -1627,21 +1626,16 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
}
: undefined
}
+ onReplace={
+ currentIsFile && canWriteCurrent
+ ? file => void handleReplaceCurrentFile(file)
+ : undefined
+ }
/>
</span>
)}
</span>
<span className="da-gfs-manage-dialog__top-actions">
- {currentIsFile && canWriteCurrent ? (
- <Button
- loading={ctrl.mutating}
- onClick={() => replaceInputRef.current?.click()}
- size="sm"
- variant="outline"
- >
- Replace file
- </Button>
- ) : null}
<IconButton
autoFocus
label="Close share dialog"
@@ -1654,20 +1648,6 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
</span>
</header>
- {currentIsFile && canWriteCurrent ? (
- <input
- aria-label="Replace file"
- className="visually-hidden"
- ref={replaceInputRef}
- type="file"
- onChange={event => {
- const file = event.currentTarget.files?.[0]
- event.currentTarget.value = ''
- void handleReplaceCurrentFile(file)
- }}
- />
- ) : null}
-
<div className="da-gfs-manage-dialog__body">
{currentIsFolder && canWriteCurrent && createFolderOpen ? (
<form
diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
index 5a04c0e9d..f30a7a31f 100644
--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
@@ -1220,8 +1220,11 @@ describe('FilesPage', () => {
renderFilesPage(pushToast)
await openManageDialog('report.txt')
+ const manageDialog = screen.getByRole('dialog', { name: 'Share file report.txt' })
+ expect(within(manageDialog).queryByRole('button', { name: 'Replace file' })).toBeNull()
+ await chooseManageAction('report.txt', 'Replace file')
await act(async () => {
- fireEvent.change(screen.getByLabelText('Replace file'), {
+ fireEvent.change(screen.getByLabelText('Replace report.txt'), {
target: {
files: [new File(['replacement'], 'report.txt', { type: 'text/plain' })],
},
@@ -1893,9 +1896,8 @@ describe('FilesPage', () => {
renderFilesPage(pushToast)
await openManageDialog('Team folder')
- fireEvent.change(await screen.findByRole('combobox', { name: 'Access role for chatllm' }), {
- target: { value: 'editor' },
- })
+ fireEvent.click(await screen.findByRole('button', { name: 'Access role for chatllm' }))
+ fireEvent.click(screen.getByRole('option', { name: 'Editor' }))
await waitFor(() =>
expect(grant).toHaveBeenCalledWith(['host:1st:mcp-host/chatllm'], ['read', 'write'], true)
@@ -1946,7 +1948,7 @@ describe('FilesPage', () => {
await openManageDialog('Team folder')
const shareRow = await screen.findByTestId('gfs-access-row-share-share-1')
- expect(shareRow.textContent).toContain('Includes contents')
+ expect(shareRow.textContent).not.toContain('Includes contents')
fireEvent.click(screen.getByRole('button', { name: 'Revoke shared access for user-9' }))
await waitFor(() => expect(revokeShare).toHaveBeenCalledWith('share-1'))
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index 57b3c9475..29f86970f 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -15870,16 +15870,22 @@ pre {
gap: var(--space-1);
}
-.da-gfs-grant-list__role.ui-control {
+.da-gfs-grant-list__role {
width: 112px;
+ flex: 0 0 112px;
+}
+
+.da-gfs-grant-list__role .ui-dropdown-select__trigger.ui-button {
min-height: 32px;
+ padding-inline: var(--space-2);
border-color: transparent;
background: transparent;
+ color: var(--text);
font-weight: var(--font-weight-medium);
}
-.da-gfs-grant-list__role.ui-control:hover,
-.da-gfs-grant-list__role.ui-control:focus {
+.da-gfs-grant-list__role .ui-dropdown-select__trigger.ui-button:hover:enabled,
+.da-gfs-grant-list__role .ui-dropdown-select__trigger.ui-button[aria-expanded='true'] {
border-color: var(--control-border);
background: var(--control-bg-strong);
}
@@ -15899,7 +15905,7 @@ pre {
}
.da-gfs-grant-list__revoke.ui-icon-button {
- color: var(--danger);
+ color: var(--text);
border-color: transparent;
background: transparent;
font-size: var(--font-size-sm);
@@ -15910,7 +15916,7 @@ pre {
.da-gfs-grant-list__revoke.ui-icon-button:focus-visible {
border-color: transparent;
background: transparent;
- color: var(--danger);
+ color: var(--text);
}
@media (max-width: 940px) {