Fix settings tab shows no selected value (#1237)
This commit is contained in:
parent
496f596f38
commit
8b22027cb6
|
@ -149,7 +149,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
this.offer = this.database?.offer();
|
this.offer = this.database?.offer();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state = {
|
const initialState: SettingsComponentState = {
|
||||||
throughput: undefined,
|
throughput: undefined,
|
||||||
throughputBaseline: undefined,
|
throughputBaseline: undefined,
|
||||||
autoPilotThroughput: undefined,
|
autoPilotThroughput: undefined,
|
||||||
|
@ -199,6 +199,11 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
selectedTab: SettingsV2TabTypes.ScaleTab,
|
selectedTab: SettingsV2TabTypes.ScaleTab,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
...initialState,
|
||||||
|
...this.getBaselineValues(),
|
||||||
|
};
|
||||||
|
|
||||||
this.saveSettingsButton = {
|
this.saveSettingsButton = {
|
||||||
isEnabled: this.isSaveSettingsButtonEnabled,
|
isEnabled: this.isSaveSettingsButtonEnabled,
|
||||||
isVisible: () => {
|
isVisible: () => {
|
||||||
|
@ -561,21 +566,24 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
};
|
};
|
||||||
|
|
||||||
public setBaseline = (): void => {
|
public setBaseline = (): void => {
|
||||||
|
const baselineValues = this.getBaselineValues();
|
||||||
|
this.setState(baselineValues as SettingsComponentState);
|
||||||
|
};
|
||||||
|
|
||||||
|
private getBaselineValues = (): Partial<SettingsComponentState> => {
|
||||||
const offerThroughput = this.offer?.manualThroughput;
|
const offerThroughput = this.offer?.manualThroughput;
|
||||||
|
|
||||||
if (!this.isCollectionSettingsTab) {
|
if (!this.isCollectionSettingsTab) {
|
||||||
this.setState({
|
return {
|
||||||
throughput: offerThroughput,
|
throughput: offerThroughput,
|
||||||
throughputBaseline: offerThroughput,
|
throughputBaseline: offerThroughput,
|
||||||
});
|
};
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultTtl = this.collection.defaultTtl();
|
const defaultTtl = this.collection.defaultTtl();
|
||||||
|
|
||||||
let timeToLive: TtlType = this.state.timeToLive;
|
let timeToLive: TtlType;
|
||||||
let timeToLiveSeconds = this.state.timeToLiveSeconds;
|
let timeToLiveSeconds: number;
|
||||||
switch (defaultTtl) {
|
switch (defaultTtl) {
|
||||||
case undefined:
|
case undefined:
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -620,7 +628,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
(this.collection.geospatialConfig && this.collection.geospatialConfig()?.type) || GeospatialConfigType.Geometry;
|
(this.collection.geospatialConfig && this.collection.geospatialConfig()?.type) || GeospatialConfigType.Geometry;
|
||||||
const geoSpatialConfigType = GeospatialConfigType[geospatialConfigTypeString as keyof typeof GeospatialConfigType];
|
const geoSpatialConfigType = GeospatialConfigType[geospatialConfigTypeString as keyof typeof GeospatialConfigType];
|
||||||
|
|
||||||
this.setState({
|
return {
|
||||||
throughput: offerThroughput,
|
throughput: offerThroughput,
|
||||||
throughputBaseline: offerThroughput,
|
throughputBaseline: offerThroughput,
|
||||||
changeFeedPolicy: changeFeedPolicy,
|
changeFeedPolicy: changeFeedPolicy,
|
||||||
|
@ -643,7 +651,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
conflictResolutionPolicyProcedureBaseline: conflictResolutionPolicyProcedure,
|
conflictResolutionPolicyProcedureBaseline: conflictResolutionPolicyProcedure,
|
||||||
geospatialConfigType: geoSpatialConfigType,
|
geospatialConfigType: geoSpatialConfigType,
|
||||||
geospatialConfigTypeBaseline: geoSpatialConfigType,
|
geospatialConfigTypeBaseline: geoSpatialConfigType,
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
private getTabsButtons = (): CommandButtonComponentProps[] => {
|
private getTabsButtons = (): CommandButtonComponentProps[] => {
|
||||||
|
|
Loading…
Reference in New Issue