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 document default selected entity picker collection on save (#73891)
Anderson33420c7ae79d
diff --git a/e2e/test/scenarios/documents/documents.cy.spec.ts b/e2e/test/scenarios/documents/documents.cy.spec.tsindex 5c7dfd294c9..968cdca4d1b 100644--- a/e2e/test/scenarios/documents/documents.cy.spec.ts+++ b/e2e/test/scenarios/documents/documents.cy.spec.ts@@ -341,6 +341,38 @@ describe("documents", () => {.should("have.attr", "contenteditable", "false");});+ it("should default the save modal to a selectable collection when Library is enabled (#73538)", () => {+ H.activateToken("pro-self-hosted");+ H.createLibrary();+ cy.intercept("POST", "/api/document").as("createDocument");++ cy.visit("/");++ H.newButton("Document").click();+ cy.findByRole("textbox", { name: "Document Title" }).type(+ "Document in default collection",+ );+ H.documentContent().type(+ "This document should save without changing folders",+ );++ cy.findByRole("button", { name: "Save" }).click();++ H.entityPickerModal().within(() => {+ cy.findByTestId("entity-picker-select-button").should("be.enabled");+ });+ cy.findByTestId("entity-picker-select-button").click();++ cy.wait("@createDocument").then(({ request }) => {+ expect(request.body).not.to.have.property("collection_id");+ });+ cy.location("pathname").should("match", /^\/document\/\d+/);+ cy.findByRole("textbox", { name: "Document Title" }).should(+ "have.value",+ "Document in default collection",+ );+ });+it("should focus the start of the document body when pressing Enter on the title input", () => {cy.visit("/document/new");diff --git a/frontend/src/metabase/documents/components/DocumentPage.tsx b/frontend/src/metabase/documents/components/DocumentPage.tsxindex f89cf7ebe6c..08441e3692e 100644--- a/frontend/src/metabase/documents/components/DocumentPage.tsx+++ b/frontend/src/metabase/documents/components/DocumentPage.tsx@@ -527,6 +527,10 @@ export const DocumentPage = ({title={t`Where should we save this document?`}onClose={() => setCollectionPickerMode(null)}entityType="document"+ value={{+ id: documentData?.collection_id ?? "root",+ model: "collection",+ }}onChange={(collection) => {if (collectionPickerMode === "save") {handleSave(canonicalCollectionId(collection.id));