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
Fix: #63463 Loosens condition that forces saving to dashboard (#63855)
Brad Anderson62d7beec2bdb
diff --git a/frontend/src/metabase/common/components/SaveQuestionForm/context.tsx b/frontend/src/metabase/common/components/SaveQuestionForm/context.tsxindex 33b53b6d205..40fe578cc4b 100644--- a/frontend/src/metabase/common/components/SaveQuestionForm/context.tsx+++ b/frontend/src/metabase/common/components/SaveQuestionForm/context.tsx@@ -164,9 +164,10 @@ export const SaveQuestionProvider = ({originalQuestion.type() !== "metric" &&originalQuestion.canWrite();- const saveToDashboard = originalQuestion- ? undefined- : (question.dashboardId() ?? undefined);+ const saveToDashboard =+ originalQuestion || !question.creationType()+ ? undefined+ : (question.dashboardId() ?? undefined);return (<FormProviderdiff --git a/frontend/src/metabase/common/components/SaveQuestionForm/context.unit.spec.tsx b/frontend/src/metabase/common/components/SaveQuestionForm/context.unit.spec.tsxindex c9209969ce9..746ab0bc2db 100644--- a/frontend/src/metabase/common/components/SaveQuestionForm/context.unit.spec.tsx+++ b/frontend/src/metabase/common/components/SaveQuestionForm/context.unit.spec.tsx@@ -137,13 +137,14 @@ describe("SaveQuestionContext", () => {);setup({- question: new Question(- createMockCard({+ question: new Question({+ ...createMockCard({collection_id: 11,collection: createMockCollection({ id: 11 }),dashboard_id: 20,}),- ),+ creationType: "custom_question",+ }),});expect(screen.getByTestId("saveToDashboard")).toBeInTheDocument();diff --git a/frontend/src/metabase/common/components/SaveQuestionModal/SaveQuestionModal.unit.spec.tsx b/frontend/src/metabase/common/components/SaveQuestionModal/SaveQuestionModal.unit.spec.tsxindex 7bdfa9f13f8..e038aef4068 100644--- a/frontend/src/metabase/common/components/SaveQuestionModal/SaveQuestionModal.unit.spec.tsx+++ b/frontend/src/metabase/common/components/SaveQuestionModal/SaveQuestionModal.unit.spec.tsx@@ -177,6 +177,7 @@ function getQuestion({collection_id = null,dashboard_id = null,can_write = true,+ creationType,}: {isSaved?: boolean;name?: string;@@ -184,8 +185,9 @@ function getQuestion({collection_id?: CollectionId | null;dashboard_id?: DashboardId | null;can_write?: boolean;+ creationType?: string;} = {}) {- const extraCardParams: Record<string, any> = {};+ const extraCardParams: Record<string, any> = { creationType };if (isSaved) {extraCardParams.id = 1; // if a card has an id, it means it's saved@@ -555,6 +557,7 @@ describe("SaveQuestionModal", () => {isSaved: true,collection_id: FOO_DASH.collection_id,dashboard_id: FOO_DASH.id, // <- question already has a dashboard save location+ creationType: "custom_question",}),);@@ -567,6 +570,20 @@ describe("SaveQuestionModal", () => {});});+ it("should show collection input if modifying a dashboard question", async () => {+ await setup(+ getQuestion({+ isSaved: true,+ collection_id: FOO_DASH.collection_id,+ dashboard_id: FOO_DASH.id, // <- question already has a dashboard save location+ }),+ );++ expect(+ screen.getByLabelText(/Where do you want to save this/),+ ).toBeInTheDocument();+ });+it("should show tab input w/ default value if select dashboard has tabs", async () => {await setup(getQuestion({