From 14cdf19efbac6c173c936f9fc8e36ee20c5bb881 Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Fri, 9 Oct 2020 11:18:50 -0500 Subject: [PATCH] Remove Explorer.isEmulator (#256) --- .../Controls/Settings/SettingsComponent.test.tsx | 6 ++---- .../SettingsSubComponents/ScaleComponent.test.tsx | 6 ++---- .../SettingsSubComponents/ScaleComponent.tsx | 3 ++- .../SubSettingsComponent.test.tsx | 3 +-- src/Explorer/Controls/Settings/TestUtils.tsx | 3 +-- .../__snapshots__/SettingsComponent.test.tsx.snap | 4 ---- src/Explorer/Explorer.ts | 3 --- .../CommandBar/CommandBarComponentButtonFactory.ts | 2 +- src/Explorer/Panes/AddCollectionPane.test.ts | 2 +- src/Explorer/Panes/AddCollectionPane.ts | 4 ++-- src/Explorer/Panes/AddDatabasePane.test.ts | 3 +-- src/Explorer/Panes/AddDatabasePane.ts | 5 +++-- src/Explorer/Panes/CassandraAddCollectionPane.ts | 5 +++-- .../Panes/DeleteCollectionConfirmationPane.test.ts | 4 ++-- .../Panes/DeleteDatabaseConfirmationPane.test.ts | 2 +- src/Explorer/Panes/SettingsPane.test.ts | 2 +- src/Explorer/Tabs/DatabaseSettingsTab.ts | 5 +++-- src/Explorer/Tabs/DocumentsTab.test.ts | 6 ++---- src/Explorer/Tabs/QueryTab.test.ts | 4 ++-- src/Explorer/Tabs/SettingsTab.test.ts | 12 +++++------- src/Explorer/Tabs/SettingsTab.ts | 12 +++++++----- src/Explorer/Tabs/TabsManager.test.ts | 2 +- src/Platform/Emulator/ExplorerFactory.ts | 3 +-- src/Platform/Hosted/ExplorerFactory.ts | 3 +-- src/Platform/Portal/ExplorerFactory.ts | 3 +-- src/RouteHandlers/TabRouteHandler.test.ts | 3 +-- 26 files changed, 47 insertions(+), 63 deletions(-) diff --git a/src/Explorer/Controls/Settings/SettingsComponent.test.tsx b/src/Explorer/Controls/Settings/SettingsComponent.test.tsx index f43a00105..0520ea843 100644 --- a/src/Explorer/Controls/Settings/SettingsComponent.test.tsx +++ b/src/Explorer/Controls/Settings/SettingsComponent.test.tsx @@ -104,8 +104,7 @@ describe("SettingsComponent", () => { expect(settingsComponentInstance.shouldShowKeyspaceSharedThroughputMessage()).toEqual(false); const newContainer = new Explorer({ - notificationsClient: undefined, - isEmulator: false + notificationsClient: undefined }); newContainer.isPreferredApiCassandra = ko.computed(() => true); @@ -148,8 +147,7 @@ describe("SettingsComponent", () => { expect(settingsComponentInstance.hasConflictResolution()).toEqual(undefined); const newContainer = new Explorer({ - notificationsClient: undefined, - isEmulator: false + notificationsClient: undefined }); newContainer.databaseAccount = ko.observable({ id: undefined, diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.test.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.test.tsx index aefe7b69b..2ea1553fb 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.test.tsx +++ b/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.test.tsx @@ -13,8 +13,7 @@ import ko from "knockout"; describe("ScaleComponent", () => { const nonNationalCloudContainer = new Explorer({ - notificationsClient: undefined, - isEmulator: false + notificationsClient: undefined }); nonNationalCloudContainer.getPlatformType = () => PlatformType.Portal; nonNationalCloudContainer.isRunningOnNationalCloud = () => false; @@ -89,8 +88,7 @@ describe("ScaleComponent", () => { it("autoScale enabled", () => { const newContainer = new Explorer({ - notificationsClient: undefined, - isEmulator: false + notificationsClient: undefined }); newContainer.databaseAccount({ diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.tsx index fcbeeccb1..326a74fb7 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.tsx +++ b/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.tsx @@ -19,6 +19,7 @@ import { import { getMaxRUs, getMinRUs, hasDatabaseSharedThroughput } from "../SettingsUtils"; import * as AutoPilotUtils from "../../../../Utils/AutoPilotUtils"; import { Text, TextField, Stack, Label, MessageBar, MessageBarType } from "office-ui-fabric-react"; +import { configContext, Platform } from "../../../../ConfigContext"; export interface ScaleComponentProps { collection: ViewModels.Collection; @@ -43,7 +44,7 @@ export class ScaleComponent extends React.Component { private isEmulator: boolean; constructor(props: ScaleComponentProps) { super(props); - this.isEmulator = this.props.container.isEmulator; + this.isEmulator = configContext.platform === Platform.Emulator; } public isAutoScaleEnabled = (): boolean => { diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/SubSettingsComponent.test.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/SubSettingsComponent.test.tsx index 4793edbdb..487f18143 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/SubSettingsComponent.test.tsx +++ b/src/Explorer/Controls/Settings/SettingsSubComponents/SubSettingsComponent.test.tsx @@ -106,8 +106,7 @@ describe("SubSettingsComponent", () => { it("partitionKey not visible", () => { const newContainer = new Explorer({ - notificationsClient: undefined, - isEmulator: false + notificationsClient: undefined }); newContainer.isPreferredApiCassandra = ko.computed(() => true); diff --git a/src/Explorer/Controls/Settings/TestUtils.tsx b/src/Explorer/Controls/Settings/TestUtils.tsx index 8ab83090b..f3ba7e553 100644 --- a/src/Explorer/Controls/Settings/TestUtils.tsx +++ b/src/Explorer/Controls/Settings/TestUtils.tsx @@ -4,8 +4,7 @@ import Explorer from "../../Explorer"; import ko from "knockout"; export const container = new Explorer({ - notificationsClient: undefined, - isEmulator: false + notificationsClient: undefined }); export const collection = ({ diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap index 37746400b..939bfd917 100644 --- a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap +++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap @@ -982,7 +982,6 @@ exports[`SettingsComponent renders 1`] = ` "isAuthWithResourceToken": [Function], "isCodeOfConductEnabled": [Function], "isCopyNotebookPaneEnabled": [Function], - "isEmulator": false, "isEnableMongoCapabilityPresent": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isGalleryPublishEnabled": [Function], @@ -2296,7 +2295,6 @@ exports[`SettingsComponent renders 1`] = ` "isAuthWithResourceToken": [Function], "isCodeOfConductEnabled": [Function], "isCopyNotebookPaneEnabled": [Function], - "isEmulator": false, "isEnableMongoCapabilityPresent": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isGalleryPublishEnabled": [Function], @@ -3623,7 +3621,6 @@ exports[`SettingsComponent renders 1`] = ` "isAuthWithResourceToken": [Function], "isCodeOfConductEnabled": [Function], "isCopyNotebookPaneEnabled": [Function], - "isEmulator": false, "isEnableMongoCapabilityPresent": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isGalleryPublishEnabled": [Function], @@ -4937,7 +4934,6 @@ exports[`SettingsComponent renders 1`] = ` "isAuthWithResourceToken": [Function], "isCodeOfConductEnabled": [Function], "isCopyNotebookPaneEnabled": [Function], - "isEmulator": false, "isEnableMongoCapabilityPresent": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isGalleryPublishEnabled": [Function], diff --git a/src/Explorer/Explorer.ts b/src/Explorer/Explorer.ts index e98526700..d0ea13ec7 100644 --- a/src/Explorer/Explorer.ts +++ b/src/Explorer/Explorer.ts @@ -100,7 +100,6 @@ enum ShareAccessToggleState { interface ExplorerOptions { notificationsClient: NotificationsClientBase; - isEmulator: boolean; } interface AdHocAccessData { readWriteUrl: string; @@ -135,7 +134,6 @@ export default class Explorer { public isFixedCollectionWithSharedThroughputSupported: ko.Computed; public isEnableMongoCapabilityPresent: ko.Computed; public isServerlessEnabled: ko.Computed; - public isEmulator: boolean; public isAccountReady: ko.Observable; public canSaveQueries: ko.Computed; public features: ko.Observable; @@ -378,7 +376,6 @@ export default class Explorer { }); this.memoryUsageInfo = ko.observable(); this.notificationsClient = options.notificationsClient; - this.isEmulator = options.isEmulator; this.features = ko.observable(); this.serverId = ko.observable(); diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts index 1aaa46170..3fcc4b853 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts @@ -194,7 +194,7 @@ export class CommandBarComponentButtonFactory { buttons.push(fullScreenButton); } - if (!container.hasOwnProperty("isEmulator") || !container.isEmulator) { + if (configContext.platform !== Platform.Emulator) { const label = "Feedback"; const feedbackButtonOptions: CommandButtonComponentProps = { iconSrc: FeedbackIcon, diff --git a/src/Explorer/Panes/AddCollectionPane.test.ts b/src/Explorer/Panes/AddCollectionPane.test.ts index f156540d2..bc2489a44 100644 --- a/src/Explorer/Panes/AddCollectionPane.test.ts +++ b/src/Explorer/Panes/AddCollectionPane.test.ts @@ -40,7 +40,7 @@ describe("Add Collection Pane", () => { }; beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); explorer.hasAutoPilotV2FeatureFlag = ko.computed(() => true); }); diff --git a/src/Explorer/Panes/AddCollectionPane.ts b/src/Explorer/Panes/AddCollectionPane.ts index be4520912..d2b3f6d24 100644 --- a/src/Explorer/Panes/AddCollectionPane.ts +++ b/src/Explorer/Panes/AddCollectionPane.ts @@ -327,7 +327,7 @@ export default class AddCollectionPane extends ContextualPaneBase { this.canRequestSupport = ko.pureComputed(() => { if ( - !this.container.isEmulator && + configContext.platform !== Platform.Emulator && !this.container.isTryCosmosDBSubscription() && this.container.getPlatformType() !== PlatformType.Portal ) { @@ -339,7 +339,7 @@ export default class AddCollectionPane extends ContextualPaneBase { }); this.costsVisible = ko.pureComputed(() => { - return !this.container.isEmulator; + return configContext.platform !== Platform.Emulator; }); this.maxCollectionsReached = ko.computed(() => { diff --git a/src/Explorer/Panes/AddDatabasePane.test.ts b/src/Explorer/Panes/AddDatabasePane.test.ts index 58f123b5a..5b9d26536 100644 --- a/src/Explorer/Panes/AddDatabasePane.test.ts +++ b/src/Explorer/Panes/AddDatabasePane.test.ts @@ -41,8 +41,7 @@ describe("Add Database Pane", () => { beforeEach(() => { explorer = new Explorer({ - notificationsClient: null, - isEmulator: false + notificationsClient: null }); }); diff --git a/src/Explorer/Panes/AddDatabasePane.ts b/src/Explorer/Panes/AddDatabasePane.ts index f392b0120..bc465022b 100644 --- a/src/Explorer/Panes/AddDatabasePane.ts +++ b/src/Explorer/Panes/AddDatabasePane.ts @@ -12,6 +12,7 @@ import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstan import { ContextualPaneBase } from "./ContextualPaneBase"; import { createDatabase } from "../../Common/dataAccess/createDatabase"; import { PlatformType } from "../../PlatformType"; +import { configContext, Platform } from "../../ConfigContext"; export default class AddDatabasePane extends ContextualPaneBase { public defaultExperience: ko.Computed; @@ -180,7 +181,7 @@ export default class AddDatabasePane extends ContextualPaneBase { this.canRequestSupport = ko.pureComputed(() => { if ( - !this.container.isEmulator && + configContext.platform !== Platform.Emulator && !this.container.isTryCosmosDBSubscription() && this.container.getPlatformType() !== PlatformType.Portal ) { @@ -203,7 +204,7 @@ export default class AddDatabasePane extends ContextualPaneBase { }); this.costsVisible = ko.pureComputed(() => { - return !this.container.isEmulator; + return configContext.platform !== Platform.Emulator; }); this.throughputSpendAckVisible = ko.pureComputed(() => { diff --git a/src/Explorer/Panes/CassandraAddCollectionPane.ts b/src/Explorer/Panes/CassandraAddCollectionPane.ts index 3e0142295..4756d14b4 100644 --- a/src/Explorer/Panes/CassandraAddCollectionPane.ts +++ b/src/Explorer/Panes/CassandraAddCollectionPane.ts @@ -12,6 +12,7 @@ import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstan import { CassandraAPIDataClient } from "../Tables/TableDataClient"; import { ContextualPaneBase } from "./ContextualPaneBase"; import { HashMap } from "../../Common/HashMap"; +import { configContext, Platform } from "../../ConfigContext"; export default class CassandraAddCollectionPane extends ContextualPaneBase { public createTableQuery: ko.Observable; @@ -231,11 +232,11 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { }); this.costsVisible = ko.pureComputed(() => { - return !this.container.isEmulator; + return configContext.platform !== Platform.Emulator; }); this.canRequestSupport = ko.pureComputed(() => { - if (!this.container.isEmulator && !this.container.isTryCosmosDBSubscription()) { + if (configContext.platform !== Platform.Emulator && !this.container.isTryCosmosDBSubscription()) { const offerThroughput: number = this.throughput(); return offerThroughput <= 100000; } diff --git a/src/Explorer/Panes/DeleteCollectionConfirmationPane.test.ts b/src/Explorer/Panes/DeleteCollectionConfirmationPane.test.ts index 5e7f46613..813c0fc30 100644 --- a/src/Explorer/Panes/DeleteCollectionConfirmationPane.test.ts +++ b/src/Explorer/Panes/DeleteCollectionConfirmationPane.test.ts @@ -17,7 +17,7 @@ describe("Delete Collection Confirmation Pane", () => { let explorer: Explorer; beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); }); it("should be true if 1 database and 1 collection", () => { @@ -56,7 +56,7 @@ describe("Delete Collection Confirmation Pane", () => { describe("shouldRecordFeedback()", () => { it("should return true if last collection and database does not have shared throughput else false", () => { - let fakeExplorer = new Explorer({ notificationsClient: null, isEmulator: false }); + let fakeExplorer = new Explorer({ notificationsClient: null }); fakeExplorer.isNotificationConsoleExpanded = ko.observable(false); fakeExplorer.refreshAllDatabases = () => Q.resolve(); diff --git a/src/Explorer/Panes/DeleteDatabaseConfirmationPane.test.ts b/src/Explorer/Panes/DeleteDatabaseConfirmationPane.test.ts index b5299a9ec..b971c983a 100644 --- a/src/Explorer/Panes/DeleteDatabaseConfirmationPane.test.ts +++ b/src/Explorer/Panes/DeleteDatabaseConfirmationPane.test.ts @@ -22,7 +22,7 @@ describe("Delete Database Confirmation Pane", () => { }); beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); }); it("should be true if only 1 database", () => { diff --git a/src/Explorer/Panes/SettingsPane.test.ts b/src/Explorer/Panes/SettingsPane.test.ts index f9f167372..dd632d84a 100644 --- a/src/Explorer/Panes/SettingsPane.test.ts +++ b/src/Explorer/Panes/SettingsPane.test.ts @@ -7,7 +7,7 @@ describe("Settings Pane", () => { let explorer: Explorer; beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); }); it("should be true for SQL API", () => { diff --git a/src/Explorer/Tabs/DatabaseSettingsTab.ts b/src/Explorer/Tabs/DatabaseSettingsTab.ts index 72595f710..49b67b689 100644 --- a/src/Explorer/Tabs/DatabaseSettingsTab.ts +++ b/src/Explorer/Tabs/DatabaseSettingsTab.ts @@ -20,6 +20,7 @@ import { updateOffer } from "../../Common/dataAccess/updateOffer"; import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent"; import { userContext } from "../../UserContext"; import { updateOfferThroughputBeyondLimit } from "../../Common/dataAccess/updateOfferThroughputBeyondLimit"; +import { configContext, Platform } from "../../ConfigContext"; const updateThroughputBeyondLimitWarningMessage: string = ` You are about to request an increase in throughput beyond the pre-allocated capacity. @@ -196,7 +197,7 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. }); this.costsVisible = ko.computed(() => { - return !this.container.isEmulator; + return configContext.platform !== Platform.Emulator; }); this.shouldDisplayPortalUsePrompt = ko.pureComputed( @@ -207,7 +208,7 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. ); this.canRequestSupport = ko.pureComputed(() => { if ( - !!this.container.isEmulator || + configContext.platform === Platform.Emulator || this.container.getPlatformType() === PlatformType.Hosted || this.canThroughputExceedMaximumValue() ) { diff --git a/src/Explorer/Tabs/DocumentsTab.test.ts b/src/Explorer/Tabs/DocumentsTab.test.ts index 51753969f..2e70a0825 100644 --- a/src/Explorer/Tabs/DocumentsTab.test.ts +++ b/src/Explorer/Tabs/DocumentsTab.test.ts @@ -28,13 +28,11 @@ describe("Documents tab", () => { describe("showPartitionKey", () => { const explorer = new Explorer({ - notificationsClient: null, - isEmulator: false + notificationsClient: null }); const mongoExplorer = new Explorer({ - notificationsClient: null, - isEmulator: false + notificationsClient: null }); mongoExplorer.defaultExperience(Constants.DefaultAccountExperience.MongoDB); diff --git a/src/Explorer/Tabs/QueryTab.test.ts b/src/Explorer/Tabs/QueryTab.test.ts index d63eb25c2..d2476d526 100644 --- a/src/Explorer/Tabs/QueryTab.test.ts +++ b/src/Explorer/Tabs/QueryTab.test.ts @@ -49,7 +49,7 @@ describe("Query Tab", () => { let explorer: Explorer; beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); }); it("should be true for accounts using SQL API", () => { @@ -69,7 +69,7 @@ describe("Query Tab", () => { let explorer: Explorer; beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); }); it("should be visible when using a supported API", () => { diff --git a/src/Explorer/Tabs/SettingsTab.test.ts b/src/Explorer/Tabs/SettingsTab.test.ts index c17a21968..e106ce58a 100644 --- a/src/Explorer/Tabs/SettingsTab.test.ts +++ b/src/Explorer/Tabs/SettingsTab.test.ts @@ -79,7 +79,7 @@ describe("Settings tab", () => { }; beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); explorer.hasAutoPilotV2FeatureFlag = ko.computed(() => true); }); @@ -178,7 +178,7 @@ describe("Settings tab", () => { let explorer: Explorer; beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); explorer.hasAutoPilotV2FeatureFlag = ko.computed(() => true); }); @@ -256,7 +256,7 @@ describe("Settings tab", () => { let explorer: Explorer; beforeEach(() => { - explorer = new Explorer({ notificationsClient: null, isEmulator: false }); + explorer = new Explorer({ notificationsClient: null }); explorer.hasAutoPilotV2FeatureFlag = ko.computed(() => true); }); @@ -338,8 +338,7 @@ describe("Settings tab", () => { function getCollection(defaultApi: string, partitionKeyOption: PartitionKeyOption) { const explorer = new Explorer({ - notificationsClient: null, - isEmulator: false + notificationsClient: null }); explorer.defaultExperience(defaultApi); explorer.hasAutoPilotV2FeatureFlag = ko.computed(() => true); @@ -471,8 +470,7 @@ describe("Settings tab", () => { describe("AutoPilot", () => { function getCollection(autoPilotTier: DataModels.AutopilotTier) { const explorer = new Explorer({ - notificationsClient: null, - isEmulator: false + notificationsClient: null }); explorer.hasAutoPilotV2FeatureFlag = ko.computed(() => true); diff --git a/src/Explorer/Tabs/SettingsTab.ts b/src/Explorer/Tabs/SettingsTab.ts index 4722b6875..c9da9420d 100644 --- a/src/Explorer/Tabs/SettingsTab.ts +++ b/src/Explorer/Tabs/SettingsTab.ts @@ -22,6 +22,7 @@ import { updateCollection } from "../../Common/dataAccess/updateCollection"; import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent"; import { userContext } from "../../UserContext"; import { updateOfferThroughputBeyondLimit } from "../../Common/dataAccess/updateOfferThroughputBeyondLimit"; +import { configContext, Platform } from "../../ConfigContext"; const ttlWarning: string = ` The system will automatically delete items based on the TTL value (in seconds) you provide, without needing a delete operation explicitly issued by a client application. @@ -454,7 +455,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor }); this.rupmVisible = ko.computed(() => { - if (this.container.isEmulator) { + if (configContext.platform === Platform.Emulator) { return false; } if (this.container.isFeatureEnabled(Constants.Features.enableRupm)) { @@ -484,7 +485,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor }); this.costsVisible = ko.computed(() => { - return !this.container.isEmulator; + return configContext.platform !== Platform.Emulator; }); this.isTryCosmosDBSubscription = ko.computed(() => { @@ -500,7 +501,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor }); this.canRequestSupport = ko.pureComputed(() => { - if (this.container.isEmulator) { + if (configContext.platform === Platform.Emulator) { return false; } @@ -711,7 +712,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor } const isThroughputGreaterThanMaxRus = this.throughput() > this.maxRUs(); - const isEmulator = this.container.isEmulator; + const isEmulator = configContext.platform === Platform.Emulator; if (isThroughputGreaterThanMaxRus && isEmulator) { return false; } @@ -881,7 +882,8 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor this.maxRUs() <= SharedConstants.CollectionCreation.DefaultCollectionRUs1Million && this.throughput() > SharedConstants.CollectionCreation.DefaultCollectionRUs1Million; - const throughputExceedsMaxValue: boolean = !this.container.isEmulator && this.throughput() > this.maxRUs(); + const throughputExceedsMaxValue: boolean = + configContext.platform !== Platform.Emulator && this.throughput() > this.maxRUs(); const ttlOptionDirty: boolean = this.timeToLive.editableIsDirty(); const ttlOrIndexingPolicyFieldsDirty: boolean = diff --git a/src/Explorer/Tabs/TabsManager.test.ts b/src/Explorer/Tabs/TabsManager.test.ts index 00f132c97..7be1e073c 100644 --- a/src/Explorer/Tabs/TabsManager.test.ts +++ b/src/Explorer/Tabs/TabsManager.test.ts @@ -16,7 +16,7 @@ describe("Tabs manager tests", () => { let documentsTab: DocumentsTab; beforeAll(() => { - explorer = new Explorer({ notificationsClient: undefined, isEmulator: false }); + explorer = new Explorer({ notificationsClient: undefined }); explorer.databaseAccount = ko.observable({ id: "test", name: "test", diff --git a/src/Platform/Emulator/ExplorerFactory.ts b/src/Platform/Emulator/ExplorerFactory.ts index 8614d063e..fa831b73d 100644 --- a/src/Platform/Emulator/ExplorerFactory.ts +++ b/src/Platform/Emulator/ExplorerFactory.ts @@ -7,8 +7,7 @@ import { NotificationsClient } from "./NotificationsClient"; export default class EmulatorExplorerFactory { public static createExplorer(): Explorer { const explorer: Explorer = new Explorer({ - notificationsClient: new NotificationsClient(), - isEmulator: true + notificationsClient: new NotificationsClient() }); explorer.databaseAccount({ name: "", diff --git a/src/Platform/Hosted/ExplorerFactory.ts b/src/Platform/Hosted/ExplorerFactory.ts index 22fb13a43..f1e4909c7 100644 --- a/src/Platform/Hosted/ExplorerFactory.ts +++ b/src/Platform/Hosted/ExplorerFactory.ts @@ -4,8 +4,7 @@ import { NotificationsClient } from "./NotificationsClient"; export default class HostedExplorerFactory { public createExplorer(): Explorer { const explorer = new Explorer({ - notificationsClient: new NotificationsClient(), - isEmulator: false + notificationsClient: new NotificationsClient() }); return explorer; diff --git a/src/Platform/Portal/ExplorerFactory.ts b/src/Platform/Portal/ExplorerFactory.ts index bf1eac162..4ee33063c 100644 --- a/src/Platform/Portal/ExplorerFactory.ts +++ b/src/Platform/Portal/ExplorerFactory.ts @@ -4,8 +4,7 @@ import { NotificationsClient } from "./NotificationsClient"; export default class PortalExplorerFactory { public createExplorer(): Explorer { var explorer = new Explorer({ - notificationsClient: new NotificationsClient(), - isEmulator: false + notificationsClient: new NotificationsClient() }); return explorer; diff --git a/src/RouteHandlers/TabRouteHandler.test.ts b/src/RouteHandlers/TabRouteHandler.test.ts index 6cf0d82fb..6f6314f75 100644 --- a/src/RouteHandlers/TabRouteHandler.test.ts +++ b/src/RouteHandlers/TabRouteHandler.test.ts @@ -10,8 +10,7 @@ describe("TabRouteHandler", () => { beforeAll(() => { (window).dataExplorer = new Explorer({ - notificationsClient: null, - isEmulator: false + notificationsClient: null }); // create a mock to avoid null refs });