Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
yomybaby committed Feb 19, 2025
1 parent e88aa59 commit 4db418f
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions react/src/components/AutoScalingRuleEditorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
type: 'up',
metric_source: 'KERNEL',
comparator: 'GREATER_THAN',
// threshold: '',
step_size: 1,
cooldown_seconds: 300,
min_replicas: 0,
Expand All @@ -280,21 +279,11 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
<Radio.Group
options={[
{
label: (
<Flex gap={'xs'}>
{t('autoScalingRule.ScaleUp')}
{/* <MoveUpRight /> */}
</Flex>
),
label: <Flex gap={'xs'}>{t('autoScalingRule.ScaleUp')}</Flex>,
value: 'up',
},
{
label: (
<Flex gap={'xs'}>
{t('autoScalingRule.ScaleDown')}
{/* <MoveDownRight /> */}
</Flex>
),
label: <Flex gap={'xs'}>{t('autoScalingRule.ScaleDown')}</Flex>,
value: 'down',
},
]}
Expand Down Expand Up @@ -377,7 +366,7 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
options={_.map(COMPARATOR_LABELS, (label, value) => ({
label: (
<Flex gap={'xs'}>
{label}{' '}
{label}
<Typography.Text type="secondary">
({value})
</Typography.Text>
Expand Down Expand Up @@ -411,6 +400,16 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
min: 1,
max: SIGNED_32BIT_MAX_INT,
},
{
validator: (_, value) => {
if (value % 1 !== 0) {
return Promise.reject(
new Error(t('error.OnlyPositiveIntegersAreAllowed')),
);
}
return Promise.resolve();
},
},
]}
>
<InputNumber min={1} step={1} style={{ width: '100%' }} />
Expand All @@ -425,6 +424,8 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
rules={[
{
required: true,
},
{
min: 0,
max: SIGNED_32BIT_MAX_INT,
type: 'number',
Expand Down Expand Up @@ -455,6 +456,8 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
rules={[
{
required: true,
},
{
min: 0,
max: SIGNED_32BIT_MAX_INT,
type: 'number',
Expand Down Expand Up @@ -486,6 +489,8 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
rules={[
{
required: true,
},
{
min: 0,
type: 'number',
},
Expand Down

0 comments on commit 4db418f

Please sign in to comment.