-
Notifications
You must be signed in to change notification settings - Fork 897
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
Fix for Service Dialog not saving default value <None> for drop down or radio button #14240
Conversation
20c839e
to
0227e27
Compare
def raw_values | ||
@raw_values ||= dynamic ? values_from_automate : static_raw_values | ||
|
||
self.value ||= default_value if @raw_values.collect { |value_pair| value_pair[0] }.include?(default_value) |
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.
@eclarizio Would suggest pulling this logic out into a separate private method with a descriptive name. Would make the raw_values
method easier to read and make the logic of this line clearer as well.
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.
Minor suggestion for readability but overall this looks good.
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.
Looks great minus a small request to extract behavior out of raw_values
@@ -91,7 +91,7 @@ def sort_data(data_to_sort) | |||
end | |||
|
|||
def raw_values | |||
@raw_values ||= dynamic ? values_from_automate : self[:values].to_miq_a | |||
@raw_values ||= dynamic ? values_from_automate : static_raw_values | |||
unless @raw_values.collect { |value_pair| value_pair[0] }.include?(default_value) |
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.
@eclarizio - I would second @gmcculloug - Can we extract this out into a private method as well - I'm getting lost in what the block is trying to accomplish.
Checked commits eclarizio/manageiq@c1a02a6~...d530fb7 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.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.
👍 Looks good to me.
Fix for Service Dialog not saving default value <None> for drop down or radio button (cherry-picked from commit a912f50) https://bugzilla.redhat.com/show_bug.cgi?id=1428133
Backported to Euwe via #14259 |
This will allow nil to be a default value for static sorted item fields. When the field is required, the user will be able to pick a "" options which corresponds to the nil option, and a "" option otherwise.
https://bugzilla.redhat.com/show_bug.cgi?id=1428133
/cc @gmcculloug Please review/test
@miq-bot assign @gmcculloug
@miq-bot add_label bug, euwe/yes