{% load i18n %}
{% load sizeformat %}
<table>
  <tr>
    <th>{% trans "Service"%}</th>
    <th>{% trans "System Stats"%}</th>
    <th>{% trans "Enabled"%}</th>
    <th>{% trans "Up"%}</th>
    <th>{% trans "Actions"%}</th>
  </tr>

  {% for service in services %}
    <tr class='{{service.up|yesno:"good,bad"}} {{service.disabled|yesno:"medium,"}} {% cycle 'odd' 'even' %}'>
      <td>
        {{service.type}} <br/>
        ( {{service.host}} )
      </td>
      {% if service.type == 'nova-compute' %}
        <td>
          <ul>
            <li>
              {% trans "Hypervisor"%}: {{service.stats.hypervisor_type}}( {{service.stats.cpu_info.features|join:', '}})
            </li>
            <li>
              {% trans "Allocable Cores"%}:
              {{service.stats.max_vcpus}}
              ({{service.stats.vcpus_used}} Used, {{service.stats.vcpus}} Physical/Virtual)
            </li>
            <li>
              {% trans "Allocable Storage"%}:
              {{service.stats.max_gigabytes|diskgbformat}}
              ({{service.stats.local_gb_used|diskgbformat}} Used, {{service.stats.local_gb|diskgbformat}} Physical)
            </li>
            <li>
              {% trans "System Ram"%}:
              {{service.stats.memory_mb|mbformat}}
              ({{service.stats.memory_mb_used|mbformat}} Used)
            </li>
          </ul>
        </td>
      {% else %}
        <td> - </td>
      {% endif %}
      <td>{{service.disabled|yesno:"Disabled,Enabled"}}</td>
      <td>{{service.up}}</td>
      <td id="actions">
        <ul>
          <li class="form">{% include "syspanel/services/_toggle.html" with form=service_toggle_enabled_form %}</li>
        </ul>
      </td>
    </tr>
  {% endfor %}
  {% for service in other_services %}
    <tr class='{{service.up|yesno:"good,bad"}} {{service.disabled|yesno:"medium,"}} {% cycle 'odd' 'even' %}'>
      <td>
        {{service.type}} <br/>
        ( {{service.host}} )
      </td>
      <td> - </td>
      <td>{{service.disabled|yesno:"Disabled,Enabled"}}</td>
      <td>{{service.up}}</td>
      <td></td>
    </tr>
  {% endfor %}
</table>
