Skip to content

Commit

Permalink
fix: Scaling bounds should parse float not int (#10026) (#10032)
Browse files Browse the repository at this point in the history
* fix: Scaling bounds should parse float not int

Currently the API can do this, the model supports this, but the parseInt removes decimals from the UI

* fix: Decimal support for upper/lower bound ASG tests

(cherry picked from commit b763cae)

Co-authored-by: Jason <[email protected]>
  • Loading branch information
mergify[bot] and jasonmcintosh authored Sep 26, 2023
1 parent 734c895 commit 69db5b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const StepPolicyAction = ({
value={step.metricIntervalLowerBound}
max={step.metricIntervalUpperBound}
onChange={(e) =>
updateStep({ ...step, metricIntervalLowerBound: Number.parseInt(e.target.value) }, index)
updateStep({ ...step, metricIntervalLowerBound: Number.parseFloat(e.target.value) }, index)
}
inputClassName="action-input"
/>
Expand All @@ -122,7 +122,7 @@ export const StepPolicyAction = ({
value={step.metricIntervalUpperBound}
min={step.metricIntervalLowerBound}
onChange={(e) =>
updateStep({ ...step, metricIntervalUpperBound: Number.parseInt(e.target.value) }, index)
updateStep({ ...step, metricIntervalUpperBound: Number.parseFloat(e.target.value) }, index)
}
inputClassName="action-input"
/>
Expand Down
11 changes: 10 additions & 1 deletion packages/ecs/src/serverGroup/serverGroup.transformer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,16 @@ describe('ecsServerGroupTransformer', () => {
[-5, 10, 0],
);
});

it('verify float adjustments work within the range', function () {
this.test(
[
{ id: 1, scalingAdjustment: 10, metricIntervalLowerBound: 3.5, metricIntervalUpperBound: 5.5 },
{ id: 2, scalingAdjustment: 0, metricIntervalLowerBound: 5.5 },
{ id: 3, scalingAdjustment: -5, metricIntervalLowerBound: 1.2, metricIntervalUpperBound: 3.5 },
],
[-5, 10, 0],
);
});
it('reverse sorts step adjustments by upper bound when all have an upper bound defined', function () {
this.test(
[
Expand Down

0 comments on commit 69db5b3

Please sign in to comment.