diff --git a/admin-js/src/App.jsx b/admin-js/src/App.jsx index 32a34c3f..262bd7cf 100644 --- a/admin-js/src/App.jsx +++ b/admin-js/src/App.jsx @@ -266,7 +266,7 @@ function createInputs(resource, name, perm_type, permissions) { return components; } -function createBulkUpdates(resource, name, permissions) { +function createBulkUpdates(resource, name, permissions, refresh) { let buttons = []; for (const [label, data] of Object.entries(resource["bulk_update"])) { let allowed = true; @@ -277,7 +277,8 @@ function createBulkUpdates(resource, name, permissions) { } } if (allowed) - buttons.push(); + buttons.push(); } return buttons; } @@ -294,13 +295,16 @@ const AiohttpList = (resource, name, permissions) => { ); - const BulkActionButtons = () => ( - <> - {hasPermission(`${name}.edit`, permissions) && createBulkUpdates(resource, name, permissions)} - - {hasPermission(`${name}.delete`, permissions) && } - - ); + const BulkActionButtons = () => { + const refresh = useRefresh(); + return ( + <> + {hasPermission(`${name}.edit`, permissions) && createBulkUpdates(resource, name, permissions, refresh)} + + {hasPermission(`${name}.delete`, permissions) && } + + ); + }; const filters = createInputs(resource, name, "view", permissions); // Remove inputs with duplicate sources. const filterSources = filters.map(c => c["props"]["source"]); diff --git a/admin-js/tests/permissions.test.js b/admin-js/tests/permissions.test.js index cb2d9a41..efd89158 100644 --- a/admin-js/tests/permissions.test.js +++ b/admin-js/tests/permissions.test.js @@ -49,7 +49,6 @@ describe("admin", () => { await userEvent.click(await screen.findByRole("button", {"name": "Set to 7"})); expect(await screen.findByText("Update 6 simples")).toBeInTheDocument(); await userEvent.click(screen.getByRole("button", {"name": "Confirm"})); - return; // Broken now await waitFor(() => screen.getAllByText("7")); const table = await screen.findByRole("table"); diff --git a/admin-js/tests/simple.test.js b/admin-js/tests/simple.test.js index 96f3aa10..f038aa67 100644 --- a/admin-js/tests/simple.test.js +++ b/admin-js/tests/simple.test.js @@ -68,7 +68,6 @@ test("filters work", async () => { const table = await within(main).findByRole("table"); let rows = within(table).getAllByRole("row"); expect(rows.length).toBeGreaterThan(2); - return; // Broken now await userEvent.type(within(quickSearch).getByRole("spinbutton", {"name": "Id"}), "1"); await waitFor(() => within(main).getByRole("button", {"name": "Add filter"})); @@ -90,7 +89,6 @@ test("enum filter works", async () => { expect(within(table).getAllByRole("row").length).toBe(2); const record = within(table).getAllByRole("row")[1]; await userEvent.click(currencySelect); - return; // Broken now await userEvent.click(await screen.findByRole("option", {"name": "GBP"})); expect(await within(main).findByText("No results found")).toBeInTheDocument(); @@ -154,7 +152,6 @@ test("reference input filter", async () => { const optionsInitial = within(resultsInitial).getAllByRole("option"); expect(optionsInitial.map(e => e.textContent)).toEqual(["first", "with child"]); - return; // Broken now await userEvent.click(within(resultsInitial).getByRole("option", {"name": "first"})); await waitFor(() => expect(screen.queryByText("USD")).not.toBeInTheDocument()); expect(await within(main).findByText("No results found")).toBeInTheDocument();