Skip to content

Commit 95653f2

Browse files
fix(ui): keep agent import action visible (#11488)
* fix(ui): keep agent import action visible The header hid its full import label after the agent list became non-empty. Hide only the nested file input so users can import more agents. Assisted-by: Codex:gpt-5 * test(ui): match the agent import label The Agents page renders the action as Import. The test searched for Import Agent, so it failed before checking visibility. Mock the observables request to remove backend timing from the fixture. Assisted-by: Codex:gpt-5 --------- Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com>
1 parent 58a37fa commit 95653f2

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

core/http/react-ui/e2e/agents.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ test.describe('Agents page', () => {
1313
await expect(page.getByRole('button', { name: 'Create Agent' }).first()).toBeVisible()
1414
})
1515

16+
test('keeps Import Agent visible when agents exist', async ({ page }) => {
17+
await page.route('**/api/agents', route => route.fulfill({
18+
json: { agents: ['existing-agent'], statuses: { 'existing-agent': true } },
19+
}))
20+
await page.route('**/api/agents/existing-agent/observables', route => route.fulfill({
21+
json: { History: [] },
22+
}))
23+
await page.reload()
24+
25+
await expect(page.locator('.header-actions label', { hasText: 'Import' })).toBeVisible()
26+
})
27+
1628
test('Create Agent navigates to the agent creation form', async ({ page }) => {
1729
const create = page.getByRole('button', { name: 'Create Agent' }).last()
1830
await create.scrollIntoViewIfNeeded()

core/http/react-ui/src/pages/Agents.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ export default function Agents() {
194194
)}
195195
{/* A label styled as a button, wrapping the file input it triggers,
196196
so the control looks and behaves like its neighbours. */}
197-
<label className="btn btn-secondary agents-import-input">
197+
<label className="btn btn-secondary">
198198
<i className="fas fa-file-import" /> {t('actions.import')}
199-
<input type="file" accept=".json" onChange={handleImport} />
199+
<input type="file" accept=".json" className="agents-import-input" onChange={handleImport} />
200200
</label>
201201
<button className="btn btn-primary" onClick={() => navigate('/app/agents/new')}>
202202
<i className="fas fa-plus" /> {t('actions.createAgent')}

0 commit comments

Comments
 (0)