feat: add refresh action to Alpha views

This commit is contained in:
yuxuanhui
2026-09-13 00:12:35 +08:00
parent 2080f812b4
commit 702b1376df
2 changed files with 24 additions and 3 deletions
+10
View File
@@ -1013,6 +1013,16 @@ export function AlphaPage({
aria-label="Alpha 表格工具栏" aria-label="Alpha 表格工具栏"
> >
<div className="inline-actions alpha-view-tools"> <div className="inline-actions alpha-view-tools">
<Button
icon={<IconRefresh aria-hidden="true" />}
theme="borderless"
type="tertiary"
aria-label="刷新 Alpha 列表"
title="按当前条件刷新列表"
loading={loading}
disabled={loading}
onClick={refresh}
/>
<Popover <Popover
trigger="custom" trigger="custom"
position="bottomLeft" position="bottomLeft"
@@ -4,7 +4,9 @@ test("local correlation filters combine with tabs and survive saved views", asyn
page, page,
}) => { }) => {
let params = new URLSearchParams(); let params = new URLSearchParams();
let searches = 0;
await page.route(/\/api\/v1\/alphas\?/, async (route) => { await page.route(/\/api\/v1\/alphas\?/, async (route) => {
searches += 1;
params = new URL(route.request().url()).searchParams; params = new URL(route.request().url()).searchParams;
await route.fulfill({ await route.fulfill({
json: { items: [], total: 0, limit: 25, offset: 0 }, json: { items: [], total: 0, limit: 25, offset: 0 },
@@ -21,9 +23,7 @@ test("local correlation filters combine with tabs and survive saved views", asyn
await page await page
.getByRole("textbox", { name: "搜索 Alpha", exact: true }) .getByRole("textbox", { name: "搜索 Alpha", exact: true })
.fill("candidate"); .fill("candidate");
await page await page.getByText("全部状态", { exact: true }).click();
.getByText("全部状态", { exact: true })
.click();
await page.getByRole("option", { name: /相关性偏高/ }).click(); await page.getByRole("option", { name: /相关性偏高/ }).click();
await page.getByText("更多筛选", { exact: true }).click(); await page.getByText("更多筛选", { exact: true }).click();
await page await page
@@ -51,6 +51,17 @@ test("local correlation filters combine with tabs and survive saved views", asyn
expect(params.get("local_correlation_status")).toBe("high"); expect(params.get("local_correlation_status")).toBe("high");
expect(params.get("local_correlation_min")).toBe("0.7"); expect(params.get("local_correlation_min")).toBe("0.7");
expect(params.get("local_correlation_max")).toBe("0.75"); expect(params.get("local_correlation_max")).toBe("0.75");
const refresh = page.getByRole("button", {
name: "刷新 Alpha 列表",
exact: true,
});
await expect(refresh).toBeEnabled();
const before = searches;
const savedQuery = params.toString();
await refresh.click();
await expect.poll(() => searches).toBeGreaterThan(before);
expect(params.toString()).toBe(savedQuery);
await expect(saved).toHaveAttribute("aria-selected", "true");
await blocked.click(); await blocked.click();
await page.getByRole("button", { name: "筛选 Alpha", exact: true }).click(); await page.getByRole("button", { name: "筛选 Alpha", exact: true }).click();
await page.getByRole("button", { name: "重置", exact: true }).click(); await page.getByRole("button", { name: "重置", exact: true }).click();