-
-
Notifications
You must be signed in to change notification settings - Fork 210
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: add support for Enekto draw widget in forms #8904
Conversation
12a9c48
to
4875f39
Compare
3507996
to
76507a3
Compare
👍 Yes, I believe that draw/signature is backed by the same libraries (maybe even the same Enekto widget... 🤔 ). I will try to carve out some time in the next week to think about optional widgets. On a related note, @garethbowen I see that the bundle size limits were removed with Grunt. Were these replaced with something else or do we have anything right now that is checking the size of the bundle? |
No they weren't replaced. In reality we weren't blocking on that anyway. It's not a practical solution because every commit gets you closer and closer to the limit until finally one unlucky soul hit it. So every time we breached it we just arbitrarily bumped it until we disabled it anyway. IMO this is a better solution: #8865 |
Have not forgotten about this. Planning to do some investigating today or tomorrow! Will follow up out here with any findings. |
@garethbowen I did a deep dive into the options for modularlizing/lazy-loading widgets and included my findings in the issue. The TLDR with regards to this PR, though is:
Let me know how you want to proceed! |
That size change should not hold up this widget. |
👍 Sounds good! My plan this week, then, is to do a proper review of these code changes and either suggest or just push some unit tests and some integration/cht-form tests. @lorerod just wanted to get you engaged at the start here in case you had any thoughts/concerns going into this. I am thinking we will want at least 1 happy-path e2e test to make sure we cover saving the drawing image as an attachment in Couch, but besides that, I will try to cover other test cases in the cht-form integration tests... |
# Conflicts: # webapp/src/ts/services/enketo.service.ts
Bad news. The While testing this code, I uncovered an issue where, if the signature is not on the last page (but on one of the earlier pages) and the signature widget is still visible on the page when the "Next" button is hit, the image will not be saved for that signature. This bug is not a result of the code changes in this PR, but I thought it might be some kind of integration issue with how we are manipulating eneketo-core. However, after extensive debugging over the last two days, I began to wonder if this was a bug in the actual Enekto widget code. This suspicion led me to a review of the latest enketo-core source code where I realized our unlucky timing here... In enketo-core For the record, the bug that I was tracking in the implementation of the draw widget from One potential fix I had identified was to update the ResizableSignaturePad code to add a check in the |
@jkuester, thank you for the detailed findings while investigating this! Am I correct in assuming that CHT version It would definitely impact our decision/haste in upgrading to newer CHT versions. |
@ChinHairSaintClair good question! We upgraded to Enekto That being said, your question has made me reconsider our options here! If we look at the Enketo PR that reverted the Draw widget changes for Enketo @garethbowen let me know if you are open to pursuing that approach (or should we just double-down on efforts to complete the Enketo uplift?). |
@jkuester - per our private chat in slack, let's go ahead with this approach:
We can be sure to undo any patchwork we do when we get around to the Enketo uplift |
…o smaller forms in draw-widget and file-upload tests.
# Conflicts: # webapp/tests/karma/ts/services/enketo.service.spec.ts
Okay, I am going to try and clarify/recap what is going on in this PR! 😅 The main goal is to address #8308 so we can support collecting signatures in forms. (The enketo The @ChinHairSaintClair I think this is finally ready to go! When you get the chance, can you pull down the latest version of this branch and try it out to make sure everything still works for you? @Benmuiruri I am hoping you might have some time next week to do a code review of this! 🙏 I am not sure how much experience you have had with the Enekto stuff so far, but if you get totally confused by looking at this, let me know and we can jump on a call to discuss! (Our "integration" with the enekto-core library is very involved (read: "tightly coupled"). These changes are not making it much better, but they are not making it too much worse either. 😬 @lorerod the testing here got a bit interesting and I would very much appreciate your feedback on it! In the cht-form integration tests, I added I thought about adding either of these workflows to the existing
|
FYI:
|
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.
@jkuester Thank you for sharing the details of the testing approach. It sounds well thought out!
Regarding the draw-widget.wdio.spec.ts
test, asserting the image size is a clever simplification. It ensures something substantial is saved and avoids overcomplicating the tests.
Keeping tests focused will make them easier to manage and less prone to breaking with future changes. Regarding the similarity between submit-photo-upload-form.wdio-spec.js
and file-upload.wdio-spec.js
, I agree with the justification behind keeping them separate to keep the tests modular and focused on their specific workflows and avoid adding unnecessary complexity to the e2e tests.
I also manually tested the enketo draw widget. It works! Here is a screenshot of the report, and extract from the saved doc:
"_attachments": {
"user-file-drawing-15_5_28.png": {
"content_type": "image/png",
"revpos": 1,
"digest": "md5-X49lAzhPmcGO+8DwomyxSA==",
"length": 20381,
"stub": true
}
}
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.
LGTM. I was able to test and see how we extend the enketo file manager and providing the widgets in Webapp.
@jkuester Seems to be working fine on my side too 😃!
|
@ChinHairSaintClair thanks for testing this out! I think your behavior difference with the URLs is actually to be expected since we changed the naming convention for the attachments. Instead of |
Description
Closes #8308
Closes #8072
Enables the draw widget, which allows CHT to capture free hand drawings through touch or mouse pointer.
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.