Skip to content

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

TypeScript

fix(control-ui): render agent choices on one line

Josué469a58446fd5
diff --git a/control-ui/components/ConnectorAgentAccessDialog/index.tsx b/control-ui/components/ConnectorAgentAccessDialog/index.tsx
index 1208d457d..79f094bbc 100644
--- a/control-ui/components/ConnectorAgentAccessDialog/index.tsx
+++ b/control-ui/components/ConnectorAgentAccessDialog/index.tsx
@@ -29,6 +29,7 @@ export function ConnectorAgentAccessDialog({
id: target.name,
label: target.label,
description: target.name,
+ title: `${target.label} (${target.name})`,
searchText: `${target.label} ${target.name}`,
})),
[agentTargets, boundAgentNamesSet, connectorSpec]
@@ -41,6 +42,7 @@ export function ConnectorAgentAccessDialog({
error={error || undefined}
items={items}
noMatchesMessage="No matching agents."
+ optionLayout="inline"
onAction={async selectedIds => {
const selected = agentTargets.filter(target => selectedIds.includes(target.name))
const added = await onAdd(
diff --git a/control-ui/components/__tests__/ConnectorDetailAccessPage.test.tsx b/control-ui/components/__tests__/ConnectorDetailAccessPage.test.tsx
index f9451b5dc..191f8e074 100644
--- a/control-ui/components/__tests__/ConnectorDetailAccessPage.test.tsx
+++ b/control-ui/components/__tests__/ConnectorDetailAccessPage.test.tsx
@@ -158,7 +158,12 @@ describe('connector detail access tabs', () => {
fireEvent.click(screen.getByRole('button', { name: 'Add agent' }))
const dialog = screen.getByRole('dialog', { name: 'Give agents access to this connector' })
- expect(within(dialog).getByRole('checkbox', { name: /Beta Agent/ })).toBeInTheDocument()
+ const betaAgentOption = within(dialog).getByRole('checkbox', {
+ name: /Beta Agent.*agent-beta/,
+ })
+ expect(betaAgentOption).toBeInTheDocument()
+ expect(betaAgentOption.closest('label')).toHaveClass('eft-multi-select__option--inline')
+ expect(betaAgentOption.closest('label')).toHaveAttribute('title', 'Beta Agent (agent-beta)')
fireEvent.click(within(dialog).getByRole('checkbox', { name: /Beta Agent/ }))
fireEvent.click(within(dialog).getByRole('button', { name: 'Add to agent' }))
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index d372816d4..131a17269 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.727",
+ "version": "0.1.728",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.727",
+ "version": "0.1.728",
"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 030cfc1d7..6cda74840 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.727",
+ "version": "0.1.728",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/packages/frontend-components/src/edit/MultiSelectActionDialog.tsx b/packages/frontend-components/src/edit/MultiSelectActionDialog.tsx
index fe4551a5b..e17ec2418 100644
--- a/packages/frontend-components/src/edit/MultiSelectActionDialog.tsx
+++ b/packages/frontend-components/src/edit/MultiSelectActionDialog.tsx
@@ -24,6 +24,7 @@ export function MultiSelectActionDialog({
pending = false,
error,
size = 'large',
+ optionLayout = 'stacked',
}: MultiSelectActionDialogProps) {
const searchId = useId()
const [query, setQuery] = useState('')
@@ -102,7 +103,14 @@ export function MultiSelectActionDialog({
<ul className="eft-multi-select__list">
{visibleItems.map(item => (
<li className="eft-multi-select__item" key={item.id}>
- <label className="eft-multi-select__option">
+ <label
+ className={
+ optionLayout === 'inline'
+ ? 'eft-multi-select__option eft-multi-select__option--inline'
+ : 'eft-multi-select__option'
+ }
+ title={optionLayout === 'inline' ? item.title : undefined}
+ >
<input
checked={selected.has(item.id)}
disabled={pending || item.disabled}
diff --git a/packages/frontend-components/src/edit/types.ts b/packages/frontend-components/src/edit/types.ts
index ebd9fd881..d7d438f4a 100644
--- a/packages/frontend-components/src/edit/types.ts
+++ b/packages/frontend-components/src/edit/types.ts
@@ -113,6 +113,7 @@ export interface MultiSelectItem {
id: string
label: ReactNode
description?: ReactNode
+ title?: string
searchText?: string
disabled?: boolean
}
@@ -136,4 +137,5 @@ export interface MultiSelectActionDialogProps {
pending?: boolean
error?: ReactNode
size?: DialogSize
+ optionLayout?: 'stacked' | 'inline'
}
diff --git a/packages/frontend-components/styles.css b/packages/frontend-components/styles.css
index a65297e3a..419ad04e9 100644
--- a/packages/frontend-components/styles.css
+++ b/packages/frontend-components/styles.css
@@ -267,6 +267,42 @@
.eft-multi-select__option-description {
margin-top: var(--cu-space-1);
}
+.eft-multi-select__option--inline {
+ align-items: center;
+}
+.eft-multi-select__option--inline input {
+ margin-top: 0;
+}
+.eft-multi-select__option--inline > span {
+ align-items: center;
+ display: flex;
+ flex: 1 1 auto;
+ gap: var(--cu-space-2);
+ justify-content: space-between;
+}
+.eft-multi-select__option--inline .eft-multi-select__option-label,
+.eft-multi-select__option--inline .eft-multi-select__option-description {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.eft-multi-select__option--inline .eft-multi-select__option-label {
+ flex: 1 1 50%;
+}
+.eft-multi-select__option--inline .eft-multi-select__option-description {
+ flex: 0 1 50%;
+ margin-top: 0;
+ text-align: right;
+}
+.eft-multi-select__option--inline:focus-within > span {
+ align-items: flex-start;
+}
+.eft-multi-select__option--inline:focus-within .eft-multi-select__option-label,
+.eft-multi-select__option--inline:focus-within .eft-multi-select__option-description {
+ overflow: visible;
+ text-overflow: clip;
+ white-space: normal;
+}
@media (max-width: 40rem) {
.eft-dialog-backdrop {