Skip to content

Commit

Permalink
fix(projectDetails): update set odk credential logic
Browse files Browse the repository at this point in the history
  • Loading branch information
NSUWAL123 committed Feb 5, 2025
1 parent b1f3d3d commit ba21e3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ const ProjectDetailsForm = ({ flag }) => {
dispatch(CreateProjectActions.SetIsUnsavedChanges(true));
};

const getSelectedOrganization = () => {
return organisationList.find((org) => org.value === values.organisation_id);
};

const handleOrganizationChange = (orgId: number) => {
// Ensure orgId is not null or undefined before integer convert
const orgIdInt = orgId && +orgId;
Expand Down Expand Up @@ -112,10 +108,6 @@ const ProjectDetailsForm = ({ flag }) => {
});
}, [organisationList]);

const shouldShowCustomODKFields = () => {
return !values.useDefaultODKCredentials;
};

return (
<div className="fmtm-flex fmtm-gap-7 fmtm-flex-col lg:fmtm-flex-row fmtm-h-full">
<DescriptionSection section="Project Details" />
Expand Down Expand Up @@ -182,7 +174,7 @@ const ProjectDetailsForm = ({ flag }) => {
}}
onMouseLeave={() => dispatch(CreateProjectActions.SetDescriptionToFocus(null))}
>
{
{hasODKCredentials && (
<CustomCheckbox
key="useDefaultODKCredentials"
label="Use default ODK credentials"
Expand All @@ -193,8 +185,8 @@ const ProjectDetailsForm = ({ flag }) => {
className="fmtm-text-black"
labelClickable={hasODKCredentials} // Dynamically set labelClickable based on hasODKCredentials
/>
}
{shouldShowCustomODKFields() && (
)}
{((!values.useDefaultODKCredentials && hasODKCredentials) || !hasODKCredentials) && (
<ODKCredentialsFields values={values} errors={errors} handleChange={handleChange} />
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface ProjectValues {
odk_central_url: string;
odk_central_user: string;
odk_central_password: string;
defaultODKCredentials: boolean;
useDefaultODKCredentials: boolean;
hasCustomTMS: boolean;
custom_tms_url: string;
}
Expand Down

0 comments on commit ba21e3c

Please sign in to comment.