Skip to content

Commit

Permalink
update PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 committed Oct 3, 2023
1 parent 882c27e commit 8d2e9e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
16 changes: 10 additions & 6 deletions public/components/acceleration/selectors/index_setting_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export const IndexSettingOptions = ({
const [checkpoint, setCheckpoint] = useState('');

const onChangePrimaryShards = (e: ChangeEvent<HTMLInputElement>) => {
const countPrimaryShards = +e.target.value;
const countPrimaryShards = parseInt(e.target.value, 10);
setAccelerationFormData({ ...accelerationFormData, primaryShardsCount: countPrimaryShards });
setPrimaryShards(countPrimaryShards);
};

const onChangeReplicaCount = (e: ChangeEvent<HTMLInputElement>) => {
const replicaCount = +e.target.value;
const replicaCount = parseInt(e.target.value, 10);
setAccelerationFormData({ ...accelerationFormData, replicaShardsCount: replicaCount });
setReplicaCount(replicaCount);
};
Expand All @@ -75,7 +75,7 @@ export const IndexSettingOptions = ({
};

const onChangeRefreshWindow = (e: ChangeEvent<HTMLInputElement>) => {
const windowCount = +e.target.value;
const windowCount = parseInt(e.target.value, 10);
setAccelerationFormData(
producer((accData) => {
accData.refreshIntervalOptions.refreshWindow = windowCount;
Expand Down Expand Up @@ -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)
);
})
);
}}
Expand All @@ -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)
);
})
);
}}
Expand Down Expand Up @@ -187,7 +191,7 @@ export const IndexSettingOptions = ({
producer((accData) => {
accData.formErrors.refreshIntervalError = validateRefreshInterval(
refreshTypeSelected,
+e.target.value
parseInt(e.target.value, 10)
);
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const GroupByTumbleExpression = ({
};

const onChangeTumbleWindow = (e: React.ChangeEvent<HTMLInputElement>) => {
const newGroupByValue = { ...groupbyValues, tumbleWindow: +e.target.value };
const newGroupByValue = { ...groupbyValues, tumbleWindow: parseInt(e.target.value, 10) };
updateGroupByStates(newGroupByValue);
};

Expand Down

0 comments on commit 8d2e9e1

Please sign in to comment.