From ad391cd567fed46da15e3ab3bd3fd42e7c512bf8 Mon Sep 17 00:00:00 2001 From: Brady Veal <61876166+bveal52@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:48:48 -0500 Subject: [PATCH 1/3] fix copy default UI --- apps/frontend/app/components/Parameter.tsx | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/frontend/app/components/Parameter.tsx b/apps/frontend/app/components/Parameter.tsx index 0fc16e92..3f12cc80 100644 --- a/apps/frontend/app/components/Parameter.tsx +++ b/apps/frontend/app/components/Parameter.tsx @@ -43,8 +43,21 @@ const Parameter = ({ form, type, index, confirmedValues, setConfirmedValues, ... if (form.values.hyperparameters[index].values && (form.values.hyperparameters[index].values.length != 1 && form.values.hyperparameters[index].values[0] != '')) { updateConfirmedValues(index, form.values.hyperparameters[index].values); } + + if (form.values.hyperparameters[index].default && form.values.hyperparameters[index].default != -1) { + setUseDefault(true); + } + else { + setUseDefault(false); + } }, []); + useEffect(() => { + if (form.values.hyperparameters[index].useDefault == false) { + form.setFieldValue(`hyperparameters.${index}.default`, -1); + } + }, [useDefault]); + const handleRemove = () => { form.removeListItem('hyperparameters', index); @@ -54,7 +67,14 @@ const Parameter = ({ form, type, index, confirmedValues, setConfirmedValues, ... const handleSwitchChange = () => { setUseDefault(!useDefault); - form.setFieldValue(`hyperparameters.${index}.useDefault`, !useDefault); + if(`hyperparameters.${index}.default` != -1){ + form.setFieldValue(`hyperparameters.${index}.useDefault`, !useDefault); + } + else { + form.setFieldValue(`hyperparameters.${index}.useDefault`, false); + } + + }; return ( @@ -89,7 +109,7 @@ const Parameter = ({ form, type, index, confirmedValues, setConfirmedValues, ... )} - +
Date: Mon, 16 Dec 2024 14:53:23 -0500 Subject: [PATCH 2/3] ignore the line for linting --- apps/frontend/app/components/Parameter.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/frontend/app/components/Parameter.tsx b/apps/frontend/app/components/Parameter.tsx index 3f12cc80..e34e4350 100644 --- a/apps/frontend/app/components/Parameter.tsx +++ b/apps/frontend/app/components/Parameter.tsx @@ -67,6 +67,7 @@ const Parameter = ({ form, type, index, confirmedValues, setConfirmedValues, ... const handleSwitchChange = () => { setUseDefault(!useDefault); + //tslint:disable-next-line if(`hyperparameters.${index}.default` != -1){ form.setFieldValue(`hyperparameters.${index}.useDefault`, !useDefault); } From 6b89a39f74d4fe69e60d78b142c498c3444ef312 Mon Sep 17 00:00:00 2001 From: Brady Veal <61876166+bveal52@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:56:51 -0500 Subject: [PATCH 3/3] try this --- apps/frontend/app/components/Parameter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/frontend/app/components/Parameter.tsx b/apps/frontend/app/components/Parameter.tsx index e34e4350..6bc0d5ee 100644 --- a/apps/frontend/app/components/Parameter.tsx +++ b/apps/frontend/app/components/Parameter.tsx @@ -67,7 +67,7 @@ const Parameter = ({ form, type, index, confirmedValues, setConfirmedValues, ... const handleSwitchChange = () => { setUseDefault(!useDefault); - //tslint:disable-next-line + // @ts-ignore if(`hyperparameters.${index}.default` != -1){ form.setFieldValue(`hyperparameters.${index}.useDefault`, !useDefault); }