From 755b732532d9dcb8bd01a9c7d91515f99ecf5900 Mon Sep 17 00:00:00 2001 From: sindhuba <122321535+sindhuba@users.noreply.github.com> Date: Mon, 10 Apr 2023 10:18:57 -0700 Subject: [PATCH] Remove Enable Azure synapse link for Cassandra (#1427) --- .../CommandBarComponentButtonFactory.test.ts | 16 ++++++++++++++++ .../CommandBarComponentButtonFactory.tsx | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts index c9133b3b9..0a4e1158b 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts @@ -54,6 +54,22 @@ describe("CommandBarComponentButtonFactory tests", () => { ); expect(enableAzureSynapseLinkBtn).toBeUndefined(); }); + + it("Button should not be visible for Cassandra API", () => { + updateUserContext({ + databaseAccount: { + properties: { + capabilities: [{ name: "EnableCassandra" }], + }, + } as DatabaseAccount, + }); + + const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState); + const enableAzureSynapseLinkBtn = buttons.find( + (button) => button.commandButtonLabel === enableAzureSynapseLinkBtnLabel + ); + expect(enableAzureSynapseLinkBtn).toBeUndefined(); + }); }); describe("Enable notebook button", () => { diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx index 137256b32..466dde648 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx @@ -51,7 +51,7 @@ export function createStaticCommandBarButtons( const buttons: CommandButtonComponentProps[] = []; buttons.push(newCollectionBtn); - if (userContext.apiType !== "Tables") { + if (userContext.apiType !== "Tables" && userContext.apiType !== "Cassandra") { const addSynapseLink = createOpenSynapseLinkDialogButton(container); if (addSynapseLink) {