{% extends "base.html" %}

{% block styles %}
{{ super() }}
</style>
{% endblock %}

{% block page_content %}
  <div class="row">
  {% include "admin/admin_tasks.html" %}

  <div class="col-md-12">
  <div class="panel panel-info" id="deployments">
  <div class="panel-heading">Deployments</div>
  <div class="panel-body"><p>
  <div class="no-more-tables">
  <table class="table table-hover table-striped table-condensed cf">
   <thead>
    <tr>
     <th>Server</th>
     <th>VLAN</th>
     <th>Alias</th>
     <th>CPU</th>
     <th>Mem</th>
     <th>HDD</th>
     <th>Last Charged</th>
     <th>Days Left</th>
     <th>Owner</th>
    </tr>
    </thead>
    <tbody>
    {% for deploy in deployments %}
     {% if deploy.enabled == False %}
     <tr class="danger">
     {% else %}
     {% if deploy.warning == True %}
     <tr class="warning">
     {% else %}
     <tr>
     {% endif %}
     {% endif %}
     <td data-title="Server">{{ deploy.server.name }}</td>
     <td data-title="VLAN">{% for vlan in deploy.inv_pubvlans %}{{ vlan.vlan_id }}{% endfor %}</td>
     <td data-title="Alias"><a class="rrd" data-toggle="tooltip" title="Protected: {{ deploy.protected }} Online: {{ deploy.connected }}ID: {{ deploy.machine_id }}"><b>{% if deploy.enabled == True %}<font color="green">{% else %}<font color="red">{% endif %}{{ deploy.machine_alias }}</font></b></a></td>
     <td data-title="CPU">{{ deploy.machine_cpu }}</td>
     <td data-title="Memory">{{ deploy.machine_mem }} MB</td>
     <td data-title="HDD">{{ deploy.machine_hdd }} GB</td>
     {% if deploy.date_last_charge == None %}
     <td data-title="Last Charged">Never</td>
     {% else %}
     <td data-title="Last Charged">{{ moment(deploy.date_last_charge).format('lll') }} ({{ moment(deploy.date_last_charge).fromNow() }})</td>
     {% endif %}
     <td data-title="Days Left">{{ deploy.daysleft }}</td>
     <td data-title="Owner"><a href="{{ url_for('admin.dashboard', user_pid=deploy.user_id) }}">{{ deploy.owner.email }}</a></td>
    {% endfor %}
    </tbody>
   </table>
  </div>
  </div>
  </div>

 </div>


  <div class="row">
  </div>

</div>

{% endblock %}