{% extends 'server/status/base.twig' %}
{% set active = 'status' %}
{% block content %}

{% if is_data_loaded %}
  <div class="row"><h3>{{ 'Network traffic since startup: %s'|trans|format(network_traffic) }}</h3></div>
  <div class="row"><p>{{ 'This MySQL server has been running for %1$s. It started up on %2$s.'|trans|format(uptime, start_time) }}</p></div>

<div class="row justify-content-between">
  <table class="table table-light table-striped table-hover col-12 col-md-5">
    <thead class="thead-light">
      <tr>
        <th scope="col">
          {% trans 'Traffic' %}
          {{ show_hint('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.'|trans) }}
        </th>
        <th scope="col">#</th>
        <th scope="col">{% trans 'ø per hour' %}</th>
      </tr>
    </thead>

    <tbody>
      {% for each_traffic in traffic %}
        <tr>
          <th scope="row">{{ each_traffic.name }}</th>
          <td class="text-monospace text-right">{{ each_traffic.number }}</td>
          <td class="text-monospace text-right">{{ each_traffic.per_hour }}</td>
        </tr>
      {% endfor %}
    </tbody>
  </table>

  <table class="table table-light table-striped table-hover col-12 col-md-6">
    <thead class="thead-light">
      <tr>
        <th scope="col">{% trans 'Connections' %}</th>
        <th scope="col">#</th>
        <th scope="col">{% trans 'ø per hour' %}</th>
        <th scope="col">%</th>
      </tr>
    </thead>

    <tbody>
      {% for connection in connections %}
        <tr>
          <th>{{ connection.name }}</th>
          <td class="text-monospace text-right">{{ connection.number }}</td>
          <td class="text-monospace text-right">{{ connection.per_hour }}</td>
          <td class="text-monospace text-right">{{ connection.percentage }}</td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
</div>

  {% if is_master or is_slave %}
    <p class="alert alert-primary clearfloat" role="alert">
      {% if is_master and is_slave %}
        {% trans 'This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.' %}
      {% elseif is_master %}
        {% trans 'This MySQL server works as <b>master</b> in <b>replication</b> process.' %}
      {% elseif is_slave %}
        {% trans 'This MySQL server works as <b>slave</b> in <b>replication</b> process.' %}
      {% endif %}
    </p>

    <hr class="clearfloat">

    <h3>{% trans 'Replication status' %}</h3>

    {{ replication|raw }}
  {% endif %}

{% else %}
  {{ 'Not enough privilege to view server status.'|trans|error }}
{% endif %}

{% endblock %}
