From 69db5b34b7704f4453f2d0b3210763b2ed0e52cc Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 18:17:33 +0000 Subject: [PATCH] fix: Scaling bounds should parse float not int (#10026) (#10032) * 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 b763cae826039df46b8dbe019689316ff5034e33) Co-authored-by: Jason --- .../scalingPolicy/upsert/step/StepPolicyAction.tsx | 4 ++-- .../src/serverGroup/serverGroup.transformer.spec.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/amazon/src/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.tsx b/packages/amazon/src/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.tsx index 0be68fedeaf..3e260e73a12 100644 --- a/packages/amazon/src/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.tsx +++ b/packages/amazon/src/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.tsx @@ -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" /> @@ -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" /> diff --git a/packages/ecs/src/serverGroup/serverGroup.transformer.spec.ts b/packages/ecs/src/serverGroup/serverGroup.transformer.spec.ts index 8d7c5ef0512..679d1b05709 100644 --- a/packages/ecs/src/serverGroup/serverGroup.transformer.spec.ts +++ b/packages/ecs/src/serverGroup/serverGroup.transformer.spec.ts @@ -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( [