{% extends 'infrastructure/base_detail.html' %}
{% load i18n %}
{% load url from future %}
{% block title %}{% trans "Rack Detail"%}{% endblock %}

{% block page_header %}
  {% include "horizon/common/_page_header.html" with title=_("Rack Detail") %}
{% endblock page_header %}

{% block breadcrumbs %}
  <div class="breadcrumbs">
    <a href="{% url 'horizon:infrastructure:resource_management:index' %}?tab=resource_management_tabs__resource_classes_tab" >Home</a>
    <span class="separator"></span>
    <a href="{% url 'horizon:infrastructure:resource_management:index' %}?tab=resource_management_tabs__racks_tab" >Racks</a>
    <span class="separator"></span>
  </div>
{% endblock breadcrumbs %}

{% block name %}{{ rack.name }}{% endblock %}

{% block actions %}
  <div class="btn-group">
    {% if rack.is_provisioned %}
      <a class="btn ajax-modal" href="{% url 'horizon:infrastructure:resource_management:racks:edit_status' rack.id %}?action=unprovision">{% trans "Unprovision Rack" %}</a>
    {% endif %}
  </div>
  {# <div class="btn-group"> #}
    {# <a class="btn ajax-modal" href="{% url 'horizon:infrastructure:resource_management:racks:edit_status' rack.id %}?action=start">{% trans "Start" %}</a> #}
    {# <a class="btn ajax-modal" href="{% url 'horizon:infrastructure:resource_management:racks:edit_status' rack.id %}?action=reboot">{% trans "Reboot" %}</a> #}
    {# <a class="btn ajax-modal" href="{% url 'horizon:infrastructure:resource_management:racks:edit_status' rack.id %}?action=shutdown">{% trans "Shutdown" %}</a> #}
  {# </div> #}
  <div class="btn-group">
    <a class="btn ajax-modal" href="{% url 'horizon:infrastructure:resource_management:racks:detail_edit' rack.id %}">{% trans "Edit" %}</a>
  </div>
{% endblock %}

{% block overall_usage %}
  <table class="capacities overall_usage">
    <tr>
      <td class="capacity_label">{% trans "Usage" %}:</td>
      <td>
        {% if rack.is_provisioned %}
        <div id="rack_usage"
             class="capacity_bar"
             data-chart-type="capacity_bar_chart"
             data-capacity-limit="{{ rack.vm_capacity.value }}"
             data-capacity-used="{{ rack.vm_capacity.usage }}"
             data-average-capacity-used="{{ rack.vm_capacity.average }}">
        </div>
        {% else %}
        <div id="rack_usage"
             class="capacity_bar"
             data-chart-type="capacity_bar_chart">
        </div>
        {% endif %}
      </td>
    </tr>
  </table>
{% endblock %}

