-
-
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
allow submitting system forms with a name for display to users #31923
Conversation
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.
🚀
Very cool, I'm excited to hear what delivery thinks of it!
:param form_name: Human readable version of the device_id. For example the | ||
Automatic Case Rule name. |
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.
💯
@@ -88,39 +88,49 @@ def __init__(self, domain, xmlns, app_id): | |||
def get_label(self, lang=None, separator=None): | |||
if separator is None: | |||
separator = " > " | |||
|
|||
return ( |
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.
?w=1 reads a lot easier for this commit
@@ -187,12 +187,13 @@ def get_case_history(case): | |||
|
|||
changes = defaultdict(dict) | |||
for form in XFormInstance.objects.get_forms(case.xform_ids, case.domain): | |||
name = xmlns_to_name(case.domain, form.xmlns, form.app_id, form_name=form.form_data.get('@name')) |
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.
It might make sense to just pass the whole form
to xmlns_to_name
and extract what's needed from it there.
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.
Ah, I guess in some instances it's an unwrapped form. Maybe not then.
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.
Yea, this also get's used for things like export configs which only have an app_id
and xmlns
. But it could be useful to create a wrapper function that takes the whole form.
Product Description
In terms of product changes this will currently only impact case update rules which will now display on the UI with a human readable name.
Before this change the display would look like this:
Once this change get's deployed the following display options will exist:
Raw XMLNS
For any system form that does not have it's XMLNS mapped we will continue to display the XMLNS:
Human readable XMLNS name
This will apply to forms (old and new) that have their XMLNS mapped to a readable name
Human readable XMLNS name with details
Form that have their XMLNS mapped and also include a form name in the XML will be displayed as
Technical Summary
Update
submit_case_blocks
to include aform_name
kwarg which is used to add aname
attribute to the root XML element of the form.Updates to the display code that converts a form XMLNS to a human readable name to include this value if it is present.
Note for future work:
There is lots of work that can still be done to clean up other system forms in order to use the best practices layed out in #31873.
There could also be future work to create smarter display output for forms e.g. link to the actual update rule etc.
Safety Assurance
Safety story
Areas of impact:
Automated test coverage
I've added some tests for the display utils. I'm wondering if it's worth adding tests for
submit_case_blocks
but I don't really think so.QA Plan
None
Rollback instructions
Labels & Review