1
0

show.html.erb 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <% content_for :title, @agent.name -%>
  2. <div class='container agent-show'>
  3. <div class='row'>
  4. <div class='col-md-2'>
  5. <ul class="nav nav-pills nav-stacked" id="show-tabs">
  6. <li><%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, filtered_agent_return_link || agents_path %></li>
  7. <% if agent_show_view(@agent).present? %>
  8. <li class='active'><a href="#summary" data-toggle="tab"><span class='glyphicon glyphicon-picture'></span> Summary</a></li>
  9. <li><a href="#details" data-toggle="tab"><span class='glyphicon glyphicon-indent-left'></span> Details</a></li>
  10. <% else %>
  11. <li class='disabled'><a><span class='glyphicon glyphicon-picture'></span> Summary</a></li>
  12. <li class='active'><a href="#details" data-toggle="tab"><span class='glyphicon glyphicon-indent-left'></span> Details</a></li>
  13. <% end %>
  14. <li><a href="#logs" data-toggle="tab" data-agent-id="<%= @agent.id %>" class='<%= @agent.recent_error_logs? ? 'recent-errors' : '' %>'><span class='glyphicon glyphicon-list-alt'></span> Logs</a></li>
  15. <% if @agent.can_create_events? && @agent.events_count > 0 %>
  16. <li><%= link_to icon_tag('glyphicon-random') + ' Events'.html_safe, agent_events_path(@agent, return: request.fullpath) %></li>
  17. <% else %>
  18. <li class='disabled'><a><span class='glyphicon glyphicon-random'></span> Events</a></li>
  19. <% end %>
  20. <li class="dropdown">
  21. <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-th-list"></span> Actions <span class="caret"></span></a>
  22. <%= render 'agents/action_menu', :agent => @agent, :return_to => "show" %>
  23. </li>
  24. </ul>
  25. </div>
  26. <div class='col-md-10'>
  27. <div class="tab-content">
  28. <div class="tab-pane <%= agent_show_view(@agent).present? ? "active" : "disabled" %>" id="summary">
  29. <h2><%= @agent.name %> Summary</h2>
  30. <% if agent_show_view(@agent).present? %>
  31. <div class="show-view <%= agent_show_class(@agent) %>">
  32. <%= render agent_show_view(@agent) %>
  33. </div>
  34. <% end %>
  35. </div>
  36. <div class="tab-pane" id="logs" data-agent-id="<%= @agent.id %>">
  37. <div class='row'>
  38. <div class='col-md-12'>
  39. <h2>
  40. <%= @agent.name %> Logs
  41. <small>
  42. <%= image_tag "spinner-arrows.gif", :class => "spinner" %>
  43. <span class="glyphicon glyphicon-refresh action-icon refresh"></span>
  44. <span class="glyphicon glyphicon-trash action-icon clear"></span>
  45. </small>
  46. </h2>
  47. </div>
  48. </div>
  49. <div class='row'>
  50. <div class='col-md-12'>
  51. <div class='logs'>
  52. Just a moment...
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="tab-pane <%= agent_show_view(@agent).present? ? "" : "active" %>" id="details">
  58. <h2><%= @agent.name %> Details</h2>
  59. <p>
  60. <b>Type:</b>
  61. <%= @agent.short_type.titleize %>
  62. </p>
  63. <% if @agent.can_be_scheduled? %>
  64. <p>
  65. <b>Schedule:</b>
  66. <%= agent_schedule(@agent) %>
  67. </p>
  68. <p>
  69. <b>Last checked:</b>
  70. <%= @agent.last_check_at ? time_ago_in_words(@agent.last_check_at) + " ago" : "never" %>
  71. </p>
  72. <% end %>
  73. <% if @agent.can_create_events? %>
  74. <p>
  75. <b>Keep events:</b>
  76. <%= (Agent::EVENT_RETENTION_SCHEDULES.detect {|s| s.last == @agent.keep_events_for } || [@agent.keep_events_for]).first %>
  77. </p>
  78. <p>
  79. <b>Last event created:</b>
  80. <%= @agent.last_event_at ? time_ago_in_words(@agent.last_event_at) + " ago" : "never" %>
  81. </p>
  82. <% end %>
  83. <% if @agent.can_receive_events? %>
  84. <p>
  85. <b>Last received event:</b>
  86. <%= @agent.last_receive_at ? time_ago_in_words(@agent.last_receive_at) + " ago" : "never" %>
  87. </p>
  88. <% end %>
  89. <% if @agent.can_create_events? %>
  90. <p>
  91. <b>Events created:</b>
  92. <%= link_to @agent.events_count, agent_events_path(@agent) %>
  93. </p>
  94. <% end %>
  95. <% if @agent.try(:oauthable?) %>
  96. <p>
  97. <b>Service:</b>
  98. <%= service_label(@agent.service) %>
  99. </p>
  100. <% end %>
  101. <% if @agent.can_receive_events? %>
  102. <p>
  103. <b>Event sources:</b>
  104. <% if (agents = @agent.sources).length > 0 %>
  105. <%= agents.map { |agent| link_to(agent.name, agent_path(agent)) }.to_sentence.html_safe %>
  106. <% else %>
  107. None
  108. <% end %>
  109. </p>
  110. <p>
  111. <b>Propagate immediately:</b>
  112. <%= yes_no @agent.propagate_immediately %>
  113. </p>
  114. <% end %>
  115. <% if @agent.can_create_events? %>
  116. <p>
  117. <b>Event receivers:</b>
  118. <% if (agents = @agent.receivers).length > 0 %>
  119. <%= agents.map { |agent| link_to(agent.name, agent_path(agent)) }.to_sentence.html_safe %>
  120. <% else %>
  121. None
  122. <% end %>
  123. </p>
  124. <% end %>
  125. <% if @agent.can_control_other_agents? %>
  126. <p>
  127. <b>Control Targets:</b>
  128. <% if (agents = @agent.control_targets).length > 0 %>
  129. <%= agents.map { |agent| link_to(agent.name, agent_path(agent)) }.to_sentence.html_safe %>
  130. <% else %>
  131. None
  132. <% end %>
  133. </p>
  134. <% end %>
  135. <p>
  136. <b>Working:</b>
  137. <%= working @agent %>
  138. </p>
  139. <p>
  140. <b>Options:</b>
  141. <pre><%= Utils.pretty_jsonify @agent.options || {} %></pre>
  142. </p>
  143. <% if @agent.memory.present? %>
  144. <p id="memory" data-agent-id="<%= @agent.id %>">
  145. <b>Memory:</b>
  146. <i class="fa fa-spinner fa-pulse spinner"></i>
  147. <i class="fa fa-trash action-icon clear"></i>
  148. <a id="toggle-memory" href="#">Show</a>
  149. <pre class="memory hidden"><%= Utils.pretty_jsonify @agent.memory || {} %></pre>
  150. </p>
  151. <% end %>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </div>