Remove window.dataExplorerPlatform (#279)

More cleanup for #253 
- Remove window.dataExplorerPlatform
- Remove explorer factories
This commit is contained in:
Steve Faulkner
2020-10-14 22:25:13 -05:00
committed by GitHub
parent 39f7ef331a
commit 821f665e78
25 changed files with 63 additions and 143 deletions

View File

@@ -13,7 +13,6 @@ import SaveIcon from "../../../images/save-cosmos.svg";
import TabsBase from "./TabsBase";
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
import { PlatformType } from "../../PlatformType";
import { RequestOptions } from "@azure/cosmos/dist-esm";
import Explorer from "../Explorer";
import { updateOffer } from "../../Common/dataAccess/updateOffer";
@@ -200,16 +199,14 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels.
return configContext.platform !== Platform.Emulator;
});
this.shouldDisplayPortalUsePrompt = ko.pureComputed<boolean>(
() => this.container.getPlatformType() === PlatformType.Hosted
);
this.shouldDisplayPortalUsePrompt = ko.pureComputed<boolean>(() => configContext.platform === Platform.Hosted);
this.canThroughputExceedMaximumValue = ko.pureComputed<boolean>(
() => this.container.getPlatformType() === PlatformType.Portal && !this.container.isRunningOnNationalCloud()
() => configContext.platform === Platform.Portal && !this.container.isRunningOnNationalCloud()
);
this.canRequestSupport = ko.pureComputed(() => {
if (
configContext.platform === Platform.Emulator ||
this.container.getPlatformType() === PlatformType.Hosted ||
configContext.platform === Platform.Hosted ||
this.canThroughputExceedMaximumValue()
) {
return false;
@@ -273,7 +270,7 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels.
});
this.maxRUThroughputInputLimit = ko.pureComputed<number>(() => {
if (this.container && this.container.getPlatformType() === PlatformType.Hosted) {
if (configContext.platform === Platform.Hosted) {
return SharedConstants.CollectionCreation.DefaultCollectionRUs1Million;
}

View File

@@ -10,10 +10,9 @@ import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstan
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
import { HashMap } from "../../Common/HashMap";
import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
import { PlatformType } from "../../PlatformType";
import Explorer from "../Explorer";
import { userContext } from "../../UserContext";
import { configContext } from "../../ConfigContext";
import { configContext, Platform } from "../../ConfigContext";
export default class MongoShellTab extends TabsBase {
public url: ko.Computed<string>;
@@ -31,7 +30,7 @@ export default class MongoShellTab extends TabsBase {
const accountName = account && account.name;
const mongoEndpoint = account && (account.properties.mongoEndpoint || account.properties.documentEndpoint);
this._runtimeEndpoint = window.dataExplorerPlatform === PlatformType.Hosted ? configContext.BACKEND_ENDPOINT : "";
this._runtimeEndpoint = configContext.platform === Platform.Hosted ? configContext.BACKEND_ENDPOINT : "";
const extensionEndpoint: string = configContext.BACKEND_ENDPOINT || this._runtimeEndpoint || "";
let baseUrl = "/content/mongoshell/dist/";
if (this._container.serverId() === "localhost") {

View File

@@ -14,7 +14,6 @@ import SaveIcon from "../../../images/save-cosmos.svg";
import TabsBase from "./TabsBase";
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
import { PlatformType } from "../../PlatformType";
import { RequestOptions } from "@azure/cosmos/dist-esm";
import Explorer from "../Explorer";
import { updateOffer } from "../../Common/dataAccess/updateOffer";
@@ -494,7 +493,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
this.canThroughputExceedMaximumValue = ko.pureComputed<boolean>(() => {
const isPublicAzurePortal: boolean =
this.container.getPlatformType() === PlatformType.Portal && !this.container.isRunningOnNationalCloud();
configContext.platform === Platform.Portal && !this.container.isRunningOnNationalCloud();
const hasPartitionKey = !!this.collection.partitionKey;
return isPublicAzurePortal && hasPartitionKey;
@@ -513,7 +512,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
return false;
}
if (this.container.getPlatformType() === PlatformType.Hosted) {
if (configContext.platform === Platform.Hosted) {
return false;
}
@@ -526,7 +525,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
});
this.shouldDisplayPortalUsePrompt = ko.pureComputed<boolean>(
() => this.container.getPlatformType() === PlatformType.Hosted && !!this.collection.partitionKey
() => configContext.platform === Platform.Hosted && !!this.collection.partitionKey
);
this.minRUs = ko.computed<number>(() => {
@@ -597,7 +596,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
});
this.maxRUThroughputInputLimit = ko.pureComputed<number>(() => {
if (this.container && this.container.getPlatformType() === PlatformType.Hosted && this.collection.partitionKey) {
if (configContext.platform === Platform.Hosted && this.collection.partitionKey) {
return SharedConstants.CollectionCreation.DefaultCollectionRUs1Million;
}