summaryrefslogtreecommitdiff
path: root/app/views/agents/events/index.html.erb
blob: 9518cde624af22bc981d4c9327af129d63af8c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<div class="row">
  <div class="small-12 columns">
    <p id="notice"><%= notice %></p>

    <h1>Listing Events for agent <%= @agent.hostname %></h1>
    <%= link_to 'New Event', new_agent_event_path(@agent), class: 'button' %>
    <%= link_to "refresh", params, id: 'refresh_page_link', style: 'display:none;' %>

    <table>
      <thead>
        <tr>
          <th>Name</th>
          <th>Data</th>
          <th width="210">Created At</th>
        </tr>
      </thead>
      <tbody>
        <% @events.each do |event| %>
          <tr>
            <td><%= event.type %></td>
            <td>
              <ul>
              <% event.data.each do |key, value| %>
                <% if key == "fingerprint" %>
                  <li><%= key %>: <%= link_to value, disposition_path(id: value) %></li>
                <% else %>
                <li><%= key %>: <%= truncate(value) %></li>
                <% end %>
              <% end %>
              </ul>
            </td>
            <td><%= event.created_at %></td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>

  <div class="small-12 columns">
    <h2>Events per minute</h2>
    <%= line_chart @agent.events.group_by_minute(:created_at).count %>
  </div>

  <div class="small-12 columns">
    <h2>Events by category</h2>
    <%= pie_chart @agent.events.group(:type).count %>
  </div>
</div>

<script type="text/javascript" charset="utf-8">
$(function(){
  //new window.EventsFeed().start(1000, '#refresh_page_link');
});
</script>