From 95653f221e3a1f8790149402baffc60f45dd91fb Mon Sep 17 00:00:00 2001 From: localai-org-maint-bot Date: Fri, 14 Aug 2026 15:06:51 +0200 Subject: [PATCH] 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> --- core/http/react-ui/e2e/agents.spec.js | 12 ++++++++++++ core/http/react-ui/src/pages/Agents.jsx | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/http/react-ui/e2e/agents.spec.js b/core/http/react-ui/e2e/agents.spec.js index ebfebd153..1935413bf 100644 --- a/core/http/react-ui/e2e/agents.spec.js +++ b/core/http/react-ui/e2e/agents.spec.js @@ -13,6 +13,18 @@ test.describe('Agents page', () => { await expect(page.getByRole('button', { name: 'Create Agent' }).first()).toBeVisible() }) + test('keeps Import Agent visible when agents exist', async ({ page }) => { + await page.route('**/api/agents', route => route.fulfill({ + json: { agents: ['existing-agent'], statuses: { 'existing-agent': true } }, + })) + await page.route('**/api/agents/existing-agent/observables', route => route.fulfill({ + json: { History: [] }, + })) + await page.reload() + + await expect(page.locator('.header-actions label', { hasText: 'Import' })).toBeVisible() + }) + test('Create Agent navigates to the agent creation form', async ({ page }) => { const create = page.getByRole('button', { name: 'Create Agent' }).last() await create.scrollIntoViewIfNeeded() diff --git a/core/http/react-ui/src/pages/Agents.jsx b/core/http/react-ui/src/pages/Agents.jsx index 7e8e2c776..c45539dea 100644 --- a/core/http/react-ui/src/pages/Agents.jsx +++ b/core/http/react-ui/src/pages/Agents.jsx @@ -194,9 +194,9 @@ export default function Agents() { )} {/* A label styled as a button, wrapping the file input it triggers, so the control looks and behaves like its neighbours. */} -