mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-16 01:05:25 +00:00
* Remove AutoPilot v2 * Update DatabaseSettingsTab.ts * Update DatabaseSettingsTab.ts * Update src/Explorer/Tabs/DatabaseSettingsTab.ts Co-authored-by: Laurent Nguyen <laurent.nguyen@microsoft.com> * Update src/Explorer/Tabs/SettingsTab.ts * Update src/Explorer/Tabs/DatabaseSettingsTab.ts Co-authored-by: Laurent Nguyen <laurent.nguyen@microsoft.com> * Update src/Explorer/Tabs/SettingsTab.ts * Remove more unused code * Remove import Co-authored-by: Laurent Nguyen <laurent.nguyen@microsoft.com>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import * as Constants from "../Common/Constants";
|
|
import { AutoPilotOfferSettings, Offer } from "../Contracts/DataModels";
|
|
|
|
export const manualToAutoscaleDisclaimer = `The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings and storage of your resource. After autoscale has been enabled, you can change the max RU/s. <a href="${Constants.Urls.autoscaleMigration}">Learn more</a>.`;
|
|
|
|
export const minAutoPilotThroughput = 4000;
|
|
|
|
export const autoPilotIncrementStep = 1000;
|
|
|
|
export function isValidV3AutoPilotOffer(offer: Offer): boolean {
|
|
const maxThroughput =
|
|
offer &&
|
|
offer.content &&
|
|
offer.content.offerAutopilotSettings &&
|
|
offer.content.offerAutopilotSettings.maxThroughput;
|
|
return isValidAutoPilotThroughput(maxThroughput);
|
|
}
|
|
|
|
export function isValidAutoPilotThroughput(maxThroughput: number): boolean {
|
|
if (!maxThroughput) {
|
|
return false;
|
|
}
|
|
if (maxThroughput < minAutoPilotThroughput) {
|
|
return false;
|
|
}
|
|
if (maxThroughput % 1000) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
export function getMinRUsBasedOnUserInput(throughput: number): number {
|
|
return Math.round(throughput && throughput * 0.1);
|
|
}
|
|
|
|
export function getStorageBasedOnUserInput(throughput: number): number {
|
|
return Math.round(throughput && throughput * 0.01);
|
|
}
|
|
|
|
export function getAutoPilotHeaderText(): string {
|
|
return "Throughput (autoscale)";
|
|
}
|