Support serverless accounts (#109)

* Changes for serverless accounts

* Dont show upsell message for serverless accounts

* Update CassandraAddCollectionPane to support serverless
This commit is contained in:
Tanuj Mittal
2020-07-24 13:13:54 -07:00
committed by GitHub
parent dc67c5f40b
commit 33969581ac
11 changed files with 171 additions and 91 deletions

View File

@@ -93,6 +93,8 @@ export default class AddCollectionPane extends ContextualPaneBase {
public canExceedMaximumValue: ko.PureComputed<boolean>;
public hasAutoPilotV2FeatureFlag: ko.PureComputed<boolean>;
public ruToolTipText: ko.Computed<string>;
public canConfigureThroughput: ko.PureComputed<boolean>;
public showUpsellMessage: ko.PureComputed<boolean>;
private _databaseOffers: HashMap<DataModels.Offer>;
private _isSynapseLinkEnabled: ko.Computed<boolean>;
@@ -102,6 +104,8 @@ export default class AddCollectionPane extends ContextualPaneBase {
this._databaseOffers = new HashMap<DataModels.Offer>();
this.hasAutoPilotV2FeatureFlag = ko.pureComputed(() => this.container.hasAutoPilotV2FeatureFlag());
this.ruToolTipText = ko.pureComputed(() => PricingUtils.getRuToolTipText(this.hasAutoPilotV2FeatureFlag()));
this.canConfigureThroughput = ko.pureComputed(() => !this.container.isServerlessEnabled());
this.showUpsellMessage = ko.pureComputed(() => !this.container.isServerlessEnabled());
this.formWarnings = ko.observable<string>();
this.collectionId = ko.observable<string>();
this.databaseId = ko.observable<string>();
@@ -591,6 +595,11 @@ export default class AddCollectionPane extends ContextualPaneBase {
if (config.platform === Platform.Emulator) {
return false;
}
if (this.container.isServerlessEnabled()) {
return false;
}
if (this.container.isPreferredApiDocumentDB()) {
return true;
}
@@ -723,10 +732,19 @@ export default class AddCollectionPane extends ContextualPaneBase {
}
private _computeOfferThroughput(): number {
if (this.databaseCreateNewShared()) {
return this.isSharedAutoPilotSelected() ? undefined : this._getThroughput();
if (!this.canConfigureThroughput()) {
return undefined;
}
return this.isAutoPilotSelected() ? undefined : this._getThroughput();
if (this.isAutoPilotSelected()) {
return undefined;
}
if (this.databaseCreateNewShared() && this.isSharedAutoPilotSelected()) {
return undefined;
}
return this._getThroughput();
}
public submit() {