<commit_before>class PhysicalServer < ApplicationRecord
  include NewWithTypeStiMixin

  acts_as_miq_taggable

  belongs_to :ext_management_system, :foreign_key => :ems_id, :class_name => "ManageIQ::Providers::PhysicalInfraManager"

  has_one :host, :inverse_of => :physical_server

  def name_with_details
    details % {
      :name => name,
    }
  end
end<commit_msg>Adds physical_server methods to be used by miq-ui<commit_after>class PhysicalServer < ApplicationRecord
  include NewWithTypeStiMixin
  include MiqPolicyMixin

  acts_as_miq_taggable

  belongs_to :ext_management_system, :foreign_key => :ems_id, :class_name => "ManageIQ::Providers::PhysicalInfraManager"

  has_one :host, :inverse_of => :physical_server

  VENDOR_TYPES = {
     # DB            Displayed
    "lenovo"          => "lenovo",
    "unknown"         => "Unknown",
    nil               => "Unknown",
  }

  def name_with_details
    details % {
      :name => name,
    }
  end

  def has_compliance_policies?
    _, plist = MiqPolicy.get_policies_for_target(self, "compliance", "physicalserver_compliance_check")
    !plist.blank?
  end

  def label_for_vendor
    VENDOR_TYPES[self.vendor]
  end
end
{'fraction_non_alphanumeric': 0.09113924050632911, 'fraction_numerical': 0.0, 'mean_word_length': 3.7063492063492065, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6513062', 'n_tokens_mistral': 417, 'n_tokens_neox': 395, 'n_words': 75}