mirror of
https://github.com/mudler/LocalAI.git
synced 2026-09-22 06:04:55 -04:00
* feat(ui): add installed model lifecycle Models now owns catalog exploration and installed runtime controls under one canonical route. URL-owned state keeps lifecycle context recoverable through links and browser history. Assisted-by: Codex:gpt-5 Playwright * feat(ui): add installed backend lifecycle Backends split discovery from backend-binary management. The canonical page now keeps both lifecycle views under one URL-backed shell while it preserves target-node placement. Assisted-by: Codex:gpt-5 Playwright * fix(ui): repair lifecycle state updates Installed models lost distributed refreshes and kept a deleted selection. Backend searches also stopped tracking URL changes, while batch upgrades stopped after their first error. Preserve background refreshes and finish each requested batch action. Drive catalog results from URL-backed state without losing full metadata. Assisted-by: Codex:gpt-5 [Playwright] * feat(ui): make resource pages canonical Replace Host navigation with canonical Models and Backends lifecycle routes, preserve legacy management URLs, and surface shared host capacity on the Operate overview. Assisted-by: Codex:gpt-5 [Playwright] * feat(ui): complete canonical resource lifecycle Finish the responsive list-to-detail behavior, remove the retired Host implementation, and keep Explore focused on discovery while Installed owns destructive actions. Update regression coverage, localization, documentation, and development binding for the canonical resource pages. Assisted-by: Codex:gpt-5 [Playwright] * docs(ui): record the UI design context Record the approved users, brand character, and design principles so future interface work uses the same product direction. Index the context from the repository's agent instructions. Assisted-by: Codex:gpt-5 --------- Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
53 lines
2.2 KiB
JavaScript
53 lines
2.2 KiB
JavaScript
import { test, expect } from './coverage-fixtures.js'
|
|
|
|
// Searching triggers a refetch. The search box lives in the rail column, so if
|
|
// a refetch unmounts the view it takes the field you are typing into with it,
|
|
// dropping focus and the caret. That is what this guards.
|
|
const MOCK = {
|
|
models: [
|
|
{ name: 'alpha-model', description: 'a', backend: 'llama-cpp', installed: false, tags: ['llm'] },
|
|
{ name: 'beta-model', description: 'b', backend: 'llama-cpp', installed: false, tags: ['llm'] },
|
|
],
|
|
allBackends: ['llama-cpp'], allTags: ['llm'],
|
|
availableModels: 2, installedModels: 0, totalPages: 1, currentPage: 1,
|
|
}
|
|
|
|
test.describe('Models Explore - searching keeps the view', () => {
|
|
test('a refetch keeps the search box, its focus and its value', async ({ page }) => {
|
|
let calls = 0
|
|
await page.route('**/api/models*', async (route) => {
|
|
calls += 1
|
|
// Slow the refetch so the loading window is real and observable.
|
|
if (calls > 1) await new Promise((r) => setTimeout(r, 600))
|
|
await route.fulfill({ contentType: 'application/json', body: JSON.stringify(MOCK) })
|
|
})
|
|
|
|
await page.goto('/app/models')
|
|
const search = page.locator('.filter-bar-group__search input')
|
|
await expect(search).toBeVisible({ timeout: 10_000 })
|
|
|
|
await search.click()
|
|
await search.fill('alpha')
|
|
|
|
// Mid-refetch: the field is still mounted, still focused, still holding
|
|
// what was typed, and the rail is marked busy rather than replaced.
|
|
await expect(search).toBeFocused()
|
|
await expect(search).toHaveValue('alpha')
|
|
await expect(page.locator('.entity-rail')).toBeVisible()
|
|
|
|
await page.waitForTimeout(900)
|
|
await expect(search).toBeFocused()
|
|
await expect(search).toHaveValue('alpha')
|
|
})
|
|
|
|
test('the first load still shows a skeleton, not an empty shell', async ({ page }) => {
|
|
// Nothing to keep on a cold start, so the skeleton is still right there.
|
|
await page.route('**/api/models*', async (route) => {
|
|
await new Promise((r) => setTimeout(r, 800))
|
|
await route.fulfill({ contentType: 'application/json', body: JSON.stringify(MOCK) })
|
|
})
|
|
await page.goto('/app/models')
|
|
await expect(page.getByTestId('gallery-loader')).toBeVisible({ timeout: 5_000 })
|
|
})
|
|
})
|