From 192a27513977b72132576b3be03ca13ecc2d8f9d Mon Sep 17 00:00:00 2001 From: Senthamil Sindhu Date: Tue, 25 Jun 2024 12:09:43 -0700 Subject: [PATCH] Remove unnecessary code --- src/Explorer/Explorer.tsx | 2 +- src/Explorer/Panes/SettingsPane/SettingsPane.tsx | 1 - src/Platform/Hosted/extractFeatures.ts | 2 -- src/Shared/StorageUtility.ts | 2 -- src/hooks/useKnockoutExplorer.ts | 11 +++++------ 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx index 6ebdae241..fbed19ba0 100644 --- a/src/Explorer/Explorer.tsx +++ b/src/Explorer/Explorer.tsx @@ -205,7 +205,7 @@ export default class Explorer { this.refreshNotebookList(); } - public async openEnableSynapseLinkDialog(): Promise { + public openEnableSynapseLinkDialog(): void { const addSynapseLinkDialogProps: DialogProps = { linkProps: { linkText: "Learn more", diff --git a/src/Explorer/Panes/SettingsPane/SettingsPane.tsx b/src/Explorer/Panes/SettingsPane/SettingsPane.tsx index 7e9d2e48f..96c2d6f20 100644 --- a/src/Explorer/Panes/SettingsPane/SettingsPane.tsx +++ b/src/Explorer/Panes/SettingsPane/SettingsPane.tsx @@ -115,7 +115,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({ const [copilotSampleDBEnabled, setCopilotSampleDBEnabled] = useState( LocalStorageUtility.getEntryString(StorageKey.CopilotSampleDBEnabled) === "true", ); - const explorerVersion = configContext.gitSha; const shouldShowQueryPageOptions = userContext.apiType === "SQL"; const shouldShowGraphAutoVizOption = userContext.apiType === "Gremlin"; diff --git a/src/Platform/Hosted/extractFeatures.ts b/src/Platform/Hosted/extractFeatures.ts index 28723e475..5bd84516e 100644 --- a/src/Platform/Hosted/extractFeatures.ts +++ b/src/Platform/Hosted/extractFeatures.ts @@ -14,7 +14,6 @@ export type Features = { readonly enableTtl: boolean; readonly executeSproc: boolean; readonly enableAadDataPlane: boolean; - readonly enableDataPlaneRbac: boolean; readonly enableResourceGraph: boolean; readonly enableKoResourceTree: boolean; readonly hostedDataExplorer: boolean; @@ -70,7 +69,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear canExceedMaximumValue: "true" === get("canexceedmaximumvalue"), cosmosdb: "true" === get("cosmosdb"), enableAadDataPlane: "true" === get("enableaaddataplane"), - enableDataPlaneRbac: "true" === get("enabledataplanerbac"), enableResourceGraph: "true" === get("enableresourcegraph"), enableChangeFeedPolicy: "true" === get("enablechangefeedpolicy"), enableFixedCollectionWithSharedThroughput: "true" === get("enablefixedcollectionwithsharedthroughput"), diff --git a/src/Shared/StorageUtility.ts b/src/Shared/StorageUtility.ts index 6cf5fa47d..f2ca1f20b 100644 --- a/src/Shared/StorageUtility.ts +++ b/src/Shared/StorageUtility.ts @@ -7,8 +7,6 @@ export { LocalStorageUtility, SessionStorageUtility }; export enum StorageKey { ActualItemPerPage, DataPlaneRbacEnabled, - DataPlaneRbacDisabled, - isDataPlaneRbacAutomatic, RUThresholdEnabled, RUThreshold, QueryTimeoutEnabled, diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index 9aef090e8..d6ed37a8c 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -255,7 +255,6 @@ async function configureHostedWithAAD(config: AAD): Promise { const subscriptionId = accountResourceId && accountResourceId.split("subscriptions/")[1].split("/")[0]; const resourceGroup = accountResourceId && accountResourceId.split("resourceGroups/")[1].split("/")[0]; let aadToken; - const keys: DatabaseAccountListKeysResult = {}; if (account.properties?.documentEndpoint) { const hrefEndpoint = new URL(account.properties.documentEndpoint).href.replace(/\/$/, "/.default"); const msalInstance = await getMsalInstance(); @@ -273,6 +272,10 @@ async function configureHostedWithAAD(config: AAD): Promise { } } try { + updateUserContext({ + databaseAccount: config.databaseAccount + }); + if (userContext.apiType === "SQL") { if (LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) { const isDataPlaneRbacSetting = LocalStorageUtility.getEntryString(StorageKey.DataPlaneRbacEnabled); @@ -302,9 +305,7 @@ async function configureHostedWithAAD(config: AAD): Promise { updateUserContext({ subscriptionId, resourceGroup, - aadToken, - databaseAccount: config.databaseAccount, - masterKey: keys.primaryMasterKey, + aadToken }); const explorer = new Explorer(); return explorer; @@ -412,7 +413,6 @@ async function configurePortal(): Promise { updateUserContext({ authType: AuthType.AAD, }); - let explorer: Explorer; return new Promise((resolve) => { // In development mode, try to load the iframe message from session storage. @@ -427,7 +427,6 @@ async function configurePortal(): Promise { console.dir(message); updateContextsFromPortalMessage(message); explorer = new Explorer(); - // In development mode, save the iframe message from the portal in session storage. // This allows webpack hot reload to funciton properly if (process.env.NODE_ENV === "development") {