-
-
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
Load data dictionary case properties in chunks #34827
Conversation
d5f143f
to
042bf8c
Compare
corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js
Outdated
Show resolved
Hide resolved
corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js
Show resolved
Hide resolved
corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js
Outdated
Show resolved
Hide resolved
corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js
Show resolved
Hide resolved
b746e0d
to
f41c020
Compare
b0793f6
to
a9428b2
Compare
I am sorry for the rebase, but I hope it makes it easier to review now that the base branches are merged. |
self.isGeoCaseProp = ko.observable(isGeoCaseProp); | ||
self.isSafeToDelete = ko.observable(isSafeToDelete); | ||
self.isSafeToDelete = ko.observable(prop.isSafeToDelete); |
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.
The data that we pass as prop
to this model has the field for is safe to delete stored as is_safe_to_delete
and not isSafeToDelete
. We'll need to change that here to correctly fetch the value. This should resolve the bug where the delete button is not showing.
After looking at the code, it seems that groups with no case properties won't be loaded to the front-end because of what's happening here in the view. Specifically, a query is done on case properties, fetching related groups. Any groups without case properties will therefore not be in the query. |
Happy to approve once this has been given a final test pass on staging. |
Deployed to staging. @zandre-eng do you mean that you or I can check this on Staging, or that the QA Team should give this another pass? The QA Team's domain is here: https://staging.commcarehq.org/a/qateam/data_dictionary/ The QA ticket is here: https://dimagi.atlassian.net/browse/QA-6727 |
@kaapstorm I think if QA is able to do a final pass then that should be fine. |
self.groups.push(groupObj); | ||
} | ||
}; | ||
|
||
self.fetchCaseProperties = function () { | ||
if (self.groups().length === 0) { |
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 admittedly don't have a lot of context around the data dictionary, hence me asking this: what is the group in this context and why do we check whether there is a group here?
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.
When the user selects a case type, the viewmodel fetches its case properties.
The server returns the CaseProperty instances nested in their CasePropertyGroup instances ("data.groups" on line 96). (The CaseProperty instances that don't have a CasePropertyGroup are nested in a group with an empty name.)
So if self.groups()
does not have a value, it means that the viewmodel has not fetched its case properties already, so it should do that now.
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.
QA has passed on this PR, and so all looks good from my end to approve.
Product Description
Improves the performance of the Data Dictionary page for projects with high numbers of case types and case properties.
Technical Summary
Context:
This change allows the data dictionary to support tens of thousands of case properties. It does this by fetching only the case properties of the selected case type, and by chunking the case properties over multiple requests if there are a lot.
This change builds on work currently in open PRs. Commits are rebased as follows:
Feature Flag
N/A. Available on all plans with Data Dictionary.
Safety Assurance
Safety story
Automated test coverage
Code changes are in JavaScript viewmodels and not covered by tests.
QA Plan
QA ticket: QA-6727
Rollback instructions
Labels & Review