ManageIQ/manageiq-ui-classic

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

Summary

Maintainability
A
40 mins
Test Coverage
F
54%
module AuthKeyPairCloudHelper::TextualSummary
  include TextualMixins::TextualGroupTags
  include TextualMixins::TextualName
  #
  # Groups
  #
  def textual_group_relationships
    TextualGroup.new(_("Relationships"), %i[provider vms])
  end

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

  def textual_provider
    textual_link(@record.ext_management_system)
  end

  #
  # Items
  #
  def textual_fingerprint
    {:label => _('Fingerprint'), :value => @record.fingerprint}
  end

  def textual_vms
    num   = @record.number_of(:vms)
    h     = {:label => _("Instances"), :icon => "pficon pficon-virtual-machine", :value => num}
    if num > 0 && 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

  def textual_group_lifecycle
    TextualGroup.new(
      _("Lifecycle"),
      %i[owner group]
    )
  end

  def textual_owner
    @record.evm_owner.try(:name)
  end

  def textual_group
    {:label => _("Group"), :value => @record.miq_group.try(:description)}
  end
end