<% job_states = Que.job_states %> <% jobs.each do |job| %> <% job_state = job_states.find { |x| x[:id] == job.id } %>
<% if job_state %>
Running now
PID: <%= job_state[:ruby_pid] %>
<% elsif job.finished_at %>
<% if job['error_count'] == 0 %> Finished without any errors <% else %> Finished after <%= pluralize(job['error_count'], 'error') %>. <% end %> <% if job.args.last == 'build' %> <%# TODO: Generalise this somehow %>
<% @mini_environment.backend_data.each do |(key, value)| %>
<%= key %>
<%= value %>
<% end %>
<% end %>
<% else %>
<%= job.last_error_message %>
<%= job.last_error_backtrace %>
<%= form_with(url: retry_now_que_job_path(job.id)) do %> <%= submit_tag( 'Retry now', class: 'btn btn-primary btn-lg btn-block' ) %> <% end %> <%= form_with(url: cancel_que_job_path(job.id)) do %> <%= submit_tag( 'Cancel', class: 'btn btn-warning btn-lg btn-block', style: 'margin-top: 5px;' ) %> <% end %>
<% end %>
<% end %>