{% load i18n sizeformat parse_date %}

<div class="detail">
  <dl class="dl-horizontal">
    <dt>{% trans "Name" %}</dt>
    <dd data-display="{{ snapshot.name|default:snapshot.id }}" class="word-wrap">{{ snapshot.name }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ snapshot.id }}</dd>
    {% if snapshot.description %}
    <dt>{% trans "Description" %}</dt>
    <dd>{{ snapshot.description }}</dd>
    {% endif %}
    <dt>{% trans "Project ID" %}</dt>
    <dd>{{ snapshot.project_id|default:_("-") }}</dd>
    <dt>{% trans "Status" %}</dt>
    <dd>{{ snapshot.status|replace_underscores|capfirst }}</dd>
    <dt>{% trans "Volume" %}</dt>
    <dd class="word-wrap">
      <a href="{{ snapshot.volume_url }}">
        {% if volume.name %}
          {{ volume.name }}
        {% else %}
          {{ snapshot.volume_id }}
        {% endif %}
      </a>
    </dd>
    <dt>{% trans "Group Snapshot" %}</dt>
    {% if group_snapshot %}
    <dd><a href="{% url 'horizon:project:vg_snapshots:detail' snapshot.group_snapshot_id %}">{{ group_snapshot.name_or_id }}</a></dd>
    {% else %}
    <dd>{% trans "-" %}</dd>
    {% endif %}
  </dl>

  <h4>{% trans "Specs" %}</h4>
  <hr class="header_rule">
  <dl class="dl-horizontal">
    <dt>{% trans "Size" %}</dt>
    <dd>{{ snapshot.size }} {% trans "GiB" %}</dd>
    <dt>{% trans "Created" %}</dt>
    <dd>{{ snapshot.created_at|parse_date }}</dd>
  </dl>

  <h4>{% trans "Metadata" %}</h4>
  <hr class="header_rule">
  <dl class="dl-horizontal">
  {% if snapshot.metadata.items %}
      {% for key, value in snapshot.metadata.items %}
          <dt>{{ key }}</dt>
          <dd>{{ value }}</dd>
      {% endfor %}
  {% else %}
      <dd>{% trans "None" %}</dd>
  {% endif %}
  </dl>
</div>
