Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(control-ui): align grant agent selection with add modal
Josué6868b0836a3d
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.cssindex d505c0fda..5d9da454a 100644--- a/control-ui/app/globals.css+++ b/control-ui/app/globals.css@@ -7023,6 +7023,12 @@ td.cu-registry-description {line-height: 1.25;}+.cu-agent-grant-picker .cu-selection-dropdown__option-label {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.cu-selection-dropdown__badge {max-width: 8rem;overflow: hidden;diff --git a/control-ui/app/profile-admin/users/[userId]/page.tsx b/control-ui/app/profile-admin/users/[userId]/page.tsxindex 607095843..491fac34d 100644--- a/control-ui/app/profile-admin/users/[userId]/page.tsx+++ b/control-ui/app/profile-admin/users/[userId]/page.tsx@@ -5,7 +5,7 @@ import Link from 'next/link'import { useParams, useRouter } from 'next/navigation'import {DataTable,- MultiSelectActionDialog,+ DialogShell,SimpleEditDialog,TableViewport,} from '@clerum/frontend-components'@@ -137,6 +137,7 @@ export default function UserDetailsPage() {const [assignedAgentNames, setAssignedAgentNames] = useState<string[]>([])const [observedAgentNames, setObservedAgentNames] = useState<string[]>([])const [selectedAgentNamesToAdd, setSelectedAgentNamesToAdd] = useState<string[]>([])+ const [agentSearchQuery, setAgentSearchQuery] = useState('')const [communicationChannels, setCommunicationChannels] = useState<CommunicationChannelItem[]>([])const [userTeams, setUserTeams] = useState<Array<{ id: string; name: string; role: TeamRole }>>(@@ -188,10 +189,9 @@ export default function UserDetailsPage() {hostNameOptions.filter(agentName => !effectiveAgentNames.includes(agentName)).map(agentName => ({- id: agentName,+ value: agentName,label: getAgentDisplayName(agentName, hosts),- description: agentName,- searchText: `${getAgentDisplayName(agentName, hosts)} ${agentName}`,+ badge: agentName,})),[effectiveAgentNames, hostNameOptions, hosts])@@ -522,6 +522,22 @@ export default function UserDetailsPage() {}}+ function closeAddAgentDialog() {+ if (busy) return+ setShowAddAgent(false)+ setSelectedAgentNamesToAdd([])+ setAgentAccessDialogError('')+ setAgentSearchQuery('')+ }++ async function grantSelectedAgents() {+ const saved = await saveAgents(+ [...effectiveAgentNames, ...selectedAgentNamesToAdd],+ selectedAgentNamesToAdd.length === 1 ? 'Agent access updated.' : 'Agents access updated.'+ )+ if (saved) setShowAddAgent(false)+ }+async function revokeAgentAccess(agentName: string) {const shouldRevoke = await confirm({title: 'Revoke Agent Access',@@ -652,6 +668,7 @@ export default function UserDetailsPage() {onClick={() => {setAgentAccessDialogError('')setSelectedAgentNamesToAdd([])+ setAgentSearchQuery('')setShowAddAgent(true)}}disabled={busy}@@ -1279,33 +1296,56 @@ export default function UserDetailsPage() {</div>)}- <MultiSelectActionDialog- actionLabel={selectedAgentNamesToAdd.length > 1 ? 'Grant agents' : 'Grant agent'}- emptyMessage="No available agents."+ <DialogShell+ busy={busy}error={agentAccessDialogError || undefined}- items={availableAgentOptions}- noMatchesMessage="No matching agents."- onAction={async selectedIds => {- const saved = await saveAgents(- [...effectiveAgentNames, ...selectedIds],- selectedIds.length === 1 ? 'Agent access updated.' : 'Agents access updated.'- )- if (saved) setShowAddAgent(false)- }}- onDismiss={() => {- if (busy) return- setShowAddAgent(false)- setSelectedAgentNamesToAdd([])- setAgentAccessDialogError('')- }}- onSelectedIdsChange={setSelectedAgentNamesToAdd}+ footer={+ <>+ <button+ className="eft-dialog__button eft-dialog__button--secondary"+ disabled={busy}+ onClick={closeAddAgentDialog}+ type="button"+ >+ Cancel+ </button>+ <button+ className="eft-dialog__button eft-dialog__button--primary"+ disabled={busy || selectedAgentNamesToAdd.length === 0}+ onClick={() => void grantSelectedAgents()}+ type="button"+ >+ {busy+ ? 'Granting…'+ : selectedAgentNamesToAdd.length > 1+ ? 'Grant agents'+ : 'Grant agent'}+ </button>+ </>+ }+ onDismiss={closeAddAgentDialog}open={showAddAgent}- pending={busy}- searchLabel="Search agents"- searchPlaceholder="Search agents..."- selectedIds={selectedAgentNamesToAdd}+ size="large"title="Grant agent access"- />+ >+ <div className="cu-field">+ <label htmlFor="member-agent-picker">Agents</label>+ <SelectionDropdown+ className="cu-agent-grant-picker"+ disabled={busy}+ emptyLabel={agentSearchQuery.trim() ? 'No matching agents.' : 'No available agents.'}+ id="member-agent-picker"+ inline+ onChange={setSelectedAgentNamesToAdd}+ onSearchQueryChange={setAgentSearchQuery}+ options={availableAgentOptions}+ placeholder="Select agents"+ searchPlaceholder="Search agents..."+ selectionLabel="Selected agents"+ value={selectedAgentNamesToAdd}+ />+ </div>+ </DialogShell>{showDeleteUserConfirm && (<divdiff --git a/control-ui/components/SelectionDropdown/index.tsx b/control-ui/components/SelectionDropdown/index.tsxindex afb6851b4..6756f2731 100644--- a/control-ui/components/SelectionDropdown/index.tsx+++ b/control-ui/components/SelectionDropdown/index.tsx@@ -199,7 +199,7 @@ export function SelectionDropdown({type="button"className="cu-selection-dropdown__option"role="option"- aria-label={option.label}+ aria-label={option.badge ? `${option.label}, ${option.badge}` : option.label}aria-selected={selected}data-selected={selected ? 'true' : undefined}onClick={() => toggleOption(option.value)}diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 29a2464ae..e87c17892 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.630",+ "version": "0.1.631","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.630",+ "version": "0.1.631","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 7e520d0b5..65a080755 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.630",+ "version": "0.1.631","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",