-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
6345 - Uplift to enketo-core version 5.18.1 #7256
Conversation
4ef441d
to
0d87d65
Compare
d98b6e5
to
f735118
Compare
3b0195b
to
0f17b49
Compare
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 just have a couple of questions about the db-object-widget refactor.
Awesome job! I'm so happy to see this finalize!
@@ -75,7 +87,7 @@ const changeHandler = function() { | |||
const doc = selected && selected[0] && selected[0].doc; | |||
if (doc) { | |||
const field = $this.attr('name'); | |||
const index = $('[name="' + field + '"]').index(this); | |||
const index = $('select[name="' + field + '"]').index(this); |
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.
So we end up having one hidden input and a select with the same name?
Is that required?
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.
Yes that is where things sit now.
Is that required?
It is not required that they have the same name. Things go bad in the Enketo logic if I change the name on the input
(which is to be expected). However, I do not have to set the same name onto the select
. I do have to set some kind of name on the select
or other weird behavior happens in Enekto (a select
with no name confuses the Enekto node resolution logic in ways that I do not fully understand...). But as far as I can tell it works fine to just set any random value as the name on the select
. I am currently just copying the name from the input
, (and am not really seeing any adverse effects), but let me know if you think it would be better to set a static name for all the db-object select
s (or to create some kind of dynamic name for each...).
const $option = $('<option></option>'); | ||
const setOptionValue = value => $option.attr('value', value).text(value); | ||
setOptionValue($textInput.val()); | ||
$textInput.on('inputupdate', () => setOptionValue($textInput.val())); |
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.
For all intents and purposes, I like this refactor.
Turning an input
into a select
just makes me nervous ...
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 not meaning to add more work on your plate but, since we're already refactoring this, what is the value of cloning the input and then changing the tag versus just making a new select element?
Is it because there are classes and attributes to copy? Are they actually needed on the select?
This is similar to my question above about the duplicated name.
Could there be bugs if we suddenly have two elements that match an old query, be it an attribute or name search?
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.
Good call on the cloning! I had forgotten to circle back to that after I got everything else cleaned up. I went back and did some more testing and found that I could just use a brand new select
element without copying anything (besides the name
as discussed above).
I think the only thing we need to decide here is what we should use as the name for the the select
s. I have left the name of the select
the same as the input
for now since it simplifies logic downstream in the changeHandler
, but we can change that (as I mentioned above). I would just need to include some other way of getting the field path into the changeHandler
function...
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.
Great stuff! Congratulations for bringing this titanic task to completion!
# Conflicts: # config/standard/forms/app/immunization_visit.xlsx
following the conversation, because i believe this will be a life saver |
Co-authored-by: Jennifer Q <[email protected]> (cherry picked from commit 2a25f87)
Description
The following changes had to be a made as a part of uplifting the
enketo-core
dependency in webapp to the latest version:webapp
from4.41.6
to^5.18.1
bm
andhi
) since those are now included in the new version of bootstrap-datepicker pulled in by enketo-core.enketo-handle-no-active-pages.patch
since this is no longer necessary.enketo-repeat-name-collision.patch
to resolve Name collision with calculate in repeat causes error enketo/enketo#99 since we cannot uplift to the latest version of enketo-core that contains the fix.api
and migrate to enketo-transformertransform
functionality provided by enketo-transformer. That uplift will be make in Uplift to use transform functionality from enketo-transformer #7295 which is blocked until we no longer have to support Node 8/10.webapp
service to instead be integrated in the generate-xform service inapi
. We should be able to remove this markdown logic in the future when utilizing thetransform
functionality provided by enketo-transformer.note
s.required
since this causes issues when filling out the forms with the new version of Enketo.webapp
from^1.5.1
to^2.0.7
. Import medic-specific functions from openrosa-xpath-extensions #4517now
function fromwebapp
since that function (with an identical implementation) is in openrosa-xpath-evaluatordifference-in-months
function from the old version of openrosa-xpath-evaluator to be a new custom function inwebapp
since it was removed from newer versions of openrosa-xpath-evaluatorNotable behavior changes in xforms:
note
fields cannot berequired
. (Will now prevent the user from progressing to next page)required
.calculation
s orrelevant
logic) has changed from0
toNaN
. See Empty integer values in Enketo forms evaluate to 0 #7222 for more information.concat
must be separated by commas (or now the form will fail to load).horizontal
andhorizontal-compact
appearances are deprecated. Thecolumns
functionality should now be used instead.columns
options is herehorizontal
appearance instead ofcolumns
cht-conf#500note
s). This may cause issues in existing question labels that unintentionally are using Markdown syntax./invalid/xpath/path = ''
would evaluate totrue
. Now, however, that expression will evaluate to false since invalid xPath paths are no longer considered equivalent to empty strings.format-date
andformate-date-time
functions no longer accept month values that are<= 0
. See this comment for more information, but the TLDR is that this could affect processing for things like birth dates calculated from given values for months and years.decimal-date-time
function has been updated to correct an issue with the default timezone used when calculating the decimal value of a date that does not include any time zone information. (Note that the values from basicdate
questions do NOT include time zone information.)See this comment for more information.
decimal-date-time
, for a basicdate
question value, will be a whole number since now there will likely be a decimal value included representing the difference between midnight in the user's TZ vs midnight in UTC.decimal-date-time
function has changed with regards to what type of parameters it will accept. Previously it would accept any kind of string parameters (e.g. date strings with various formats) and would leverage the JS Date logic to evaluate the values. Now, it will only accept strings containing ISO 8601 date values. See this comment for more information.Newly available Enketo Widgets:
(A demo form containing these widgets can be found here.)
url
appearance to give a clickable url displayednumber
input. Will display the number below, separated by thousands.Newly available xPath functions:
Native functions now implemented directly in openrosa:
Custom functions implemented in openrosa
Note that this PR builds off of the changes from the earlier (unmerged) PR #6129.
Closes #6345
Closes #4517
Closes #7298
Closes #7237
Closes #1495
Closes #6803
Closes #7222
Closes #6846
Closes #5636
Closes #6589
Closes #5980
Closes #4132
Code review checklist
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.