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
BOT-1575: Show the illustrations toggle whenever illustrations are off (#81871)
Andrei Simionescu0efc4c2161a1
diff --git a/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotCustomizationPage/MetabotCustomizationPage.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotCustomizationPage/MetabotCustomizationPage.unit.spec.tsxindex 740905d4814..2e4fc7f102c 100644--- a/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotCustomizationPage/MetabotCustomizationPage.unit.spec.tsx+++ b/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotCustomizationPage/MetabotCustomizationPage.unit.spec.tsx@@ -1,3 +1,6 @@+import userEvent from "@testing-library/user-event";+import fetchMock from "fetch-mock";+import {setupPropertiesEndpoints,setupSettingsEndpoints,@@ -76,4 +79,19 @@ describe("MetabotCustomizationPage", () => {const preview = await screen.findByAltText("Metabot icon");expect(preview).toHaveAttribute("src", "data:image/png;base64,abc123");});++ it("shows the illustrations toggle when illustrations are off, even with the default icon", async () => {+ setup({ showIllustrations: false });++ const toggle = await screen.findByRole("switch", {+ name: /Show Metabot illustrations/,+ });+ await userEvent.click(toggle);++ const call = fetchMock.callHistory.lastCall(+ "path:/api/setting/metabot-show-illustrations",+ { method: "PUT" },+ );+ expect(await call?.request?.json()).toEqual({ value: true });+ });});diff --git a/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotCustomizationPage/MetabotIconField.tsx b/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotCustomizationPage/MetabotIconField.tsxindex c84df1c0b92..30227ac5915 100644--- a/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotCustomizationPage/MetabotIconField.tsx+++ b/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotCustomizationPage/MetabotIconField.tsx@@ -34,6 +34,7 @@ export function MetabotIconField() {const [iconError, setIconError] = useState("");const isDefaultIcon = !metabotIcon || metabotIcon === "metabot";+ const isIllustrationsSectionVisible = !isDefaultIcon || !showIllustrations;const iconPreviewSrc =!isDefaultIcon && typeof metabotIcon === "string" ? metabotIcon : null;@@ -165,7 +166,7 @@ export function MetabotIconField() {</Flex>)}</Flex>- {!isDefaultIcon && (+ {isIllustrationsSectionVisible && (<Stack mt="xl" gap="sm"><Text fz="md" fw="bold">{t`Metabot illustrations`}