Module: JobInvocationsHelper

Defined in:
app/helpers/job_invocations_helper.rb

Overview

frozen_string_literal:true

Instance Method Summary collapse

Instance Method Details

#collapsed_preview(target) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'app/helpers/job_invocations_helper.rb', line 41

def collapsed_preview(target)
  title = target.try(:name) || 'N/A'
  (:h5,
              :class => "expander collapsed out",
              :data => { :toggle => 'collapse',
                         :target => "#preview_#{target.id}" }) do
    (:span, '', :class => 'caret') + title
  end
end

#job_invocations_buttonsObject



15
16
17
18
19
20
# File 'app/helpers/job_invocations_helper.rb', line 15

def job_invocations_buttons
  [
    documentation_button_rex('3.2ExecutingaJob'),
    display_link_if_authorized(_('Run Job'), hash_for_new_job_invocation_path)
  ]
end

#minicard(icon, number, text) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/job_invocations_helper.rb', line 4

def minicard(icon, number, text)
  (:div, :class => 'card-pf card-pf-accented
              card-pf-aggregate-status card-pf-aggregate-status-mini') do
    (:h2, :class => 'card-pf-title', :style => 'line-height: 1.1') do
      icon_text(icon, '', :kind => 'pficon') +
      (:span, number, :class =>'card-pf-aggregate-status-count') +
      text
    end
  end
end

#preview_hosts(template_invocation) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'app/helpers/job_invocations_helper.rb', line 31

def preview_hosts(template_invocation)
  hosts = template_invocation.targeting.hosts.take(20)
  hosts.map do |host|
    collapsed_preview(host) +
      render(:partial => 'job_invocations/user_input',
             :locals => { :template_invocation => template_invocation,
                          :target => host })
  end.reduce(:+)
end


22
23
24
25
26
27
28
29
# File 'app/helpers/job_invocations_helper.rb', line 22

def template_name_and_provider_link(template)
  template_name = (:strong, template.name)
  provider = template.provider.humanized_name
  link_content = template_name + ' - ' + provider + ' ' +
    icon_text('edit', '', :kind => 'pficon')
  link_to_if_authorized(link_content,
                        hash_for_edit_job_template_path(:id => template.id))
end