From fe7b4df1d4e84da319c5b2fb93295eed2aa87de4 Mon Sep 17 00:00:00 2001 From: nimrodshn Date: Tue, 14 Mar 2017 18:01:31 +0200 Subject: [PATCH] Add UI support for Pod to PV relationship refactored small mistakes refactored small mistakes refactored small mistakes refactored small mistakes refactoring --- app/helpers/persistent_volume_helper/textual_summary.rb | 7 ++++++- app/views/layouts/listnav/_persistent_volume.html.haml | 3 +++ app/views/persistent_volume/show.html.haml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/helpers/persistent_volume_helper/textual_summary.rb b/app/helpers/persistent_volume_helper/textual_summary.rb index 1e042b2c0195..c0400768df2e 100644 --- a/app/helpers/persistent_volume_helper/textual_summary.rb +++ b/app/helpers/persistent_volume_helper/textual_summary.rb @@ -23,7 +23,7 @@ def textual_group_claim_properties end def textual_group_relationships - TextualGroup.new(_("Relationships"), %i(parent)) + TextualGroup.new(_("Relationships"), %i(parent pods_using_persistent_volume)) end def textual_group_smart_management @@ -40,6 +40,11 @@ def textual_group_capacity # # Items # + def textual_pods_using_persistent_volume + link = url_for_only_path(:id => @record.id, :action => "show", :display => "container_groups") + textual_link(@record.container_groups, :as => ContainerGroup, :link => link) + end + def textual_resource_version @record.resource_version end diff --git a/app/views/layouts/listnav/_persistent_volume.html.haml b/app/views/layouts/listnav/_persistent_volume.html.haml index 74a8b6033445..14e2af0baee6 100644 --- a/app/views/layouts/listnav/_persistent_volume.html.haml +++ b/app/views/layouts/listnav/_persistent_volume.html.haml @@ -15,3 +15,6 @@ = link_to("#{ui_lookup(:table => "ems_container")}: #{@record.parent.name}", polymorphic_path(@record.parent), :title => _("Show this persistent volume's parent Containers Provider")) + %li + = link_to("#{ui_lookup(:table => "container_groups")}", + url_for_only_path(:id => @record.id, :action => "show", :display => "container_groups")) diff --git a/app/views/persistent_volume/show.html.haml b/app/views/persistent_volume/show.html.haml index 4300d07738d4..7b4746338b1a 100644 --- a/app/views/persistent_volume/show.html.haml +++ b/app/views/persistent_volume/show.html.haml @@ -1,4 +1,4 @@ -- if @display == 'containers' +- if %w(containers container_groups).include?(@display) = render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"} - elsif @showtype == 'main' = render :partial => "layouts/textual_groups_generic"