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
20 21 22 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 20 def ansible_module_args(log) report_json_viewer module_invocations (log) end |
#ansible_module_message(log) ⇒ Object
24 25 26 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 24 def (log) report_json_viewer hash_with_keys_removed (log) end |
#ansible_module_name(log) ⇒ Object
14 15 16 17 18 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 14 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
36 37 38 39 40 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 36 def ansible_report?(log) module_name(log).present? rescue StandardError false end |
#ansible_report_origin_icon ⇒ Object
28 29 30 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 28 def ansible_report_origin_icon 'foreman_ansible/Ansible.png' end |
#ansible_report_origin_partial ⇒ Object
32 33 34 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 32 def ansible_report_origin_partial 'foreman_ansible/config_reports/ansible' end |
#report_json_viewer(json) ⇒ Object
42 43 44 45 46 47 |
# File 'app/helpers/foreman_ansible/ansible_reports_helper.rb', line 42 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 |