<%= link_to(_('Auto Reload'), '', class: %w(btn btn-sm btn-default reload-button hidden)) %>
<% if authorized_for(:permission => :edit_foreman_tasks, :auth_object => @task) %>
<%= link_to(_('Dynflow console'),
format((defined?(Rails) ? request.script_name : '') + '/foreman_tasks/dynflow/%s', @task.external_id),
class: %w(btn btn-sm btn-default)) if Setting['dynflow_enable_console'] %>
<%= link_to(_('Resume'),
resume_foreman_tasks_task_path(@task),
class: ['btn', 'btn-sm', 'btn-primary', ('disabled' unless @task.resumable?)].compact,
method: :post) %>
<% if Setting['dynflow_allow_dangerous_actions'] %>
<%= link_to(_('Unlock'),
'',
class: ['btn', 'btn-sm', 'btn-warning', 'reload-button-stop', ('disabled' unless @task.state == 'paused')].compact,
:'data-toggle' => "modal",
:'data-target' => "#unlock_modal") %>
<%= link_to(_('Force Unlock'),
'',
class: ['btn', 'btn-sm', 'btn-danger', 'reload-button-stop', ('disabled' if @task.state == 'stopped')].compact,
:'data-toggle' => "modal",
:'data-target' => "#force_unlock_modal") %>
<% end %>
<% end %>
<%= _("Id") %>:
<%= @task.id %>
<%= _("Label") %>:
<%= @task.label %>
<%= _("Name") %>:
<%= @task.humanized[:action] %>
<%= _("Owner") %>:
<%= @task.username %>
<%= _("Started at") %>:
<%= @task.started_at %>
<%= _("Ended at") %>:
<%= @task.ended_at %>
<%= _("State") %>:
<%= @task.state %>
<%= _("Result") %>:
<%= @task.state == 'running' ? '-' : @task.result %>
<%= _("Params") %>:
<%= format_task_input(@task) %>
<% if @task.parent_task %>
<%= link_to(_("Parent task"), foreman_tasks_task_path(@task.parent_task)) %>
<% end %>
<% if @task.sub_tasks.any? %>
<%= link_to(_("Sub tasks"), sub_tasks_foreman_tasks_task_path(@task)) %>
<% end %>
<% progress = 100 * @task.progress %>
<% progress_class = if @task.state == 'running'
nil
else
case @task.result
when 'success'
'progress-bar-success'
when 'error'
'progress-bar-danger'
when 'warning'
'progress-bar-warning'
else
nil
end
end %>
<% classes = ['progress-bar', progress_class] %>
<%= progress %>% Complete
<%= progress.round %>%
<% unless @task.humanized[:output].blank? %>
<%= _("Output") %>:
<%= @task.humanized[:output] %>
<% end %>
<% unless @task.humanized[:errors].blank? %>
<%= _("Errors") %>:
<%= @task.humanized[:errors].join("\n") %>
<% end %>