Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new org unit form #421

Merged
merged 33 commits into from
Oct 22, 2024
Merged

feat: new org unit form #421

merged 33 commits into from
Oct 22, 2024

Conversation

flaminic
Copy link
Contributor

@flaminic flaminic commented Oct 8, 2024

No description provided.

Copy link

netlify bot commented Oct 8, 2024

Deploy Preview for dhis2-maintenance-app-beta ready!

Name Link
🔨 Latest commit dbd0df2
🔍 Latest deploy log https://app.netlify.com/sites/dhis2-maintenance-app-beta/deploys/671783d130904900084fc0d1
😎 Deploy Preview https://deploy-preview-421--dhis2-maintenance-app-beta.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@Birkbjo Birkbjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this, overall looks great!
Preliminary review :)

src/components/form/fields/CodeField.tsx Outdated Show resolved Hide resolved
src/components/form/fields/CodeField.tsx Outdated Show resolved Hide resolved
src/components/form/fields/CodeField.tsx Outdated Show resolved Hide resolved
src/components/form/fields/CodeField.tsx Outdated Show resolved Hide resolved
src/lib/form/useOnSubmit.ts Show resolved Hide resolved
src/pages/organisationUnits/New.tsx Outdated Show resolved Hide resolved
@flaminic flaminic force-pushed the DHIS2-17898/new-org-unit-form branch from 0bed3e1 to 8df351c Compare October 15, 2024 13:40
@flaminic flaminic force-pushed the DHIS2-17898/new-org-unit-form branch from 8df351c to 1795788 Compare October 15, 2024 13:45
@flaminic flaminic force-pushed the DHIS2-17898/new-org-unit-form branch from ea4d691 to bbb94fa Compare October 16, 2024 11:07
@flaminic flaminic force-pushed the DHIS2-17898/new-org-unit-form branch from 693420d to 8bd6709 Compare October 17, 2024 12:18
Copy link
Member

@Birkbjo Birkbjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor notes.
Mostly related to minor cleanups, so nothing crucial. Thanks a lot for this!

src/lib/models/useCheckMaxLengthFromSchema.ts Outdated Show resolved Hide resolved
src/lib/models/useCheckMaxLengthFromSchema.ts Show resolved Hide resolved
src/pages/organisationUnits/form/types.ts Outdated Show resolved Hide resolved
<div className={classes.selectedOrgUnitBox}>
<OrganisationUnitField
name={'parent'}
singleSelection
Copy link
Member

@Birkbjo Birkbjo Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could potentially add some logic to the OrganisationUnitField to be aware of singleSelection (now it just passes it through to the UnitTree - and then operate on reference instead of an array. Then we wouldn't have to change the type of the parent in formValue? However it does have the complication of "changing" the API, so maybe not worth?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's have a quick chat about this :)

src/pages/organisationUnits/form/ImageField.tsx Outdated Show resolved Hide resolved
code: z.string().trim().optional(),
description: z.string().trim().optional(),
image: z.object({ id: z.string() }).optional(),
attributeValues: z
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the helpers from modelFormSchemas, eg. withAttributeValues here?


const { withAttributeValues } = modelFormSchemas

export const organisationUnitSchema = withAttributeValues.extend({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing id now. Could also us identifiable from modelFormSchemas.

}

return (
<FieldRFF<string | undefined> name={fieldName}>
Copy link
Member

@Birkbjo Birkbjo Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this. This will create a new listener for the field - and we already have useField above.
Edit: I updated this in the commit for image preview

@flaminic flaminic force-pushed the DHIS2-17898/new-org-unit-form branch from caf07d1 to dbd0df2 Compare October 22, 2024 10:51
@flaminic flaminic merged commit cee3edc into master Oct 22, 2024
9 of 10 checks passed
@flaminic flaminic deleted the DHIS2-17898/new-org-unit-form branch October 22, 2024 11:00
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 0.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants