<% content_for :head do %>
  <%= javascript_include_tag "diagram" %>
<% end %>

<div class='container'>
  <div class='row'>
    <div class='col-md-12'>
      <div class="page-header">
        <h2>Agent Event Flow</h2>
      </div>
      <div class="btn-group">
        <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, (@scenario ? scenario_path(@scenario) : agents_path), class: "btn btn-default" %>
        <% if (num_disabled = @disabled_agents.count).nonzero? -%>
          <% if params[:exclude_disabled] %>
            <%= link_to @scenario ? scenario_diagram_path(@scenario) : diagram_path, class: 'btn btn-default' do %><%= icon_tag('glyphicon-eye-open') %> Show <%= pluralize(num_disabled, 'disabled Agent') %><% end %>
          <% else %>
            <%= link_to @scenario ? scenario_diagram_path(@scenario, exclude_disabled: true) : diagram_path(exclude_disabled: true), class: 'btn btn-default' do %><%= icon_tag('glyphicon-eye-close') %> Hide <%= pluralize(num_disabled, 'disabled Agent') %><% end %>
          <% end %>
        <% end %>
      </div>

      <div class='digraph'>
        <%= render_agents_diagram(@agents, layout: params[:layout]) %>
      </div>
    </div>
  </div>
</div>
