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
Add embed flow to the command palette (#63944)
Phoomparin Mano03f68f0a2c19
diff --git a/e2e/test/scenarios/onboarding/command-palette.cy.spec.js b/e2e/test/scenarios/onboarding/command-palette.cy.spec.jsindex ebf2bb2395a..eb2834e620b 100644--- a/e2e/test/scenarios/onboarding/command-palette.cy.spec.js+++ b/e2e/test/scenarios/onboarding/command-palette.cy.spec.js@@ -393,6 +393,16 @@ describe("command palette", () => {H.activateToken("bleeding-edge");});+ it("should show the 'Create a new embed' command palette item", () => {+ cy.visit("/");+ cy.findByRole("button", { name: /search/ }).click();++ H.commandPalette().within(() => {+ H.commandPaletteInput().should("exist").type("new embed");+ cy.findByText("Create a new embed").should("be.visible");+ });+ });+it("should have a 'New document' item", () => {cy.visit("/");cy.findByRole("button", { name: /search/ }).click();diff --git a/frontend/src/metabase/palette/hooks/useCommandPaletteBasicActions.tsx b/frontend/src/metabase/palette/hooks/useCommandPaletteBasicActions.tsxindex b0e03d4f280..557583dff92 100644--- a/frontend/src/metabase/palette/hooks/useCommandPaletteBasicActions.tsx+++ b/frontend/src/metabase/palette/hooks/useCommandPaletteBasicActions.tsx@@ -6,6 +6,7 @@ import { t } from "ttag";import {useDatabaseListQuery,+ useHasTokenFeature,useSearchListQuery,} from "metabase/common/hooks";import Collections from "metabase/entities/collections/collections";@@ -54,6 +55,7 @@ export const useCommandPaletteBasicActions = ({const hasDatabaseWithActionsEnabled =getHasDatabaseWithActionsEnabled(databases);const hasModels = models.length > 0;+ const hasEmbedJsFeature = useHasTokenFeature("embedding_simple");const openNewModal = useCallback((modalId: string) => {@@ -223,6 +225,16 @@ export const useCommandPaletteBasicActions = ({});}+ if (isAdmin && hasEmbedJsFeature) {+ actions.push({+ id: "navigate-embed-js",+ section: "basic",+ icon: "embed",+ keywords: "embed flow, new embed, embed js",+ perform: () => dispatch(push("/embed-js")),+ });+ }+if (personalCollectionId) {actions.push({id: "navigate-personal-collection",@@ -254,6 +266,7 @@ export const useCommandPaletteBasicActions = ({openNewModal,isAdmin,personalCollectionId,+ hasEmbedJsFeature,]);useRegisterShortcut(initialActions, [initialActions]);diff --git a/frontend/src/metabase/palette/shortcuts/global.ts b/frontend/src/metabase/palette/shortcuts/global.tsindex f4edcc1e365..d1a35ecca4d 100644--- a/frontend/src/metabase/palette/shortcuts/global.ts+++ b/frontend/src/metabase/palette/shortcuts/global.ts@@ -133,4 +133,13 @@ export const globalShortcuts = {shortcut: ["g h"],shortcutGroup: "global" as const,},++ "navigate-embed-js": {+ get name() {+ return t`Create a new embed`;+ },++ shortcut: ["c e"],+ shortcutGroup: "global" as const,+ },};