index.html.erb 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <div class='container'>
  2. <div class='row'>
  3. <div class='col-md-12'>
  4. <div class="page-header">
  5. <h2>
  6. Background Jobs
  7. </h2>
  8. </div>
  9. <div class='table-responsive'>
  10. <table class='table table-striped events'>
  11. <tr>
  12. <th>Status</th>
  13. <th>Created</th>
  14. <th>Next Run</th>
  15. <th>Attempts</th>
  16. <th>Last Error</th>
  17. <th></th>
  18. </tr>
  19. <% @jobs.each do |job| %>
  20. <tr>
  21. <td><%= status(job) %></td>
  22. <td title='<%= job.created_at %>'><%= time_ago_in_words job.created_at %> ago</td>
  23. <td title='<%= job.run_at %>'>
  24. <% if !job.failed_at %>
  25. <%= relative_distance_of_time_in_words job.run_at %>
  26. <% end %>
  27. </td>
  28. <td><%= job.attempts %></td>
  29. <td>
  30. <a data-toggle="modal" data-target="#error<%= job.id %>"><%= truncate job.last_error, :length => 90, :omission => "", :separator => "\n" %></a>
  31. <div class="modal fade" id="error<%= job.id %>" tabindex="-1" role="dialog" aria-labelledby="#<%= "error#{job.id}" %>" aria-hidden="true">
  32. <div class="modal-dialog big-modal-dialog">
  33. <div class="modal-content">
  34. <div class="modal-header">
  35. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  36. <h4 class="modal-title" id="myModalLabel">Error Backtrace</h4>
  37. </div>
  38. <div class="modal-body">
  39. <pre>
  40. <%= raw html_escape(job.last_error).split("\n").join('<br/>') %>
  41. </pre>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </td>
  47. <td>
  48. <% if (!job.locked_at && !job.locked_by) || job.failed_at.present? %>
  49. <div class="btn-group btn-group-xs" style="float: right">
  50. <% if (job.run_at > Time.now) || job.failed_at.present? %>
  51. <%= link_to 'Run now', run_job_path(job), class: "btn btn-default", method: :put %>
  52. <% end %>
  53. <%= link_to 'Delete', job_path(job), class: "btn btn-danger", method: :delete, data: { confirm: 'Really delete this job?' } %>
  54. </div>
  55. <% end %>
  56. </td>
  57. </tr>
  58. <% end %>
  59. </table>
  60. </div>
  61. <%= paginate @jobs, :theme => 'twitter-bootstrap-3' %>
  62. <br />
  63. <div class="btn-group">
  64. <%= link_to destroy_failed_jobs_path, class: "btn btn-default", method: :delete do %>
  65. <span class="glyphicon glyphicon-trash"></span> Remove failed jobs
  66. <% end %>
  67. </div>
  68. </div>
  69. </div>
  70. </div>