<p> <%= 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 %> </p> <div class="modal fade" id="unlock_modal" tabindex="-1" role="dialog" aria-labelledby="Deploy" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h2 class="modal-title" id="deploy_modal_label"> <span class="glyphicon glyphicon-warning-sign"></span> <%= _("Unlock") %> </h2> </div> <div class="modal-body"> <%= _("This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed.") %> <div> <input class="disable-unlock" type="checkbox"/> <%= _("I understand that this may cause harm and have working database backups of all backend services.") %> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"><%= _("Cancel") %></button> <%= link_to(_("Unlock"), unlock_foreman_tasks_task_path(@task), method: :post, class: 'btn btn-warning modal-submit disabled') %> </div> </div> </div> </div> <div class="modal fade" id="force_unlock_modal" tabindex="-1" role="dialog" aria-labelledby="Deploy" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h2 class="modal-title" id="deploy_modal_label"> <span class="glyphicon glyphicon-exclamation-sign"></span> <%= _("Force Unlock") %> </h2> </div> <div class="modal-body"> <%= _("Resources will be unlocked and will not prevent other tasks from being run. As the task might be still running, it should be avoided to use this unless you are really sure the task got stuck") %> <div> <input class="disable-unlock" type="checkbox"/> <%= _("I understand that this may cause harm and have working database backups of all backend services.") %> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"><%= _("Cancel") %></button> <%= link_to(_("Force Unlock"), force_unlock_foreman_tasks_task_path(@task), method: :post, class: 'btn btn-danger modal-submit disabled') %> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div> <span class="param-name list-group-item-heading"><%= _("Name") %>:</span> <% task_label = format_task_input(@task) %> <span class="param-value" data-original-title="<%= task_label %>" rel="twipsy"> <%= truncate(task_label, :length => 50) %></span> </div> <div> <span class="param-name list-group-item-heading"><%= _("Result") %>:</span> <span class="param-value"> <% 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 %> </span> </div> <div> <span class="param-name list-group-item-heading"><%= _("Triggered by") %>:</span> <span class="param-value"> <% 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 %> </span> </div> <div> <span class="param-name list-group-item-heading"><%= _("Execution type") %>:</span> <span class="param-value"><%= _(@task.execution_type) %></span> </div> </div> <div class="col-md-6"> <div> <span class="param-name list-group-item-heading"><%= _("Start at") %>:</span> <span class="param-value"><%= @task.start_at.nil? ? '-' : time_in_words_span(@task.start_at) %></span> </div> <div> <span class="param-name list-group-item-heading"><%= _("Started at") %>:</span> <span class="param-value"><%= time_in_words_span @task.started_at.try(:in_time_zone) %></span> </div> <div> <span class="param-name list-group-item-heading"><%= _("Ended at") %>:</span> <span class="param-value"><%= time_in_words_span @task.ended_at.try(:in_time_zone) %></span> </div> <div> <span class="param-name list-group-item-heading"><%= _("Start before") %>:</span> <span class="param-value"><%= @task.start_before.nil? ? '-' : time_in_words_span(@task.start_before) %></span> </div> </div> </div> <br /> <div class="row"> <div class="col-xs-12"> <% 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 %> <div class="progress-description <%= 'active' if @task.state == 'running' %>"> <span class="list-group-item-heading">State:</span> <%= @task.state %> </div> <div class="progress progress-striped progress-label-top-right"> <div class="progress-bar <%= progress_class %>" role="progressbar" aria-valuenow="<%= progress %>" aria-valuemin="0" aria-valuemax="100" style="width: <%= progress %>%;"> <span><%= progress.round %>% Complete</span> </div> </div> </div> </div> <% unless @task.humanized[:output].blank? %> <div> <span class="param-name list-group-item-heading"><%= _("Output") %>:</span> <span class="param-value"> <pre><%= @task.humanized[:output] %></pre> </span> </div> <% end %> <% unless @task.humanized[:errors].blank? %> <div> <span class="param-name"><%= _("Errors") %>:</span> <span class="param-value"> <pre><%=Array(@task.humanized[:errors]).join("\n") %></pre> </span> </div> <% end %>