Skip to content

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

TypeScript

fix(frontend): r1-l1 keep list controls outside record lists

Josué55be5c245e46
diff --git a/control-ui/app/profile-admin/teams/[teamId]/page.tsx b/control-ui/app/profile-admin/teams/[teamId]/page.tsx
index 4e4f3f679..f5a1ff2cc 100644
--- a/control-ui/app/profile-admin/teams/[teamId]/page.tsx
+++ b/control-ui/app/profile-admin/teams/[teamId]/page.tsx
@@ -954,7 +954,7 @@ export default function TeamDetailsPage() {
{initialLoading ? (
<div role="list">
{[1, 2, 3].map(i => (
- <div key={i} className="cu-skeleton--row">
+ <div key={i} className="cu-skeleton--row" role="listitem">
<div
className="cu-skeleton cu-skeleton--cell"
style={{ width: '10rem' }}
diff --git a/control-ui/components/__tests__/ProfileAdminAgentCompatibility.test.tsx b/control-ui/components/__tests__/ProfileAdminAgentCompatibility.test.tsx
index b3cb02081..7ade3fc4c 100644
--- a/control-ui/components/__tests__/ProfileAdminAgentCompatibility.test.tsx
+++ b/control-ui/components/__tests__/ProfileAdminAgentCompatibility.test.tsx
@@ -128,6 +128,15 @@ afterEach(() => {
})
describe('profile-admin agent compatibility access', () => {
+ it('renders team agent loading skeleton rows as listitems', () => {
+ vi.mocked(api.getAdminTeamAgents).mockReturnValue(new Promise(() => {}))
+
+ renderTeamDetails()
+
+ const list = screen.getByRole('list')
+ expect(within(list).getAllByRole('listitem')).toHaveLength(3)
+ })
+
it('removes only owned Context grants when a member loses final agent access', async () => {
vi.mocked(api.getAdminUserContexts)
.mockResolvedValueOnce({ userId: 'user-1', contextIds: ['ctx-alpha', 'ctx-unrelated'] })
diff --git a/profile-ui/app/components/__tests__/SettingsChannelSection.test.tsx b/profile-ui/app/components/__tests__/SettingsChannelSection.test.tsx
new file mode 100644
index 000000000..a9a30b300
--- /dev/null
+++ b/profile-ui/app/components/__tests__/SettingsChannelSection.test.tsx
@@ -0,0 +1,58 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import '@testing-library/jest-dom/vitest'
+import { cleanup, render, screen, within } from '@testing-library/react'
+import { SettingsChannelSection } from '../../settings/SettingsChannelSection'
+
+const section = {
+ key: 'emails' as const,
+ title: 'Email addresses',
+ description: 'Addresses used for profile notifications.',
+ placeholder: '[email protected]',
+ addLabel: 'Add email',
+}
+
+afterEach(cleanup)
+
+describe('SettingsChannelSection list semantics', () => {
+ it('keeps empty and add controls outside the RecordList', () => {
+ render(
+ <SettingsChannelSection
+ section={section}
+ rows={[]}
+ disabled={false}
+ onUpdate={vi.fn()}
+ onRemove={vi.fn()}
+ onAdd={vi.fn()}
+ />
+ )
+
+ expect(screen.getByText('No values added.')).toBeInTheDocument()
+ expect(screen.queryByRole('list')).not.toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Add email' })).toBeInTheDocument()
+ })
+
+ it('renders only row children inside the RecordList when values exist', () => {
+ render(
+ <SettingsChannelSection
+ section={section}
+ rows={[{ id: 'email-1', value: '[email protected]' }]}
+ readonlyValues={[
+ {
+ id: 'readonly-1',
+ value: '[email protected]',
+ caption: 'Managed by the organization.',
+ },
+ ]}
+ disabled={false}
+ onUpdate={vi.fn()}
+ onRemove={vi.fn()}
+ onAdd={vi.fn()}
+ />
+ )
+
+ const list = screen.getByRole('list')
+ expect(within(list).getAllByRole('listitem')).toHaveLength(2)
+ expect(within(list).queryByRole('button', { name: 'Add email' })).not.toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Add email' })).toBeInTheDocument()
+ })
+})
diff --git a/profile-ui/app/settings/SettingsChannelSection.tsx b/profile-ui/app/settings/SettingsChannelSection.tsx
index e360565e2..4b8445bf8 100644
--- a/profile-ui/app/settings/SettingsChannelSection.tsx
+++ b/profile-ui/app/settings/SettingsChannelSection.tsx
@@ -37,53 +37,56 @@ export function SettingsChannelSection({
<h3 className="settings-subtitle">{section.title}</h3>
<p className="settings-help">{section.description}</p>
</div>
- <RecordList className="settings-channel-rows">
- {!hasValues && <div className="small muted">No values added.</div>}
- {readonlyValues.map(row => (
- <RecordListRow className="settings-channel-readonly-row" key={row.id}>
- <div className="settings-channel-readonly-content">
- <div className="settings-channel-readonly-value">{row.value}</div>
- <div className="settings-channel-readonly-caption">{row.caption}</div>
- </div>
- {row.actionLabel && onReadonlyValueAction && (
- <Button
- variant="secondary"
- onClick={() => onReadonlyValueAction(section.key, row.value)}
+ {!hasValues ? (
+ <div className="small muted">No values added.</div>
+ ) : (
+ <RecordList className="settings-channel-rows">
+ {readonlyValues.map(row => (
+ <RecordListRow className="settings-channel-readonly-row" key={row.id}>
+ <div className="settings-channel-readonly-content">
+ <div className="settings-channel-readonly-value">{row.value}</div>
+ <div className="settings-channel-readonly-caption">{row.caption}</div>
+ </div>
+ {row.actionLabel && onReadonlyValueAction && (
+ <Button
+ variant="secondary"
+ onClick={() => onReadonlyValueAction(section.key, row.value)}
+ disabled={disabled}
+ >
+ {row.actionLabel}
+ </Button>
+ )}
+ </RecordListRow>
+ ))}
+ {rows.map(row => (
+ <RecordListRow className="settings-channel-row" key={row.id}>
+ <TextInput
+ className="fluid-control"
+ value={row.value}
+ onChange={event => onUpdate(section.key, row.id, event.target.value)}
+ placeholder={section.placeholder}
+ aria-label={section.title}
disabled={disabled}
- >
- {row.actionLabel}
- </Button>
- )}
- </RecordListRow>
- ))}
- {rows.map(row => (
- <RecordListRow className="settings-channel-row" key={row.id}>
- <TextInput
- className="fluid-control"
- value={row.value}
- onChange={event => onUpdate(section.key, row.id, event.target.value)}
- placeholder={section.placeholder}
- aria-label={section.title}
- disabled={disabled}
- />
- <RowActionMenu
- ariaLabel={`Actions for ${row.value || section.title}`}
- actions={[
- {
- key: 'remove',
- label: 'Remove',
- danger: true,
- disabled,
- onSelect: () => void onRemove(section.key, row.id),
- },
- ]}
- />
- </RecordListRow>
- ))}
- <Button variant="secondary" onClick={() => onAdd(section.key)} disabled={disabled}>
- {section.addLabel}
- </Button>
- </RecordList>
+ />
+ <RowActionMenu
+ ariaLabel={`Actions for ${row.value || section.title}`}
+ actions={[
+ {
+ key: 'remove',
+ label: 'Remove',
+ danger: true,
+ disabled,
+ onSelect: () => void onRemove(section.key, row.id),
+ },
+ ]}
+ />
+ </RecordListRow>
+ ))}
+ </RecordList>
+ )}
+ <Button variant="secondary" onClick={() => onAdd(section.key)} disabled={disabled}>
+ {section.addLabel}
+ </Button>
</div>
)
}