feat: refine frontend tables and task center
This commit is contained in:
@@ -56,7 +56,6 @@ const resourcePaths = {
|
||||
confirmations: "/phase-a/confirmations",
|
||||
tasks: "/phase-a/tasks",
|
||||
attempts: "/phase-a/attempts",
|
||||
audit: "/phase-a/audit",
|
||||
"network-exits": "/network-exits",
|
||||
"creator-accounts": "/creator/accounts",
|
||||
"creator-competitors": "/creator/competitors",
|
||||
@@ -97,7 +96,7 @@ export const dataProvider = {
|
||||
valueOf(field) !== undefined ? [[field, valueOf(field)]] : [],
|
||||
),
|
||||
);
|
||||
if (resource === "audit" || resource.startsWith("creator-")) {
|
||||
if (resource.startsWith("creator-")) {
|
||||
const currentPage = pagination.currentPage || pagination.page;
|
||||
const pageSize = pagination.pageSize || pagination.perPage;
|
||||
if (currentPage || pageSize) {
|
||||
@@ -309,16 +308,6 @@ function filterKeys(resource) {
|
||||
drafts: ["account_id"],
|
||||
confirmations: ["draft_id"],
|
||||
tasks: ["account_id", "draft_id", "state"],
|
||||
audit: [
|
||||
"account_id",
|
||||
"task_id",
|
||||
"attempt_id",
|
||||
"browser_env_alias",
|
||||
"network_exit_id",
|
||||
"event_type",
|
||||
"from",
|
||||
"to",
|
||||
],
|
||||
"creator-competitors": ["platform"],
|
||||
"creator-works": [
|
||||
"platform",
|
||||
|
||||
@@ -130,38 +130,6 @@ describe("dataProvider", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("maps paginated audit filters without exposing a CRUD mutation", async () => {
|
||||
const fetch = vi
|
||||
.fn()
|
||||
.mockResolvedValue(
|
||||
new Response(
|
||||
'{"data":[{"id":7,"event_type":"task_verified"}],"total":31}',
|
||||
{ status: 200 },
|
||||
),
|
||||
);
|
||||
vi.stubGlobal("fetch", fetch);
|
||||
|
||||
await expect(
|
||||
dataProvider.getList({
|
||||
resource: "audit",
|
||||
pagination: { currentPage: 2, pageSize: 25 },
|
||||
filters: [
|
||||
{ field: "task_id", value: "task-a" },
|
||||
{ field: "attempt_id", value: "attempt-a" },
|
||||
{ field: "browser_env_alias", value: "env-a" },
|
||||
{ field: "network_exit_id", value: "exit-a" },
|
||||
],
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
data: [{ id: 7, event_type: "task_verified" }],
|
||||
total: 31,
|
||||
});
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
"/api/phase-a/audit?task_id=task-a&attempt_id=attempt-a&browser_env_alias=env-a&network_exit_id=exit-a&page=2&page_size=25",
|
||||
{ headers: {} },
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps generated draft, confirmation and enqueue identifiers out of user input", async () => {
|
||||
const fetch = vi
|
||||
.fn()
|
||||
|
||||
Reference in New Issue
Block a user