<script type="text/javascript" src="<%= root_path %>javascripts/dashboard.js"></script>
<div class= "dashboard clearfix">
  <h3 >
    <%= x.t("Dashboard") %>
    <span class="beacon">
      <span class="ring"></span>
      <span class="dot"></span>
    </span>
  </h3>
  <div class="interval-slider">
    <span class="interval-slider-label"><%= x.t("PollingInterval") %>:</span>
    <span class="current-interval">2 sec</span>
    <br/>
    <input type="range" min="2000" max="20000" step="1000" value="2000"/>
  </div>
</div>

<div class="row chart">
  <div id="realtime" data-processed-label="<%= x.t("Processed") %>" data-failed-label="<%= x.t("Failed") %>"></div>
  <div id="realtime-legend"></div>
</div>

<div class="row chart">
  <h5>
    <span class="history-heading"><%= x.t("History") %></span>
    <a href="<%= root_path %>?days=7" class="history-graph <%= "active" if days == 7 %>"><%= x.t("OneWeek") %></a>
    <a href="<%= root_path %>/" class="history-graph <%= "active" if days == 30 %>"><%= x.t("OneMonth") %></a>
    <a href="<%= root_path %>?days=90" class="history-graph <%= "active" if days == 90 %>"><%= x.t("ThreeMonths") %></a>
    <a href="<%= root_path %>?days=180" class="history-graph <%= "active" if days == 180 %>"><%= x.t("SixMonths") %></a>
  </h5>

  <div id="history" data-processed-label="<%= x.t("Processed") %>" data-failed-label="<%= x.t("Failed") %>" data-processed="<%= x.h processed_history.to_json %>" data-failed="<%= x.h failed_history.to_json %>" data-update-url="<%= x.root_path %>stats"></div>
  <div id="history-legend"></div>
</div>

<br/>
<h5>Redis</h5>
<div class="redis-wrapper">
  <div class="stats-container">
    <% if redis_info.fetch("redis_version", nil) %>
      <div class="stat">
        <h3 class="redis_version"><%= redis_info.fetch("redis_version", nil) %></h3>
        <p><%= x.t("Version") %></p>
      </div>
    <% end %>

    <% if redis_info.fetch("uptime_in_days", nil) %>
      <div class="stat">
        <h3 class="uptime_in_days"><%= redis_info.fetch("uptime_in_days", nil) %></h3>
        <p><%= x.t("Uptime") %></p>
      </div>
    <% end %>

    <% if redis_info.fetch("connected_clients", nil) %>
      <div class="stat">
        <h3 class="connected_clients"><%= redis_info.fetch("connected_clients", nil) %></h3>
        <p><%= x.t("Connections") %></p>
      </div>
    <% end %>

    <%  if redis_info.fetch("used_memory_human", nil) %>
      <div class="stat">
        <h3 class="used_memory_human"><%= redis_info.fetch("used_memory_human", nil) %></h3>
        <p><%= x.t("MemoryUsage") %></p>
      </div>
    <% end %>

    <%  if redis_info.fetch("used_memory_peak_human", nil) %>
      <div class="stat">
        <h3 class="used_memory_peak_human"><%= redis_info.fetch("used_memory_peak_human", nil) %></h3>
        <p><%= x.t("PeakMemoryUsage") %></p>
      </div>
    <% end %>
  </div>
</div>
