From 2829ac0a7c106e0b16519b8accb09de3700f5744 Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Wed, 25 Mar 2020 09:59:13 -0400 Subject: [PATCH] Listnav and Summary screen updates - Added Relationships on Configuration Manager, Profile and Configure System summary screen listnavs - Updated Configured summary screen to show Relationships box. --- .../configured_system_controller.rb | 2 +- .../textual_summary.rb | 44 +++++++++++-------- .../listnav/_configuration_manager.html.haml | 12 +++++ .../listnav/_configuration_profile.html.haml | 11 +++++ .../listnav/_configured_system.html.haml | 10 +++++ 5 files changed, 60 insertions(+), 19 deletions(-) diff --git a/app/controllers/configured_system_controller.rb b/app/controllers/configured_system_controller.rb index a57476bcbf87..93edd8679963 100644 --- a/app/controllers/configured_system_controller.rb +++ b/app/controllers/configured_system_controller.rb @@ -51,7 +51,7 @@ def provision end def textual_group_list - [%i[properties environment os], %i[tenancy tags]] + [%i[properties relationships environment], %i[os tenancy tags]] end helper_method :textual_group_list diff --git a/app/helpers/configured_system_helper/textual_summary.rb b/app/helpers/configured_system_helper/textual_summary.rb index 947ac1c3af82..e8c7229f7f1b 100644 --- a/app/helpers/configured_system_helper/textual_summary.rb +++ b/app/helpers/configured_system_helper/textual_summary.rb @@ -4,7 +4,7 @@ module ConfiguredSystemHelper::TextualSummary def textual_group_properties TextualGroup.new( _("Properties"), - %i[hostname ipmi_present ipaddress mac_address configuration_profile_desc provider_name zone] + %i[hostname ipmi_present ipaddress mac_address zone] ) end @@ -28,27 +28,35 @@ def textual_mac_address {:label => _("Mac address"), :value => @record.mac_address} end - def textual_configuration_profile_desc - h = { - :label => _("Configuration Profile Description"), - :value => @record.configuration_profile.try(:description), - :explorer => true - } - h[:icon] = "fa fa-list-ul" if @record.configuration_profile - h + def textual_zone + {:label => _("Zone"), :value => @record.configuration_manager.my_zone} end - def textual_provider_name - { - :label => _("Provider"), - :image => @record.configuration_manager.decorate.fileicon, - :value => @record.configuration_manager.try(:name), - :explorer => true - } + def textual_group_relationships + TextualGroup.new( + _("Relationships"), + %i[configuration_manager configuration_profile] + ) end - def textual_zone - {:label => _("Zone"), :value => @record.configuration_manager.my_zone} + def textual_configuration_manager + configuration_manager = @record.configuration_manager + h = {:label => "Configuration Manager", :icon => "pficon pficon-configuration_manager", :value => (configuration_manager.nil? ? _("None") : configuration_manager.name)} + if configuration_manager && role_allows?(:feature => "configuration_manager_show") + h[:title] = _("Show this Configured System's Configuration Manager") + h[:link] = url_for_only_path(:controller => 'configuration_manager', :action => 'show', :id => configuration_manager) + end + h + end + + def textual_configuration_profile + configuration_profile = @record.configuration_profile + h = {:label => "Configuration Profile", :icon => "pficon pficon-configuration_profile", :value => (configuration_profile.nil? ? _("None") : configuration_profile.name)} + if configuration_profile && role_allows?(:feature => "configuration_profile_show") + h[:title] = _("Show this Configured System's Configuration Profile") + h[:link] = url_for_only_path(:controller => 'configuration_profile', :action => 'show', :id => configuration_profile) + end + h end def textual_group_environment diff --git a/app/views/layouts/listnav/_configuration_manager.html.haml b/app/views/layouts/listnav/_configuration_manager.html.haml index a3f84467f280..ff612b69c850 100644 --- a/app/views/layouts/listnav/_configuration_manager.html.haml +++ b/app/views/layouts/listnav/_configuration_manager.html.haml @@ -12,3 +12,15 @@ = miq_accordion_panel(_("Relationships"), false, "stack_rel") do %ul.nav.nav-pills.nav-stacked + - if role_allows?(:feature => "configuration_profile_show_list") + = li_link(:count => @record.number_of(:configuration_profiles), + :record_id => @record.id, + :tables => 'configuration_profiles', + :display => 'configuration_profiles', + :action => 'show') + - if role_allows?(:feature => "configured_system_show_list") + = li_link(:count => @record.number_of(:configured_systems), + :record_id => @record.id, + :tables => 'configured_systems', + :display => 'configured_systems', + :action => 'show') diff --git a/app/views/layouts/listnav/_configuration_profile.html.haml b/app/views/layouts/listnav/_configuration_profile.html.haml index a3f84467f280..080df554a6ff 100644 --- a/app/views/layouts/listnav/_configuration_profile.html.haml +++ b/app/views/layouts/listnav/_configuration_profile.html.haml @@ -12,3 +12,14 @@ = miq_accordion_panel(_("Relationships"), false, "stack_rel") do %ul.nav.nav-pills.nav-stacked + - if role_allows?(:feature => "configuration_manager_show") && !@record.configuration_manager.nil? + %li + = link_to(_("Configuration Manager: %{name}") % {:name => @record.configuration_manager.name}, + {:controller => "configuration_manager", :action => 'show', :id => @record.configuration_manager.id}, + :title => _("Show parent Configuration Manager for this Configuration Profile")) + - if role_allows?(:feature => "configured_system_show_list") + = li_link(:count => @record.number_of(:configured_systems), + :record_id => @record.id, + :tables => 'configured_systems', + :display => 'configured_systems', + :action => 'show') diff --git a/app/views/layouts/listnav/_configured_system.html.haml b/app/views/layouts/listnav/_configured_system.html.haml index a3f84467f280..05a3a5807248 100644 --- a/app/views/layouts/listnav/_configured_system.html.haml +++ b/app/views/layouts/listnav/_configured_system.html.haml @@ -12,3 +12,13 @@ = miq_accordion_panel(_("Relationships"), false, "stack_rel") do %ul.nav.nav-pills.nav-stacked + - if role_allows?(:feature => "configuration_manager_show") && !@record.configuration_manager.nil? + %li + = link_to(_("Configuration Manager: %{name}") % {:name => @record.configuration_manager.name}, + {:controller => "configuration_manager", :action => 'show', :id => @record.configuration_manager.id}, + :title => _("Show parent Configuration Manager for this Configured System")) + - if role_allows?(:feature => "configuration_profile_show") && !@record.configuration_profile.nil? + %li + = link_to(_("Configuration Profile: %{name}") % {:name => @record.configuration_profile.name}, + {:controller => "configuration_profile", :action => 'show', :id => @record.configuration_profile.id}, + :title => _("Show parent Configuration Profile for this Configured System"))