<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
    <link href="https://fonts.googleapis.com/css2?family=Material+Icons" rel="stylesheet">
    <script src="https://code.jquery.com/jquery-3.6.0.slim.min.js" integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.19.1/dist/bootstrap-table.min.css">
<script src="https://unpkg.com/bootstrap-table@1.19.1/dist/bootstrap-table.min.js"></script>
    <title>MySQL Tuner {{ MySQLTuner.version }} - {{ MySQLTuner.datetime | default(' ??? ') }}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <h1>MySQL Tuner {{ MySQLTuner.version }} - {{ MySQLTuner.datetime | default(' ??? ') }}</h1>

<div class="d-flex align-items-start">
  <div class="nav flex-column nav-pills me-3 justify-content-rigth" id="v-pills-tab" role="tablist" aria-orientation="vertical">
    {% set sections = { "Recommendations": "bi bi-list-check", "Variables": "bi bi-list-check", "Status": "bi bi-list-check", "Calculations": "bi bi-list-check" } %}
    {% for etab in sections %}
      <button class="nav-link{% if loop.index == 1 %} active{% endif %}" id="v-pills-{{ etab }}-tab" data-bs-toggle="pill" data-bs-target="#v-pills-{{ etab }}" type="button" role="tab" aria-controls="v-pills-{{ etab }}" aria-selected="true"><i class="{{ sections[etab] }}"></i>{{ etab }}</button>
    {% endfor %}
  </div>
  <div class="tab-content" id="v-pills-tabContent">
    <div class="tab-pane fade show active" id="v-pills-Recommendations" role="tabpanel" aria-labelledby="v-pills-Recommendations-tab">
      <h3><i class="bi bi-list-check"></i>Recommendations</h3>
      <script>
        function recFunction() {
          var input, filter, table, tr, td, i, txtValue;
          input = document.getElementById("recInput");
          filter = input.value.toUpperCase();
          table = document.getElementById("recTable");
          tr = table.getElementsByTagName("tr");
          for (i = 0; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[1];
            if (td) {
              txtValue = td.textContent || td.innerText;
              if (txtValue.toUpperCase().indexOf(filter) > -1) {
                tr[i].style.display = "";
              } else {
                tr[i].style.display = "none";
              }
            }
          }
        }
      </script>
      <table class="table" id="recTable">
        <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">Recommandations <input type="text" id="recInput" onkeyup="recFunction()" placeholder="Search for names.." title="Type in a name"\></th>
          </tr>
        </thead>
        <tbody class="results">{% for result in Recommendations %}
          <tr>
              <td> {{ loop.index }}</td>
              <td> {{ result }}</td>
          </tr>{% endfor %}
        </tbody>
      </table>  
    </div>
    
    <div class="tab-pane fade" id="v-pills-Variables" role="tabpanel" aria-labelledby="v-pills-Variables-tab">
      <h3><i class="bi bi-list-check"></i>System variables</h3>
      <ul>
        <li><a href="https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html" target="_blank">MySQL 5.7 system variables</a></li>
        <li><a href="https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html" target="_blank">MySQL 8.0 system variables</a></li>
        <li><a href="https://mariadb.com/kb/en/server-system-variables" target="_blank">MariaDB system variables</a></li>
      </ul>
      <script>
        function sysFunction() {
          var input, filter, table, tr, td, i, txtValue;
          input = document.getElementById("sysInput");
          filter = input.value.toUpperCase();
          table = document.getElementById("sysTable");
          tr = table.getElementsByTagName("tr");
          for (i = 0; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[1];
            if (td) {
              txtValue = td.textContent || td.innerText;
              if (txtValue.toUpperCase().indexOf(filter) > -1) {
                tr[i].style.display = "";
              } else {
                tr[i].style.display = "none";
              }
            }
          }
        }
      </script>
      <table class="table" id="sysTable">
        <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">Variable <input type="text" id="sysInput" onkeyup="sysFunction()" placeholder="Search for names.." title="Type in a name"\></th>
            <th scope="col">Value</th>
          </tr>
        </thead>
        <tbody>{% for vari in Variables %}
          <tr>
              <td> {{ loop.index }}</td>
              <td> {{ vari }}</td>
              <td>
                <ul>
                {% if Variables[vari] is string %}
                  {% for v in Variables[vari].split(',') %}
                    <li>{% if v == '' %}NOT DEFINED{% else %}{{ v }}{% endif %}</li>
                  {% endfor %}
                {% else %}
                  <li>{{ Variables[vari] }}</li>
                {% endif %}
                </ul>
              </td>
          </tr>{% endfor %}
        </tbody>
      </table>
    </div>
    <div class="tab-pane fade" id="v-pills-Status" role="tabpanel" aria-labelledby="v-pills-Status-tab">
      <h3><i class="bi bi-list-check"></i>Status Variables</h3>
      <ul>
        <li><a href="https://dev.mysql.com/doc/refman/5.7/en/server-status-variables.html" target="_blank">MySQL 5.7 Server status</a></li>
        <li><a href="https://dev.mysql.com/doc/refman/8.0/en/server-status-variables.html" target="_blank">MySQL 8.0 Server status</a></li>
        <li><a href="https://mariadb.com/kb/en/server-status-variables/" target="_blank">MariaDB Server status</a></li>
      </ul>
      <script>
        function statFunction() {
          var input, filter, table, tr, td, i, txtValue;
          input = document.getElementById("statInput");
          filter = input.value.toUpperCase();
          table = document.getElementById("statTable");
          tr = table.getElementsByTagName("tr");
          for (i = 0; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[1];
            if (td) {
              txtValue = td.textContent || td.innerText;
              if (txtValue.toUpperCase().indexOf(filter) > -1) {
                tr[i].style.display = "";
              } else {
                tr[i].style.display = "none";
              }
            }
          }
        }
      </script>
      <table class="table" id="statTable">
        <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">Variable de status <input type="text" id="statInput" onkeyup="statFunction()" placeholder="Search for names.." title="Type in a name"\></th>
            <th scope="col">Value</th>
          </tr>
        </thead>
        <tbody>{% for vari in Status %}
          <tr>
              <td> {{ loop.index }}</td>
              <td> {{ vari }}</td>
              <td>
                <ul>
                {% if Status[vari] is string %}
                  {% for v in Status[vari].split(',') %}
                    <li>{% if v == '' %}NOT DEFINED{% else %}{{ v }}{% endif %}</li>
                  {% endfor %}
                {% else %}
                  <li>{{ Status[vari] }}</li>
                {% endif %}
                </ul>
              </td>

          </tr>{% endfor %}
        </tbody>
      </table>
    </div>
    <div class="tab-pane fade" id="v-pills-Calculations" role="tabpanel" aria-labelledby="v-pills-Calculations-tab">
      <h3><i class="bi bi-list-check"></i>Calculated variables</h3>
      <script>
        function calcFunction() {
          var input, filter, table, tr, td, i, txtValue;
          input = document.getElementById("calcInput");
          filter = input.value.toUpperCase();
          table = document.getElementById("calcTable");
          tr = table.getElementsByTagName("tr");
          for (i = 0; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[1];
            if (td) {
              txtValue = td.textContent || td.innerText;
              if (txtValue.toUpperCase().indexOf(filter) > -1) {
                tr[i].style.display = "";
              } else {
                tr[i].style.display = "none";
              }
            }
          }
        }
      </script>
      <table class="table" id="calcTable">
        <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">Calculated variables <input type="text" id="calcInput" onkeyup="calcFunction()" placeholder="Search for names.." title="Type in a name"\></th>
            <th scope="col">Value</th>
          </tr>
        </thead>
        <tbody>{% for vari in Calculations %}
          <tr>
              <td> {{ loop.index }}</td>
              <td> {{ vari }}</td>
              <td> {{ Calculations[vari] }}</td>
          </tr>{% endfor %}
        </tbody>
      </table>
    </div>
  </div>
</div>
    
  

  </body>
</html>