{% extends 'layouts/base.html' %}

{% set active_menu = 'synchronization' %}
{% set page_title = 'Synchronization Issue Overview' %}

{% block breadcrumbs %}
<nav class="pt-3" aria-label="breadcrumb">
    <ol class="breadcrumb">
        <li>
            <a href="{{ url_for('overview.index') }}">Home</a>
        </li>
        <li class="is-active">
            <a href="#" aria-current="page">Sync</a>
        </li>
    </ol>
</nav>
{% endblock %}

{% block body_header %}
<h1 class="title mb-4">Package Synchronization Target Suites</h1>
{% endblock %}

{% block body %}
<div class="column is-10">

  <h4 class="subtitle is-4">Automatic Synchronization Tasks</h4>
  <div class="columns is-multiline is-mobile">
    {% for sconf in auto_syncs %}
      <div class="column is-half">

      <div class="card">
      <header class="card-header">
        <p class="card-header-title">
          <i class="fas fa-compress-arrows-alt"></i>&nbsp;{{sconf.destination_suite.name}}&nbsp;&nbsp;<span class="has-text-weight-light">from&nbsp;<i class="fas fa-expand-arrows-alt"></i>&nbsp;{{sconf.source.os_name}} {{sconf.source.suite_name}}</span>
        </p>
        <div class="p-3">
         <span class="tag is-rounded is-light"><i class="fa-solid fa-box-archive"></i>&nbsp;{{sconf.repo.name}}</span>
        </div>
      </header>

      <div class="card-content py-2">
          <div class="content">
              <p class="mb-1"></p>
              {% if sconf.sync_enabled %}<font class="fas fa-check" aria-hidden="true" color="green"></font>{% else %}<font class="fas fa-times" aria-hidden="true" color="orange"></font>{% endif %} Synchronization allowed<br/>
              {% if sconf.sync_binaries %}<font class="fas fa-check" aria-hidden="true" color="green"></font>{% else %}<font class="fas fa-times" aria-hidden="true" color="orange"></font>{% endif %} Pull binaries from origin<br/>
              {% if sconf.auto_cruft_remove %}<font class="fas fa-check" aria-hidden="true" color="green"></font>{% else %}<font class="fas fa-times" aria-hidden="true" color="orange"></font>{% endif %} Attempt auto cruft removal
          </div>
      </div>
      <footer class="card-footer">
          <a href="{{ url_for('synchronization.issues_table', config_id=sconf.id) }}" class="card-footer-item">Suite Sync Issue Table</a>
      </footer>
      </div>

      </div>
    {% endfor %}
  </div>

  <h4 class="subtitle is-4">Other Registered Synchronization Tasks</h4>
  <div class="columns is-multiline is-mobile">
    {% for sconf in manual_syncs %}
      <div class="column is-half">

      <div class="card">
      <header class="card-header">
        <p class="card-header-title">
          <i class="fas fa-compress-arrows-alt"></i>&nbsp;{{sconf.destination_suite.name}}&nbsp;&nbsp;<span class="has-text-weight-light">from&nbsp;<i class="fas fa-expand-arrows-alt"></i>&nbsp;{{sconf.source.os_name}} {{sconf.source.suite_name}}</span>
        </p>
        <div class="p-3">
         <span class="tag is-rounded is-light"><i class="fa-solid fa-box-archive"></i>&nbsp;{{sconf.repo.name}}</span>
        </div>
      </header>

      <div class="card-content py-2">
          <div class="content">
              <p class="mb-1"></p>
              {% if sconf.sync_enabled %}<font class="fas fa-check" aria-hidden="true" color="green"></font>{% else %}<font class="fas fa-times" aria-hidden="true" color="orange"></font>{% endif %} Synchronization allowed<br/>
              {% if sconf.sync_binaries %}<font class="fas fa-check" aria-hidden="true" color="green"></font>{% else %}<font class="fas fa-times" aria-hidden="true" color="orange"></font>{% endif %} Pull binaries from origin<br/>
              {% if sconf.auto_cruft_remove %}<font class="fas fa-check" aria-hidden="true" color="green"></font>{% else %}<font class="fas fa-times" aria-hidden="true" color="orange"></font>{% endif %} Attempt auto cruft removal
          </div>
      </div>
      </div>

      </div>
    {% endfor %}
  </div>

</div>
{% endblock %}
