Skip to content

Commit

Permalink
Listnav and Summary screen updates
Browse files Browse the repository at this point in the history
- Added Relationships on Configuration Manager, Profile and Configure System summary screen listnavs
- Updated Configured summary screen to show Relationships box.
  • Loading branch information
h-kataria committed Mar 25, 2020
1 parent 202d6a3 commit 2829ac0
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/controllers/configured_system_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
44 changes: 26 additions & 18 deletions app/helpers/configured_system_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions app/views/layouts/listnav/_configuration_manager.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
11 changes: 11 additions & 0 deletions app/views/layouts/listnav/_configuration_profile.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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") && [email protected]_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')
10 changes: 10 additions & 0 deletions app/views/layouts/listnav/_configured_system.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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") && [email protected]_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") && [email protected]_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"))

0 comments on commit 2829ac0

Please sign in to comment.