-
Notifications
You must be signed in to change notification settings - Fork 898
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
Include reflections of descendant classes when building model details for reporting and expression editors #5506
Include reflections of descendant classes when building model details for reporting and expression editors #5506
Conversation
@gmcculloug @dclarizio @bzwei Please review |
LGTM |
2b54ce6
to
d8371f2
Compare
refs = model.reflections_with_virtual | ||
model.descendants.each do |desc| | ||
refs.reverse_merge!(desc.reflections_with_virtual) | ||
end if model.respond_to?(:include_descendant_classes_in_expressions?) && model.include_descendant_classes_in_expressions? |
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.
You can use try
here. try will also return nil if the receiver does not respond to the method. I also prefer seeing the if
condition upfront, but I'll leave that up to you.
if model.try(:include_descendant_classes_in_expressions?)
model.descendants.each { |desc| refs.reverse_merge!(desc.reflections_with_virtual) }
end
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.
Making that change now. Much nicer. Thanks.
d8371f2
to
b60d546
Compare
it "includes reflections from descendant classes of Host" do | ||
relats = MiqExpression.get_relats(Host) | ||
relats[:reflections][:cloud_networks].should_not be_blank | ||
end |
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.
@gtanzillo Please add a negative test here using a class that does not respond to include_descendant_classes_in_expressions?
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.
Done, thanks!
b60d546
to
474a94f
Compare
LGTM |
@dclarizio Please review/merge. |
@@ -1031,6 +1033,9 @@ en: | |||
miq_custom_attribute: EVM Custom Attribute | |||
miq_custom_attributes: EVM Custom Attributes | |||
miq_event_definition: Event | |||
manageiq_providers_foreman_configuration_manager_configuration_profile: Confirugation Profile (Foreman) |
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.
Typo: Confirugation Profile
Besides the typo in my comment above, this looks ready to go to me. |
… for reporting and expression editors - Enabled only for Vm and Host models - Enables inclusion of cloud tenants under an openstack VM in reports and expressions - Enables inclusion of cloud networks under an openstack Host https://bugzilla.redhat.com/show_bug.cgi?id=1236001
474a94f
to
a7597b6
Compare
Typo fixed, thanks @dclarizio |
Checked commit gtanzillo@a7597b6 with ruby 1.9.3, rubocop 0.34.2, and haml-lint 0.13.0 app/models/miq_expression.rb
|
…nditions Include reflections of descendant classes when building model details for reporting and expression editors
Include reflections of descendant classes when building model details for report ing and expression editors - Enabled only for Vm and Host models - Enables inclusion of cloud tenants under an openstack VM in reports and expressions - Enables inclusion of cloud networks under an openstack Host https://bugzilla.redhat.com/show_bug.cgi?id=1291724 Cherry-picked from ManageIQ#5506 Cherry-pick was not clean. There were conflicts in config/locales/en.yml which I resolved. See merge request !624
…e19a887cd85c72d1f8f08 Fix Expression builder argument error by reverting #5506
…e19a887cd85c72d1f8f08 Fix Expression builder argument error by reverting #5506 (cherry picked from commit 075ae85) https://bugzilla.redhat.com/show_bug.cgi?id=1514257
…e19a887cd85c72d1f8f08 Fix Expression builder argument error by reverting #5506 (cherry picked from commit 075ae85) https://bugzilla.redhat.com/show_bug.cgi?id=1514258
…b9c6089ee19a887cd85c72d1f8f08 Fix Expression builder argument error by reverting ManageIQ#5506 (cherry picked from commit 075ae85) https://bugzilla.redhat.com/show_bug.cgi?id=1514258
https://bugzilla.redhat.com/show_bug.cgi?id=1236001