{% load i18n sizeformat %}
{% load url from future %}

<h3>{% trans "Instance Overview" %}</h3>

<div class="status row detail">
  <h4>{% trans "Information" %}</h4>
  <hr class="header_rule">
  <dl class="dl-horizontal">
    <dt>{% trans "Name" %}</dt>
    <dd>{{ instance.name }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ instance.id }}</dd>
    <dt>{% trans "Datastore" %}</dt>
    <dd>{{ instance.datastore.type }}</dd>
    <dt>{% trans "Datastore Version" %}</dt>
    <dd>{{ instance.datastore.version }}</dd>
    <dt>{% trans "Status" %}</dt>
    <dd>{{ instance.status|title }}</dd>
  </dl>
</div>

<div class="specs row detail">
  <h4>{% trans "Specs" %}</h4>
  <hr class="header_rule">
  <dl class="dl-horizontal">
    <dt>{% trans "Flavor" %}</dt>
    <dd>{{ instance.full_flavor.name }}</dd>
    <dt>{% trans "RAM" %}</dt>
    <dd>{{ instance.full_flavor.ram|mb_float_format }}</dd>
    {% if instance.volume %}
      <dt>{% trans "Volume Size" %}</dt>
      <dd>{{ instance.volume.size|diskgbformat }}</dd>
    {% endif %}
    <dt>{% trans "Created" %}</dt>
    <dd>{{ instance.created|parse_isotime }}</dd>
    <dt>{% trans "Updated" %}</dt>
    <dd>{{ instance.updated|parse_isotime }}</dd>
  </dl>
</div>

{% block connection_info %}
{% endblock %}

{% if instance.replica_of or instance.replicas %}
<div class="specs row detail">
  <h4>{% trans "Replication" %}</h4>
  <hr class="header_rule">
  <dl>
    {% if instance.replica_of %}
      <dt>{% trans "Is a Replica Of" %}</dt>
      <dd>
        {% url 'horizon:project:databases:detail' instance.replica_of.id as instance_url %}
        <a href="{{ instance_url }}">{{ instance.replica_of.id }}</a>
      </dd>
    {% endif %}

    {% if instance.replicas %}
      <dt>{% trans "Replicas" %}</dt>
      {% for replica in instance.replicas %}
        <dd>
          {% url 'horizon:project:databases:detail' replica.id as instance_url %}
          <a href="{{ instance_url }}">{{ replica.id }}</a>
        </dd>
      {% endfor %}
    {% endif %}
  </dl>
</div>
{% endif %}
