fix(ui): перенести фильтры BGP и бэкапов на FilterQuery

This commit is contained in:
Denozordec committed 2026-09-14 22:09:48 +07:00
1 parent a475b5c6df
commit fca42aaa81
11 files changed
+103 -34

No files matched your search

+21 -1
View File
@@ -15,7 +15,7 @@ const certificates = certificatesListResponseSchema.parse({ failures: [], certif
daysLeft: 300 + i, keySize: 2048, usage: ["server"], trusted: true, status: "valid",
})) })
const backups: BackupItem[] = ids.map(i => ({ id: String(i), serverId: 1, serverName: "Тестовый роутер",
filename: `backup-${i}.backup`, sizeBytes: i === 12 ? 1048576 : i * 1024, createdAt: "2026-09-14T00:00:00Z", kind: "manual" }))
filename: `backup-${i}.backup`, sizeBytes: i === 12 ? 1048576 : i * 1024, createdAt: "2026-09-14T00:00:00Z", kind: i > 6 ? "auto" : "manual" }))
async function setup(page: Page, url: string) {
await page.route("**/health", route => route.fulfill({ json: { ok: true } }))
@@ -70,3 +70,23 @@ test("Бэкапы: 12 строк, числовая сортировка и вы
await page.getByRole("button", { name: "Отмена", exact: true }).click()
await expect(rows).toHaveCount(12)
})
test("Бэкапы FilterQuery: тип, изменение значения и сброс", async ({ page }) => {
await setup(page, "/backups")
const rows = page.locator("tr[data-row-id]")
await expect(rows).toHaveCount(12)
await page.getByRole("button", { name: "Фильтры", exact: true }).click()
await page.getByRole("option", { name: "Тип", exact: true }).click()
await page.getByRole("option", { name: "равно", exact: true }).click()
await page.getByRole("option", { name: "авто", exact: true }).click()
await expect(rows).toHaveCount(6)
await expect(page.locator('tr[data-row-id="12"]')).toBeVisible()
await expect(page.locator('tr[data-row-id="1"]')).toHaveCount(0)
await page.getByRole("button", { name: "авто", exact: true }).click()
await page.getByRole("option", { name: "вручную", exact: true }).click()
await expect(rows).toHaveCount(6)
await expect(page.locator('tr[data-row-id="1"]')).toBeVisible()
await expect(page.locator('tr[data-row-id="12"]')).toHaveCount(0)
await page.getByRole("button", { name: "Очистить", exact: true }).click()
await expect(rows).toHaveCount(12)
})
+20 -1
View File
@@ -15,7 +15,7 @@ const ospf = {
}
const bgp = ids.map(i => ({ ...host, id: String(i), name: `Пир ${i}`, peerIp: `192.0.2.${i}`,
remoteAs: 65000 + i, localAs: 64512, localId: "192.0.2.100", remoteId: `192.0.2.${i}`,
state: "Established", type: "eBGP", uptime: "1h", holdTime: 90, keepalive: 30,
state: i > 6 ? "Active" : "Established", type: "eBGP", uptime: "1h", holdTime: 90, keepalive: 30,
prefixesRx: i, prefixesTx: i, inputMessages: i, outputMessages: i, capabilities: ["route-refresh"], lastError: null }))
async function setup(page: Page, path: string, empty = false) {
@@ -72,3 +72,22 @@ test("Пустые ответы API показывают пустые состо
await expect(page.getByText(message, { exact: true })).toBeVisible()
}
})
test("BGP FilterQuery: выбор, AND и сброс", async ({ page }) => {
await setup(page, "/bgp")
const rows = page.locator("tr[data-row-id]")
await expect(rows).toHaveCount(12)
await page.getByRole("button", { name: "Фильтры", exact: true }).click()
await page.getByRole("option", { name: "Состояние", exact: true }).click()
await page.getByRole("option", { name: "равно", exact: true }).click()
await page.getByRole("option", { name: "Active", exact: true }).click()
await expect(rows).toHaveCount(6)
await expect(rows.first()).toContainText("Пир 7")
await page.getByRole("button", { name: "Фильтры", exact: true }).click()
await page.getByRole("option", { name: "Тип", exact: true }).click()
await page.getByRole("option", { name: "равно", exact: true }).click()
await page.getByRole("option", { name: "iBGP", exact: true }).click()
await expect(rows).toHaveCount(0)
await page.getByRole("button", { name: "Очистить", exact: true }).click()
await expect(rows).toHaveCount(12)
})