ManageIQ/manageiq-ui-classic

View on GitHub
app/helpers/placement_group_helper/textual_summary.rb

Summary

Maintainability
A
35 mins
Test Coverage
D
60%
module PlacementGroupHelper::TextualSummary
  include TextualMixins::TextualEmsCloud
  include TextualMixins::TextualGroupTags
  include TextualMixins::TextualName
  include TextualMixins::TextualCustomButtonEvents
  #
  # Groups
  #

  def textual_group_relationships
    TextualGroup.new(_("Relationships"), %i[ems_cloud instances])
  end

  def textual_group_properties
    TextualGroup.new(_("Properties"), %i[name policy])
  end

  #
  # Items
  #
  def textual_type
    ui_lookup(:model => @record.type)
  end

  def textual_policy
    ui_lookup(:model => @record.policy)
  end

  def textual_instances
    num   = @record.number_of(:vms)
    h     = {:label => _('Instances'), :icon => "pficon pficon-virtual-machine", :value => num}
    if num.positive? && role_allows?(:feature => "vm_show_list")
      h[:link]  = url_for_only_path(:action => 'show', :id => @record, :display => 'instances')
      h[:title] = _("Show all Instances")
    end
    h
  end
end