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
Subtler Add Data button in side nav (#64745)
Maz Ameli5931cb0d0ab2
diff --git a/e2e/test/scenarios/onboarding/add-initial-data.cy.spec.ts b/e2e/test/scenarios/onboarding/add-initial-data.cy.spec.tsindex e5f28d905b2..478ea85f128 100644--- a/e2e/test/scenarios/onboarding/add-initial-data.cy.spec.ts+++ b/e2e/test/scenarios/onboarding/add-initial-data.cy.spec.ts@@ -27,7 +27,7 @@ H.describeWithSnowplow(cy.visit("/");H.navigationSidebar().findByRole("tab", { name: /^Getting Started/i })- .findByLabelText("Add data")+ .findByLabelText("Add your data").should("be.visible").click();addDataModal().should("be.visible");@@ -219,15 +219,12 @@ describe("Add data modal", () => {cy.findByText("Home").should("be.visible");cy.log("Make sure we don't display the 'Getting Started' section");cy.findByText(/Getting Started/i).should("not.exist");- cy.findByText("Add data").should("not.exist");+ cy.findByText("Add your data").should("not.exist");cy.log(- "Make sure we don't display the 'Add' button in the 'Data' section",+ "Make sure we don't display the 'Add data' button in the 'Data' section",);cy.findByText(/^Data$/i).should("be.visible");- cy.findByText("Add").should("not.exist");-- cy.log("Both buttons have the same label, and neither should exist");cy.findByLabelText("Add data").should("not.exist");});});diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/BrowseNavSection.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/BrowseNavSection.tsxindex 7d3f831c1ae..3098f4e3b04 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/BrowseNavSection.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/BrowseNavSection.tsx@@ -7,11 +7,12 @@ import { useSelector } from "metabase/lib/redux";import { getIsEmbeddingIframe } from "metabase/selectors/embed";import { getEntityTypes } from "metabase/selectors/embedding-data-picker";import {- Button,+ ActionIcon,Collapse,Flex,Group,Icon,+ Tooltip,UnstyledButton,} from "metabase/ui";@@ -69,19 +70,18 @@ export const BrowseNavSection = ({<Icon name={opened ? "chevrondown" : "chevronright"} size={8} /></Group>{showAddDataButton && (- <Button- aria-label="Add data"- variant="subtle"- leftSection={<Icon name="add_data" />}- h="auto"- p={0}- onClick={() => {- trackAddDataModalOpened("left-nav");- onAddDataModalOpen();- }}- >- {t`Add`}- </Button>+ <Tooltip label={t`Add data`}>+ <ActionIcon+ aria-label={t`Add data`}+ color="var(--mb-color-text-medium)"+ onClick={() => {+ trackAddDataModalOpened("left-nav");+ onAddDataModalOpen();+ }}+ >+ <Icon name="add" />+ </ActionIcon>+ </Tooltip>)}</Flex>diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/BrowseNavSection.unit.spec.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/BrowseNavSection.unit.spec.tsxindex e49ba7a4d67..03fa3622647 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/BrowseNavSection.unit.spec.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/BrowseNavSection.unit.spec.tsx@@ -1,6 +1,9 @@import userEvent from "@testing-library/user-event";-import { setupDatabaseListEndpoint } from "__support__/server-mocks";+import {+ setupDatabaseListEndpoint,+ setupUpdateSettingEndpoint,+} from "__support__/server-mocks";import { getIcon, renderWithProviders, screen, within } from "__support__/ui";import * as domUtils from "metabase/lib/dom";import { createMockDatabase, createMockUser } from "metabase-types/api/mocks";@@ -26,8 +29,6 @@ describe("BrowseNavSection", () => {expect(await within(tab).findByRole("button", { name: "Add data" }),).toBeInTheDocument();- // The user-visible text of the button says only "Add"- expect(within(tab).getByText("Add")).toBeInTheDocument();});it("should not render a section title and an 'Add data' button for users without enough permissions", async () => {@@ -42,8 +43,6 @@ describe("BrowseNavSection", () => {expect(within(tab).queryByRole("button", { name: "Add data" }),).not.toBeInTheDocument();- // The user-visible text of the button says only "Add"- expect(within(tab).queryByText("Add")).not.toBeInTheDocument();});it("should not render the 'Add data' button for full app embedding", () => {@@ -186,6 +185,7 @@ function setup({can_upload: true,});setupDatabaseListEndpoint([database]);+ setupUpdateSettingEndpoint();if (isEmbeddingIframe) {jest.spyOn(domUtils, "isWithinIframe").mockReturnValue(true);diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/GettingStartedSection.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/GettingStartedSection.tsxindex c55ad408845..9535f017849 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/GettingStartedSection.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/GettingStartedSection.tsx@@ -48,7 +48,7 @@ export const GettingStartedSection = ({>{canPerformMeaningfulActions && (<PaddedSidebarLink icon="add_data" onClick={onAddDataModalOpen}>- {t`Add data`}+ {t`Add your data`}</PaddedSidebarLink>)}diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/GettingStartedSection.unit.spec.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/GettingStartedSection.unit.spec.tsxindex 992bdbc2abe..7f0aa6dfc66 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/GettingStartedSection.unit.spec.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/GettingStartedSection.unit.spec.tsx@@ -61,17 +61,17 @@ describe("GettingStartedSection", () => {it("should render the 'Add data' button", () => {setup();- expect(screen.getByLabelText("Add data")).toBeInTheDocument();+ expect(screen.getByLabelText("Add your data")).toBeInTheDocument();});it("should not render the 'Add data' button if the user is not an admin", () => {setup({ isAdmin: false });- expect(screen.queryByLabelText("Add data")).not.toBeInTheDocument();+ expect(screen.queryByLabelText("Add your data")).not.toBeInTheDocument();});it("should trigger the modal on 'Add data' click", async () => {const { onAddDataModalOpen } = setup();- await userEvent.click(screen.getByText("Add data"));+ await userEvent.click(screen.getByText("Add your data"));expect(onAddDataModalOpen).toHaveBeenCalledTimes(1);});});