-
Notifications
You must be signed in to change notification settings - Fork 356
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
Physical infra pages #196
Physical infra pages #196
Conversation
Need the Gemfile changes in ManageIQ/manageiq#11846 for tests to pass. |
This pull request is not mergeable. Please rebase and repush. |
@miq-bot remove_label wip |
@miq-bot assign @dclarizio |
Hey @dclarizio could you see about getting this merged. It's all working technically and been reviewed by both @AparnaKarve and myself. |
@juliancheal will look at this today and discuss with @AparnaKarve |
@juliancheal asking @himdel and @mzazrivec to review this to make sure we're following some of the latest UI guidelines. |
There's exactly 0 tests in this PR. And there are new controllers. Please include at least one test for every new screen. |
This introduces another copy of angular topology controler - won't force you to do the refactoring now (since we already have 5 of them), but.. created https://www.pivotaltracker.com/story/show/140220953 |
:default_userid => @ems.authentication_userid ? @ems.authentication_userid : "", | ||
:ems_controller => controller_name, | ||
:default_auth_status => default_auth_status, | ||
} if controller_name == "ems_physical_infra" |
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.
Uh, and here I thought mixins are supposed to be for shared code.
The pattern of having controllers A and B include mixin M, which checks controller name and does something based on it .. feels silly (and more importantly, wrong). Can we just call a method that's defined in all those controllers?
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.
Agree, there is a good scope for a refactor here, but just not in this PR.
Note that most of the code here is adhering to the existing code pattern, which has gotten crazy over the last few months when folks keep adding more and more controllers here.
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.
Well if we keep saying that and postponing cleanups then we are doomed.
The need to add new code that follows a bad pattern should be the trigger for refactoring :-(
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.
The need to add new code that follows a bad pattern should be the trigger for refactoring :-(
@martinpovolny Could not agree more.
However, it goes without saying that the refactoring effort should not be part of this (already gigantic) PR. That said, what I can offer here is this commit that I just pushed:
1dd3e43
It renders the ems_physical_infra
-specific json using it's own controller method, making sure it does not add to the mess in the mixin.
Does that work?
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.
Well if we keep saying that and postponing cleanups then we are doomed.
This is a fine sentiment, but this ems_common
has been bad for a very very long time. Pinning this level of cleanup on this PR is a mistake, imo.
Refactoring ems_common
to be what it really should be (common code used by multiple controllers) is a monumental effort. Best suited for a separate dedicated PR that can be reviewed in that specific context.
app/helpers/application_helper.rb
Outdated
@@ -200,6 +200,10 @@ def url_for_db(db, action = "show", item = nil) # Default action is show | |||
) | |||
elsif @host && ["Patch", "GuestApplication"].include?(db) | |||
return url_for(:controller => "host", :action => @lastaction, :id => @host, :show => @id) | |||
elsif db == "MiqCimInstance" && @db && @db == "snia_local_file_system" |
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.
these 4 lines are obsolete, this functionality got removed in #204 (https://github.com/ManageIQ/manageiq-ui-classic/pull/204/files#diff-127a850b7d7b20173ad3fba88f8a25e3L203)
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.
Got spot, tried to find all of these.
|
||
def textual_group_topology | ||
items = %w(topology) | ||
i = items.collect { |m| send("textual_#{m}") }.flatten.compact |
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.
Really? Can't we just do i = [ textual_topology ]
?
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.
Sure? Until there's more than one...
In reality, this should be a private method somewhere hiding the details of building this "textual_"
prefixed items since there's already 17[1] other occurrences of this exact line. And, if you want to optimize on whether there's only one item, then the private method would be a fantastic place to do that.
$ git grep -Ii "items.collect { |m| send(\"textual_#{m}"
app/helpers/container_build_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_group_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_image_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_image_registry_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_node_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_project_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_replicator_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_route_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_service_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/container_template_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/ems_cloud_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/ems_container_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/ems_infra_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/ems_middleware_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/ems_network_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
app/helpers/persistent_volume_helper/textual_summary.rb: items.collect { |m| send("textual_#{m}") }.flatten.compact
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.
Leaving this as-is for now unless this is absolutely an issue.
end | ||
|
||
def textual_physical_infrastructure_folders | ||
return nil if @record.kind_of?(ManageIQ::Providers::PhysicalInfraManager) |
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.
So... what is the @record
that this deals with?
Seems like this is just copy-pasted from ems_infra
, where the condition dealt specifically with openstack (introduced in ManageIQ/manageiq#3556) - and makes little sense here.
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.
@record
is a record of the new provider type -- ManageIQ::Providers::PhysicalInfraManager
.
Not really sure if we can draw a connection here with Openstack or not or how closely this Provider type is related to ems_infra
.
@juliancheal Any idea?
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.
@himdel It looks like it's copy-pasta, because it is :) Ems Infra has been a good start to base Physical Infra on, but sometimes we do have unneeded code.
Didn't realise that's what @record
here was used for, as there weren't any comments 😌
end | ||
|
||
def textual_folders | ||
return nil if @record.kind_of?(ManageIQ::Providers::PhysicalInfraManager) |
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.
same here
def entity_status(entity) | ||
case entity | ||
when ManageIQ::Providers::PhysicalInfraManager | ||
entity.authentications.blank? ? 'Unknown' : entity.authentications.first.status.try(:capitalize) |
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.
Unknown
.. missing translation (2 other occurences in this function)
@@ -0,0 +1,11 @@ | |||
= render :partial => "layouts/flash_msg" | |||
.row | |||
.col-md-12.col-lg-6 |
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.
This is obsolete and doesn't work anymore. Please see #274 on how to fix this.
Also, @juliancheal .. clearly this screen is not being tested since it doesn't work and the tests pass ;).
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.
I believe the Lenovo guys did test the Textual Summary page, and AFAIK, everything seemed to work OK.
But we'll address the obsolete part.
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.
Tests are still WIP :)
now tailored specifically for Physical Infra Provider
@martinpovolny @AparnaKarve yay finally green! |
Any possibility to clean up all/most of the rubocops? |
The current broken cops are in style with the rest of the UI. I think it would be best to leave those for now and fix in a later PR with other classes that are also wrong with this style. |
Folks, we have been through many many rounds of rebasing and resolving merge conflicts. Can someone please do the needful? Thanks. |
return false; | ||
} | ||
|
||
topologyService.addContextMenuOption(popup, "Go to summary page", data, self.dblclick); |
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.
missing i18n
container_template | ||
ems_block_storage | ||
ems_object_storage | ||
timeline usage).include?(@layout) |
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.
should this be timeline_usage
or 2 lines?
Some comments on commits https://github.com/juliancheal/manageiq-ui-classic/compare/219131e374178987571ed9b2b85959cabab51175~...3d7e8df215c9b57389d01ccbc81313aeca63f478 spec/controllers/ems_physical_infra_controller_spec.rb
|
Checked commits https://github.com/juliancheal/manageiq-ui-classic/compare/219131e374178987571ed9b2b85959cabab51175~...3d7e8df215c9b57389d01ccbc81313aeca63f478 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/controllers/ems_physical_infra_controller.rb
app/helpers/application_helper/toolbar/ems_physical_infra_center.rb
app/helpers/application_helper/toolbar/ems_physical_infras_center.rb
app/helpers/ems_physical_infra_helper/textual_summary.rb
app/presenters/menu/default_menu.rb
app/services/physical_infra_topology_service.rb
app/views/ems_physical_infra/_form.html.haml app/views/ems_physical_infra/edit.html.haml
app/views/ems_physical_infra/new.html.haml
app/views/layouts/listnav/_ems_physical_infra.html.haml
app/views/physical_infra_topology/show.html.haml
spec/controllers/ems_physical_infra_controller_spec.rb
spec/routing/ems_physical_infra_routing_spec.rb
|
ems_block_storage | ||
ems_object_storage | ||
timeline | ||
usage).include?(@layout) |
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.
@dclarizio @martinpovolny 2 requests here for future PRs:
- Please alphabetize this list
- Please move the list to a well-named constant so code is more readable
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.
@chessbyte : Toolbar chooser was extracted but not yet refactored :-(
For the record: I don't think we should merge new code that has so many Rubocop issues. No matter it might match other places in the code. It's not the way forward and someone will have to fix it sooner or later anyway. |
@juliancheal Not sure if that's a know problem or not but... Clicking on "Validate" when adding an phinfra provider just returns success, without even trying. (Added the provider with |
@juliancheal , @AparnaKarve the textual summary still has a link to Topology, it even seems like there is a PhysicalInfraTopology controller, but the topology itself is not available from the menu, and, perhaps more importantly, completely broken right now :). FYI ;) |
@himdel The only way to get to Physical Infra Topology is via the summary screen -- so that's a known thing. As far as the Topology itself goes, do you have enough data to get a decent Topology graph? Can you also post a screenshot of your summary screen...I'm curious to know what |
OK, cool .. because all the others have a Topology entry in the menu too..
Not really, I just have that one provider, without any additional data :). (I just used the bug that you can just add it without validation, so... I have a provider, but that's it.) |
@AparnaKarve this is my summary screen.. but not sure it helps :) |
relates to: ManageIQ#196
relates to: ManageIQ/manageiq-ui-classic#196 (transferred from ManageIQ/manageiq-ui-classic@c57b49e)
relates to: ManageIQ/manageiq-ui-classic#196 (transferred from manageiq-ui-classic@c57b49eaa709046958493ce47cd4621736858764)
Adds the Physical Infra pages.
There are still issues.
This PR links to ManageIQ/manageiq#13587