{% extends 'base_templates/flask_wide_base.html' %}
{% block content %}
{%- from "base_templates/form_macros.html" import render_addon_field, render_submit_field, myrender_hidden_field with context %}
<ul class="nav nav-pills danavpillssmaller">
  <li class="nav-item dropdown">
    <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" title="{{ word('Open another log file')}}">
      <span class="fas fa-file" aria-hidden="true"></span>&nbsp;&nbsp;{{ current_file }}
    </a>
    <div class="dropdown-menu daheightlim">
      {% for file in files %}{% if file == current_file %}
      <a class="dropdown-item active" href="#"><span class="fas fa-file fa-fw" aria-hidden="true"></span> {{ file }}
      </a>
      {% else %}
      <a class="dropdown-item" href="?file={{ file }}"><span class="fas fa-file fa-fw" aria-hidden="true"></span> {{ file }}
      </a>
      {% endif %}{% endfor %}
    </div>
  </li>
  <li class="nav-item">
    <a class="nav-link" title="{{ word('Download this log file') }}" href="{{ url_for('logfile', filename=current_file) }}"><span class="fas fa-download" aria-hidden="true"></span>&nbsp;&nbsp;{{ word('Download this file') }}</a>
  </li>
  {%- if show_download_all %}
  <li class="nav-item">
    <a class="nav-link" title="{{ word('Download all files') + ' ' + word('(%s uncompressed)') % (total_bytes, ) }}" href="{{ url_for('logs', zip=1) }}"><span class="fas fa-file-archive" aria-hidden="true"></span>&nbsp;&nbsp;{{ word('Download all files') }}</a>
  </li>
  {%- endif %}
</ul>
<form action="{{ url_for('logs') }}" method="POST" role="form" id="form">
  <div class="d-flex">
    <div class="my-1 align-self-start">
      <input type="text" class="form-control" name="filter_string" id="filter_string" value="{{ default_filter_string }}" placeholder="{{ word('Filter for') }}">
    </div>
    <div class="my-1 ms-1 align-self-start">
      <button type="submit" name="{{ form.submit.id }}" class="btn {{ config['BUTTON_STYLE'] }}primary" value="{{ form.submit.label.text }}">{{ form.submit.label.text }}</button>
    </div>
    <div class="my-1 ms-1 align-self-start">
      <button type="submit" name="{{ form.clear.id }}" class="btn {{ config['BUTTON_STYLE'] }}secondary" value="{{ form.clear.label.text }}">{{ form.clear.label.text }}</button>
    </div>
    <div class="ms-auto my-1 h3">
      {%- if default_filter_string == '' %}
      <a title="{{ word('Refresh') }}" href="{{ url_for('logs', file=current_file) }}"><i class="fas fa-sync-alt"></i></a>
      {%- else %}
      <a title="{{ word('Refresh') }}" href="{{ url_for('logs', file=current_file, q=default_filter_string) }}"><i class="fas fa-sync-alt"></i></a>
      {%- endif %}
    </div>
  </div>
  {{ form.hidden_tag() }}
  {{ myrender_hidden_field(form.file_name, value=current_file) }}
</form>
<div>
  <pre class="dawrappre davspace">{{ content }}</pre>
</div>
<div>
  <p>{{ word("Only the last 30 lines are shown.  Download the file to see the previous lines.") }}</p>
</div>
{%- endblock %}
