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

Include reflections of descendant classes when building model details for reporting and expression editors #5506

Merged

Conversation

gtanzillo
Copy link
Member

  • 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

@gtanzillo
Copy link
Member Author

@gmcculloug @dclarizio @bzwei Please review

@bzwei
Copy link
Contributor

bzwei commented Nov 18, 2015

LGTM

@gtanzillo gtanzillo force-pushed the bz-1236001-cloud-tenant-in-conditions branch from 2b54ce6 to d8371f2 Compare November 18, 2015 22:28
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?
Copy link
Member

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

Copy link
Member Author

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.

@gtanzillo gtanzillo force-pushed the bz-1236001-cloud-tenant-in-conditions branch from d8371f2 to b60d546 Compare November 19, 2015 14:21
it "includes reflections from descendant classes of Host" do
relats = MiqExpression.get_relats(Host)
relats[:reflections][:cloud_networks].should_not be_blank
end
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks!

@gtanzillo gtanzillo force-pushed the bz-1236001-cloud-tenant-in-conditions branch from b60d546 to 474a94f Compare November 19, 2015 19:06
@gmcculloug
Copy link
Member

LGTM

@gmcculloug
Copy link
Member

@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)

Choose a reason for hiding this comment

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

Typo: Confirugation Profile

@dclarizio
Copy link

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
@gtanzillo gtanzillo force-pushed the bz-1236001-cloud-tenant-in-conditions branch from 474a94f to a7597b6 Compare November 20, 2015 12:00
@gtanzillo
Copy link
Member Author

Typo fixed, thanks @dclarizio

@miq-bot
Copy link
Member

miq-bot commented Nov 20, 2015

Checked commit gtanzillo@a7597b6 with ruby 1.9.3, rubocop 0.34.2, and haml-lint 0.13.0
4 files checked, 2 offenses detected

app/models/miq_expression.rb

gmcculloug added a commit that referenced this pull request Nov 20, 2015
…nditions

Include reflections of descendant classes when building model details for reporting and expression editors
@gmcculloug gmcculloug merged commit a51629b into ManageIQ:master Nov 20, 2015
@gmcculloug gmcculloug added this to the Sprint 33 Ending Dec 7, 2015 milestone Nov 20, 2015
h-kataria pushed a commit to h-kataria/manageiq that referenced this pull request Jan 15, 2016
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
gtanzillo added a commit that referenced this pull request Nov 15, 2017
…e19a887cd85c72d1f8f08

Fix Expression builder argument error by reverting #5506
simaishi pushed a commit that referenced this pull request Nov 17, 2017
…e19a887cd85c72d1f8f08

Fix Expression builder argument error by reverting #5506
(cherry picked from commit 075ae85)

https://bugzilla.redhat.com/show_bug.cgi?id=1514257
simaishi pushed a commit that referenced this pull request Nov 20, 2017
…e19a887cd85c72d1f8f08

Fix Expression builder argument error by reverting #5506
(cherry picked from commit 075ae85)

https://bugzilla.redhat.com/show_bug.cgi?id=1514258
d-m-u pushed a commit to d-m-u/manageiq that referenced this pull request Jun 6, 2018
…b9c6089ee19a887cd85c72d1f8f08

Fix Expression builder argument error by reverting ManageIQ#5506
(cherry picked from commit 075ae85)

https://bugzilla.redhat.com/show_bug.cgi?id=1514258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants