diff --git a/src/Common/CosmosClient.ts b/src/Common/CosmosClient.ts index 80201e290..bd277cd76 100644 --- a/src/Common/CosmosClient.ts +++ b/src/Common/CosmosClient.ts @@ -33,14 +33,14 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => { return authorizationToken; } - if ((userContext.dataPlaneRbacEnabled) && userContext.authorizationToken) { - console.log(` Getting Portal Auth token `) + if (userContext.dataPlaneRbacEnabled && userContext.authorizationToken) { + console.log(` Getting Portal Auth token `); const AUTH_PREFIX = `type=aad&ver=1.0&sig=`; const authorizationToken = `${AUTH_PREFIX}${userContext.authorizationToken}`; console.log(`Returning Portal Auth token`); return authorizationToken; } - + if (configContext.platform === Platform.Emulator) { // TODO This SDK method mutates the headers object. Find a better one or fix the SDK. await Cosmos.setAuthorizationTokenHeaderUsingMasterKey(verb, resourceId, resourceType, headers, EmulatorMasterKey); diff --git a/src/Common/MongoProxyClient.ts b/src/Common/MongoProxyClient.ts index 860be2bee..d9aa0fb4c 100644 --- a/src/Common/MongoProxyClient.ts +++ b/src/Common/MongoProxyClient.ts @@ -710,4 +710,3 @@ async function errorHandling(response: Response, action: string, params: unknown export function getARMCreateCollectionEndpoint(params: DataModels.MongoParameters): string { return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/mongodbDatabases/${params.db}/collections/${params.coll}`; } - diff --git a/src/Explorer/Tables/TableDataClient.ts b/src/Explorer/Tables/TableDataClient.ts index e40ddef6f..c818bf394 100644 --- a/src/Explorer/Tables/TableDataClient.ts +++ b/src/Explorer/Tables/TableDataClient.ts @@ -759,18 +759,18 @@ export class CassandraAPIDataClient extends TableDataClient { configContext.CASSANDRA_PROXY_ENDPOINT !== CassandraProxyEndpoints.Development && userContext.databaseAccount.properties.ipRules?.length > 0 ) { - if ( - configContext.CASSANDRA_PROXY_ENDPOINT !== CassandraProxyEndpoints.Development && - userContext.databaseAccount.properties.ipRules?.length > 0 - ) { - canAccessCassandraProxy = canAccessCassandraProxy && configContext.CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED; - } + if ( + configContext.CASSANDRA_PROXY_ENDPOINT !== CassandraProxyEndpoints.Development && + userContext.databaseAccount.properties.ipRules?.length > 0 + ) { + canAccessCassandraProxy = canAccessCassandraProxy && configContext.CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED; + } - return ( - canAccessCassandraProxy && - configContext.NEW_CASSANDRA_APIS?.includes(api) && - activeCassandraProxyEndpoints.includes(configContext.CASSANDRA_PROXY_ENDPOINT) - ); + return ( + canAccessCassandraProxy && + configContext.NEW_CASSANDRA_APIS?.includes(api) && + activeCassandraProxyEndpoints.includes(configContext.CASSANDRA_PROXY_ENDPOINT) + ); + } } } -} diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index 42247f72c..53273f754 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -440,8 +440,7 @@ async function configurePortal(): Promise { updateUserContext({ authType: AuthType.AAD, }); - - + let explorer: Explorer; return new Promise(async (resolve) => { // In development mode, try to load the iframe message from session storage. @@ -457,7 +456,6 @@ async function configurePortal(): Promise { 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") { @@ -481,7 +479,7 @@ async function configurePortal(): Promise { // Check for init message const message: PortalMessage = event.data?.data; - const inputs = message?.inputs; + const inputs = message?.inputs; const openAction = message?.openAction; if (inputs) { if ( @@ -523,7 +521,9 @@ async function configurePortal(): Promise { useDataPlaneRbac.setState({ dataPlaneRbacEnabled: dataPlaneRbacEnabled }); } } else { - await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name); + if (userContext.apiType !== "Postgres" && userContext.apiType !== "VCoreMongo") { + await listKeys(subscriptionId, resourceGroup, account.name); + } } explorer = new Explorer(); @@ -553,11 +553,9 @@ async function configurePortal(): Promise { }, false, ); - + sendReadyMessage(); - }); - } function shouldForwardMessage(message: PortalMessage, messageOrigin: string) {