mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 09:51:11 +00:00
WIP
This commit is contained in:
@@ -1260,16 +1260,6 @@ export default class Explorer {
|
|||||||
$("#contextSwitchPrompt").dialog("open");
|
$("#contextSwitchPrompt").dialog("open");
|
||||||
}
|
}
|
||||||
|
|
||||||
public displayConnectExplorerForm(): void {
|
|
||||||
$("#divExplorer").hide();
|
|
||||||
$("#connectExplorer").css("display", "flex");
|
|
||||||
}
|
|
||||||
|
|
||||||
public hideConnectExplorerForm(): void {
|
|
||||||
$("#connectExplorer").hide();
|
|
||||||
$("#divExplorer").show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public isReadWriteToggled: () => boolean = (): boolean => {
|
public isReadWriteToggled: () => boolean = (): boolean => {
|
||||||
return this.shareAccessToggleState() === ShareAccessToggleState.ReadWrite;
|
return this.shareAccessToggleState() === ShareAccessToggleState.ReadWrite;
|
||||||
};
|
};
|
||||||
@@ -1878,16 +1868,6 @@ export default class Explorer {
|
|||||||
subscriptionType: inputs.subscriptionType,
|
subscriptionType: inputs.subscriptionType,
|
||||||
quotaId: inputs.quotaId
|
quotaId: inputs.quotaId
|
||||||
});
|
});
|
||||||
TelemetryProcessor.traceSuccess(
|
|
||||||
Action.LoadDatabaseAccount,
|
|
||||||
{
|
|
||||||
resourceId: this.databaseAccount && this.databaseAccount().id,
|
|
||||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
|
||||||
databaseAccount: this.databaseAccount && this.databaseAccount()
|
|
||||||
},
|
|
||||||
inputs.loadDatabaseAccountTimestamp
|
|
||||||
);
|
|
||||||
|
|
||||||
this.isAccountReady(true);
|
this.isAccountReady(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
26
src/Main.tsx
26
src/Main.tsx
@@ -70,32 +70,15 @@ import hdeConnectImage from "../images/HdeConnectCosmosDB.svg";
|
|||||||
import refreshImg from "../images/refresh-cosmos.svg";
|
import refreshImg from "../images/refresh-cosmos.svg";
|
||||||
import arrowLeftImg from "../images/imgarrowlefticon.svg";
|
import arrowLeftImg from "../images/imgarrowlefticon.svg";
|
||||||
import { KOCommentEnd, KOCommentIfStart } from "./koComment";
|
import { KOCommentEnd, KOCommentIfStart } from "./koComment";
|
||||||
import { AccountKind, DefaultAccountExperience, TagNames } from "./Common/Constants";
|
|
||||||
import { updateUserContext } from "./UserContext";
|
import { updateUserContext } from "./UserContext";
|
||||||
import AuthHeadersUtil from "./Platform/Hosted/Authorization";
|
import AuthHeadersUtil from "./Platform/Hosted/Authorization";
|
||||||
import { CollectionCreation } from "./Shared/Constants";
|
import { CollectionCreation } from "./Shared/Constants";
|
||||||
import { extractFeatures } from "./Platform/Hosted/extractFeatures";
|
import { extractFeatures } from "./Platform/Hosted/extractFeatures";
|
||||||
|
import { emulatorAccount } from "./Platform/Emulator/emulatorAccount";
|
||||||
|
|
||||||
// TODO: Encapsulate and reuse all global variables as environment variables
|
// TODO: Encapsulate and reuse all global variables as environment variables
|
||||||
window.authType = AuthType.AAD;
|
window.authType = AuthType.AAD;
|
||||||
|
|
||||||
const emulatorAccount = {
|
|
||||||
name: "",
|
|
||||||
id: "",
|
|
||||||
location: "",
|
|
||||||
type: "",
|
|
||||||
kind: AccountKind.DocumentDB,
|
|
||||||
tags: {
|
|
||||||
[TagNames.defaultExperience]: DefaultAccountExperience.DocumentDB
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
documentEndpoint: "",
|
|
||||||
tableEndpoint: "",
|
|
||||||
gremlinEndpoint: "",
|
|
||||||
cassandraEndpoint: ""
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const App: React.FunctionComponent = () => {
|
const App: React.FunctionComponent = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initializeConfiguration().then(config => {
|
initializeConfiguration().then(config => {
|
||||||
@@ -114,7 +97,7 @@ const App: React.FunctionComponent = () => {
|
|||||||
const accountResourceId = account.id;
|
const accountResourceId = account.id;
|
||||||
const subscriptionId = accountResourceId && accountResourceId.split("subscriptions/")[1].split("/")[0];
|
const subscriptionId = accountResourceId && accountResourceId.split("subscriptions/")[1].split("/")[0];
|
||||||
const resourceGroup = accountResourceId && accountResourceId.split("resourceGroups/")[1].split("/")[0];
|
const resourceGroup = accountResourceId && accountResourceId.split("resourceGroups/")[1].split("/")[0];
|
||||||
const inputs: DataExplorerInputsFrame = {
|
explorer.initDataExplorerWithFrameInputs({
|
||||||
databaseAccount: account,
|
databaseAccount: account,
|
||||||
subscriptionId,
|
subscriptionId,
|
||||||
resourceGroup,
|
resourceGroup,
|
||||||
@@ -130,8 +113,7 @@ const App: React.FunctionComponent = () => {
|
|||||||
quotaId: undefined,
|
quotaId: undefined,
|
||||||
addCollectionDefaultFlight: explorer.flight(),
|
addCollectionDefaultFlight: explorer.flight(),
|
||||||
isTryCosmosDBSubscription: explorer.isTryCosmosDBSubscription()
|
isTryCosmosDBSubscription: explorer.isTryCosmosDBSubscription()
|
||||||
};
|
});
|
||||||
explorer.initDataExplorerWithFrameInputs(inputs);
|
|
||||||
explorer.isAccountReady(true);
|
explorer.isAccountReady(true);
|
||||||
}
|
}
|
||||||
} else if (config.platform === Platform.Emulator) {
|
} else if (config.platform === Platform.Emulator) {
|
||||||
@@ -154,7 +136,7 @@ const App: React.FunctionComponent = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("message", message => explorer.handleMessage(message), false);
|
window.addEventListener("message", explorer.handleMessage.bind(explorer), false);
|
||||||
}
|
}
|
||||||
applyExplorerBindings(explorer);
|
applyExplorerBindings(explorer);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
const parentParams = new URLSearchParams(window.parent.location.search);
|
|
||||||
|
|
||||||
export function extractFeatures(params?: URLSearchParams): { [key: string]: string } {
|
export function extractFeatures(params?: URLSearchParams): { [key: string]: string } {
|
||||||
params = params || parentParams;
|
params = params || new URLSearchParams(window.parent.location.search);
|
||||||
const featureParamRegex = /feature.(.*)/i;
|
const featureParamRegex = /feature.(.*)/i;
|
||||||
const features: { [key: string]: string } = {};
|
const features: { [key: string]: string } = {};
|
||||||
params.forEach((value: string, param: string) => {
|
params.forEach((value: string, param: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user