Skip to content
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

[B5] Migrate first reports to bootstrap 5! #35704

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

biyeun
Copy link
Member

@biyeun biyeun commented Jan 29, 2025

Technical Summary

Finally! I am so excited that we are here at last. This PR includes the migration of two reports to bootstrap 5:

  • Case List
  • Application Status

Both have completed QA, and the related issues have been marked "done". Just waiting on the final sign-off:
https://dimagi.atlassian.net/browse/QA-7409

Safety Assurance

Safety story

QA on staging has taken place for these reports

Automated test coverage

diffs, yes

QA Plan

https://dimagi.atlassian.net/browse/QA-7409

Rollback instructions

leaving unchecked due to bootstrap 5 diffs, which can sometimes make a simple revert annoyingly complex depending on how much time has elapsed

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@biyeun biyeun added awaiting QA QA in progress. Do not merge product/all-users-all-environments Change impacts all users on all environments labels Jan 29, 2025
@biyeun biyeun requested review from orangejenny and a team January 29, 2025 20:26
@biyeun biyeun requested a review from esoergel as a code owner January 29, 2025 20:26
@biyeun biyeun added QA Passed and removed awaiting QA QA in progress. Do not merge labels Jan 30, 2025
Copy link
Contributor

@millerdev millerdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is great to have the first reports migrated!

I didn't see anything specific that looks problematic, but also didn't spend a lot of time teasing out the B5-related changes from what looks like code cleanup/refactoring. Not approving since my review doesn't feel complete.

Comment on lines -165 to +192
res = []
#the NUMBER of cols sorting
sort_cols = int(self.request.GET.get('iSortingCols', 0))
if sort_cols > 0:
for x in range(sort_cols):
col_key = 'iSortCol_%d' % x
sort_dir = self.request.GET['sSortDir_%d' % x]
col_id = int(self.request.GET[col_key])
col = self.headers.header[col_id]
sort_prop = getattr(col, sort_prop_name) or col.prop_name
if x == 0:
self.primary_sort_prop = sort_prop
if self.selected_app_id:
sort_dict = {
sort_prop: {
"order": sort_dir,
"nested_filter": {
"term": {
self.sort_filter: self.selected_app_id
}
}
}
block = []
for col in self.datatables_params.order:
col_ind = col['column']
sort_dir = col['dir']
dt_column_obj = self.headers.header[col_ind]
sort_prop = getattr(dt_column_obj, sort_prop_name) or dt_column_obj.prop_name
if col_ind == 0:
# this feels like a bit of a hack, but kept it in from the original sorting block
# prior to bootstrap 5 migration. could use a second look in the future
self.primary_sort_prop = sort_prop
if self.selected_app_id:
sort_dict = self._get_selected_app_sort_dict(sort_prop, sort_dir)
else:
sort_dict = {sort_prop: sort_dir}
block.append(sort_dict)
if len(block) == 0 and self.default_sort is not None:
block.append(self.default_sort)
return block
Copy link
Contributor

@millerdev millerdev Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Difficult to tell what changed here that is B5 related and what is code refactoring. Could those be split into separate commits or is this necessarily a complicated transformation for B5 support?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the whole sorting block changed, I'm not sure I can split it up any further? There is no other way to have a diff

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also FYI this isn't B5 related but Datatables 1.10+ upgrade related, so there isn't going to ever be a clean-cut diff as your would expect with property changes for B5-type changes.

our old version of datatables is not compatible with bootstrap 5, which is why the upgrade was necessary. So any b5 migration of a report, will also require these kind of sorting block updates (if there is a custom sorting block) due to datatables. Relevant context is part of this PR, which we went over as a group #35648

Copy link
Member Author

@biyeun biyeun Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess i could have split out _get_selected_app_sort_dict, but that was the only refactoring related change, and I did that at the end to make the whole sorting block a little more readable. Unlikely I would have changed it from the beginning. Everything else was not a refactor

@biyeun
Copy link
Member Author

biyeun commented Jan 31, 2025

thanks for the review @orangejenny and for catching those form-selects and typo

should be g2g now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product/all-users-all-environments Change impacts all users on all environments QA Passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants