Module: ForemanAnsible::AnsibleReportsHelper
- Defined in:
- app/helpers/foreman_ansible/ansible_reports_helper.rb
Overview
This module takes the config reports stored in Foreman for Ansible and modifies them to be properly presented in views
Constant Summary collapse
- ANSIBLE_META_KEYS =
%w[ _ansible_parsed _ansible_no_log _ansible_item_result _ansible_ignore_errors _ansible_verbose_always _ansible_verbose_override ].freeze
- ANSIBLE_HIDDEN_KEYS =
%w[ invocation module_args results ansible_facts stdout stderr ].freeze
Instance Method Summary collapse
- #ansible_module_args(log) ⇒ Object
- #ansible_module_message(log) ⇒ Object
- #ansible_module_name(log) ⇒ Object
- #ansible_report?(log) ⇒ Boolean
- #ansible_report_origin_icon ⇒ Object
- #ansible_report_origin_partial ⇒ Object
- #report_json_viewer(json) ⇒ Object
Instance Method Details
#ansible_module_args(log) ⇒ Object
22 23 24 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 22 def ansible_module_args(log) report_json_viewer module_invocations (log) end |
#ansible_module_message(log) ⇒ Object
26 27 28 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 26 def (log) report_json_viewer hash_with_keys_removed (log) end |
#ansible_module_name(log) ⇒ Object
16 17 18 19 20 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 16 def ansible_module_name(log) source_value = log.source&.value name = source_value.split(':')[0].strip if source_value&.include?(':') name end |
#ansible_report?(log) ⇒ Boolean
38 39 40 41 42 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 38 def ansible_report?(log) module_name(log).present? rescue StandardError false end |
#ansible_report_origin_icon ⇒ Object
30 31 32 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 30 def ansible_report_origin_icon 'foreman_ansible/Ansible.png' end |
#ansible_report_origin_partial ⇒ Object
34 35 36 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 34 def ansible_report_origin_partial 'foreman_ansible/config_reports/ansible' end |
#report_json_viewer(json) ⇒ Object
44 45 46 47 48 49 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 44 def report_json_viewer(json) uid = "reportjson-viewer-#{json.object_id}" viewer = content_tag :div, '', :id => uid viewer << mount_react_component('ReportJsonViewer', "##{uid}", json.to_json) end |