Sha256: 7425ab4b3c4054e12d0e1c8c1dd275e693a6ea80cbe8b4c6862b032ea9845443

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

<div class="content">
  <h1>Connections</h1>

  <p><%= pluralize(@total_connections, "connection") %></p>

  <% if @total_connections > 0 %>
    <h3>By Database</h3>

    <% top_connections = Hash.new(0) %>
    <% @connection_sources.each do |source| %>
      <% top_connections[source["database"]] += source["total_connections"].to_i %>
    <% end %>
    <% top_connections = top_connections.sort_by { |k, v| [-v, k] } %>

    <div id="chart-1" class="chart" style="height: 260px; line-height: 260px; margin-bottom: 20px;">Loading...</div>
    <script>
      new Chartkick.PieChart("chart-1", <%= json_escape(top_connections.to_json).html_safe %>);
    </script>

    <h3>By User</h3>

    <% top_connections = Hash.new(0) %>
    <% @connection_sources.each do |source| %>
      <% top_connections[source["user"]] += source["total_connections"].to_i %>
    <% end %>
    <% top_connections = top_connections.sort_by { |k, v| [-v, k] } %>

    <div id="chart-2" class="chart" style="height: 260px; line-height: 260px; margin-bottom: 20px;">Loading...</div>
    <script>
      new Chartkick.PieChart("chart-2", <%= json_escape(top_connections.to_json).html_safe %>);
    </script>

    <%= render partial: "connections_table", locals: {connection_sources: @connection_sources} %>
  <% end %>
</div>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pghero-1.7.0 app/views/pg_hero/home/connections.html.erb
pghero-1.6.5 app/views/pg_hero/home/connections.html.erb
pghero-1.6.4 app/views/pg_hero/home/connections.html.erb