testing for legacy mongo shell

This commit is contained in:
Asier Isayas 2024-06-21 12:46:47 -04:00
parent e66c8a1b5c
commit 13df1e8da0
7 changed files with 25 additions and 24 deletions

View File

@ -20,6 +20,7 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => {
if (userContext.features.enableAadDataPlane && userContext.aadToken) {
const AUTH_PREFIX = `type=aad&ver=1.0&sig=`;
const authorizationToken = `${AUTH_PREFIX}${userContext.aadToken}`;
console.log(authorizationToken)
return authorizationToken;
}

View File

@ -70,7 +70,7 @@ export function queryDocuments(
if (!useMongoProxyEndpoint("resourcelist") || !useMongoProxyEndpoint("queryDocuments")) {
return queryDocuments_ToBeDeprecated(databaseId, collection, isResourceList, query, continuationToken);
}
console.log(configContext.MONGO_PROXY_ENDPOINT)
const { databaseAccount } = userContext;
const resourceEndpoint = databaseAccount.properties.mongoEndpoint || databaseAccount.properties.documentEndpoint;
const params = {

View File

@ -107,7 +107,7 @@ let configContext: Readonly<ConfigContext> = {
JUNO_ENDPOINT: JunoEndpoints.Prod,
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
PORTAL_BACKEND_ENDPOINT: PortalBackendEndpoints.Prod,
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Prod,
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Local,
NEW_MONGO_APIS: [
"resourcelist",
"queryDocuments",
@ -200,7 +200,7 @@ if (process.env.NODE_ENV === "development") {
PROXY_PATH: "/proxy",
EMULATOR_ENDPOINT: "https://localhost:8081",
PORTAL_BACKEND_ENDPOINT: PortalBackendEndpoints.Mpac,
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Mpac,
// MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Mpac,
CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Mpac,
});
}
@ -255,3 +255,4 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
}
export { configContext };

View File

@ -1,5 +1,4 @@
import { Link } from "@fluentui/react/lib/Link";
import { isPublicInternetAccessAllowed } from "Common/DatabaseAccountUtility";
import { sendMessage } from "Common/MessageHandler";
import { Platform, configContext } from "ConfigContext";
import { MessageTypes } from "Contracts/ExplorerContracts";
@ -1124,7 +1123,7 @@ export default class Explorer {
useNotebook.getState().setIsNotebookEnabled(isNotebookEnabled);
useNotebook
.getState()
.setIsShellEnabled(useNotebook.getState().isPhoenixFeatures && isPublicInternetAccessAllowed());
.setIsShellEnabled(false);
TelemetryProcessor.trace(Action.NotebookEnabled, ActionModifiers.Mark, {
isNotebookEnabled,

View File

@ -1,4 +1,3 @@
import { useMongoProxyEndpoint } from "Common/MongoProxyClient";
import React, { Component } from "react";
import * as Constants from "../../../Common/Constants";
import { configContext } from "../../../ConfigContext";
@ -55,8 +54,8 @@ export default class MongoShellTabComponent extends Component<
constructor(props: IMongoShellTabComponentProps) {
super(props);
this._logTraces = new Map();
this._useMongoProxyEndpoint = useMongoProxyEndpoint("legacyMongoShell");
// this._useMongoProxyEndpoint = useMongoProxyEndpoint("legacyMongoShell");
this._useMongoProxyEndpoint = true;
this.state = {
url: getMongoShellUrl(this._useMongoProxyEndpoint),
};
@ -140,7 +139,7 @@ export default class MongoShellTabComponent extends Component<
apiEndpoint: apiEndpoint,
},
},
window.origin,
"https://localhost:8080",
);
}

View File

@ -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 ? `/mongoshell/index.html?${queryString}` : `/mongoshell/indexv2.html?${queryString}`;
return useMongoProxyEndpoint ? `https://localhost:8080/index.html?${queryString}` : `/mongoshell/indexv2.html?${queryString}`;
}

View File

@ -5,20 +5,21 @@ export function isInvalidParentFrameOrigin(event: MessageEvent): boolean {
}
function isValidOrigin(allowedOrigins: ReadonlyArray<string>, event: MessageEvent): boolean {
const eventOrigin = (event && event.origin) || "";
const windowOrigin = (window && window.origin) || "";
if (eventOrigin === windowOrigin) {
return true;
}
return true;
// const eventOrigin = (event && event.origin) || "";
// const windowOrigin = (window && window.origin) || "";
// if (eventOrigin === windowOrigin) {
// return true;
// }
for (const origin of allowedOrigins) {
const result = new RegExp(origin).test(eventOrigin);
if (result) {
return true;
}
}
console.error(`Invalid parent frame origin detected: ${eventOrigin}`);
return false;
// for (const origin of allowedOrigins) {
// const result = new RegExp(origin).test(eventOrigin);
// if (result) {
// return true;
// }
// }
// console.error(`Invalid parent frame origin detected: ${eventOrigin}`);
// return false;
}
export function shouldProcessMessage(event: MessageEvent): boolean {