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

Fixing Provider PhysicalSwitches page summary show #3954

Merged
merged 1 commit into from Jun 11, 2018

Conversation

EsdrasVP
Copy link
Member

@EsdrasVP EsdrasVP commented May 17, 2018

This PR is able to:

  • Enable PhysicalSwitches listing in Physical Infra Provider
  • Display Physical Switches in Physical Infra Provider 'Relationships' field

The problems:

When trying to list the Physical Switches from a Physical Infra Provider (/ems_physical_infra/:id?display=physical_switches)
physical_swiches_listing_02

An error is returned
physical_switches_listing_03

This happens because the application controller from the UI calls paged_view_search, which is a method from Search class inside ManageIQ core that, internally, uses the base model for the class passed. The result is that, instead of PhysicalSwitch, its parent Switch is called.

@EsdrasVP EsdrasVP changed the title Fixing Provider PhysicalSwitches listing Fixing Provider PhysicalSwitches page summary and quadicons show May 18, 2018
@@ -70,8 +70,6 @@ def self.settings_key(klass, layout)
when "ems_physical_infra", "ems_cloud", "ems_network", "ems_container"
layout.to_sym
end
elsif klass.base_model.name != klass.name.demodulize
Copy link
Contributor

@himdel himdel May 21, 2018

Choose a reason for hiding this comment

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

Sorry, can't remove this - this will break Vm for example :).

But you can add a special case for switch vs physical switch, the same as it is done for ExtManagementSystem.

EDIT: never mind, it's the other line, this was introduced in #3699 and should be safe to remove

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I put back the demodulize and added a condition for "physical_switch".

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@himdel @saulotoledo I removed both demodulize and the elsif for physical_switch.

Copy link
Member

Choose a reason for hiding this comment

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

@himdel this actually fixes VMs 😉

Copy link
Member

Choose a reason for hiding this comment

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

But as I stated it here this might not be The Right Way™ to fix this...

@@ -54,7 +54,12 @@ def textual_port
end

def textual_physical_switches
textual_link(@record.physical_switches)
Copy link
Contributor

Choose a reason for hiding this comment

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

most likely, adding :as => PhysicalSwitch would have the same effect

More to the point, the new code does not use role_allows?, so it can't stay as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for that, this was an old solution that I put before fixing the base model for PhysicalSwitch. I put back the textual link call, which is working with new solution.

@EsdrasVP EsdrasVP force-pushed the fix_provider_switches_listing branch from a3a0e13 to 4b69907 Compare May 21, 2018 17:30
@EsdrasVP EsdrasVP changed the title Fixing Provider PhysicalSwitches page summary and quadicons show [WIP] Fixing Provider PhysicalSwitches page summary and quadicons show May 22, 2018
@miq-bot miq-bot added the wip label May 22, 2018
@EsdrasVP EsdrasVP force-pushed the fix_provider_switches_listing branch from 4b69907 to 16278d9 Compare May 22, 2018 18:33
@EsdrasVP EsdrasVP changed the title [WIP] Fixing Provider PhysicalSwitches page summary and quadicons show Fixing Provider PhysicalSwitches page summary and quadicons show May 22, 2018
@EsdrasVP EsdrasVP changed the title Fixing Provider PhysicalSwitches page summary and quadicons show [WIP] Fixing Provider PhysicalSwitches page summary and quadicons show May 22, 2018
@EsdrasVP EsdrasVP changed the title [WIP] Fixing Provider PhysicalSwitches page summary and quadicons show Fixing Provider PhysicalSwitches page summary and quadicons show May 23, 2018
@miq-bot miq-bot removed the wip label May 23, 2018
@@ -70,6 +70,8 @@ def self.settings_key(klass, layout)
when "ems_physical_infra", "ems_cloud", "ems_network", "ems_container"
layout.to_sym
end
elsif klass.base_model.to_s.underscore == "physical_switch"
klass.base_model.name.underscore.to_sym
elsif klass.base_model.name != klass.name.demodulize
klass.name.demodulize.underscore.to_sym
Copy link
Member

Choose a reason for hiding this comment

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

I suggest to remove the demodulize. It was introduced by me at https://github.com/ManageIQ/manageiq-ui-classic/pull/3699/files#diff-6525cb9600835fcc2ba062fde39a2292R73 and it is causing an issue fixed at #3980

Removing the demodulize will help in both cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

@saulotoledo I removed this, now it should work fine without both conditions.

@miq-bot
Copy link
Member

miq-bot commented May 24, 2018

This pull request is not mergeable. Please rebase and repush.

@EsdrasVP EsdrasVP force-pushed the fix_provider_switches_listing branch from 306d1fb to b5364ba Compare June 4, 2018 16:52
@EsdrasVP EsdrasVP changed the title Fixing Provider PhysicalSwitches page summary and quadicons show Fixing Provider PhysicalSwitches page summary show Jun 4, 2018
@EsdrasVP EsdrasVP force-pushed the fix_provider_switches_listing branch from b5364ba to 12de9e7 Compare June 4, 2018 17:08
@miq-bot
Copy link
Member

miq-bot commented Jun 4, 2018

Checked commit EsdrasVP@12de9e7 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🏆

@EsdrasVP EsdrasVP changed the title Fixing Provider PhysicalSwitches page summary show [WIP] Fixing Provider PhysicalSwitches page summary show Jun 5, 2018
@miq-bot miq-bot added the wip label Jun 5, 2018
@EsdrasVP EsdrasVP changed the title [WIP] Fixing Provider PhysicalSwitches page summary show Fixing Provider PhysicalSwitches page summary show Jun 5, 2018
@EsdrasVP EsdrasVP closed this Jun 5, 2018
@EsdrasVP EsdrasVP reopened this Jun 5, 2018
@miq-bot miq-bot removed the wip label Jun 5, 2018
@EsdrasVP EsdrasVP closed this Jun 5, 2018
@EsdrasVP EsdrasVP reopened this Jun 5, 2018
@EsdrasVP
Copy link
Member Author

EsdrasVP commented Jun 5, 2018

@himdel Could you check if this solution is ok?

@himdel himdel self-assigned this Jun 7, 2018
@himdel
Copy link
Contributor

himdel commented Jun 7, 2018

@EsdrasVP looks good, thanks! :)

Is this still pending core?

@EsdrasVP
Copy link
Member Author

EsdrasVP commented Jun 7, 2018

@himdel There is no more core dependency, this is now a standalone PR.

@himdel himdel added this to the Sprint 88 Ending Jun 18, 2018 milestone Jun 11, 2018
@himdel himdel merged commit 50137e2 into ManageIQ:master Jun 11, 2018
@himdel
Copy link
Contributor

himdel commented Jun 11, 2018

👍 Seeing switches both in provider summary and in relationships now.

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.

None yet

6 participants