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) O3-2255: Using REST endpoint to fetch address template and updated the tests for the address component #769

Merged
merged 14 commits into from
Aug 8, 2023

Conversation

vasharma05
Copy link
Member

Requirements

Summary

This PR updates the address component in the patient registration form to fetch the address configuration using the REST endpoint /es/rest/v1/addresstemplate. This improves the label provided for the different fields on the form and the translation is also handled on the backend itself.

Alongside, the test cases were updated with the new endpoint's results as mock and added new test suite for the address search component.

Screenshots

image

Related Issue

https://issues.openmrs.org/browse/O3-2255

Other

None.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 26, 2023

Size Change: -42.5 kB (-2%)

Total Size: 2.14 MB

Filename Size Change
packages/esm-patient-registration-app/dist/9.js 0 B -12.2 kB (removed) 🏆
packages/esm-patient-registration-app/dist/947.js 0 B -28.9 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/130.js 134 kB 0 B
packages/esm-active-visits-app/dist/316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/319.js 543 B 0 B
packages/esm-active-visits-app/dist/574.js 543 B 0 B
packages/esm-active-visits-app/dist/588.js 6.66 kB 0 B
packages/esm-active-visits-app/dist/629.js 7.48 kB 0 B
packages/esm-active-visits-app/dist/757.js 637 B 0 B
packages/esm-active-visits-app/dist/784.js 2.63 kB 0 B
packages/esm-active-visits-app/dist/788.js 540 B 0 B
packages/esm-active-visits-app/dist/807.js 856 B 0 B
packages/esm-active-visits-app/dist/833.js 660 B 0 B
packages/esm-active-visits-app/dist/842.js 881 B 0 B
packages/esm-active-visits-app/dist/879.js 2.94 kB 0 B
packages/esm-active-visits-app/dist/909.js 54.2 kB 0 B
packages/esm-active-visits-app/dist/936.js 7.96 kB 0 B
packages/esm-active-visits-app/dist/main.js 3.39 kB 0 B
packages/esm-active-visits-app/dist/openmrs-esm-active-visits-app.js 3.22 kB 0 B
packages/esm-appointments-app/dist/130.js 134 kB 0 B
packages/esm-appointments-app/dist/319.js 1.73 kB 0 B
packages/esm-appointments-app/dist/328.js 11.5 kB 0 B
packages/esm-appointments-app/dist/381.js 10.5 kB 0 B
packages/esm-appointments-app/dist/437.js 2.44 kB 0 B
packages/esm-appointments-app/dist/456.js 661 B 0 B
packages/esm-appointments-app/dist/469.js 6.65 kB 0 B
packages/esm-appointments-app/dist/574.js 1.72 kB 0 B
packages/esm-appointments-app/dist/591.js 16.9 kB 0 B
packages/esm-appointments-app/dist/610.js 6.71 kB 0 B
packages/esm-appointments-app/dist/738.js 144 kB 0 B
packages/esm-appointments-app/dist/752.js 30.9 kB 0 B
packages/esm-appointments-app/dist/757.js 1.73 kB 0 B
packages/esm-appointments-app/dist/781.js 103 kB 0 B
packages/esm-appointments-app/dist/784.js 2.63 kB 0 B
packages/esm-appointments-app/dist/788.js 1.73 kB 0 B
packages/esm-appointments-app/dist/80.js 5.09 kB 0 B
packages/esm-appointments-app/dist/807.js 2.42 kB 0 B
packages/esm-appointments-app/dist/833.js 2.02 kB 0 B
packages/esm-appointments-app/dist/884.js 1.96 kB 0 B
packages/esm-appointments-app/dist/main.js 5.49 kB 0 B
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.18 kB 0 B
packages/esm-outpatient-app/dist/119.js 27.6 kB 0 B
packages/esm-outpatient-app/dist/121.js 4 kB 0 B
packages/esm-outpatient-app/dist/130.js 134 kB 0 B
packages/esm-outpatient-app/dist/176.js 5.94 kB 0 B
packages/esm-outpatient-app/dist/242.js 218 B 0 B
packages/esm-outpatient-app/dist/252.js 2.21 kB 0 B
packages/esm-outpatient-app/dist/286.js 2.88 kB 0 B
packages/esm-outpatient-app/dist/308.js 8.14 kB 0 B
packages/esm-outpatient-app/dist/319.js 3.06 kB 0 B
packages/esm-outpatient-app/dist/328.js 3.1 kB 0 B
packages/esm-outpatient-app/dist/330.js 8.61 kB 0 B
packages/esm-outpatient-app/dist/364.js 2.02 kB 0 B
packages/esm-outpatient-app/dist/425.js 3.43 kB 0 B
packages/esm-outpatient-app/dist/457.js 2.49 kB 0 B
packages/esm-outpatient-app/dist/469.js 6.65 kB 0 B
packages/esm-outpatient-app/dist/521.js 2.74 kB 0 B
packages/esm-outpatient-app/dist/53.js 3.11 kB 0 B
packages/esm-outpatient-app/dist/574.js 3.08 kB 0 B
packages/esm-outpatient-app/dist/591.js 16.9 kB 0 B
packages/esm-outpatient-app/dist/610.js 6.71 kB 0 B
packages/esm-outpatient-app/dist/611.js 2.64 kB 0 B
packages/esm-outpatient-app/dist/616.js 3.61 kB 0 B
packages/esm-outpatient-app/dist/644.js 1.24 kB 0 B
packages/esm-outpatient-app/dist/670.js 155 kB 0 B
packages/esm-outpatient-app/dist/733.js 4.09 kB 0 B
packages/esm-outpatient-app/dist/757.js 3.06 kB 0 B
packages/esm-outpatient-app/dist/764.js 5.25 kB 0 B
packages/esm-outpatient-app/dist/766.js 4.73 kB 0 B
packages/esm-outpatient-app/dist/784.js 2.63 kB 0 B
packages/esm-outpatient-app/dist/788.js 3.06 kB 0 B
packages/esm-outpatient-app/dist/807.js 4.43 kB 0 B
packages/esm-outpatient-app/dist/833.js 3.66 kB 0 B
packages/esm-outpatient-app/dist/86.js 4.42 kB 0 B
packages/esm-outpatient-app/dist/981.js 2.91 kB 0 B
packages/esm-outpatient-app/dist/main.js 3.96 kB 0 B
packages/esm-outpatient-app/dist/openmrs-esm-outpatient-app.js 3.19 kB 0 B
packages/esm-patient-list-app/dist/130.js 134 kB 0 B
packages/esm-patient-list-app/dist/255.js 4.4 kB 0 B
packages/esm-patient-list-app/dist/294.js 3.29 kB 0 B
packages/esm-patient-list-app/dist/319.js 943 B 0 B
packages/esm-patient-list-app/dist/404.js 4.36 kB 0 B
packages/esm-patient-list-app/dist/469.js 95.9 kB 0 B
packages/esm-patient-list-app/dist/537.js 534 B 0 B
packages/esm-patient-list-app/dist/563.js 15.4 kB 0 B
packages/esm-patient-list-app/dist/574.js 942 B 0 B
packages/esm-patient-list-app/dist/588.js 6.66 kB 0 B
packages/esm-patient-list-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-list-app/dist/716.js 4.62 kB 0 B
packages/esm-patient-list-app/dist/757.js 1.09 kB 0 B
packages/esm-patient-list-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-list-app/dist/788.js 941 B 0 B
packages/esm-patient-list-app/dist/791.js 1.72 kB 0 B
packages/esm-patient-list-app/dist/807.js 1.37 kB 0 B
packages/esm-patient-list-app/dist/833.js 1.13 kB 0 B
packages/esm-patient-list-app/dist/900.js 7.66 kB 0 B
packages/esm-patient-list-app/dist/main.js 6.08 kB 0 B
packages/esm-patient-list-app/dist/openmrs-esm-patient-list-app.js 3.18 kB 0 B
packages/esm-patient-registration-app/dist/117.js 12.1 kB 0 B
packages/esm-patient-registration-app/dist/130.js 134 kB 0 B
packages/esm-patient-registration-app/dist/167.js 26.9 kB -524 B (-2%)
packages/esm-patient-registration-app/dist/177.js 57.2 kB 0 B
packages/esm-patient-registration-app/dist/294.js 23.4 kB 0 B
packages/esm-patient-registration-app/dist/319.js 1.29 kB -70 B (-5%)
packages/esm-patient-registration-app/dist/485.js 29 kB 0 B
packages/esm-patient-registration-app/dist/537.js 3.74 kB 0 B
packages/esm-patient-registration-app/dist/574.js 1.36 kB -70 B (-5%)
packages/esm-patient-registration-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-registration-app/dist/62.js 6.86 kB 0 B
packages/esm-patient-registration-app/dist/635.js 456 B 0 B
packages/esm-patient-registration-app/dist/68.js 9.32 kB -161 B (-2%)
packages/esm-patient-registration-app/dist/735.js 464 B 0 B
packages/esm-patient-registration-app/dist/742.js 721 B 0 B
packages/esm-patient-registration-app/dist/757.js 1.62 kB -77 B (-5%)
packages/esm-patient-registration-app/dist/784.js 2.64 kB 0 B
packages/esm-patient-registration-app/dist/788.js 1.29 kB -72 B (-5%)
packages/esm-patient-registration-app/dist/807.js 2.05 kB -110 B (-5%)
packages/esm-patient-registration-app/dist/833.js 1.59 kB -73 B (-4%)
packages/esm-patient-registration-app/dist/857.js 2.08 kB 0 B
packages/esm-patient-registration-app/dist/879.js 2.94 kB 0 B
packages/esm-patient-registration-app/dist/975.js 425 B 0 B
packages/esm-patient-registration-app/dist/main.js 21.6 kB -219 B (-1%)
packages/esm-patient-registration-app/dist/openmrs-esm-patient-registration-app.js 3.23 kB +1 B (0%)
packages/esm-patient-search-app/dist/110.js 16.9 kB 0 B
packages/esm-patient-search-app/dist/128.js 2.02 kB 0 B
packages/esm-patient-search-app/dist/130.js 134 kB 0 B
packages/esm-patient-search-app/dist/262.js 29.4 kB 0 B
packages/esm-patient-search-app/dist/319.js 779 B 0 B
packages/esm-patient-search-app/dist/327.js 1.05 kB 0 B
packages/esm-patient-search-app/dist/357.js 5.72 kB 0 B
packages/esm-patient-search-app/dist/519.js 5.08 kB 0 B
packages/esm-patient-search-app/dist/574.js 792 B 0 B
packages/esm-patient-search-app/dist/588.js 6.66 kB 0 B
packages/esm-patient-search-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-search-app/dist/757.js 923 B 0 B
packages/esm-patient-search-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-search-app/dist/788.js 778 B 0 B
packages/esm-patient-search-app/dist/807.js 1.12 kB 0 B
packages/esm-patient-search-app/dist/833.js 947 B 0 B
packages/esm-patient-search-app/dist/842.js 2.06 kB 0 B
packages/esm-patient-search-app/dist/939.js 4.42 kB 0 B
packages/esm-patient-search-app/dist/982.js 1.69 kB 0 B
packages/esm-patient-search-app/dist/main.js 3.44 kB 0 B
packages/esm-patient-search-app/dist/openmrs-esm-patient-search-app.js 3.19 kB 0 B

compressed-size-action

Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

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

Apologies for semi-hijacking this to make some stricter types. Looks good apart from one bit of commented code left in.

setValidationSchema((validationSchema) => validationSchema.concat(addressValidationSchema));
}
}, [inEditMode, addressTemplate, initialAddressFieldValues]);
// useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

We can delete this right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I missed it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @ibacher !
This brings to another question.
Do we need the regex validation from the address template to work on the frontend?
Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

@vasharma05 Probably eventually, but it's not the highest priority.

@denniskigen
Copy link
Member

Will the value for Country default to Cambodia? Would it be preferable to have dev3 default to an empty field instead if so?

@ibacher
Copy link
Member

ibacher commented Jul 26, 2023

@denniskigen It looks like we're properly pulling defaults from the address template, so if someone puts a value in there, it will be the default, but we should be able to unset it.

@vasharma05
Copy link
Member Author

vasharma05 commented Jul 27, 2023

Thank you @ibacher for the strict typings!
I'll take care of the same from the next time.

Regarding the default @denniskigen, @gracepotma filed this ticket to remove the dev3.

As I suggested before as well in the coffee break, I believe we should have a default value in the reference application, let not be Cambodia, but something so that the end user is aware that we have the defaults functioning in the address template.

What do you say about this @gracepotma ?
Thanks!

@vasharma05 vasharma05 requested a review from ibacher August 1, 2023 06:44
@ibacher ibacher changed the title O3-2255: Using REST endpoint to fetch address template and updated the tests for the address component (feat) O3-2255: Using REST endpoint to fetch address template and updated the tests for the address component Aug 8, 2023
@ibacher ibacher merged commit 015563e into main Aug 8, 2023
7 checks passed
@ibacher ibacher deleted the O3-2255 branch August 8, 2023 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants