<%= 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), target: '_blank') 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) %> <%= link_to(_('Cancel'), cancel_foreman_tasks_task_path(@task), class: ['btn', 'btn-sm', 'btn-primary', ('disabled' unless @task.cancellable?)].compact, method: :post) %> <% if @task.parent_task %> <%= link_to(_("Parent task"), foreman_tasks_task_path(@task.parent_task), class: ['btn', 'btn-sm', 'btn-default']) %> <% end %> <% if @task.sub_tasks.any? %> <%= link_to(_("Sub tasks"), sub_tasks_foreman_tasks_task_path(@task), class: ['btn', 'btn-sm', 'btn-default']) %> <% end %> <% 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 %>

<%= _("Name") %>: <% task_label = format_task_input(@task, true) %> <%= truncate(task_label, :length => 50) %>
<%= _("Result") %>: <% if @task.state != 'stopped' %> <%= content_tag(:i, ' '.html_safe, :class => 'task-status pficon-help') %> <% else %> <%= content_tag(:i, ' '.html_safe, :class => task_result_icon_class(@task)) + content_tag(:span, @task.result) %> <% end %>
<%= _("Triggered by") %>: <% if @task.owner.present? && @task.username != User::ANONYMOUS_API_ADMIN && @task.username != User::ANONYMOUS_ADMIN %> <%= link_to_if_authorized(@task.username, hash_for_edit_user_path(@task.owner)) %> <% else %> <%= @task.username %> <% end %>
<%= _("Execution type") %>: <%= _(@task.execution_type) %>
<%= _("Start at") %>: <%= @task.start_at.nil? ? '-' : time_in_words_span(@task.start_at) %>
<%= _("Started at") %>: <%= time_in_words_span @task.started_at.try(:in_time_zone) %>
<%= _("Ended at") %>: <%= time_in_words_span @task.ended_at.try(:in_time_zone) %>
<%= _("Start before") %>: <%= @task.start_before.nil? ? '-' : time_in_words_span(@task.start_before) %>

<% 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 %>
State: <%= @task.state %>
<%= progress.round %>% Complete
<% unless @task.humanized[:output].blank? %>
<%= _("Output") %>:
<%= @task.humanized[:output] %>
<% end %> <% unless @task.humanized[:errors].blank? %>
<%= _("Errors") %>:
<%=Array(@task.humanized[:errors]).join("\n") %>
<% end %>