From 8d2e9e16ec822ce3e98cfaca4200ced98b02db8c Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Mon, 2 Oct 2023 23:52:25 -0700 Subject: [PATCH] update PR comments Signed-off-by: Shenoy Pratik --- .../acceleration/create/create_acceleration.tsx | 2 +- .../selectors/index_setting_options.tsx | 16 ++++++++++------ .../group_by_tumble_expression.tsx | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) 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); };