mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 06:56:38 +00:00
Remove Explorer.isTryCosmos (#556)
This commit is contained in:
parent
a2e3be9680
commit
9db0975f7f
@ -5,6 +5,7 @@ import { configContext, Platform } from "../../../../ConfigContext";
|
|||||||
import * as DataModels from "../../../../Contracts/DataModels";
|
import * as DataModels from "../../../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../../Contracts/ViewModels";
|
||||||
import * as SharedConstants from "../../../../Shared/Constants";
|
import * as SharedConstants from "../../../../Shared/Constants";
|
||||||
|
import { userContext } from "../../../../UserContext";
|
||||||
import * as AutoPilotUtils from "../../../../Utils/AutoPilotUtils";
|
import * as AutoPilotUtils from "../../../../Utils/AutoPilotUtils";
|
||||||
import Explorer from "../../../Explorer";
|
import Explorer from "../../../Explorer";
|
||||||
import {
|
import {
|
||||||
@ -79,7 +80,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public getMaxRUs = (): number => {
|
public getMaxRUs = (): number => {
|
||||||
if (this.props.container?.isTryCosmosDBSubscription()) {
|
if (userContext.isTryCosmosDBSubscription) {
|
||||||
return Constants.TryCosmosExperience.maxRU;
|
return Constants.TryCosmosExperience.maxRU;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public getMinRUs = (): number => {
|
public getMinRUs = (): number => {
|
||||||
if (this.props.container?.isTryCosmosDBSubscription()) {
|
if (userContext.isTryCosmosDBSubscription) {
|
||||||
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,7 +945,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isSparkEnabledForAccount": [Function],
|
"isSparkEnabledForAccount": [Function],
|
||||||
"isSynapseLinkUpdating": [Function],
|
"isSynapseLinkUpdating": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"isTryCosmosDBSubscription": [Function],
|
|
||||||
"loadQueryPane": LoadQueryPane {
|
"loadQueryPane": LoadQueryPane {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"files": [Function],
|
"files": [Function],
|
||||||
@ -2144,7 +2143,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isSparkEnabledForAccount": [Function],
|
"isSparkEnabledForAccount": [Function],
|
||||||
"isSynapseLinkUpdating": [Function],
|
"isSynapseLinkUpdating": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"isTryCosmosDBSubscription": [Function],
|
|
||||||
"loadQueryPane": LoadQueryPane {
|
"loadQueryPane": LoadQueryPane {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"files": [Function],
|
"files": [Function],
|
||||||
@ -3356,7 +3354,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isSparkEnabledForAccount": [Function],
|
"isSparkEnabledForAccount": [Function],
|
||||||
"isSynapseLinkUpdating": [Function],
|
"isSynapseLinkUpdating": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"isTryCosmosDBSubscription": [Function],
|
|
||||||
"loadQueryPane": LoadQueryPane {
|
"loadQueryPane": LoadQueryPane {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"files": [Function],
|
"files": [Function],
|
||||||
@ -4555,7 +4552,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"isSparkEnabledForAccount": [Function],
|
"isSparkEnabledForAccount": [Function],
|
||||||
"isSynapseLinkUpdating": [Function],
|
"isSynapseLinkUpdating": [Function],
|
||||||
"isTabsContentExpanded": [Function],
|
"isTabsContentExpanded": [Function],
|
||||||
"isTryCosmosDBSubscription": [Function],
|
|
||||||
"loadQueryPane": LoadQueryPane {
|
"loadQueryPane": LoadQueryPane {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"files": [Function],
|
"files": [Function],
|
||||||
|
@ -163,7 +163,6 @@ export default class Explorer {
|
|||||||
public isAccountReady: ko.Observable<boolean>;
|
public isAccountReady: ko.Observable<boolean>;
|
||||||
public canSaveQueries: ko.Computed<boolean>;
|
public canSaveQueries: ko.Computed<boolean>;
|
||||||
public features: ko.Observable<any>;
|
public features: ko.Observable<any>;
|
||||||
public isTryCosmosDBSubscription: ko.Observable<boolean>;
|
|
||||||
public queriesClient: QueriesClient;
|
public queriesClient: QueriesClient;
|
||||||
public tableDataClient: TableDataClient;
|
public tableDataClient: TableDataClient;
|
||||||
public splitter: Splitter;
|
public splitter: Splitter;
|
||||||
@ -398,7 +397,6 @@ export default class Explorer {
|
|||||||
|
|
||||||
this.features = ko.observable();
|
this.features = ko.observable();
|
||||||
this.queriesClient = new QueriesClient(this);
|
this.queriesClient = new QueriesClient(this);
|
||||||
this.isTryCosmosDBSubscription = ko.observable<boolean>(false);
|
|
||||||
|
|
||||||
this.resourceTokenDatabaseId = ko.observable<string>();
|
this.resourceTokenDatabaseId = ko.observable<string>();
|
||||||
this.resourceTokenCollectionId = ko.observable<string>();
|
this.resourceTokenCollectionId = ko.observable<string>();
|
||||||
@ -1447,7 +1445,6 @@ export default class Explorer {
|
|||||||
if (inputs.addCollectionDefaultFlight) {
|
if (inputs.addCollectionDefaultFlight) {
|
||||||
this.flight(inputs.addCollectionDefaultFlight);
|
this.flight(inputs.addCollectionDefaultFlight);
|
||||||
}
|
}
|
||||||
this.isTryCosmosDBSubscription(inputs.isTryCosmosDBSubscription ?? false);
|
|
||||||
this.setFeatureFlagsFromFlights(inputs.flights);
|
this.setFeatureFlagsFromFlights(inputs.flights);
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
Action.LoadDatabaseAccount,
|
Action.LoadDatabaseAccount,
|
||||||
|
@ -49,7 +49,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
public throughputDatabase: ViewModels.Editable<number>;
|
public throughputDatabase: ViewModels.Editable<number>;
|
||||||
public isPreferredApiTable: ko.Computed<boolean>;
|
public isPreferredApiTable: ko.Computed<boolean>;
|
||||||
public partitionKeyPlaceholder: ko.Computed<string>;
|
public partitionKeyPlaceholder: ko.Computed<string>;
|
||||||
public isTryCosmosDBSubscription: ko.Computed<boolean>;
|
public isTryCosmosDBSubscription: ko.Observable<boolean>;
|
||||||
public maxThroughputRU: ko.Observable<number>;
|
public maxThroughputRU: ko.Observable<number>;
|
||||||
public minThroughputRU: ko.Observable<number>;
|
public minThroughputRU: ko.Observable<number>;
|
||||||
public throughputRangeText: ko.Computed<string>;
|
public throughputRangeText: ko.Computed<string>;
|
||||||
@ -288,9 +288,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
return estimatedSpend;
|
return estimatedSpend;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.isTryCosmosDBSubscription = ko.pureComputed<boolean>(() => {
|
this.isTryCosmosDBSubscription = ko.observable<boolean>(userContext.isTryCosmosDBSubscription || false);
|
||||||
return (this.container && this.container.isTryCosmosDBSubscription()) || false;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.isTryCosmosDBSubscription.subscribe((isTryCosmosDB: boolean) => {
|
this.isTryCosmosDBSubscription.subscribe((isTryCosmosDB: boolean) => {
|
||||||
if (!!isTryCosmosDB) {
|
if (!!isTryCosmosDB) {
|
||||||
@ -301,7 +299,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
this.canRequestSupport = ko.pureComputed(() => {
|
this.canRequestSupport = ko.pureComputed(() => {
|
||||||
if (
|
if (
|
||||||
configContext.platform !== Platform.Emulator &&
|
configContext.platform !== Platform.Emulator &&
|
||||||
!this.container.isTryCosmosDBSubscription() &&
|
!userContext.isTryCosmosDBSubscription &&
|
||||||
configContext.platform !== Platform.Portal
|
configContext.platform !== Platform.Portal
|
||||||
) {
|
) {
|
||||||
const offerThroughput: number = this._getThroughput();
|
const offerThroughput: number = this._getThroughput();
|
||||||
|
@ -169,7 +169,7 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
|||||||
this.canRequestSupport = ko.pureComputed(() => {
|
this.canRequestSupport = ko.pureComputed(() => {
|
||||||
if (
|
if (
|
||||||
configContext.platform !== Platform.Emulator &&
|
configContext.platform !== Platform.Emulator &&
|
||||||
!this.container.isTryCosmosDBSubscription() &&
|
!userContext.isTryCosmosDBSubscription &&
|
||||||
configContext.platform !== Platform.Portal
|
configContext.platform !== Platform.Portal
|
||||||
) {
|
) {
|
||||||
const offerThroughput: number = this.throughput();
|
const offerThroughput: number = this.throughput();
|
||||||
|
@ -223,7 +223,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.canRequestSupport = ko.pureComputed(() => {
|
this.canRequestSupport = ko.pureComputed(() => {
|
||||||
if (configContext.platform !== Platform.Emulator && !this.container.isTryCosmosDBSubscription()) {
|
if (configContext.platform !== Platform.Emulator && !userContext.isTryCosmosDBSubscription) {
|
||||||
const offerThroughput: number = this.throughput();
|
const offerThroughput: number = this.throughput();
|
||||||
return offerThroughput <= 100000;
|
return offerThroughput <= 100000;
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,14 @@ interface UserContext {
|
|||||||
// API Type is not yet provided by ARM. You need to manually inspect all the capabilities+kind so we abstract that logic in userContext
|
// API Type is not yet provided by ARM. You need to manually inspect all the capabilities+kind so we abstract that logic in userContext
|
||||||
// This is coming in a future Cosmos ARM API version as a prperty on databaseAccount
|
// This is coming in a future Cosmos ARM API version as a prperty on databaseAccount
|
||||||
apiType?: ApiType;
|
apiType?: ApiType;
|
||||||
|
isTryCosmosDBSubscription?: boolean;
|
||||||
portalEnv?: PortalEnv;
|
portalEnv?: PortalEnv;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ApiType = "SQL" | "Mongo" | "Gremlin" | "Tables" | "Cassandra";
|
type ApiType = "SQL" | "Mongo" | "Gremlin" | "Tables" | "Cassandra";
|
||||||
export type PortalEnv = "localhost" | "blackforest" | "fairfax" | "mooncake" | "prod" | "dev";
|
export type PortalEnv = "localhost" | "blackforest" | "fairfax" | "mooncake" | "prod" | "dev";
|
||||||
|
|
||||||
const userContext: UserContext = {
|
const userContext: UserContext = { isTryCosmosDBSubscription: false, portalEnv: "prod" };
|
||||||
portalEnv: "prod",
|
|
||||||
};
|
|
||||||
|
|
||||||
function updateUserContext(newContext: UserContext): void {
|
function updateUserContext(newContext: UserContext): void {
|
||||||
Object.assign(userContext, newContext);
|
Object.assign(userContext, newContext);
|
||||||
|
@ -33,7 +33,7 @@ describe("MongoDB Index policy tests", () => {
|
|||||||
await frame.click(`div[data-test="${collectionId}"]`);
|
await frame.click(`div[data-test="${collectionId}"]`);
|
||||||
|
|
||||||
await frame.waitFor(`div[data-test="Scale & Settings"]`), { visible: true };
|
await frame.waitFor(`div[data-test="Scale & Settings"]`), { visible: true };
|
||||||
await frame.waitFor(LOADING_STATE_DELAY);
|
await frame.waitFor(10000);
|
||||||
await frame.click(`div[data-test="Scale & Settings"]`);
|
await frame.click(`div[data-test="Scale & Settings"]`);
|
||||||
|
|
||||||
await frame.waitFor(`button[data-content="Indexing Policy"]`), { visible: true };
|
await frame.waitFor(`button[data-content="Indexing Policy"]`), { visible: true };
|
||||||
|
Loading…
Reference in New Issue
Block a user