From 383da73c52c57ec84c6b09addd7f55f9f8594f56 Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Fri, 5 Dec 2025 09:35:35 -0800 Subject: [PATCH] Remove Synapse from command bar and container create --- src/Common/Constants.ts | 5 - src/Contracts/DataModels.ts | 1 - src/Explorer/Explorer.tsx | 53 +------- .../CommandBarComponentButtonFactory.test.ts | 8 -- .../CommandBarComponentButtonFactory.tsx | 34 ----- src/Explorer/Notebook/useNotebook.ts | 4 - .../AddCollectionPanel/AddCollectionPanel.tsx | 105 --------------- .../AddCollectionPanelUtility.tsx | 67 ---------- .../AddCollectionPanel.test.tsx.snap | 123 ------------------ .../AddGlobalSecondaryIndexPanel.tsx | 28 +--- .../Components/AnalyticalStoreComponent.tsx | 99 -------------- ...AddGlobalSecondaryIndexPanel.test.tsx.snap | 30 ----- src/Shared/Telemetry/TelemetryConstants.ts | 1 - 13 files changed, 2 insertions(+), 556 deletions(-) delete mode 100644 src/Explorer/Panes/AddGlobalSecondaryIndexPanel/Components/AnalyticalStoreComponent.tsx diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index 65b3f8d51..b5df96efa 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -531,11 +531,6 @@ export class PriorityLevel { public static readonly Default = "low"; } -export class ariaLabelForLearnMoreLink { - public static readonly AnalyticalStore = "Learn more about analytical store."; - public static readonly AzureSynapseLink = "Learn more about Azure Synapse Link."; -} - export class GlobalSecondaryIndexLabels { public static readonly NewGlobalSecondaryIndex: string = "New Global Secondary Index"; } diff --git a/src/Contracts/DataModels.ts b/src/Contracts/DataModels.ts index fef85ab87..d9d3cfba2 100644 --- a/src/Contracts/DataModels.ts +++ b/src/Contracts/DataModels.ts @@ -416,7 +416,6 @@ export interface CreateCollectionParamsBase { databaseId: string; databaseLevelThroughput: boolean; offerThroughput?: number; - analyticalStorageTtl?: number; autoPilotMaxThroughput?: number; indexingPolicy?: IndexingPolicy; partitionKey?: PartitionKey; diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx index 75abd2f47..a2a1f6a8a 100644 --- a/src/Explorer/Explorer.tsx +++ b/src/Explorer/Explorer.tsx @@ -18,7 +18,6 @@ import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility"; import { acquireMsalTokenForAccount } from "Utils/AuthorizationUtils"; import { allowedNotebookServerUrls, validateEndpoint } from "Utils/EndpointUtils"; import { featureRegistered } from "Utils/FeatureRegistrationUtils"; -import { update } from "Utils/arm/generatedClients/cosmos/databaseAccounts"; import { useQueryCopilot } from "hooks/useQueryCopilot"; import * as ko from "knockout"; import React from "react"; @@ -48,7 +47,7 @@ import { stringToBlob } from "../Utils/BlobUtils"; import { isCapabilityEnabled } from "../Utils/CapabilityUtils"; import { fromContentUri, toRawContentUri } from "../Utils/GitHubUtils"; import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils"; -import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../Utils/NotificationConsoleUtils"; +import { logConsoleError, logConsoleInfo } from "../Utils/NotificationConsoleUtils"; import { useSidePanel } from "../hooks/useSidePanel"; import { ReactTabKind, useTabs } from "../hooks/useTabs"; import "./ComponentRegisterer"; @@ -218,56 +217,6 @@ export default class Explorer { this.refreshNotebookList(); } - public openEnableSynapseLinkDialog(): void { - const addSynapseLinkDialogProps: DialogProps = { - linkProps: { - linkText: "Learn more", - linkUrl: "https://aka.ms/cosmosdb-synapselink", - }, - isModal: true, - title: `Enable Azure Synapse Link on your Cosmos DB account`, - subText: `Enable Azure Synapse Link to perform near real time analytical analytics on this account, without impacting the performance of your transactional workloads. - Azure Synapse Link brings together Cosmos Db Analytical Store and Synapse Analytics`, - primaryButtonText: "Enable Azure Synapse Link", - secondaryButtonText: "Cancel", - - onPrimaryButtonClick: async () => { - const startTime = TelemetryProcessor.traceStart(Action.EnableAzureSynapseLink); - const clearInProgressMessage = logConsoleProgress( - "Enabling Azure Synapse Link for this account. This may take a few minutes before you can enable analytical store for this account.", - ); - useNotebook.getState().setIsSynapseLinkUpdating(true); - useDialog.getState().closeDialog(); - - try { - await update(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name, { - properties: { - enableAnalyticalStorage: true, - }, - }); - - clearInProgressMessage(); - logConsoleInfo("Enabled Azure Synapse Link for this account"); - TelemetryProcessor.traceSuccess(Action.EnableAzureSynapseLink, {}, startTime); - userContext.databaseAccount.properties.enableAnalyticalStorage = true; - } catch (error) { - clearInProgressMessage(); - logConsoleError(`Enabling Azure Synapse Link for this account failed. ${getErrorMessage(error)}`); - TelemetryProcessor.traceFailure(Action.EnableAzureSynapseLink, {}, startTime); - } finally { - useNotebook.getState().setIsSynapseLinkUpdating(false); - } - }, - - onSecondaryButtonClick: () => { - useDialog.getState().closeDialog(); - TelemetryProcessor.traceCancel(Action.EnableAzureSynapseLink); - }, - }; - useDialog.getState().openDialog(addSynapseLinkDialogProps); - TelemetryProcessor.traceStart(Action.EnableAzureSynapseLink); - } - public async openLoginForEntraIDPopUp(): Promise { if (userContext.databaseAccount.properties?.documentEndpoint) { try { diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts index 12831e3d7..5c0aa7290 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts @@ -29,14 +29,6 @@ describe("CommandBarComponentButtonFactory tests", () => { }); }); - it("Button should be visible", () => { - const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState); - const enableAzureSynapseLinkBtn = buttons.find( - (button) => button.commandButtonLabel === enableAzureSynapseLinkBtnLabel, - ); - expect(enableAzureSynapseLinkBtn).toBeDefined(); - }); - // TODO: Now that Tables API supports dataplane RBAC, calling createStaticCommandBarButtons will enable the // Entra ID Login button, which causes this test to fail due to "Invalid hook call.". This seems to be // unsupported in jest and needs to be tested with react-hooks-testing-library. diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx index bd4f2b85e..f69560bd4 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx @@ -12,10 +12,8 @@ import HostedTerminalIcon from "../../../../images/Hosted-Terminal.svg"; 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"; import * as ViewModels from "../../../Contracts/ViewModels"; import { userContext } from "../../../UserContext"; @@ -55,11 +53,6 @@ export function createStaticCommandBarButtons( userContext.apiType !== "Tables" && userContext.apiType !== "Cassandra" ) { - const addSynapseLink = createOpenSynapseLinkDialogButton(container); - if (addSynapseLink) { - addDivider(); - buttons.push(addSynapseLink); - } if (userContext.apiType !== "Gremlin") { const addVsCode = createOpenVsCodeDialogButton(container); buttons.push(addVsCode); @@ -237,33 +230,6 @@ function areScriptsSupported(): boolean { ); } -function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonComponentProps { - if (configContext.platform === Platform.Emulator) { - return undefined; - } - - if (userContext?.databaseAccount?.properties?.enableAnalyticalStorage) { - return undefined; - } - - const capabilities = userContext?.databaseAccount?.properties?.capabilities || []; - if (capabilities.some((capability) => capability.name === Constants.CapabilityNames.EnableStorageAnalytics)) { - return undefined; - } - - const label = "Enable Azure Synapse Link"; - return { - iconSrc: SynapseIcon, - iconAlt: label, - onCommandClick: () => container.openEnableSynapseLinkDialog(), - commandButtonLabel: label, - hasPopup: false, - disabled: - useSelectedNode.getState().isQueryCopilotCollectionSelected() || useNotebook.getState().isSynapseLinkUpdating, - ariaLabel: label, - }; -} - function createOpenVsCodeDialogButton(container: Explorer): CommandButtonComponentProps { const label = "Visual Studio Code"; return { diff --git a/src/Explorer/Notebook/useNotebook.ts b/src/Explorer/Notebook/useNotebook.ts index 64acb2e3f..c30511125 100644 --- a/src/Explorer/Notebook/useNotebook.ts +++ b/src/Explorer/Notebook/useNotebook.ts @@ -25,7 +25,6 @@ interface NotebookState { isNotebooksEnabledForAccount: boolean; notebookServerInfo: DataModels.NotebookWorkspaceConnectionInfo; sparkClusterConnectionInfo: DataModels.SparkClusterConnectionInfo; - isSynapseLinkUpdating: boolean; memoryUsageInfo: DataModels.MemoryUsageInfo; isShellEnabled: boolean; notebookBasePath: string; @@ -44,7 +43,6 @@ interface NotebookState { setIsNotebooksEnabledForAccount: (isNotebooksEnabledForAccount: boolean) => void; setNotebookServerInfo: (notebookServerInfo: DataModels.NotebookWorkspaceConnectionInfo) => void; setSparkClusterConnectionInfo: (sparkClusterConnectionInfo: DataModels.SparkClusterConnectionInfo) => void; - setIsSynapseLinkUpdating: (isSynapseLinkUpdating: boolean) => void; setMemoryUsageInfo: (memoryUsageInfo: DataModels.MemoryUsageInfo) => void; setIsShellEnabled: (isShellEnabled: boolean) => void; setNotebookBasePath: (notebookBasePath: string) => void; @@ -79,7 +77,6 @@ export const useNotebook: UseStore = create((set, get) => ({ password: undefined, endpoints: [], }, - isSynapseLinkUpdating: false, memoryUsageInfo: undefined, isShellEnabled: false, notebookBasePath: Constants.Notebook.defaultBasePath, @@ -106,7 +103,6 @@ export const useNotebook: UseStore = create((set, get) => ({ set({ notebookServerInfo }), setSparkClusterConnectionInfo: (sparkClusterConnectionInfo: DataModels.SparkClusterConnectionInfo) => set({ sparkClusterConnectionInfo }), - setIsSynapseLinkUpdating: (isSynapseLinkUpdating: boolean) => set({ isSynapseLinkUpdating }), setMemoryUsageInfo: (memoryUsageInfo: DataModels.MemoryUsageInfo) => set({ memoryUsageInfo }), setIsShellEnabled: (isShellEnabled: boolean) => set({ isShellEnabled }), setNotebookBasePath: (notebookBasePath: string) => set({ notebookBasePath }), diff --git a/src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx b/src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx index 58d7037b6..03ea23f28 100644 --- a/src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx +++ b/src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx @@ -25,7 +25,6 @@ import { FullTextPoliciesComponent } from "Explorer/Controls/FullTextSeach/FullT import { VectorEmbeddingPoliciesComponent } from "Explorer/Controls/VectorSearch/VectorEmbeddingPoliciesComponent"; import { AllPropertiesIndexed, - AnalyticalStoreHeader, ContainerVectorPolicyTooltipContent, FullTextPolicyDefault, getPartitionKey, @@ -33,11 +32,9 @@ import { getPartitionKeyPlaceHolder, getPartitionKeyTooltipText, isFreeTierAccount, - isSynapseLinkEnabled, parseUniqueKeys, scrollToSection, SharedDatabaseDefault, - shouldShowAnalyticalStoreOptions, UniqueKeysHeader, } from "Explorer/Panes/AddCollectionPanel/AddCollectionPanelUtility"; import { useSidePanel } from "hooks/useSidePanel"; @@ -86,7 +83,6 @@ export interface AddCollectionPanelState { enableDedicatedThroughput: boolean; createMongoWildCardIndex: boolean; useHashV1: boolean; - enableAnalyticalStore: boolean; uniqueKeys: string[]; errorMessage: string; showErrorDetails: boolean; @@ -128,7 +124,6 @@ export class AddCollectionPanel extends React.Component )} - {shouldShowAnalyticalStoreOptions() && ( - - - {AnalyticalStoreHeader()} - - - -
- - On - - - Off -
-
- - {!isSynapseLinkEnabled() && ( - - - Azure Synapse Link is required for creating an analytical store{" "} - {getCollectionName().toLocaleLowerCase()}. Enable Synapse Link for this Cosmos DB account.
- - Learn more - -
- this.props.explorer.openEnableSynapseLinkDialog()} - style={{ height: 27, width: 80 }} - styles={{ label: { fontSize: 12 } }} - /> -
- )} -
- )} {this.shouldShowVectorSearchParameters() && ( ): void { - if (event.target.checked && !this.state.enableAnalyticalStore) { - this.setState({ - enableAnalyticalStore: true, - }); - } - } - - private onDisableAnalyticalStoreRadioBtnChange(event: React.ChangeEvent): void { - if (event.target.checked && this.state.enableAnalyticalStore) { - this.setState({ - enableAnalyticalStore: false, - }); - } - } - private onTurnOnIndexing(event: React.ChangeEvent): void { if (event.target.checked && !this.state.enableIndexing) { this.setState({ @@ -1243,25 +1158,6 @@ export class AddCollectionPanel extends React.Component - - Analytical Store - - - - - - ); -} - -export function AnalyticalStorageContent(): JSX.Element { - return ( - - Enable analytical store capability to perform near real-time analytics on your operational data, without impacting - the performance of transactional workloads.{" "} - - Learn more - - - ); -} - -export function isSynapseLinkEnabled(): boolean { - if (!userContext.databaseAccount) { - return false; - } - - const { properties } = userContext.databaseAccount; - if (!properties) { - return false; - } - - if (properties.enableAnalyticalStorage) { - return true; - } - - return properties.capabilities?.some( - (capability) => capability.name === Constants.CapabilityNames.EnableStorageAnalytics, - ); -} - export function scrollToSection(id: string): void { document.getElementById(id)?.scrollIntoView(); } diff --git a/src/Explorer/Panes/AddCollectionPanel/__snapshots__/AddCollectionPanel.test.tsx.snap b/src/Explorer/Panes/AddCollectionPanel/__snapshots__/AddCollectionPanel.test.tsx.snap index 97ae169ca..776ed4061 100644 --- a/src/Explorer/Panes/AddCollectionPanel/__snapshots__/AddCollectionPanel.test.tsx.snap +++ b/src/Explorer/Panes/AddCollectionPanel/__snapshots__/AddCollectionPanel.test.tsx.snap @@ -367,129 +367,6 @@ exports[`AddCollectionPanel should render Default properly 1`] = ` } } /> - - - - - Analytical Store - - - - - - - -
- - - On - - - - Off - -
-
- - - Azure Synapse Link is required for creating an analytical store - - container - . Enable Synapse Link for this Cosmos DB account. -
- - Learn more - -
- -
-
(); const [enableDedicatedThroughput, setEnabledDedicatedThroughput] = useState(); const [isThroughputCapExceeded, setIsThroughputCapExceeded] = useState(); - const [enableAnalyticalStore, setEnableAnalyticalStore] = useState(); const [vectorEmbeddingPolicy, setVectorEmbeddingPolicy] = useState([]); const [vectorIndexingPolicy, setVectorIndexingPolicy] = useState([]); const [vectorPolicyValidated, setVectorPolicyValidated] = useState(true); @@ -142,25 +138,6 @@ export const AddGlobalSecondaryIndexPanel = (props: AddGlobalSecondaryIndexPanel return isVectorSearchEnabled() && (isServerlessAccount() || showCollectionThroughputInput()); }; - const getAnalyticalStorageTtl = (): number => { - if (!isSynapseLinkEnabled()) { - return undefined; - } - - if (!shouldShowAnalyticalStoreOptions()) { - return undefined; - } - - if (enableAnalyticalStore) { - // TODO: always default to 90 days once the backend hotfix is deployed - return userContext.features.ttl90Days - ? Constants.AnalyticalStorageTtl.Days90 - : Constants.AnalyticalStorageTtl.Infinite; - } - - return Constants.AnalyticalStorageTtl.Disabled; - }; - const validateInputs = (): boolean => { if (!selectedSourceContainer) { setErrorMessage("Please select a source container"); @@ -257,7 +234,6 @@ export const AddGlobalSecondaryIndexPanel = (props: AddGlobalSecondaryIndexPanel ...(!databaseLevelThroughput && { autoPilotMaxThroughput: globalSecondaryIndexThroughput, }), - analyticalStorageTtl: getAnalyticalStorageTtl(), indexingPolicy: indexingPolicy, partitionKey: partitionKeyPaths, vectorEmbeddingPolicy: vectorEmbeddingPolicyFinal, @@ -369,9 +345,7 @@ export const AddGlobalSecondaryIndexPanel = (props: AddGlobalSecondaryIndexPanel isCostAknowledgedOnChange, }} /> - {shouldShowAnalyticalStoreOptions() && ( - - )} + {showVectorSearchParameters() && ( >; -} -export const AnalyticalStoreComponent = (props: AnalyticalStoreComponentProps): JSX.Element => { - const { explorer, enableAnalyticalStore, setEnableAnalyticalStore } = props; - - const onEnableAnalyticalStoreRadioButtonChange = (checked: boolean): void => { - if (checked && !enableAnalyticalStore) { - setEnableAnalyticalStore(true); - } - }; - - const onDisableAnalyticalStoreRadioButtonnChange = (checked: boolean): void => { - if (checked && enableAnalyticalStore) { - setEnableAnalyticalStore(false); - } - }; - - return ( - - - {AnalyticalStorageContent()} - - - -
- ) => { - onEnableAnalyticalStoreRadioButtonChange(event.target.checked); - }} - /> - On - - ) => { - onDisableAnalyticalStoreRadioButtonnChange(event.target.checked); - }} - /> - Off -
-
- - {!isSynapseLinkEnabled() && ( - - - Azure Synapse Link is required for creating an analytical store {getCollectionName().toLocaleLowerCase()}. - Enable Synapse Link for this Cosmos DB account.{" "} - - Learn more - - - explorer.openEnableSynapseLinkDialog()} - style={{ height: 27, width: 80 }} - styles={{ label: { fontSize: 12 } }} - /> - - )} -
- ); -}; diff --git a/src/Explorer/Panes/AddGlobalSecondaryIndexPanel/__snapshots__/AddGlobalSecondaryIndexPanel.test.tsx.snap b/src/Explorer/Panes/AddGlobalSecondaryIndexPanel/__snapshots__/AddGlobalSecondaryIndexPanel.test.tsx.snap index dcc3834b1..26b6bd74a 100644 --- a/src/Explorer/Panes/AddGlobalSecondaryIndexPanel/__snapshots__/AddGlobalSecondaryIndexPanel.test.tsx.snap +++ b/src/Explorer/Panes/AddGlobalSecondaryIndexPanel/__snapshots__/AddGlobalSecondaryIndexPanel.test.tsx.snap @@ -142,36 +142,6 @@ exports[`AddGlobalSecondaryIndexPanel render default panel 1`] = ` setIsThroughputCapExceeded={[Function]} showCollectionThroughputInput={[Function]} /> -