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
Update alignment and copy for embedding hub (#64279)
Phoomparin Mano384d0b5d3b59
diff --git a/e2e/test/scenarios/embedding/embedding-hub/embedding-hub.cy.spec.ts b/e2e/test/scenarios/embedding/embedding-hub/embedding-hub.cy.spec.tsindex a57777b7512..5dfafbbaad2 100644--- a/e2e/test/scenarios/embedding/embedding-hub/embedding-hub.cy.spec.ts+++ b/e2e/test/scenarios/embedding/embedding-hub/embedding-hub.cy.spec.ts@@ -23,12 +23,12 @@ describe("scenarios - embedding hub", () => {.should("exist");});- it('"Generate a dashboard" card should work correctly', () => {+ it('"Create a dashboard" card should work correctly', () => {cy.visit("/admin/embedding/setup-guide");- cy.log("Find and click on 'Generate a dashboard' card");+ cy.log("Find and click on 'Create a dashboard' card");cy.findByTestId("admin-layout-content")- .findByText("Generate a dashboard")+ .findByText("Create a dashboard").click();cy.log("Select a table to generate dashboard from");@@ -44,11 +44,13 @@ describe("scenarios - embedding hub", () => {cy.url().should("include", "/auto/dashboard/table/");});- it('"Add data" card should work correctly', () => {+ it('"Connect a database" card should work correctly', () => {cy.visit("/admin/embedding/setup-guide");- cy.log("Find and click on 'Add data' card");- cy.findByTestId("admin-layout-content").findByText("Add data").click();+ cy.log("Find and click on 'Connect a database' card");+ cy.findByTestId("admin-layout-content")+ .findByText("Connect a database")+ .click();cy.log("Add data modal should open");cy.findByRole("dialog").within(() => {@@ -70,14 +72,16 @@ describe("scenarios - embedding hub", () => {cy.visit("/admin/embedding/setup-guide");- cy.log("'Add data' should not be marked as done");+ cy.log("'Connect a database' should not be marked as done");cy.findByTestId("admin-layout-content")- .findByText("Add data")+ .findByText("Connect a database").closest("button").findByText("Done").should("not.exist");- cy.findByTestId("admin-layout-content").findByText("Add data").click();+ cy.findByTestId("admin-layout-content")+ .findByText("Connect a database")+ .click();H.modal().within(() => {cy.findByText("CSV").click();@@ -101,9 +105,9 @@ describe("scenarios - embedding hub", () => {cy.wait("@getChecklist");- cy.log("'Add data' should be marked as done");+ cy.log("'Connect a database' should be marked as done");cy.findByTestId("admin-layout-content")- .findByText("Add data")+ .findByText("Connect a database").closest("button").scrollIntoView().findByText("Done")@@ -143,11 +147,11 @@ describe("scenarios - embedding hub", () => {});});- it('"Embed in your code" card should take you to the embed flow', () => {+ it('"Get embed snippet" card should take you to the embed flow', () => {cy.visit("/admin/embedding/setup-guide");cy.findByTestId("admin-layout-content")- .findByText("Embed in your code")+ .findByText("Get embed snippet").click();cy.url().should("include", "/embed-js?auth_method=user_session");@@ -189,8 +193,8 @@ describe("scenarios - embedding hub", () => {cy.get("main").within(() => {cy.findByText("Create models").should("be.visible");- cy.findByText("Generate a dashboard").should("be.visible");- cy.findByText("Add data").should("be.visible").click();+ cy.findByText("Create a dashboard").should("be.visible");+ cy.findByText("Connect a database").should("be.visible").click();});cy.log("Sanity check: add data modal should open");diff --git a/frontend/src/metabase/admin/components/RelatedSettingsSection/RelatedSettingsSection.tsx b/frontend/src/metabase/admin/components/RelatedSettingsSection/RelatedSettingsSection.tsxindex 44189c93e9f..b18c4a1617b 100644--- a/frontend/src/metabase/admin/components/RelatedSettingsSection/RelatedSettingsSection.tsx+++ b/frontend/src/metabase/admin/components/RelatedSettingsSection/RelatedSettingsSection.tsx@@ -24,7 +24,7 @@ export function RelatedSettingsSection({{t`Related settings`}</Text>- <SimpleGrid cols={3} spacing="md">+ <SimpleGrid cols={{ xs: 1, md: 3 }} spacing="md">{items?.map((item) => (<RelatedSettingCardkey={item.to}diff --git a/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.unit.spec.tsx b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.unit.spec.tsxindex ab922e75cf7..0c05685a581 100644--- a/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.unit.spec.tsx+++ b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.unit.spec.tsx@@ -57,10 +57,10 @@ describe("EmbeddingHub", () => {mockPush.mockClear();});- it("opens AddDataModal when 'Add data' is clicked", async () => {+ it("opens AddDataModal when 'Connect a database' is clicked", async () => {setup();- await userEvent.click(screen.getByText("Add data"));+ await userEvent.click(screen.getByText("Connect a database"));await waitFor(() => {const dialog = within(screen.getByRole("dialog"));@@ -70,10 +70,10 @@ describe("EmbeddingHub", () => {});});- it("opens DataPickerModal when 'Generate a dashboard' is clicked", async () => {+ it("opens DataPickerModal when 'Create a dashboard' is clicked", async () => {setup();- await userEvent.click(screen.getByText("Generate a dashboard"));+ await userEvent.click(screen.getByText("Create a dashboard"));const dialog = await screen.findByTestId("entity-picker-modal");expect(dialog).toBeInTheDocument();diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.cssindex 6a3ab9b4efa..b815ceeea0c 100644--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css@@ -61,16 +61,6 @@width: 100%;}-.optionalStepCard,-.stepCardLink:has(.optionalStepCard) {- max-width: 15.625rem;-}--.requiredStepCard,-.stepCardLink:has(.requiredStepCard) {- max-width: 30rem;-}-.lockedStepCard {cursor: not-allowed;}diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsxindex af756ea5b8e..f71213df329 100644--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx@@ -5,7 +5,16 @@ import { match } from "ts-pattern";import { t } from "ttag";import type { UtmProps } from "metabase/selectors/settings";-import { Card, Flex, Group, Icon, Stack, Stepper, Text } from "metabase/ui";+import {+ Card,+ Flex,+ Grid,+ Group,+ Icon,+ Stack,+ Stepper,+ Text,+} from "metabase/ui";import { DocsLink } from "../DocsLink";@@ -80,7 +89,7 @@ export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {className={cx(S.step, isDone && S.stepDone)}icon={isDone ? <Icon name="check" /> : undefined}description={- <Group align="stretch">+ <Grid>{step.cards.map((card) => {const onClick =card.clickAction?.type === "click"@@ -90,94 +99,97 @@ export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {const isNextCard = nextCard && nextCard.id === card.id;return (- <CardAction card={card} key={card.id}>- <Card- className={cx(S.stepCard, {- [S.requiredStepCard]: !card.optional,- [S.optionalStepCard]: card.optional,- [S.lockedStepCard]: card.locked,- [S.nextStepCard]: isNextCard,- })}- component={onClick ? "button" : undefined}- onClick={onClick}- disabled={card.locked}- data-testid={`step-card-${card.id}`}- data-next-step={isNextCard}- >- <Stack justify="space-between" h="100%">- <Stack gap="xs" h="100%">- <Text- size={card.optional ? "md" : "lg"}- fw="bold"- c={- card.done- ? "var(--mb-color-text-secondary)"- : "var(--mb-color-text-primary)"- }- >- {card.title}- </Text>-- <Text- c="var(--mb-color-text-secondary)"- size="sm"- lh="lg"- >- {card.description}- </Text>- </Stack>-- {(card.optional || card.done || card.locked) && (- <Flex justify="flex-end">- {match(card)- .with({ done: true }, () => (- <Group gap="xs">- <Icon- name="check"- c="var(--mb-color-success-darker)"- size={12}- />+ <Grid.Col+ span={{ xs: 12, md: card.optional ? 4 : 8 }}+ key={card.id}+ >+ <CardAction card={card}>+ <Card+ className={cx(S.stepCard, {+ [S.lockedStepCard]: card.locked,+ [S.nextStepCard]: isNextCard,+ })}+ component={onClick ? "button" : undefined}+ onClick={onClick}+ disabled={card.locked}+ data-testid={`step-card-${card.id}`}+ data-next-step={isNextCard}+ >+ <Stack justify="space-between" h="100%">+ <Stack gap="xs" h="100%">+ <Text+ size={card.optional ? "md" : "lg"}+ fw="bold"+ c={+ card.done+ ? "var(--mb-color-text-secondary)"+ : "var(--mb-color-text-primary)"+ }+ >+ {card.title}+ </Text>++ <Text+ c="var(--mb-color-text-secondary)"+ size="sm"+ lh="lg"+ >+ {card.description}+ </Text>+ </Stack>++ {(card.optional || card.done || card.locked) && (+ <Flex justify="flex-end">+ {match(card)+ .with({ done: true }, () => (+ <Group gap="xs">+ <Icon+ name="check"+ c="var(--mb-color-success-darker)"+ size={12}+ />+ <Text+ size="sm"+ c="var(--mb-color-success-darker)"+ >+ {t`Done`}+ </Text>+ </Group>+ ))+ .with({ locked: true }, () => (+ <Group gap="xs">+ <Icon+ name="lock"+ c="var(--mb-color-text-secondary)"+ size={12}+ />++ <Text+ c="var(--mb-color-text-secondary)"+ fz={12}+ >+ {t`Complete the other steps to unlock`}+ </Text>+ </Group>+ ))+ .with({ optional: true }, () => (<Textsize="sm"- c="var(--mb-color-success-darker)"- >- {t`Done`}- </Text>- </Group>- ))- .with({ locked: true }, () => (- <Group gap="xs">- <Icon- name="lock"c="var(--mb-color-text-secondary)"- size={12}- />-- <Text- c="var(--mb-color-text-secondary)"- fz={12}>- {t`Complete the other steps to unlock`}+ {t`Optional`}</Text>- </Group>- ))- .with({ optional: true }, () => (- <Text- size="sm"- c="var(--mb-color-text-secondary)"- >- {t`Optional`}- </Text>- ))- .otherwise(() => null)}- </Flex>- )}- </Stack>- </Card>- </CardAction>+ ))+ .otherwise(() => null)}+ </Flex>+ )}+ </Stack>+ </Card>+ </CardAction>+ </Grid.Col>);})}- </Group>+ </Grid>}data-done={isDone}></Stepper.Step>diff --git a/frontend/src/metabase/embedding/embedding-hub/utils/embedding-hub-steps.ts b/frontend/src/metabase/embedding/embedding-hub/utils/embedding-hub-steps.tsindex 91d0df374f2..3c789671721 100644--- a/frontend/src/metabase/embedding/embedding-hub/utils/embedding-hub-steps.ts+++ b/frontend/src/metabase/embedding/embedding-hub/utils/embedding-hub-steps.ts@@ -9,8 +9,8 @@ export const getEmbeddingHubSteps = (): EmbeddingHubStep[] => {icon: "test_tube",actions: [{- title: t`Embed in your code`,- description: t`Embed a dashboard, question, the query builder or the collection browser.`,+ title: t`Get embed snippet`,+ description: t`Embed a dashboard, question, the query builder or the collection browser. Configure the experience and customize the appearance.`,to: "/embed-js?auth_method=user_session",variant: "outline",},@@ -33,7 +33,7 @@ export const getEmbeddingHubSteps = (): EmbeddingHubStep[] => {},actions: [{- title: t`Add data`,+ title: t`Connect a database`,description: t`Connect your own database or upload a CSV and start working with your real data.`,modal: { type: "add-data", initialTab: "db" },variant: "outline",@@ -52,18 +52,11 @@ export const getEmbeddingHubSteps = (): EmbeddingHubStep[] => {},actions: [{- title: t`Generate a dashboard`,+ title: t`Create a dashboard`,description: t`Automatically generate a dashboard from your data using x-rays.`,modal: { type: "xray-dashboard" },variant: "outline",},- // {- // title: t`Build a dashboard`,- // description: t`Build your own dashboard from scratch.`,- // modal: { type: "new-dashboard" },- // variant: "subtle",- // optional: true,- // },{title: t`Create models`,description: t`Set up data models for your embedded analytics.`,