mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
Remove Explorer.isEmulator (#256)
This commit is contained in:
@@ -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<boolean>(
|
||||
@@ -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()
|
||||
) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -79,7 +79,7 @@ describe("Settings tab", () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
explorer = new Explorer({ notificationsClient: null, isEmulator: false });
|
||||
explorer = new Explorer({ notificationsClient: null });
|
||||
explorer.hasAutoPilotV2FeatureFlag = ko.computed<boolean>(() => 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<boolean>(() => 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<boolean>(() => 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<boolean>(() => 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<boolean>(() => true);
|
||||
|
||||
|
||||
@@ -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<boolean>(() => {
|
||||
@@ -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 =
|
||||
|
||||
@@ -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<DataModels.DatabaseAccount>({
|
||||
id: "test",
|
||||
name: "test",
|
||||
|
||||
Reference in New Issue
Block a user