|
<div class='container agent-show'>
<div class='row'>
<div class='span12'>
<div class="tabbable tabs-left">
<ul class="nav nav-tabs" id="show-tabs">
<% if agent_show_view(@agent).present? %>
<li class='active'><a href="#summary" data-toggle="tab"><i class='icon-picture'></i> Summary</a></li>
<li><a href="#details" data-toggle="tab"><i class='icon-indent-left'></i> Details</a></li>
<% else %>
<li class='disabled'><a><i class='icon-picture'></i> Summary</a></li>
<li class='active'><a href="#details" data-toggle="tab"><i class='icon-indent-left'></i> Details</a></li>
<% end %>
<li><a href="#logs" data-toggle="tab" data-agent-id="<%= @agent.id %>" class='<%= @agent.recent_error_logs? ? 'recent-errors' : '' %>'><i class='icon-list-alt'></i> Logs</a></li>
<% if @agent.can_create_events? && @agent.events.count > 0 %>
<li><%= link_to '<i class="icon-random"></i> Events'.html_safe, events_path(:agent => @agent.to_param) %></li>
<% end %>
<li><%= link_to '<i class="icon-chevron-left"></i> Back'.html_safe, agents_path %></li>
<li><%= link_to '<i class="icon-pencil"></i> Edit'.html_safe, edit_agent_path(@agent) %></li>
<% if @agent.can_be_scheduled? || @agent.events.count > 0 %>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Actions <b class="caret"></b></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<% if @agent.can_be_scheduled? %>
<li>
<%= link_to '<i class="icon-refresh"></i> Run'.html_safe, run_agent_path(@agent, :return => "show"), method: :post, :tabindex => "-1" %>
</li>
<% end %>
<% if @agent.can_create_events? && @agent.events.count > 0 %>
<li>
<%= link_to '<i class="icon-trash"></i> Delete all events'.html_safe, remove_events_agent_path(@agent), method: :delete, data: {confirm: 'Are you sure you want to delete ALL events for this Agent?'}, :tabindex => "-1" %>
</li>
<% end %>
</ul>
</li>
<% end %>
</ul>
<div class="tab-content">
<div class="tab-pane <%= agent_show_view(@agent).present? ? "active" : "disabled" %>" id="summary">
<h2><%= @agent.name %> Summary</h2>
<% if agent_show_view(@agent).present? %>
<div class="show-view <%= agent_show_class(@agent) %>">
<%= render agent_show_view(@agent) %>
</div>
<% end %>
</div>
<div class="tab-pane" id="logs" data-agent-id="<%= @agent.id %>">
<h2>
<%= @agent.name %> Logs
<%= image_tag "spinner-arrows.gif", :class => "spinner" %>
<i class="icon-refresh action-icon refresh"></i>
<i class="icon-trash action-icon clear"></i>
</h2>
<div class='logs'>
Just a moment...
</div>
</div>
<div class="tab-pane <%= agent_show_view(@agent).present? ? "" : "active" %>" id="details">
<h2><%= @agent.name %> Details</h2>
<p>
<b>Type:</b>
<%= @agent.short_type.titleize %>
</p>
<% if @agent.can_be_scheduled? %>
<p>
<b>Schedule:</b>
<%= (@agent.schedule || "n/a").humanize.titleize %>
</p>
<p>
<b>Last checked:</b>
<%= @agent.last_check_at ? time_ago_in_words(@agent.last_check_at) + " ago" : "never" %>
</p>
<% end %>
<% if @agent.can_create_events? %>
<p>
<b>Keep events:</b>
<%= (Agent::EVENT_RETENTION_SCHEDULES.detect {|s| s.last == @agent.keep_events_for } || [@agent.keep_events_for]).first %>
</p>
<p>
<b>Last event created:</b>
<%= @agent.last_event_at ? time_ago_in_words(@agent.last_event_at) + " ago" : "never" %>
</p>
<% end %>
<% if @agent.can_receive_events? %>
<p>
<b>Last received event:</b>
<%= @agent.last_receive_at ? time_ago_in_words(@agent.last_receive_at) + " ago" : "never" %>
</p>
<% end %>
<% if @agent.can_create_events? %>
<p>
<b>Events created:</b>
<%= link_to @agent.events.count, events_path(:agent => @agent.to_param) %>
</p>
<% end %>
<% if @agent.can_receive_events? %>
<p>
<b>Event sources:</b>
<% if @agent.sources.length %>
<%= @agent.sources.map { |source_agent| link_to(source_agent.name, agent_path(source_agent)) }.to_sentence.html_safe %>
<% else %>
None
<% end %>
</p>
<% end %>
<% if @agent.can_create_events? %>
<p>
<b>Event receivers:</b>
<% if @agent.receivers.length %>
<%= @agent.receivers.map { |receiver_agent| link_to(receiver_agent.name, agent_path(receiver_agent)) }.to_sentence.html_safe %>
<% else %>
None
<% end %>
</p>
<% end %>
<p>
<b>Working:</b>
<%= working @agent %>
</p>
<p>
<b>Options:</b>
<pre><%= Utils.pretty_jsonify @agent.options || {} %></pre>
</p>
<p>
<b>Memory:</b>
<pre><%= Utils.pretty_jsonify @agent.memory || {} %></pre>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
|