Module: JobInvocationsHelper
- Defined in:
- app/helpers/job_invocations_helper.rb
Overview
frozen_string_literal:true
Instance Method Summary collapse
- #collapsed_preview(target) ⇒ Object
- #job_invocation_task_buttons(task) ⇒ Object
- #job_invocations_buttons ⇒ Object
- #minicard(icon, number, text) ⇒ Object
- #preview_hosts(template_invocation) ⇒ Object
- #template_name_and_provider_link(template) ⇒ Object
Instance Method Details
#collapsed_preview(target) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'app/helpers/job_invocations_helper.rb', line 70 def collapsed_preview(target) title = target.try(:name) || 'N/A' content_tag(:h5, :class => "expander collapsed out", :data => { :toggle => 'collapse', :target => "#preview_#{target.id}" }) do content_tag(:span, '', :class => 'caret') + title end end |
#job_invocation_task_buttons(task) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/helpers/job_invocations_helper.rb', line 15 def (task) job_invocation = task.task_groups.find { |group| group.class == JobInvocationTaskGroup }.job_invocation = [] if (hash_for_new_job_invocation_path) << link_to(_('Rerun'), rerun_job_invocation_path(:id => job_invocation.id), :class => 'btn btn-default', :title => _('Rerun the job')) end if (hash_for_new_job_invocation_path) << link_to(_('Rerun failed'), rerun_job_invocation_path(:id => job_invocation.id, :failed_only => 1), :class => 'btn btn-default', :disabled => task.sub_tasks.none? { |sub_task| task_failed?(sub_task) }, :title => _('Rerun on failed hosts')) end if (:permission => :view_foreman_tasks, :auth_object => task) << link_to(_('Job Task'), foreman_tasks_task_path(task), :class => 'btn btn-default', :title => _('See the last task details')) end if (:permission => :edit_foreman_tasks, :auth_object => task) << link_to(_('Cancel Job'), cancel_foreman_tasks_task_path(task), :class => 'btn btn-danger', :title => _('Try to cancel the job'), :disabled => !task.cancellable?, :method => :post) end end |
#job_invocations_buttons ⇒ Object
44 45 46 47 48 49 |
# File 'app/helpers/job_invocations_helper.rb', line 44 def [ ('3.2ExecutingaJob'), (_('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) content_tag(:div, :class => 'card-pf card-pf-accented card-pf-aggregate-status card-pf-aggregate-status-mini') do content_tag(:h2, :class => 'card-pf-title', :style => 'line-height: 1.1') do icon_text(icon, '', :kind => 'pficon') + content_tag(:span, number, :class =>'card-pf-aggregate-status-count') + text end end end |
#preview_hosts(template_invocation) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'app/helpers/job_invocations_helper.rb', line 60 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 |
#template_name_and_provider_link(template) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'app/helpers/job_invocations_helper.rb', line 51 def template_name_and_provider_link(template) template_name = content_tag(:strong, template.name) provider = template.provider.humanized_name link_content = template_name + ' - ' + provider + ' ' + icon_text('edit', '', :kind => 'pficon') (link_content, hash_for_edit_job_template_path(:id => template.id)) end |