feat: 左侧导航改版与 Python 镜像管理
- 应用外壳换成 stash-ui Layout:左侧导航(任务调度 / Python 镜像)+ 页面标题区,窄屏折叠为顶部导航 - 新增 python_mirrors 表与 CRUD/设默认接口,内置清华、阿里云、中科大、PyPI 官方 - Python 脚本任务运行时注入默认镜像的 PIP_INDEX_URL / UV_INDEX_URL,任务自身环境变量优先 - 新增镜像管理页与表单,支持新增、编辑、启用/停用、设默认、删除 - 重新生成 OpenAPI 与 TS 类型;补齐后端镜像测试、前端单测与 e2e,修复窄屏页面被宽表格撑开
This commit is contained in:
@@ -246,7 +246,9 @@ test('renders without external network access', async ({ page }) => {
|
||||
})
|
||||
|
||||
await page.goto('/')
|
||||
await expect(page.getByRole('heading', { name: 'TaskPilot' })).toBeVisible()
|
||||
await expect(
|
||||
page.getByRole('heading', { name: '任务调度' }),
|
||||
).toBeVisible()
|
||||
|
||||
const state = await page.evaluate(async () => {
|
||||
// 字体二进制不入库;未生成时应回退系统字体,而不是报错。
|
||||
@@ -331,3 +333,47 @@ test('keeps a long run log scrollable without rendering every line', async ({
|
||||
fullPage: true,
|
||||
})
|
||||
})
|
||||
|
||||
test('manages python package mirrors', async ({ page, request }) => {
|
||||
const headers = await authHeaders(request)
|
||||
|
||||
// 失败重跑时先清理上一次留下的测试镜像,并把默认源还原。
|
||||
const existing = await request.get('/api/v1/python/mirrors')
|
||||
expect(existing.ok()).toBeTruthy()
|
||||
const existingMirrors = (await existing.json()) as Array<{
|
||||
id: string
|
||||
index_url: string
|
||||
}>
|
||||
for (const mirror of existingMirrors) {
|
||||
if (mirror.index_url.includes('pypi.e2e.example')) {
|
||||
await request.delete(`/api/v1/python/mirrors/${mirror.id}`, { headers })
|
||||
}
|
||||
}
|
||||
await request.post('/api/v1/python/mirrors/tsinghua/default', { headers })
|
||||
|
||||
await page.goto('/mirrors')
|
||||
await expect(
|
||||
page.getByRole('heading', { name: 'Python 镜像' }),
|
||||
).toBeVisible()
|
||||
await expect(page.getByRole('row', { name: /清华 TUNA/ })).toBeVisible()
|
||||
|
||||
await page.getByRole('button', { name: '+ 新增镜像' }).click()
|
||||
const dialog = page.getByRole('dialog', { name: '新增 Python 镜像' })
|
||||
await dialog.getByLabel('名称').fill('E2E 镜像')
|
||||
await dialog.getByLabel('索引地址').fill('https://pypi.e2e.example/simple')
|
||||
await dialog.getByRole('button', { name: '保存' }).click()
|
||||
|
||||
const row = page.getByRole('row', { name: /E2E 镜像/ })
|
||||
await expect(row).toBeVisible()
|
||||
await row.getByRole('button', { name: '设为默认' }).click()
|
||||
await expect(row.getByText('默认', { exact: true })).toBeVisible()
|
||||
|
||||
await row.getByRole('button', { name: '删除' }).click()
|
||||
await page
|
||||
.getByRole('dialog', { name: /删除镜像/ })
|
||||
.getByRole('button', { name: '确认删除' })
|
||||
.click()
|
||||
await expect(row).toHaveCount(0)
|
||||
|
||||
await request.post('/api/v1/python/mirrors/tsinghua/default', { headers })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user