From 01542e1bc2151be1909a60e4ba4d567e1dd860d9 Mon Sep 17 00:00:00 2001 From: felipedf Date: Mon, 18 Jun 2018 16:58:41 -0300 Subject: [PATCH] Add a topology view for a single physical infra provider --- .../javascripts/services/topology_service.js | 2 +- app/views/container_topology/show.html.haml | 59 +------------------ .../ems_container/_show_topology.html.haml | 58 ++++++++++++++++++ .../_show_topology.html.haml | 39 ++++++++++++ .../physical_infra_topology/show.html.haml | 40 +------------ .../shared/views/ems_common/_show.html.haml | 2 +- 6 files changed, 101 insertions(+), 99 deletions(-) create mode 100644 app/views/ems_container/_show_topology.html.haml create mode 100644 app/views/ems_physical_infra/_show_topology.html.haml diff --git a/app/assets/javascripts/services/topology_service.js b/app/assets/javascripts/services/topology_service.js index 301857147220..027b1132658f 100644 --- a/app/assets/javascripts/services/topology_service.js +++ b/app/assets/javascripts/services/topology_service.js @@ -270,7 +270,7 @@ ManageIQ.angular.app.service('topologyService', ['$location', '$http', 'miqServi return controller.dataUrl; } - var match = screenUrl.match(/(ems_container|show)\/([0-9]+)\?display=topology$/) || + var match = screenUrl.match(/(ems_container|ems_physical_infra|show)\/([0-9]+)\?display=topology$/) || screenUrl.match(/(_topology)\/show\/([0-9]+)\/?$/); if (match) { diff --git a/app/views/container_topology/show.html.haml b/app/views/container_topology/show.html.haml index b30ff3d97dc4..1667065c77dd 100644 --- a/app/views/container_topology/show.html.haml +++ b/app/views/container_topology/show.html.haml @@ -1,58 +1 @@ -- tooltip_options = {"tooltip-placement" => "bottom", "uib-tooltip" => "{{vm.legendTooltip}}"} -.topology{'ng-controller' => "containerTopologyController as vm"} - .legend - %label#selected - %div{'ng-if' => "vm.kinds"} - %kubernetes-topology-icon{tooltip_options, :kind => "ContainerReplicator"} - %label - %i.pficon.pficon-replicator - = _("Replicators") - %kubernetes-topology-icon{tooltip_options, :kind => "ContainerGroup"} - %label - %i.fa.fa-cubes - = _("Pods") - %kubernetes-topology-icon{tooltip_options, :kind => "Container"} - %label - %i.fa.fa-cube - = _("Containers") - %kubernetes-topology-icon{tooltip_options, :kind => "ContainerService"} - %label - %i.pficon.pficon-service - = _("Services") - %kubernetes-topology-icon{tooltip_options, :kind => "ContainerRoute"} - %label - %i.pficon.pficon-route - = _("Routes") - %kubernetes-topology-icon{tooltip_options, :kind => "ContainerNode"} - %label - %i.pficon.pficon-container-node - = _("Nodes") - %kubernetes-topology-icon{tooltip_options, :kind => "Vm"} - %label - %i.pficon.pficon-virtual-machine - = _("VMs") - %kubernetes-topology-icon{tooltip_options, :kind => "Host"} - %label - %i.pficon.pficon-screen - = _("Hosts") - - .alert.alert-info.alert-dismissable - %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} - %span.pficon.pficon-close - %span.pficon.pficon-info - %strong - = _("Click on the legend to show/hide entities, and double click/right click the entities in the graph to navigate to their summary pages.") - .alert.alert-warning.alert-dismissable - %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} - %span.pficon.pficon-close - %span.pficon.pficon-warning-triangle-o - %strong - = _("Note: displaying a very large number of objects in the topology display can adversely affect the performance of some web browsers.") - - - = render :partial => "shared/topology/not_found_vm" - - %kubernetes-topology-graph{:items => "vm.items", :relations => "vm.relations", :kinds => "vm.kinds"} - -:javascript - miq_bootstrap('.topology'); += render :partial => "ems_container/show_topology" diff --git a/app/views/ems_container/_show_topology.html.haml b/app/views/ems_container/_show_topology.html.haml new file mode 100644 index 000000000000..b30ff3d97dc4 --- /dev/null +++ b/app/views/ems_container/_show_topology.html.haml @@ -0,0 +1,58 @@ +- tooltip_options = {"tooltip-placement" => "bottom", "uib-tooltip" => "{{vm.legendTooltip}}"} +.topology{'ng-controller' => "containerTopologyController as vm"} + .legend + %label#selected + %div{'ng-if' => "vm.kinds"} + %kubernetes-topology-icon{tooltip_options, :kind => "ContainerReplicator"} + %label + %i.pficon.pficon-replicator + = _("Replicators") + %kubernetes-topology-icon{tooltip_options, :kind => "ContainerGroup"} + %label + %i.fa.fa-cubes + = _("Pods") + %kubernetes-topology-icon{tooltip_options, :kind => "Container"} + %label + %i.fa.fa-cube + = _("Containers") + %kubernetes-topology-icon{tooltip_options, :kind => "ContainerService"} + %label + %i.pficon.pficon-service + = _("Services") + %kubernetes-topology-icon{tooltip_options, :kind => "ContainerRoute"} + %label + %i.pficon.pficon-route + = _("Routes") + %kubernetes-topology-icon{tooltip_options, :kind => "ContainerNode"} + %label + %i.pficon.pficon-container-node + = _("Nodes") + %kubernetes-topology-icon{tooltip_options, :kind => "Vm"} + %label + %i.pficon.pficon-virtual-machine + = _("VMs") + %kubernetes-topology-icon{tooltip_options, :kind => "Host"} + %label + %i.pficon.pficon-screen + = _("Hosts") + + .alert.alert-info.alert-dismissable + %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} + %span.pficon.pficon-close + %span.pficon.pficon-info + %strong + = _("Click on the legend to show/hide entities, and double click/right click the entities in the graph to navigate to their summary pages.") + .alert.alert-warning.alert-dismissable + %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} + %span.pficon.pficon-close + %span.pficon.pficon-warning-triangle-o + %strong + = _("Note: displaying a very large number of objects in the topology display can adversely affect the performance of some web browsers.") + + + = render :partial => "shared/topology/not_found_vm" + + %kubernetes-topology-graph{:items => "vm.items", :relations => "vm.relations", :kinds => "vm.kinds"} + +:javascript + miq_bootstrap('.topology'); diff --git a/app/views/ems_physical_infra/_show_topology.html.haml b/app/views/ems_physical_infra/_show_topology.html.haml new file mode 100644 index 000000000000..a507a06e2419 --- /dev/null +++ b/app/views/ems_physical_infra/_show_topology.html.haml @@ -0,0 +1,39 @@ +- tooltipOptions = {"tooltip-placement" => "bottom", "uib-tooltip" => "{{vm.legendTooltip}}"} +.topology{'ng-controller' => "physicalInfraTopologyController as vm"} + .legend + %label#selected + %div{'ng-if' => "vm.kinds"} + %kubernetes-topology-icon{tooltipOptions, :kind => "PhysicalRack"} + %label + %i.pficon.pficon-enterprise + = _("Physical Racks") + %kubernetes-topology-icon{tooltipOptions, :kind => "PhysicalServer"} + %label + %i.pficon.pficon-server-group + = _("Physical Servers") + %kubernetes-topology-icon{tooltipOptions, :kind => "PhysicalSwitch"} + %label + %i.ff.ff-network-switch + = _("Physical Switches") + %kubernetes-topology-icon{tooltipOptions, :kind => "Host"} + %label + %i.pficon.pficon-screen + = _("Hosts") + %kubernetes-topology-icon{tooltipOptions, :kind => "Vm"} + %label + %i.pficon.pficon-screen + = _("VMs") + + .alert.alert-info.alert-dismissable + %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} + %span.pficon.pficon-close + %span.pficon.pficon-info + %strong + = _("Click on the legend to show/hide entities, and double click/right click the entities in the graph to navigate to their summary pages.") + + = render :partial => "shared/topology/not_found_vm" + + %kubernetes-topology-graph{:items => "vm.items", :relations => "vm.relations", :kinds => "vm.kinds"} + +:javascript + miq_bootstrap('.topology'); diff --git a/app/views/physical_infra_topology/show.html.haml b/app/views/physical_infra_topology/show.html.haml index a507a06e2419..adf77c6ded40 100644 --- a/app/views/physical_infra_topology/show.html.haml +++ b/app/views/physical_infra_topology/show.html.haml @@ -1,39 +1 @@ -- tooltipOptions = {"tooltip-placement" => "bottom", "uib-tooltip" => "{{vm.legendTooltip}}"} -.topology{'ng-controller' => "physicalInfraTopologyController as vm"} - .legend - %label#selected - %div{'ng-if' => "vm.kinds"} - %kubernetes-topology-icon{tooltipOptions, :kind => "PhysicalRack"} - %label - %i.pficon.pficon-enterprise - = _("Physical Racks") - %kubernetes-topology-icon{tooltipOptions, :kind => "PhysicalServer"} - %label - %i.pficon.pficon-server-group - = _("Physical Servers") - %kubernetes-topology-icon{tooltipOptions, :kind => "PhysicalSwitch"} - %label - %i.ff.ff-network-switch - = _("Physical Switches") - %kubernetes-topology-icon{tooltipOptions, :kind => "Host"} - %label - %i.pficon.pficon-screen - = _("Hosts") - %kubernetes-topology-icon{tooltipOptions, :kind => "Vm"} - %label - %i.pficon.pficon-screen - = _("VMs") - - .alert.alert-info.alert-dismissable - %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} - %span.pficon.pficon-close - %span.pficon.pficon-info - %strong - = _("Click on the legend to show/hide entities, and double click/right click the entities in the graph to navigate to their summary pages.") - - = render :partial => "shared/topology/not_found_vm" - - %kubernetes-topology-graph{:items => "vm.items", :relations => "vm.relations", :kinds => "vm.kinds"} - -:javascript - miq_bootstrap('.topology'); += render :partial => "ems_physical_infra/show_topology" diff --git a/app/views/shared/views/ems_common/_show.html.haml b/app/views/shared/views/ems_common/_show.html.haml index a54900fee263..01dd8ddb2987 100644 --- a/app/views/shared/views/ems_common/_show.html.haml +++ b/app/views/shared/views/ems_common/_show.html.haml @@ -27,4 +27,4 @@ - elsif @showtype == 'ad_hoc_metrics' = render :partial => 'show_ad_hoc_metrics' - elsif @showtype == 'topology' - = render :file => 'container_topology/show' + = render :partial => 'show_topology'