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

Adding connected physical servers to physical switches page #4356

Merged
merged 1 commit into from
Aug 7, 2018

Conversation

douglasgabriel
Copy link
Member

@douglasgabriel douglasgabriel commented Jul 25, 2018

This PR is able to

  • Add a new table to physical switch page to list the connected components;
  • Add the list of connected physical servers (that are the unique component that we track the connections, for now);

screenshot-localhost 3000-2018-07-25-15-42-56

screenshot-localhost 3000-2018-07-25-15-51-43

Depends on
ManageIQ/manageiq#17735 - Merged

@douglasgabriel
Copy link
Member Author

@miq-bot add_label pending core
@miq-bot add_label compute/physical infrastructure
@miq-bot add_label ux/review

def textual_ports
ports_count = @record.physical_network_ports.count
ports = {:label => _("Ports"), :value => ports_count, :icon => "ff ff-network-port"}
ports = {:label => _("Ports"), :value => ports_count, :icon => PhysicalNetworkPortDecorator.fonticon}
Copy link
Member

Choose a reason for hiding this comment

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

I'd say record.decorate.fonticon, what do you think, @skateman ?

Copy link
Member

Choose a reason for hiding this comment

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

yes

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case @record is a PhysicalSwitch instance, and here I'm printing the PhysicalNetworkPort icon, so if I put record.decorate.fonticon the wrong icon will be shown. 🤔

Copy link
Member

Choose a reason for hiding this comment

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

oh, ok. @skateman, if you have a better way to handle this, let's do it in a follow up PR.

Copy link
Member

Choose a reason for hiding this comment

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

@martinpovolny 🤔 🤔 🤔 I don't have a better idea right now 😕

physical_servers_count = @record.physical_servers.count
physical_servers = {:label => _("Physical Servers"), :value => physical_servers_count, :icon => PhysicalServerDecorator.fonticon}
if physical_servers_count.positive?
physical_servers[:link] = "/physical_switch/show/#{@record.id}?display=physical_servers"
Copy link
Member

Choose a reason for hiding this comment

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

I think you should try to use a helper method to calculate the URLs. I will help if we convert the controllers to restful ones. (The same on line 44). There's show_link in GenericShowMixin that you have already included in your controller. Seems to me you could use that one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just realize this method: url_for_only_path. Do you think that I can use it?

Like:

physical_servers[:link] = url_for_only_path(:action => 'show', :id => @record, :display => 'physical_servers')

@martinpovolny
Copy link
Member

Last thing: can you, please, add a (simple) spec for the textual summary helper? There is already a number of examples. Thx!

@martinpovolny
Copy link
Member

@douglasgabriel : please, ping me, when you add the specs. Thx!

@douglasgabriel douglasgabriel force-pushed the cnt_comp_sys branch 2 times, most recently from 4c8cfde to ef5e6dc Compare August 3, 2018 14:40
@douglasgabriel
Copy link
Member Author

Done @martinpovolny . I don't think that the Travis failures are due to my changes

@miq-bot
Copy link
Member

miq-bot commented Aug 6, 2018

Checked commit douglasgabriel@44d07d1 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
3 files checked, 0 offenses detected
Everything looks fine. 🍰

@martinpovolny martinpovolny merged commit 373d6d1 into ManageIQ:master Aug 7, 2018
@martinpovolny martinpovolny added this to the Sprint 92 Ending Aug 13, 2018 milestone Aug 7, 2018
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.

4 participants