Module: ForemanVirtWhoConfigure::ConfigsHelper
- Defined in:
- app/helpers/foreman_virt_who_configure/configs_helper.rb
Instance Method Summary collapse
- #config_attribute(attribute, value, label = nil) ⇒ Object
- #config_attribute_default_label(attr) ⇒ Object
- #config_attribute_label(attr, label) ⇒ Object
- #config_attribute_value(attribute, value) ⇒ Object
- #config_report_status(config) ⇒ Object
- #config_report_status_icon(config) ⇒ Object
- #hypervisor_server_help_data ⇒ Object
- #hypervisor_username_help_data ⇒ Object
- #report_status_class(status) ⇒ Object
- #status_class(status) ⇒ Object
Instance Method Details
#config_attribute(attribute, value, label = nil) ⇒ Object
80 81 82 83 84 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 80 def config_attribute(attribute, value, label = nil) content_tag :div, :class => 'row' do config_attribute_label(attribute, label) + config_attribute_value(attribute, value) end end |
#config_attribute_default_label(attr) ⇒ Object
64 65 66 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 64 def config_attribute_default_label(attr) s_(ForemanVirtWhoConfigure::Config.gettext_translation_for_attribute_name(attr)).titleize end |
#config_attribute_label(attr, label) ⇒ Object
68 69 70 71 72 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 68 def config_attribute_label(attr, label) content_tag :div, :class => 'col-md-2' do content_tag :strong, (label || config_attribute_default_label(attr)) end end |
#config_attribute_value(attribute, value) ⇒ Object
74 75 76 77 78 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 74 def config_attribute_value(attribute, value) content_tag :div, :class => 'config-status' do content_tag :span, value, :class => "config-#{attribute}" end end |
#config_report_status(config) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 23 def config_report_status(config) = case config.status when :unknown _('No Report Yet') when :ok, :out_of_date l(config.last_report_at, :format => :long) else _('Unknown configuration status') end config_report_status_icon(config) + content_tag(:span, , :class => config.status) end |
#config_report_status_icon(config) ⇒ Object
36 37 38 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 36 def config_report_status_icon(config) content_tag(:span, ''.html_safe, :class => report_status_class(config.status), :title => config.status_description) + ' '.html_safe end |
#hypervisor_server_help_data ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 3 def hypervisor_server_help_data @hypervisor_server_help_data ||= { 'esx' => _('VMware vCenter server’s fully qualified host name or IP address.'), 'hyperv' => _('Microsoft Hyper-V fully qualified host name or IP address.'), 'libvirt' => _('Libvirt server’s fully qualified host name or IP address. You can also specify preferred schema, for example: <code>qemu+ssh://libvirt.example.com/system</code>. Make sure you setup root\'s SSH key on target host for a user specified at hypervisor username field'), 'kubevirt' => _('Container-native virtualization’s fully qualified host name or IP address. In order to connect to the cluster it is required to provide path to kubeconfig which contains connection details and authentication token.'), 'ahv' => _('Nutanix AHV’s IP address.') } end |
#hypervisor_username_help_data ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 13 def hypervisor_username_help_data @hypervisor_username_help_data ||= { 'esx' => _('Account name by which virt-who is to connect to the hypervisor, in the format <code>domain_name\account_name</code>. Note that only a single backslash separates the values for domain_name and account_name. If you are using a domain account, and the global configuration file <code>/etc/virt-who.conf</code>, then <b>two</b> backslashes are required. For further details, see <a href="https://access.redhat.com/solutions/1270223">Red Hat Knowledgebase solution How to use a windows domain account with virt-who</a> for more information.'), 'hyperv' => _('Account name by which virt-who is to connect to the hypervisor. By default this is <code>Administrator</code>. To use an alternate account, create a user account and assign that account to the following groups (Windows 2012 Server): Hyper-V Administrators and Remote Management Users.'), 'libvirt' => _('Account name by which virt-who is to connect to the hypervisor. Virt-who does not support password based authentication, you must manually setup SSH key, see <a href="https://access.redhat.com/solutions/1515983">Red Hat Knowledgebase solution How to configure virt-who for a KVM host</a> for more information.'), 'kubevirt' => '', 'ahv' => _('Account name by which virt-who is to connect to Nutanix AHV.') } end |
#report_status_class(status) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 40 def report_status_class(status) icon_class = case status when :ok, :out_of_date 'pficon-ok' when :unknown 'pficon-info' else 'pficon-help' end "virt-who-config-report-status #{icon_class} #{status_class(status)}" end |
#status_class(status) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'app/helpers/foreman_virt_who_configure/configs_helper.rb', line 53 def status_class(status) case status when :ok, :out_of_date 'status-ok'.html_safe when :unknown 'status-info'.html_safe else 'status-warn'.html_safe end end |