1
0

show.html.erb 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 (agents = @agent.controllers).length > 0 %>
  74. <p>
  75. <b>Controllers:</b>
  76. <%= agents.map { |agent| link_to(agent.name, agent_path(agent)) }.to_sentence.html_safe %>
  77. </p>
  78. <% end %>
  79. <% if @agent.can_create_events? %>
  80. <p>
  81. <b>Keep events:</b>
  82. <%= (Agent::EVENT_RETENTION_SCHEDULES.detect {|s| s.last == @agent.keep_events_for } || [@agent.keep_events_for]).first %>
  83. </p>
  84. <p>
  85. <b>Last event created:</b>
  86. <%= @agent.last_event_at ? time_ago_in_words(@agent.last_event_at) + " ago" : "never" %>
  87. </p>
  88. <% end %>
  89. <% if @agent.can_receive_events? %>
  90. <p>
  91. <b>Last received event:</b>
  92. <%= @agent.last_receive_at ? time_ago_in_words(@agent.last_receive_at) + " ago" : "never" %>
  93. </p>
  94. <% end %>
  95. <% if @agent.can_create_events? %>
  96. <p>
  97. <b>Events created:</b>
  98. <%= link_to @agent.events_count, agent_events_path(@agent) %>
  99. </p>
  100. <% end %>
  101. <% if @agent.try(:oauthable?) %>
  102. <p>
  103. <b>Service:</b>
  104. <%= service_label(@agent.service) %>
  105. </p>
  106. <% end %>
  107. <% if @agent.can_receive_events? %>
  108. <p>
  109. <b>Event sources:</b>
  110. <% if (agents = @agent.sources).length > 0 %>
  111. <%= agents.map { |agent| link_to(agent.name, agent_path(agent)) }.to_sentence.html_safe %>
  112. <% else %>
  113. None
  114. <% end %>
  115. </p>
  116. <p>
  117. <b>Propagate immediately:</b>
  118. <%= yes_no @agent.propagate_immediately %>
  119. </p>
  120. <% end %>
  121. <% if @agent.can_create_events? %>
  122. <p>
  123. <b>Event receivers:</b>
  124. <% if (agents = @agent.receivers).length > 0 %>
  125. <%= agents.map { |agent| link_to(agent.name, agent_path(agent)) }.to_sentence.html_safe %>
  126. <% else %>
  127. None
  128. <% end %>
  129. </p>
  130. <% end %>
  131. <% if @agent.can_control_other_agents? %>
  132. <p>
  133. <b>Control Targets:</b>
  134. <% if (agents = @agent.control_targets).length > 0 %>
  135. <%= agents.map { |agent| link_to(agent.name, agent_path(agent)) }.to_sentence.html_safe %>
  136. <% else %>
  137. None
  138. <% end %>
  139. </p>
  140. <% end %>
  141. <p>
  142. <b>Working:</b>
  143. <%= working @agent %>
  144. </p>
  145. <p>
  146. <b>Options:</b>
  147. <pre><%= Utils.pretty_jsonify @agent.options || {} %></pre>
  148. </p>
  149. <% if @agent.memory.present? %>
  150. <p id="memory" data-agent-id="<%= @agent.id %>">
  151. <b>Memory:</b>
  152. <i class="fa-solid fa-spinner fa-spin-pulse spinner"></i>
  153. <i class="fa-solid fa-trash action-icon clear"></i>
  154. <a id="toggle-memory" href="#">Show</a>
  155. <pre class="memory hidden"><%= Utils.pretty_jsonify @agent.memory || {} %></pre>
  156. </p>
  157. <% end %>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </div>