diff --git a/public/components/acceleration/create/create_acceleration.tsx b/public/components/acceleration/create/create_acceleration.tsx index 8dae138b..4cfc5e44 100644 --- a/public/components/acceleration/create/create_acceleration.tsx +++ b/public/components/acceleration/create/create_acceleration.tsx @@ -83,7 +83,7 @@ export const CreateAcceleration = ({ const copyToEditor = () => { const errors = formValidator(accelerationFormData); - if (Object.values(errors).some((e) => !!e.length)) { + if (hasError(errors)) { setAccelerationFormData({ ...accelerationFormData, formErrors: errors }); return; } diff --git a/public/components/acceleration/selectors/index_setting_options.tsx b/public/components/acceleration/selectors/index_setting_options.tsx index 7aec7ca0..3fc259ad 100644 --- a/public/components/acceleration/selectors/index_setting_options.tsx +++ b/public/components/acceleration/selectors/index_setting_options.tsx @@ -55,13 +55,13 @@ export const IndexSettingOptions = ({ const [checkpoint, setCheckpoint] = useState(''); const onChangePrimaryShards = (e: ChangeEvent) => { - const countPrimaryShards = +e.target.value; + const countPrimaryShards = parseInt(e.target.value, 10); setAccelerationFormData({ ...accelerationFormData, primaryShardsCount: countPrimaryShards }); setPrimaryShards(countPrimaryShards); }; const onChangeReplicaCount = (e: ChangeEvent) => { - const replicaCount = +e.target.value; + const replicaCount = parseInt(e.target.value, 10); setAccelerationFormData({ ...accelerationFormData, replicaShardsCount: replicaCount }); setReplicaCount(replicaCount); }; @@ -75,7 +75,7 @@ export const IndexSettingOptions = ({ }; const onChangeRefreshWindow = (e: ChangeEvent) => { - const windowCount = +e.target.value; + const windowCount = parseInt(e.target.value, 10); setAccelerationFormData( producer((accData) => { accData.refreshIntervalOptions.refreshWindow = windowCount; @@ -127,7 +127,9 @@ export const IndexSettingOptions = ({ onBlur={(e) => { setAccelerationFormData( producer((accData) => { - accData.formErrors.primaryShardsError = validatePrimaryShardCount(+e.target.value); + accData.formErrors.primaryShardsError = validatePrimaryShardCount( + parseInt(e.target.value, 10) + ); }) ); }} @@ -150,7 +152,9 @@ export const IndexSettingOptions = ({ onBlur={(e) => { setAccelerationFormData( producer((accData) => { - accData.formErrors.replicaShardsError = validateReplicaCount(+e.target.value); + accData.formErrors.replicaShardsError = validateReplicaCount( + parseInt(e.target.value, 10) + ); }) ); }} @@ -187,7 +191,7 @@ export const IndexSettingOptions = ({ producer((accData) => { accData.formErrors.refreshIntervalError = validateRefreshInterval( refreshTypeSelected, - +e.target.value + parseInt(e.target.value, 10) ); }) ); diff --git a/public/components/acceleration/visual_editors/materialized_view/group_by_tumble_expression.tsx b/public/components/acceleration/visual_editors/materialized_view/group_by_tumble_expression.tsx index e1e25339..ba56488f 100644 --- a/public/components/acceleration/visual_editors/materialized_view/group_by_tumble_expression.tsx +++ b/public/components/acceleration/visual_editors/materialized_view/group_by_tumble_expression.tsx @@ -50,7 +50,7 @@ export const GroupByTumbleExpression = ({ }; const onChangeTumbleWindow = (e: React.ChangeEvent) => { - const newGroupByValue = { ...groupbyValues, tumbleWindow: +e.target.value }; + const newGroupByValue = { ...groupbyValues, tumbleWindow: parseInt(e.target.value, 10) }; updateGroupByStates(newGroupByValue); };