Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Reset button for drawing/signature and upload not working #990

Closed
MartijnR opened this issue Apr 19, 2018 · 14 comments
Closed

Reset button for drawing/signature and upload not working #990

MartijnR opened this issue Apr 19, 2018 · 14 comments
Labels

Comments

@MartijnR
Copy link
Member

This is for file upload/drawing item types. The reset button does not work for any of these, so it is not possible to clear the image/file/drawing. Note that the Undo button works for draw/annotate, but it is only undoing the lines, not the image upload for annotate.

Note that the reset button is not doing anything (there is no popup confirmation of the action like there was before).

@MartijnR MartijnR added the bug label Apr 19, 2018
@MartijnR MartijnR added this to the OpenClinica Next milestone Apr 19, 2018
@MartijnR MartijnR added the OC label Apr 19, 2018
@MartijnR
Copy link
Member Author

MartijnR commented Apr 20, 2018

@MartijnR
Copy link
Member Author

MartijnR commented Apr 20, 2018

in dialog.js, the gui object is empty. This affects all modal dialogs called from widgets (e.g. geo widgets too).

Could be an aliasify issue.

@MartijnR
Copy link
Member Author

very mysterious. If I copy gui.js to gui.1.js and change require('./gui) to require('./gui.1') all is good again. This seems like some kind of interaction with another module with the same name.

@MartijnR
Copy link
Member Author

You can trick the system into a correct build by calling require('../dialog') from e.g. the main-webform.js entry file.

MartijnR added a commit to OpenClinica/enketo-express-oc that referenced this issue Apr 20, 2018
@MartijnR
Copy link
Member Author

Leaving this open. I was not able to find the actual cause of this JS build issue yet. I added a temporary workaround for now.

@pbowen-oc
Copy link

@MartijnR - The Reset Button is generally working now, but it is not considering whether the form is open in edit/review-only/read-only mode. We expect that the file should be able to be reset in edit mode, but not review-only or read-only mode. However, we are observing that the reset button is present and active in review-only and read-only mode. The button should be disabled in these modes or not visible at all. (Note that review-only mode is actually submitting the file removal back to us, but read-only is not submitting it.)

@MartijnR
Copy link
Member Author

ah yes, of course. That was never implemented (including geo widgets).

@MartijnR MartijnR added the bug label Apr 24, 2018
@pbowen-oc
Copy link

@MartijnR - Ideally, the Reset button and Undo button would not be visible in review-only and read-only modes. The Download button should still be visible and functional in all modes.

MartijnR added a commit to enketo/enketo-core that referenced this issue Apr 25, 2018
@MartijnR
Copy link
Member Author

MartijnR commented Apr 25, 2018

  • do final check in special fs note-only views

@MartijnR
Copy link
Member Author

MartijnR commented Apr 25, 2018

working too fast. Reset no longer functional in drawings in note-only mode, but still visible. Properly hidden in file upload widgets.

  • [Minor] hide reset button in drawing widget when drawing is readonly

@MartijnR
Copy link
Member Author

fixed in 1.65.0.oc-2

@MartijnR
Copy link
Member Author

MartijnR commented May 2, 2018

reopening as this this needs a proper fix (without the temporary workaround)

@MartijnR
Copy link
Member Author

I think this is because of the way gui.js self-initializes.

@MartijnR
Copy link
Member Author

MartijnR commented Jul 18, 2018

Finally figured it out. It's very subtle so here is the post-op for posterity:

TL/DR; it's a circular reference

  1. dialog.js (aliasified from enketo/dialog) requires gui.js
  2. gui.js requires ../core/print.js
  3. ../core/print.js requires dialog.js (aliasified from enketo/dialog)
  4. for some reason that results in the gui module in dialog.js becoming an empty object

Commenting out the require('../core/print') eliminates the issue.

The fix:

  • in Enketo Core let dialog.confirm and dialog.alert always resolve with a value (if confirmed) or with empty if not confirmed
  • get rid of dialog.js by aliasifying enketo/dialog to gui.js and changing gui.alert and gui.confirm functions to return a Promise
  • check all uses of gui.alert and gui.confirm in EE for regressions
  • check all uses of gui.alert and gui.confirm in EE-OC

MartijnR added a commit to enketo/enketo-core that referenced this issue Jul 19, 2018
MartijnR added a commit that referenced this issue Jul 19, 2018
MartijnR added a commit to OpenClinica/enketo-express-oc that referenced this issue Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants