1
0

_table.html.erb 3.4 KB

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