From 0d79f01304547d83098a50a4e81deb9900e2bda4 Mon Sep 17 00:00:00 2001 From: victor-meng <56978073+victor-meng@users.noreply.github.com> Date: Mon, 24 May 2021 13:42:54 -0700 Subject: [PATCH] Update free tier limits and messages (#786) --- .../SettingsSubComponents/ScaleComponent.tsx | 6 ++++-- .../ThroughputInputAutoPilotV3Component.tsx | 12 +++++++----- .../ThroughputInput/ThroughputInput.tsx | 5 ++--- .../ThroughputInputComponentAutoPilotV3.ts | 18 +++++++++--------- src/Explorer/Panes/PanelInfoErrorComponent.tsx | 2 +- src/Shared/Constants.ts | 5 +++++ src/Utils/PricingUtils.ts | 6 ++++-- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.tsx index bb4058fec..e73469101 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.tsx +++ b/src/Explorer/Controls/Settings/SettingsSubComponents/ScaleComponent.tsx @@ -202,10 +202,12 @@ export class ScaleComponent extends React.Component { } private getFreeTierInfoMessage(): JSX.Element { + const freeTierLimits = SharedConstants.FreeTierLimits; return ( - With free tier, you will get the first 400 RU/s and 5 GB of storage in this account for free. To keep your - account free, keep the total RU/s across all resources in the account to 400 RU/s. + With free tier, you will get the first {freeTierLimits.RU} RU/s and {freeTierLimits.Storage} GB of storage in + this account for free. To keep your account free, keep the total RU/s across all resources in the account to{" "} + {freeTierLimits.RU} RU/s. 400, + this.props.isFreeTierAccount && + !this.props.isAutoPilotSelected && + this.props.throughput > SharedConstants.FreeTierLimits.RU, }; this.step = this.props.step ?? ThroughputInputAutoPilotV3Component.defaultStep; @@ -441,7 +443,9 @@ export class ThroughputInputAutoPilotV3Component extends React.Component< if (this.overrideWithAutoPilotSettings()) { this.props.onMaxAutoPilotThroughputChange(newThroughput); } else { - this.setState({ exceedFreeTierThroughput: this.props.isFreeTierAccount && newThroughput > 400 }); + this.setState({ + exceedFreeTierThroughput: this.props.isFreeTierAccount && newThroughput > SharedConstants.FreeTierLimits.RU, + }); this.props.onThroughputChange(newThroughput); } }; @@ -581,9 +585,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component< messageBarIconProps={{ iconName: "WarningSolid", className: "messageBarWarningIcon" }} styles={messageBarStyles} > - { - "Billing will apply if you provision more than 400 RU/s of manual throughput, or if the resource scales beyond 400 RU/s with autoscale." - } + {`Billing will apply if you provision more than ${SharedConstants.FreeTierLimits.RU} RU/s of manual throughput, or if the resource scales beyond ${SharedConstants.FreeTierLimits.RU} RU/s with autoscale.`} )} {this.props.getThroughputWarningMessage() && ( diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx b/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx index 8b20d32db..9ee8b272e 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx @@ -187,9 +187,8 @@ export const ThroughputInput: FunctionComponent = ({ SharedConstants.CollectionCreation.DefaultCollectionRUs400 - ? "The first 400 RU/s in this account are free. Billing will apply to any throughput beyond 400 RU/s." + showFreeTierExceedThroughputTooltip && throughput > SharedConstants.FreeTierLimits.RU + ? `The first ${SharedConstants.FreeTierLimits.RU} RU/s in this account are free. Billing will apply to any throughput beyond ${SharedConstants.FreeTierLimits.RU} RU/s.` : undefined } > diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3.ts b/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3.ts index eef3c7193..3999fa57f 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3.ts +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3.ts @@ -1,13 +1,13 @@ -import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils"; import * as ko from "knockout"; -import * as ViewModels from "../../../Contracts/ViewModels"; -import ThroughputInputComponentAutoscaleV3 from "./ThroughputInputComponentAutoscaleV3.html"; import { KeyCodes } from "../../../Common/Constants"; -import { WaitsForTemplateViewModel } from "../../WaitsForTemplateViewModel"; - -import { userContext } from "../../../UserContext"; -import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor"; +import * as ViewModels from "../../../Contracts/ViewModels"; +import { FreeTierLimits } from "../../../Shared/Constants"; import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants"; +import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor"; +import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils"; +import { WaitsForTemplateViewModel } from "../../WaitsForTemplateViewModel"; +import ThroughputInputComponentAutoscaleV3 from "./ThroughputInputComponentAutoscaleV3.html"; + /** * Throughput Input: * @@ -236,11 +236,11 @@ export class ThroughputInputViewModel extends WaitsForTemplateViewModel { this.freeTierExceedThroughputTooltip = options.freeTierExceedThroughputTooltip || ko.observable(); this.freeTierExceedThroughputWarning = options.freeTierExceedThroughputWarning || ko.observable(); this.showFreeTierExceedThroughputTooltip = ko.pureComputed( - () => !!this.freeTierExceedThroughputTooltip() && this.value() > 400 + () => !!this.freeTierExceedThroughputTooltip() && this.value() > FreeTierLimits.RU ); this.showFreeTierExceedThroughputWarning = ko.pureComputed( - () => !!this.freeTierExceedThroughputWarning() && this.value() > 400 + () => !!this.freeTierExceedThroughputWarning() && this.value() > FreeTierLimits.RU ); } diff --git a/src/Explorer/Panes/PanelInfoErrorComponent.tsx b/src/Explorer/Panes/PanelInfoErrorComponent.tsx index b7e075399..f124a3fb1 100644 --- a/src/Explorer/Panes/PanelInfoErrorComponent.tsx +++ b/src/Explorer/Panes/PanelInfoErrorComponent.tsx @@ -36,7 +36,7 @@ export const PanelInfoErrorComponent: React.FunctionComponent - {linkText} + {" " + linkText} )} diff --git a/src/Shared/Constants.ts b/src/Shared/Constants.ts index a316b4c77..97a9349c5 100644 --- a/src/Shared/Constants.ts +++ b/src/Shared/Constants.ts @@ -201,3 +201,8 @@ export class SubscriptionUtilMappings { export class AutopilotDocumentation { public static Url: string = "https://aka.ms/cosmos-autoscale-info"; } + +export class FreeTierLimits { + public static RU: number = 1000; + public static Storage: number = 25; +} diff --git a/src/Utils/PricingUtils.ts b/src/Utils/PricingUtils.ts index a3b75e2e7..09b16373e 100644 --- a/src/Utils/PricingUtils.ts +++ b/src/Utils/PricingUtils.ts @@ -267,9 +267,11 @@ export function getUpsellMessage( if (isFreeTier) { const collectionName = getCollectionName().toLocaleLowerCase(); const resourceType = isCollection ? collectionName : "database"; + const freeTierMaxRU = Constants.FreeTierLimits.RU; + const freeTierMaxStorage = Constants.FreeTierLimits.Storage; return isFirstResourceCreated - ? `The free tier discount of 400 RU/s has already been applied to a database or ${collectionName} in this account. Billing will apply to this ${resourceType} after it is created.` - : `With free tier, you'll get the first 400 RU/s and 5 GB of storage in this account for free. Billing will apply if you provision more than 400 RU/s of manual throughput, or if the ${resourceType} scales beyond 400 RU/s with autoscale.`; + ? `Your account currently has at least 1 database or ${collectionName} with provisioned RU/s. Billing will apply to this ${resourceType} if the total RU/s in your account exceeds ${freeTierMaxRU} RU/s.` + : `With free tier, you'll get the first ${freeTierMaxRU} RU/s and ${freeTierMaxStorage} GB of storage in this account for free. Billing will apply if you provision more than ${freeTierMaxRU} RU/s of manual throughput, or if the ${resourceType} scales beyond ${freeTierMaxRU} RU/s with autoscale.`; } else { let price: number = Constants.OfferPricing.MonthlyPricing.default.Standard.StartingPrice;