-
Notifications
You must be signed in to change notification settings - Fork 356
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
Also post check tree nodes top-to-bottom when required #1057
Conversation
spec/javascripts/miq_tree_spec.js
Outdated
|
||
debugger; |
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.
debugger ;)
spec/javascripts/miq_tree_spec.js
Outdated
expect(miqTreeFindNodeByKey('test', '1').state.checked).toBe(undefined); | ||
expect(miqTreeFindNodeByKey('test', '2-1').state.checked).toBe(true); | ||
expect(miqTreeFindNodeByKey('test', '2-2').state.checked).toBe(true); | ||
expect(miqTreeFindNodeByKey('test', '3-1').state.checked).toBe(true); |
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.
Maybe also add
expect(miqTreeFindNodeByKey('test', '2').state.checked).toBe(true);
expect(miqTreeFindNodeByKey('test', '3').state.checked).toBe(true);
to be sure the parent always wins?
var node = nodes.pop(); | ||
if (!node.state) node.state = {}; | ||
var parent = nodes.pop(); | ||
if (!parent.nodes) { |
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.
!parent.nodes
never happens because if (node.nodes) parents.push(node)
, am I missing something or just defensive programming? :)
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, you're confused by the variable name, check where it is popped from 😉
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.
Aah :D
LGTM, as long as we never get any data with the parent wrongly checked, this should not break anything 👍 |
Verified in the UI, SmartProxyAffinity tree (ManageIQ/manageiq#10374) works the same after this. Also checked that changin the data in that tree so that a folder has select true makes the change propagate both up and down 👍 |
Checked commit skateman@b78ed65 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@himdel Actually, this seems to work well and could help with fixes needed for the RBAC Tree in Fine. If there's a way we can backport this to Fine, it would make things easier. Otherwise I'll carry forward my Euwe changes. |
@skateman Not #137, just this one. It could mean a smaller fix to Fine than the one I did for Euwe. |
Ahh, alright, changed to (And please keep it minimal ;)) |
Also post check tree nodes top-to-bottom when required (cherry picked from commit 8d04045)
Fine backport details:
|
The
post_check
feature is a post-processing for hierarchical checkboxes, it was able to set a node's checked state based on their childrens'. This PR introduces the same logic in the opposite way, if a parent node is checked, it also sets the child nodes' state to checked.FYI @hayesr