The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Hide the step number circle in the setup flow when we only have one step (#64292)
Phoomparin Mano93052b8a8ed1
diff --git a/e2e/test/scenarios/onboarding/setup/setup.cy.spec.ts b/e2e/test/scenarios/onboarding/setup/setup.cy.spec.tsindex 43c7fcdea25..bd901862727 100644--- a/e2e/test/scenarios/onboarding/setup/setup.cy.spec.ts+++ b/e2e/test/scenarios/onboarding/setup/setup.cy.spec.ts@@ -314,6 +314,19 @@ describe("scenarios > setup", () => {.should("be.visible");});+ // There are only one step in the setup flow, so there is no need to show step numbers.+ it("should not show step numbers in cloud embedding use case", () => {+ H.mockSessionProperty("is-hosted?", true);+ H.mockSessionProperty("token-features", { hosting: true });++ cy.visit(+ "/setup?first_name=John&last_name=Doe&[email protected]&site_name=Doe%20Unlimited&use_case=embedding",+ );++ H.main().findByText("What should we call you?").should("be.visible");+ cy.findByTestId("step-number").should("not.exist");+ });+it("should allow localization in the 'embedding' setup flow", () => {cy.visit("/setup?first_name=John&last_name=Doe&[email protected]&site_name=Doe%20Unlimited&use_case=embedding",diff --git a/frontend/src/metabase/setup/components/ActiveStep/ActiveStep.tsx b/frontend/src/metabase/setup/components/ActiveStep/ActiveStep.tsxindex 3eca5c20ae9..067bb707ccc 100644--- a/frontend/src/metabase/setup/components/ActiveStep/ActiveStep.tsx+++ b/frontend/src/metabase/setup/components/ActiveStep/ActiveStep.tsx@@ -1,5 +1,8 @@import type { ReactNode } from "react";+import { useSelector } from "metabase/lib/redux";+import { getShouldShowStepNumber } from "metabase/setup";+import {StepLabel,StepLabelText,@@ -20,6 +23,8 @@ export const ActiveStep = ({children,className,}: ActiveStepProps): JSX.Element => {+ const shouldShowStepNumber = useSelector(getShouldShowStepNumber);+return (<StepRootrole="listitem"@@ -29,9 +34,13 @@ export const ActiveStep = ({className={className}><StepTitle>{title}</StepTitle>- <StepLabel data-testid="step-number">- <StepLabelText>{label}</StepLabelText>- </StepLabel>++ {shouldShowStepNumber && (+ <StepLabel data-testid="step-number">+ <StepLabelText>{label}</StepLabelText>+ </StepLabel>+ )}+{children}</StepRoot>);diff --git a/frontend/src/metabase/setup/selectors.ts b/frontend/src/metabase/setup/selectors.tsindex 2c9ff89ab50..e4307487778 100644--- a/frontend/src/metabase/setup/selectors.ts+++ b/frontend/src/metabase/setup/selectors.ts@@ -159,3 +159,11 @@ export const getNextStep = (state: State) => {const activeStepIndex = steps.findIndex((step) => step.isActiveStep);return steps[activeStepIndex + 1].key;};++export const getShouldShowStepNumber = (state: State): boolean => {+ const interactiveSteps = getSteps(state).filter(+ (step) => step.key !== "welcome" && step.key !== "completed",+ );++ return interactiveSteps.length > 1;+};