Add checks for serverless account (#244)

This commit is contained in:
victor-meng 2020-10-02 14:44:12 -07:00 committed by GitHub
parent 3112cf5573
commit 0f82ed3749
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -516,6 +516,10 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
return false; return false;
} }
if (this.container.isServerlessEnabled()) {
return false;
}
const numPartitions = this.collection.quotaInfo().numPartitions; const numPartitions = this.collection.quotaInfo().numPartitions;
return !!this.collection.partitionKeyProperty || numPartitions > 1; return !!this.collection.partitionKeyProperty || numPartitions > 1;
}); });
@ -525,7 +529,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
); );
this.minRUs = ko.computed<number>(() => { this.minRUs = ko.computed<number>(() => {
if (this.isTryCosmosDBSubscription()) { if (this.isTryCosmosDBSubscription() || this.container.isServerlessEnabled()) {
return SharedConstants.CollectionCreation.DefaultCollectionRUs400; return SharedConstants.CollectionCreation.DefaultCollectionRUs400;
} }
@ -572,7 +576,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
this.maxRUs = ko.computed<number>(() => { this.maxRUs = ko.computed<number>(() => {
const isTryCosmosDBSubscription = this.isTryCosmosDBSubscription(); const isTryCosmosDBSubscription = this.isTryCosmosDBSubscription();
if (isTryCosmosDBSubscription) { if (isTryCosmosDBSubscription || this.container.isServerlessEnabled()) {
return Constants.TryCosmosExperience.maxRU; return Constants.TryCosmosExperience.maxRU;
} }
@ -748,7 +752,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
if ( if (
this.rupm() === Constants.RUPMStates.on && this.rupm() === Constants.RUPMStates.on &&
this.throughput() > this.throughput() >
SharedConstants.CollectionCreation.MaxRUPMPerPartition * this.collection.quotaInfo().numPartitions SharedConstants.CollectionCreation.MaxRUPMPerPartition * this.collection.quotaInfo()?.numPartitions
) { ) {
return false; return false;
} }