Skip to content

Commit

Permalink
Merge pull request #13487 from lokanandaprabhu/feature/OCPBUGS-26415
Browse files Browse the repository at this point in the history
OCPBUGS-26415: Application creation fail when manually entering input scaling value in local setup
  • Loading branch information
openshift-merge-bot[bot] committed Mar 12, 2024
2 parents 395ac92 + 3473b1a commit 63e97fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Expand Up @@ -8,7 +8,16 @@ import { RedExclamationCircleIcon } from '../status';
import { FieldProps } from './field-types';
import { getFieldId } from './field-utils';

const NumberSpinnerField: React.FC<FieldProps> = ({ label, helpText, required, ...props }) => {
interface NumberSpinnerFieldProps extends FieldProps {
setOutputAsIntegerFlag?: boolean;
}

const NumberSpinnerField: React.FC<NumberSpinnerFieldProps> = ({
label,
helpText,
required,
...props
}) => {
const [field, { touched, error }] = useField(props.name);
const { setFieldValue, setFieldTouched } = useFormikContext<FormikValues>();
const fieldId = getFieldId(props.name, 'number-spinner');
Expand All @@ -20,9 +29,14 @@ const NumberSpinnerField: React.FC<FieldProps> = ({ label, helpText, required, .
const handleChange: React.ReactEventHandler<HTMLInputElement> = React.useCallback(
(event) => {
field.onChange(event);
setFieldValue(props.name, event.currentTarget.value);
setFieldValue(
props.name,
props?.setOutputAsIntegerFlag
? _.toInteger(event.currentTarget.value)
: event.currentTarget.value,
);
},
[field, props.name, setFieldValue],
[field, props.name, setFieldValue, props?.setOutputAsIntegerFlag],
);

return (
Expand Down
Expand Up @@ -15,6 +15,7 @@ const ScalingSection: React.FC<{ name: string }> = ({ name }) => {
name={name}
label={t('devconsole~Replicas')}
helpText={t('devconsole~The number of instances of your Image.')}
setOutputAsIntegerFlag
/>
</FormSection>
);
Expand Down

0 comments on commit 63e97fa

Please sign in to comment.