1
0

_table.html.erb 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <div class='table-responsive'>
  2. <table class='table table-striped'>
  3. <tr>
  4. <th><%= sortable_column 'name', 'asc' %></th>
  5. <th>Schedule</th>
  6. <th><%= sortable_column 'last_check_at', name: 'Last Check' %></th>
  7. <th><%= sortable_column 'last_event_at', name: 'Last Event Out' %></th>
  8. <th><%= sortable_column 'last_receive_at', name: 'Last Event In' %></th>
  9. <th>Events Created</th>
  10. <th>Working?</th>
  11. <th></th>
  12. </tr>
  13. <% @agents.each do |agent| %>
  14. <tr>
  15. <td class='<%= "agent-unavailable" if agent.unavailable? %>'>
  16. <%= link_to agent.name, agent_path(agent) %>
  17. <br/>
  18. <span class='text-muted'><%= agent.short_type.titleize %></span>
  19. <% if agent.scenarios.present? %>
  20. <span>
  21. <%= scenario_links(agent) %>
  22. </span>
  23. <% end %>
  24. </td>
  25. <td class='<%= "agent-unavailable" if agent.unavailable? %>'>
  26. <% if agent.can_be_scheduled? %>
  27. <%= agent_schedule(agent, ',<br/>') %>
  28. <% else %>
  29. <span class='not-applicable'></span>
  30. <% end %>
  31. </td>
  32. <td class='<%= "agent-unavailable" if agent.unavailable? %>'>
  33. <% if agent.can_be_scheduled? %>
  34. <%= agent.last_check_at ? time_ago_in_words(agent.last_check_at) + " ago" : "never" %>
  35. <% else %>
  36. <span class='not-applicable'></span>
  37. <% end %>
  38. </td>
  39. <td class='<%= "agent-unavailable" if agent.unavailable? %>'>
  40. <% if agent.can_create_events? %>
  41. <%= agent.last_event_at ? time_ago_in_words(agent.last_event_at) + " ago" : "never" %>
  42. <% else %>
  43. <span class='not-applicable'></span>
  44. <% end %>
  45. </td>
  46. <td class='<%= "agent-unavailable" if agent.unavailable? %>'>
  47. <% if agent.can_receive_events? %>
  48. <%= agent.last_receive_at ? time_ago_in_words(agent.last_receive_at) + " ago" : "never" %>
  49. <% else %>
  50. <span class='not-applicable'></span>
  51. <% end %>
  52. </td>
  53. <td class='<%= "agent-unavailable" if agent.unavailable? %>'>
  54. <% if agent.can_create_events? %>
  55. <%= link_to(agent.events_count || 0, agent_events_path(agent)) %>
  56. <% else %>
  57. <span class='not-applicable'></span>
  58. <% end %>
  59. </td>
  60. <td><%= working(agent) %></td>
  61. <td>
  62. <div class="btn-group">
  63. <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
  64. <span class="glyphicon glyphicon-th-list"></span> Actions <span class="caret"></span>
  65. </button>
  66. <%= render 'agents/action_menu', :agent => agent, :returnTo => (defined?(returnTo) && returnTo) || "index" %>
  67. </div>
  68. </td>
  69. </tr>
  70. <% end %>
  71. </table>
  72. </div>
  73. <%= paginate @agents, :theme => 'twitter-bootstrap-3' %>