show.html.erb 6.6 KB

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