mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-29 00:47:01 +00:00
Fix scale tab not showing the correct throughput mode and value and remove freetierautoscalethroughput feature flag (#1245)
This commit is contained in:
parent
06f6df83ad
commit
2e3e547a46
@ -99,7 +99,6 @@ export class Flights {
|
|||||||
public static readonly PhoenixNotebooks = "phoenixnotebooks";
|
public static readonly PhoenixNotebooks = "phoenixnotebooks";
|
||||||
public static readonly PhoenixFeatures = "phoenixfeatures";
|
public static readonly PhoenixFeatures = "phoenixfeatures";
|
||||||
public static readonly NotebooksDownBanner = "notebooksdownbanner";
|
public static readonly NotebooksDownBanner = "notebooksdownbanner";
|
||||||
public static readonly FreeTierAutoscaleThroughput = "freetierautoscalethroughput";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AfecFeatures {
|
export class AfecFeatures {
|
||||||
|
@ -202,6 +202,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.state = {
|
this.state = {
|
||||||
...initialState,
|
...initialState,
|
||||||
...this.getBaselineValues(),
|
...this.getBaselineValues(),
|
||||||
|
...this.getAutoscaleBaselineValues(),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.saveSettingsButton = {
|
this.saveSettingsButton = {
|
||||||
@ -230,7 +231,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.loadMongoIndexes();
|
this.loadMongoIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setAutoPilotStates();
|
|
||||||
this.setBaseline();
|
this.setBaseline();
|
||||||
if (this.props.settingsTab.isActive()) {
|
if (this.props.settingsTab.isActive()) {
|
||||||
useCommandBar.getState().setContextButtons(this.getTabsButtons());
|
useCommandBar.getState().setContextButtons(this.getTabsButtons());
|
||||||
@ -291,17 +291,24 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
private setAutoPilotStates = (): void => {
|
private getAutoscaleBaselineValues = (): Partial<SettingsComponentState> => {
|
||||||
const autoscaleMaxThroughput = this.offer?.autoscaleMaxThroughput;
|
const autoscaleMaxThroughput = this.offer?.autoscaleMaxThroughput;
|
||||||
|
|
||||||
if (autoscaleMaxThroughput && AutoPilotUtils.isValidAutoPilotThroughput(autoscaleMaxThroughput)) {
|
if (autoscaleMaxThroughput && AutoPilotUtils.isValidAutoPilotThroughput(autoscaleMaxThroughput)) {
|
||||||
this.setState({
|
return {
|
||||||
isAutoPilotSelected: true,
|
isAutoPilotSelected: true,
|
||||||
wasAutopilotOriginallySet: true,
|
wasAutopilotOriginallySet: true,
|
||||||
autoPilotThroughput: autoscaleMaxThroughput,
|
autoPilotThroughput: autoscaleMaxThroughput,
|
||||||
autoPilotThroughputBaseline: autoscaleMaxThroughput,
|
autoPilotThroughputBaseline: autoscaleMaxThroughput,
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
isAutoPilotSelected: false,
|
||||||
|
wasAutopilotOriginallySet: false,
|
||||||
|
autoPilotThroughput: undefined,
|
||||||
|
autoPilotThroughputBaseline: undefined,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
public hasProvisioningTypeChanged = (): boolean =>
|
public hasProvisioningTypeChanged = (): boolean =>
|
||||||
@ -567,7 +574,8 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
|
|
||||||
public setBaseline = (): void => {
|
public setBaseline = (): void => {
|
||||||
const baselineValues = this.getBaselineValues();
|
const baselineValues = this.getBaselineValues();
|
||||||
this.setState(baselineValues as SettingsComponentState);
|
const autoscaleBaselineValues = this.getAutoscaleBaselineValues();
|
||||||
|
this.setState({ ...baselineValues, ...autoscaleBaselineValues } as SettingsComponentState);
|
||||||
};
|
};
|
||||||
|
|
||||||
private getBaselineValues = (): Partial<SettingsComponentState> => {
|
private getBaselineValues = (): Partial<SettingsComponentState> => {
|
||||||
|
@ -19,7 +19,7 @@ import { Action, ActionModifiers } from "../../../../../Shared/Telemetry/Telemet
|
|||||||
import * as TelemetryProcessor from "../../../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../../../../UserContext";
|
import { userContext } from "../../../../../UserContext";
|
||||||
import * as AutoPilotUtils from "../../../../../Utils/AutoPilotUtils";
|
import * as AutoPilotUtils from "../../../../../Utils/AutoPilotUtils";
|
||||||
import { autoPilotThroughput1K, autoPilotThroughput4K } from "../../../../../Utils/AutoPilotUtils";
|
import { autoPilotThroughput1K } from "../../../../../Utils/AutoPilotUtils";
|
||||||
import { calculateEstimateNumber, usageInGB } from "../../../../../Utils/PricingUtils";
|
import { calculateEstimateNumber, usageInGB } from "../../../../../Utils/PricingUtils";
|
||||||
import { Int32 } from "../../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
|
import { Int32 } from "../../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
|
||||||
import {
|
import {
|
||||||
@ -540,7 +540,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
step={AutoPilotUtils.autoPilotIncrementStep}
|
step={AutoPilotUtils.autoPilotIncrementStep}
|
||||||
value={this.overrideWithProvisionedThroughputSettings() ? "" : this.props.maxAutoPilotThroughput?.toString()}
|
value={this.overrideWithProvisionedThroughputSettings() ? "" : this.props.maxAutoPilotThroughput?.toString()}
|
||||||
onChange={this.onAutoPilotThroughputChange}
|
onChange={this.onAutoPilotThroughputChange}
|
||||||
min={userContext.features.freetierAutoscaleThroughput ? autoPilotThroughput1K : autoPilotThroughput4K}
|
min={autoPilotThroughput1K}
|
||||||
errorMessage={this.props.throughputError}
|
errorMessage={this.props.throughputError}
|
||||||
/>
|
/>
|
||||||
{!this.overrideWithProvisionedThroughputSettings() && this.getAutoPilotUsageCost()}
|
{!this.overrideWithProvisionedThroughputSettings() && this.getAutoPilotUsageCost()}
|
||||||
|
@ -145,7 +145,7 @@ exports[`ThroughputInputAutoPilotV3Component autopilot input visible 1`] = `
|
|||||||
id="autopilotInput"
|
id="autopilotInput"
|
||||||
key="auto pilot throughput input"
|
key="auto pilot throughput input"
|
||||||
label="Max RU/s"
|
label="Max RU/s"
|
||||||
min={4000}
|
min={1000}
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
required={true}
|
required={true}
|
||||||
step={1000}
|
step={1000}
|
||||||
|
@ -34,9 +34,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
}: ThroughputInputProps) => {
|
}: ThroughputInputProps) => {
|
||||||
const [isAutoscaleSelected, setIsAutoScaleSelected] = useState<boolean>(true);
|
const [isAutoscaleSelected, setIsAutoScaleSelected] = useState<boolean>(true);
|
||||||
const [throughput, setThroughput] = useState<number>(
|
const [throughput, setThroughput] = useState<number>(
|
||||||
isFreeTier && userContext.features.freetierAutoscaleThroughput
|
isFreeTier ? AutoPilotUtils.autoPilotThroughput1K : AutoPilotUtils.autoPilotThroughput4K
|
||||||
? AutoPilotUtils.autoPilotThroughput1K
|
|
||||||
: AutoPilotUtils.autoPilotThroughput4K
|
|
||||||
);
|
);
|
||||||
const [isCostAcknowledged, setIsCostAcknowledged] = useState<boolean>(false);
|
const [isCostAcknowledged, setIsCostAcknowledged] = useState<boolean>(false);
|
||||||
const [throughputError, setThroughputError] = useState<string>("");
|
const [throughputError, setThroughputError] = useState<string>("");
|
||||||
@ -157,10 +155,9 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
|
|
||||||
const handleOnChangeMode = (event: React.ChangeEvent<HTMLInputElement>, mode: string): void => {
|
const handleOnChangeMode = (event: React.ChangeEvent<HTMLInputElement>, mode: string): void => {
|
||||||
if (mode === "Autoscale") {
|
if (mode === "Autoscale") {
|
||||||
const defaultThroughput =
|
const defaultThroughput = isFreeTier
|
||||||
isFreeTier && userContext.features.freetierAutoscaleThroughput
|
? AutoPilotUtils.autoPilotThroughput1K
|
||||||
? AutoPilotUtils.autoPilotThroughput1K
|
: AutoPilotUtils.autoPilotThroughput4K;
|
||||||
: AutoPilotUtils.autoPilotThroughput4K;
|
|
||||||
setThroughput(defaultThroughput);
|
setThroughput(defaultThroughput);
|
||||||
setIsAutoScaleSelected(true);
|
setIsAutoScaleSelected(true);
|
||||||
setThroughputValue(defaultThroughput);
|
setThroughputValue(defaultThroughput);
|
||||||
@ -236,11 +233,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
}}
|
}}
|
||||||
onChange={(event, newInput?: string) => onThroughputValueChange(newInput)}
|
onChange={(event, newInput?: string) => onThroughputValueChange(newInput)}
|
||||||
step={AutoPilotUtils.autoPilotIncrementStep}
|
step={AutoPilotUtils.autoPilotIncrementStep}
|
||||||
min={
|
min={AutoPilotUtils.autoPilotThroughput1K}
|
||||||
userContext.features.freetierAutoscaleThroughput
|
|
||||||
? AutoPilotUtils.autoPilotThroughput1K
|
|
||||||
: AutoPilotUtils.autoPilotThroughput4K
|
|
||||||
}
|
|
||||||
value={throughput.toString()}
|
value={throughput.toString()}
|
||||||
aria-label="Max request units per second"
|
aria-label="Max request units per second"
|
||||||
required={true}
|
required={true}
|
||||||
|
@ -1638,7 +1638,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
aria-label="Max request units per second"
|
aria-label="Max request units per second"
|
||||||
errorMessage=""
|
errorMessage=""
|
||||||
key=".0:$.2"
|
key=".0:$.2"
|
||||||
min={4000}
|
min={1000}
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
required={true}
|
required={true}
|
||||||
step={1000}
|
step={1000}
|
||||||
@ -1660,7 +1660,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
aria-label="Max request units per second"
|
aria-label="Max request units per second"
|
||||||
deferredValidationTime={200}
|
deferredValidationTime={200}
|
||||||
errorMessage=""
|
errorMessage=""
|
||||||
min={4000}
|
min={1000}
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
required={true}
|
required={true}
|
||||||
resizable={true}
|
resizable={true}
|
||||||
@ -1956,7 +1956,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
|||||||
aria-invalid={false}
|
aria-invalid={false}
|
||||||
className="ms-TextField-field field-64"
|
className="ms-TextField-field field-64"
|
||||||
id="TextField2"
|
id="TextField2"
|
||||||
min={4000}
|
min={1000}
|
||||||
onBlur={[Function]}
|
onBlur={[Function]}
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
onFocus={[Function]}
|
onFocus={[Function]}
|
||||||
|
@ -146,10 +146,9 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
|||||||
// TODO add feature flag that disables validation for customers with custom accounts
|
// TODO add feature flag that disables validation for customers with custom accounts
|
||||||
if (isAutoscaleSelected) {
|
if (isAutoscaleSelected) {
|
||||||
if (!AutoPilotUtils.isValidAutoPilotThroughput(throughput)) {
|
if (!AutoPilotUtils.isValidAutoPilotThroughput(throughput)) {
|
||||||
const minAutoPilotThroughput = userContext.features.freetierAutoscaleThroughput
|
setFormErrors(
|
||||||
? AutoPilotUtils.autoPilotThroughput1K
|
`Please enter a value greater than ${AutoPilotUtils.autoPilotThroughput1K} for autopilot throughput`
|
||||||
: AutoPilotUtils.autoPilotThroughput4K;
|
);
|
||||||
setFormErrors(`Please enter a value greater than ${minAutoPilotThroughput} for autopilot throughput`);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ export type Features = {
|
|||||||
phoenixNotebooks?: boolean;
|
phoenixNotebooks?: boolean;
|
||||||
phoenixFeatures?: boolean;
|
phoenixFeatures?: boolean;
|
||||||
notebooksDownBanner: boolean;
|
notebooksDownBanner: boolean;
|
||||||
freetierAutoscaleThroughput: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function extractFeatures(given = new URLSearchParams(window.location.search)): Features {
|
export function extractFeatures(given = new URLSearchParams(window.location.search)): Features {
|
||||||
@ -90,7 +89,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
|||||||
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
|
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
|
||||||
notebooksDownBanner: "true" === get("notebooksDownBanner"),
|
notebooksDownBanner: "true" === get("notebooksDownBanner"),
|
||||||
enableThroughputCap: "true" === get("enablethroughputcap"),
|
enableThroughputCap: "true" === get("enablethroughputcap"),
|
||||||
freetierAutoscaleThroughput: "true" === get("freetierautoscalethroughput"),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import { userContext } from "UserContext";
|
|
||||||
|
|
||||||
export const autoPilotThroughput1K = 1000;
|
export const autoPilotThroughput1K = 1000;
|
||||||
export const autoPilotIncrementStep = 1000;
|
export const autoPilotIncrementStep = 1000;
|
||||||
export const autoPilotThroughput4K = 4000;
|
export const autoPilotThroughput4K = 4000;
|
||||||
@ -8,10 +6,7 @@ export function isValidAutoPilotThroughput(maxThroughput: number): boolean {
|
|||||||
if (!maxThroughput) {
|
if (!maxThroughput) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const minAutoPilotThroughput = userContext.features.freetierAutoscaleThroughput
|
if (maxThroughput < autoPilotThroughput1K) {
|
||||||
? autoPilotThroughput4K
|
|
||||||
: autoPilotThroughput1K;
|
|
||||||
if (maxThroughput < minAutoPilotThroughput) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (maxThroughput % 1000) {
|
if (maxThroughput % 1000) {
|
||||||
|
@ -378,9 +378,6 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
|||||||
if (inputs.flights.indexOf(Flights.NotebooksDownBanner) !== -1) {
|
if (inputs.flights.indexOf(Flights.NotebooksDownBanner) !== -1) {
|
||||||
userContext.features.notebooksDownBanner = true;
|
userContext.features.notebooksDownBanner = true;
|
||||||
}
|
}
|
||||||
if (inputs.flights.indexOf(Flights.FreeTierAutoscaleThroughput) !== -1) {
|
|
||||||
userContext.features.freetierAutoscaleThroughput = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user