diff --git a/src/Explorer/Tabs/MongoShellTab/MongoShellTabComponent.tsx b/src/Explorer/Tabs/MongoShellTab/MongoShellTabComponent.tsx index d6b11b649..b9598eae2 100644 --- a/src/Explorer/Tabs/MongoShellTab/MongoShellTabComponent.tsx +++ b/src/Explorer/Tabs/MongoShellTab/MongoShellTabComponent.tsx @@ -1,4 +1,6 @@ +import { useMongoProxyEndpoint } from "Common/MongoProxyClient"; import React, { Component } from "react"; +import * as Constants from "../../../Common/Constants"; import { configContext } from "../../../ConfigContext"; import * as ViewModels from "../../../Contracts/ViewModels"; import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants"; @@ -10,6 +12,7 @@ import Explorer from "../../Explorer"; import TabsBase from "../TabsBase"; import { getMongoShellUrl } from "./getMongoShellUrl"; + //eslint-disable-next-line class MessageType { static IframeReady = "iframeready"; @@ -53,8 +56,7 @@ export default class MongoShellTabComponent extends Component< constructor(props: IMongoShellTabComponentProps) { super(props); this._logTraces = new Map(); - // this._useMongoProxyEndpoint = useMongoProxyEndpoint("legacyMongoShell"); - this._useMongoProxyEndpoint = true; + this._useMongoProxyEndpoint = useMongoProxyEndpoint("legacyMongoShell"); this.state = { url: getMongoShellUrl(this._useMongoProxyEndpoint), }; @@ -111,6 +113,12 @@ export default class MongoShellTabComponent extends Component< const resourceId = databaseAccount?.id; const accountName = databaseAccount?.name; const documentEndpoint = databaseAccount?.properties.mongoEndpoint || databaseAccount?.properties.documentEndpoint; + const mongoEndpoint = + documentEndpoint.substr( + Constants.MongoDBAccounts.protocol.length + 3, + documentEndpoint.length - + (Constants.MongoDBAccounts.protocol.length + 2 + Constants.MongoDBAccounts.defaultPort.length), + ) + Constants.MongoDBAccounts.defaultPort.toString(); const databaseId = this.props.collection.databaseId; const collectionId = this.props.collection.id(); const apiEndpoint = this._useMongoProxyEndpoint @@ -124,7 +132,7 @@ export default class MongoShellTabComponent extends Component< data: { resourceId: resourceId, accountName: accountName, - mongoEndpoint: documentEndpoint, + mongoEndpoint: this._useMongoProxyEndpoint ? documentEndpoint : mongoEndpoint, authorization: authorization, databaseId: databaseId, collectionId: collectionId, diff --git a/src/Explorer/Tabs/MongoShellTab/getMongoShellUrl.ts b/src/Explorer/Tabs/MongoShellTab/getMongoShellUrl.ts index 5c84332de..aafb8a8a3 100644 --- a/src/Explorer/Tabs/MongoShellTab/getMongoShellUrl.ts +++ b/src/Explorer/Tabs/MongoShellTab/getMongoShellUrl.ts @@ -7,5 +7,5 @@ export function getMongoShellUrl(useMongoProxyEndpoint?: boolean): string { const mongoEndpoint = account?.properties?.mongoEndpoint || account?.properties?.documentEndpoint; const queryString = `resourceId=${resourceId}&accountName=${accountName}&mongoEndpoint=${mongoEndpoint}`; - return useMongoProxyEndpoint ? `https://localhost:8080/index.html?${queryString}` : `/mongoshell/indexv2.html?${queryString}`; + return useMongoProxyEndpoint ? `https://localhost:8080/index.html?${queryString}` : `https://localhost:8080/indexv2.html?${queryString}`; }