Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Disable the move and create buttons until the shared collection is known (#83489)

Romeo Van Snickeda959cf7b9e
diff --git a/frontend/src/metabase/embedding/setup-guide/components/SetupPermissionsAndTenantsPage/MoveDashboardStepContent.tsx b/frontend/src/metabase/embedding/setup-guide/components/SetupPermissionsAndTenantsPage/MoveDashboardStepContent.tsx
index 2a35a11baae..4bed2150e4a 100644
--- a/frontend/src/metabase/embedding/setup-guide/components/SetupPermissionsAndTenantsPage/MoveDashboardStepContent.tsx
+++ b/frontend/src/metabase/embedding/setup-guide/components/SetupPermissionsAndTenantsPage/MoveDashboardStepContent.tsx
@@ -125,7 +125,7 @@ export const MoveDashboardStepContent = ({
variant="filled"
onClick={handleMoveDashboard}
loading={isMoving}
- disabled={!effectiveDashboardId}
+ disabled={!effectiveDashboardId || sharedCollectionId === null}
>
{t`Move to shared collection`}
</Button>
@@ -140,6 +140,7 @@ export const MoveDashboardStepContent = ({
variant={hasXrayDashboard ? "default" : "filled"}
onClick={handleCreateSampleDashboard}
loading={isCreating}
+ disabled={sharedCollectionId === null}
>
{t`Create a sample dashboard`}
</Button>
diff --git a/frontend/src/metabase/embedding/setup-guide/components/SetupPermissionsAndTenantsPage/MoveDashboardStepContent.unit.spec.tsx b/frontend/src/metabase/embedding/setup-guide/components/SetupPermissionsAndTenantsPage/MoveDashboardStepContent.unit.spec.tsx
index 3d45a06ddaf..d70d3dfb215 100644
--- a/frontend/src/metabase/embedding/setup-guide/components/SetupPermissionsAndTenantsPage/MoveDashboardStepContent.unit.spec.tsx
+++ b/frontend/src/metabase/embedding/setup-guide/components/SetupPermissionsAndTenantsPage/MoveDashboardStepContent.unit.spec.tsx
@@ -99,7 +99,10 @@ describe("MoveDashboardStepContent", () => {
const { onCompleted } = setup({ hasXrayDashboard: true });
- const moveButton = await screen.findByText("Move to shared collection");
+ const moveButton = await screen.findByRole("button", {
+ name: "Move to shared collection",
+ });
+ await waitFor(() => expect(moveButton).toBeEnabled());
await userEvent.click(moveButton);
await waitFor(() => {
@@ -138,7 +141,10 @@ describe("MoveDashboardStepContent", () => {
const { onCompleted } = setup({ hasXrayDashboard: false });
- const createButton = await screen.findByText("Create a sample dashboard");
+ const createButton = await screen.findByRole("button", {
+ name: "Create a sample dashboard",
+ });
+ await waitFor(() => expect(createButton).toBeEnabled());
await userEvent.click(createButton);
await waitFor(() => {