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

Topology for Container Projects #120

Merged
merged 1 commit into from
Mar 2, 2017

Conversation

zeari
Copy link

@zeari zeari commented Jan 10, 2017

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1426229
From projects summary page click on the topology view toggle button:
screencapture-localhost-3000-container_project-show-7-1484060335913

Land here:
screencapture-localhost-3000-container_project-show-7-1484060193857

@martinpovolny PTAL, I remember you refactored topology recently

  • ContainerProjectTopologyService is ContainerTopologyService with a different build_topology method but i can throw the shared code into a mixin. I also couldnt get around creating ContainerProjectTopologyController which is more of the same.
  • we should probably have a system in toolbar_chooser to figure out which entities have topology\dashboard views and show the upper right toolbar icons accordingly. Im guessing a role_allows?(:feature => 'topologyview')

cc @simon3z
@miq-bot add_label topology, providers/containers, ui, wip

@miq-bot
Copy link
Member

miq-bot commented Jan 10, 2017

@zeari Cannot apply the following labels because they are not recognized: topology, ui

@martinpovolny
Copy link
Member

Overall it looks good!

I don't get how the part entities have topology\dashboard views relates to role_allows??

I see it more related to capabilities and the supports? framework that we have on models. But this is really not a capability or feature of the backed component but rather a property of the UI related to the models.

We may use the decorators for this -- the decarators on the classes (not instances) that @himdel is just adding.

I am concerned about entity_display_type and entity_status -- those look pretty ugly, probably again a use case for some decorators or presenter classes. Also I wonder how i18n is (is not?) handled for the strings used there.

@martinpovolny martinpovolny self-requested a review January 27, 2017 09:51
@martinpovolny martinpovolny self-assigned this Jan 27, 2017
@@ -43,6 +43,8 @@ def view_toolbar_filename
'drift_view_tb'
elsif %w(ems_container ems_infra).include?(@layout) && %w(main dashboard topology).include?(@display)
'dashboard_summary_toggle_view_tb'
elsif %w(container_project).include?(@layout)
"#{@layout}_view_tb"
Copy link
Author

Choose a reason for hiding this comment

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

I don't get how the part entities have topology\dashboard views relates to role_allows??

I thought that if an entity (like ems) has a dashboard view available (maybe through supports?) then we should add the toolbar dashboard view button instead of picking specific entities with their toolbars.
or maybe we always have entities search for their "#{@layout}_view_tb" file.
Im just trying to prevent massive refactors later...

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

sorry, I don't get it :-(

@zeari
Copy link
Author

zeari commented Feb 2, 2017

@dclarizio @serenamarie125 Can I get a general ack towards making this change?

@serenamarie125
Copy link

@zeari is this essentially adding the Topology icon in the view selector ?

@zeari
Copy link
Author

zeari commented Feb 2, 2017

@zeari is this essentially adding the Topology icon in the view selector ?

@serenamarie125 that goes to a project level topology screen, yes.

Copy link

@serenamarie125 serenamarie125 left a comment

Choose a reason for hiding this comment

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

This is exactly what UX designed and recommends. Thanks @zeari

@miq-bot
Copy link
Member

miq-bot commented Feb 10, 2017

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

@zeari zeari force-pushed the project_level_topology branch from 7015b1c to 9c7c96d Compare February 22, 2017 13:26
@zeari zeari force-pushed the project_level_topology branch from 9c7c96d to beba70d Compare February 22, 2017 13:51
@zeari
Copy link
Author

zeari commented Feb 22, 2017

@miq-bot remove_label wip

@zeari zeari changed the title [WIP] Topology for Container Projects Topology for Container Projects Feb 22, 2017
@miq-bot
Copy link
Member

miq-bot commented Feb 22, 2017

@zeari Cannot apply the following labels because they are not recognized: topology, providers/containers

@miq-bot miq-bot added ui and removed wip labels Feb 22, 2017
@zeari
Copy link
Author

zeari commented Feb 22, 2017

@martinpovolny @himdel PTAL

@zeari zeari force-pushed the project_level_topology branch from beba70d to c45c1fa Compare February 22, 2017 20:53
@zeari
Copy link
Author

zeari commented Feb 22, 2017

I am concerned about entity_display_type and entity_status -- those look pretty ugly, probably again a use case for some decorators or presenter classes. Also I wonder how i18n is (is not?) handled for the strings used there.

Im not sure whats the next step here. right now i just refactored that code into the mixin.

@simon3z
Copy link
Contributor

simon3z commented Feb 23, 2017

I am concerned about entity_display_type and entity_status -- those look pretty ugly, probably again a use case for some decorators or presenter classes. Also I wonder how i18n is (is not?) handled for the strings used there.

Im not sure whats the next step here. right now i just refactored that code into the mixin.

@martinpovolny @zeari those methods are definitely ugly and must be improved, but if this PR is about just moving some code from one place to another (mixin) I don't think we should block on a technical debt / refactoring.

:ContainerServices => { :ContainerRoutes => nil }
}
}
}
Copy link
Author

@zeari zeari Feb 23, 2017

Choose a reason for hiding this comment

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

@simon3z Do we want to show nodes\Vms in this topology?

Copy link
Contributor

Choose a reason for hiding this comment

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

@zeari are we taking advantage of the same logic of auto-disabling entities when we reach a limit? (PR #95) I think we should, because indeed we would like to show nodes and VMs here.

Copy link
Author

Choose a reason for hiding this comment

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

@zeari are we taking advantage of the same logic of auto-disabling entities when we reach a limit? (PR #95) I think we should, because indeed we would like to show nodes and VMs here.

Yes. Im adding nodes and vms.

@zeari zeari force-pushed the project_level_topology branch 3 times, most recently from 27279da to 2fd75cf Compare February 23, 2017 16:07
} else {
// search for pattern ^/<controler>/<id>$ in the pathname
type = 'container_topology'
Copy link
Contributor

Choose a reason for hiding this comment

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

@zeari @martinpovolny this logic of this functions seems to become a little complex to maintain. Maybe we don't have to keep the old container_topology path if it's becoming an exception (as you need an extra else branch).

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct me if I'm wrong please, but .. isn't it always container_topology here? We don't really reuse the controller for any other topologies now, do we?

Copy link
Author

@zeari zeari Feb 26, 2017

Choose a reason for hiding this comment

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

Correct me if I'm wrong please, but .. isn't it always container_topology here? We don't really reuse the controller for any other topologies now, do we?

in this case it could also be container_project_topology. container_topology would lead to code from ContainerTopologyService which generates topology for ems and not projects.

@zeari @martinpovolny this logic of this functions seems to become a little complex to maintain. Maybe we don't have to keep the old container_topology path if it's becoming an exception (as you need an extra else branch).

in that case we would need the /ems_container/ path to build topology for ems .
right now there are 3 cases for the url:

  • all ems topology (the path/container_topology/ without an id)
  • single ems topology (the same but with id - /ems_container/3 --> "/container_topology/data/3")
  • in this PR: single topology for any entity: '/container_project/show/21' --> "/container_project_topology/data/21'

@zeari zeari force-pushed the project_level_topology branch from 2fd75cf to db55c81 Compare February 26, 2017 12:17
// search for pattern ^/<controler>/<id>$ in the pathname - /ems_container/4
var arr = pathname.match('/(.+)/([0-9]+)');
type = 'container_topology';
id = '/' + arr[2]
}

Copy link
Author

Choose a reason for hiding this comment

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

@himdel @simon3z I tried to make it a little more clear

@zeari zeari force-pushed the project_level_topology branch from db55c81 to 8f4ad1a Compare February 26, 2017 15:19
@simon3z
Copy link
Contributor

simon3z commented Feb 27, 2017

@zeari IIUC the special logic you have in container_topology_controller.js is because the url paths for container providers and projects are different:

/ems_container/{id}
/container_project/show/{id}

Is this difference in paths really necessary to keep? So much that it's worth to add special handling logic in the topology?
Would it be hard instead to make the url paths consistent so that we won't need to understand both?

@zeari
Copy link
Author

zeari commented Feb 27, 2017

@simon3z though the project is going in that direction, I think converting the containers area to 'restful urls' seem is a little big just to satisfy this bit of code 😅

cc @martinpovolny

@martinpovolny
Copy link
Member

@simon3z : we would like to get all the URLs to the "restful" style. But noone is working on that project at this moment imho.

I think that unification is a great think but agree that we cannot do everything in one PR.

@simon3z
Copy link
Contributor

simon3z commented Feb 27, 2017

I think that unification is a great think but agree that we cannot do everything in one PR.

@martinpovolny if the plan is to move to the "restful" style, maybe now we have the chance to update the container projects and at the same time avoid extra logic in the topology; it seems worth investigating (unless it's a dramatic change).
Of course I don't expect that to be in the same PR.

@showtype = "topology"
drop_breadcrumb(:name => @record.name + _(" (Topology)"),
:url => "/#{controller_name}/show/#{@record.id}?display=topology")
end
Copy link
Member

Choose a reason for hiding this comment

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

we have already show_topology in EmsCommon. But never mind this can be unified in a follow up PR. But please, use the show_link to generate the show links so that this works also for restful? == true.

Copy link
Member

@martinpovolny martinpovolny left a comment

Choose a reason for hiding this comment

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

please, fix the show link

@martinpovolny
Copy link
Member

Let's fix the show link, merge this and deal with the rest in follow up PRs.

@zeari zeari force-pushed the project_level_topology branch from 8f4ad1a to 38c6a00 Compare March 2, 2017 10:00
@miq-bot
Copy link
Member

miq-bot commented Mar 2, 2017

Checked commit zeari@38c6a00 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
10 files checked, 22 offenses detected

app/helpers/application_helper/toolbar/container_project_view.rb

  • ❗ - Line 20, Col 3 - Style/IndentArray - Indent the right bracket the same as the first position after the preceding left parenthesis.
  • ❗ - Line 3, Col 5 - Style/IndentArray - Use 2 spaces for indentation in an array, relative to the first position after the preceding left parenthesis.

app/services/container_project_topology_service.rb

  • ❗ - Line 12, Col 55 - Style/IndentHash - Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
  • ❗ - Line 15, Col 55 - Style/AlignHash - Align the elements of a hash literal if they span more than one line.
  • ❗ - Line 16, Col 53 - Style/IndentHash - Indent the right brace the same as the start of the line where the left brace is.
  • ❗ - Line 17, Col 51 - Style/MultilineHashBraceLayout - Closing hash brace must be on the same line as the last hash element when opening brace is on the same line as the first hash element.
  • ❗ - Line 18, Col 28 - Style/MultilineHashBraceLayout - Closing hash brace must be on the same line as the last hash element when opening brace is on the same line as the first hash element.
  • ❗ - Line 22, Col 59 - Style/AlignHash - Align the elements of a hash literal if they span more than one line.
  • ❗ - Line 32, Col 1 - Style/EmptyLines - Extra blank line detected.

app/services/container_topology_service_mixin.rb

@zeari
Copy link
Author

zeari commented Mar 2, 2017

please, fix the show link

Fixed

@martinpovolny martinpovolny merged commit 93befd5 into ManageIQ:master Mar 2, 2017
@martinpovolny martinpovolny added this to the Sprint 56 Ending Mar 13, 2017 milestone Mar 2, 2017
@abonas
Copy link
Member

abonas commented May 14, 2017

@miq-bot add_label topology

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.

7 participants