-
Notifications
You must be signed in to change notification settings - Fork 248
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
(fix) O3-2627: Improvements to the visit notes image upload functionality #1748
Conversation
Why are we even allowing all types of documents when we only need images? |
I've tested the existing functionality on the refapp, and it looks like the validation is working as intended courtesy of work done in #1620, #1685, and #1584. supported-file-extensions.mp4So, this change should not be required. What could change, however, is:
|
@denniskigen You are correct! I believe this PR should be closed unless there is something that needs fixing. Yesterday's internet was so poor that I couldn't see the Snackbar error message. Please forgive me. |
@jwnasambu @vasharma05 I think in this case we want inline error notifications, not a snackbar, right? From what @denniskigen mentioned above, this is working as expected. |
packages/esm-patient-notes-app/src/notes/visit-notes-form.component.tsx
Outdated
Show resolved
Hide resolved
e871749
to
60d17c6
Compare
I'm not familiar entirely with this functionality, but a generic attachments functionality is useful, to be able to upload things like reports in PDF format, etc. |
@mogoodrich @vasharma05 it definitely makes sense to open this up to different file formats. This current implementation is guided by the design, specifically the Add Image button, which suggests that file uploads in the visit note form should be limited to images. This limitation is not enforced in the attachments app with the caveat that attachments recorded there aren’t linked to a visit note. |
@denniskigen it would be nice to understand the design requirements. It would be nice to open this to some common file formats unless there are clear reasons for not opening it up. I see a lot of use cases beyond just images though |
Yeah, I'll seek Ciaran and Paul's feedback on this tomorrow @ojwanganto. Update: Here's the slack thread https://openmrs.slack.com/archives/CKS32D55G/p1711010187179539. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm merging this as it meets the requirements in the ticket. I'll file a new ticket with the new requirement of uploading different file formats via the visit note form.
Yeah, sorry, didn't mean to derail this ticket, just wanted to note that there is a significant use case for other kinds of uploads like PDFs. |
Hello @jwnasambu,
This configuration comes from the backend which for security reasons also validates the allowed extensions. And now if we set the global property Do you have any reason to keep this change or can I revert it to the old one? cc: @mogoodrich, @denniskigen, @ojwanganto, @hadijahkyampeire, @ibacher |
Sorry about that, @icrc-loliveira. What does the request for the |
This is an example of the values that is expecting:
|
@ibacher does the |
@denniskigen All GPs are basically just string values. However, changing the value there would require updates to the attachments module code, since we're currently lopping the extension off separately. @icrc-loliveira Would we want to allow all of those values on the visit notes image upload? That probably requires reworking the page a bit (since |
Please feel free to revert to the old convention, @icrc-loliveira. Sorry for the inconvenience. |
Requirements
Summary
I modified
showImageCaptureModal
function before setting the value of the image field to checks if the file type is 'image'. If it's not an image, to displays a Snackbar error message indicating that only image files are allowed.It rejects the promise with an error if the file type is not an image, preventing the modal from closing and the value from being set and if the file type is an image, it proceeds to set the image field value and close the modal as before.
Screenshots
Related Issue
https://openmrs.atlassian.net/browse/O3-2627
Other