From d2294593d9fe1f21c19619c82d9df45c55166a8d Mon Sep 17 00:00:00 2001 From: JustinKol <144163838+JustinKol@users.noreply.github.com> Date: Thu, 15 May 2025 17:55:55 -0400 Subject: [PATCH] Missing vs code button and image (#2155) * Reverting back to popup by default as too many factors are present using a timeout * Added telemetry constant for VSCode * VSCode image and button --- images/vscode.svg | 1 + .../CommandBarComponentButtonFactory.tsx | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 images/vscode.svg diff --git a/images/vscode.svg b/images/vscode.svg new file mode 100644 index 000000000..137be57f0 --- /dev/null +++ b/images/vscode.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx index f9aa5e54f..03ee0423d 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx @@ -14,6 +14,7 @@ import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg"; import OpenInTabIcon from "../../../../images/open-in-tab.svg"; import SettingsIcon from "../../../../images/settings_15x15.svg"; import SynapseIcon from "../../../../images/synapse-link.svg"; +import VSCodeIcon from "../../../../images/vscode.svg"; import { AuthType } from "../../../AuthType"; import * as Constants from "../../../Common/Constants"; import { Platform, configContext } from "../../../ConfigContext"; @@ -60,6 +61,10 @@ export function createStaticCommandBarButtons( addDivider(); buttons.push(addSynapseLink); } + if (userContext.apiType !== "Gremlin") { + const addVsCode = createOpenVsCodeDialogButton(container); + buttons.push(addVsCode); + } } if (isDataplaneRbacSupported(userContext.apiType)) { @@ -268,6 +273,18 @@ function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonCo }; } +function createOpenVsCodeDialogButton(container: Explorer): CommandButtonComponentProps { + const label = "Visual Studio Code"; + return { + iconSrc: VSCodeIcon, + iconAlt: label, + onCommandClick: () => container.openInVsCode(), + commandButtonLabel: label, + hasPopup: false, + ariaLabel: label, + }; +} + function createLoginForEntraIDButton(container: Explorer): CommandButtonComponentProps { if (configContext.platform !== Platform.Portal) { return undefined; @@ -501,5 +518,6 @@ export function createPostgreButtons(container: Explorer): CommandButtonComponen export function createVCoreMongoButtons(container: Explorer): CommandButtonComponentProps[] { const openVCoreMongoTerminalButton = createOpenTerminalButtonByKind(container, ViewModels.TerminalKind.VCoreMongo); - return [openVCoreMongoTerminalButton]; + const addVsCode = createOpenVsCodeDialogButton(container); + return [openVCoreMongoTerminalButton, addVsCode]; }