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

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

<div class="info row-fluid detail">
  <h4>{% trans "Info" %}</h4>
  <hr class="header_rule">
  <dl>
    <dt>{% trans "Name" %}</dt>
    <dd>{{ share.name }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ share.id }}</dd>
    {% if share.description %}
    <dt>{% trans "Description" %}</dt>
    <dd>{{ share.description }}</dd>
    {% endif %}
    <dt>{% trans "Status" %}</dt>
    <dd>{{ share.status|capfirst }}</dd>
    <dt>{% trans "Export locations" %}</dt>
    {% for el in share.export_locations %}
    <dd>{{ el }}</dd>
    {% endfor %}
    {% if share.snapshot_id %}
    <dt>{% trans "Snapshot ID" %}</dt>
    {% url 'horizon:project:shares:snapshot-detail' share.snapshot_id as snapshot_url%}
    <dd><a href="{{ snapshot_url }}">{{ share.snapshot_id }}</a></dd>
    {% endif %}
    <dt>{% trans "Visibility" %}</dt>
    {% if share.is_public == True %}
    <dd>{{ 'public' }}</dd>
    {% else %}
    <dd>{{ 'private' }}</dd>
    {% endif %}
  </dl>
</div>

<div class="specs row-fluid detail">
  <h4>{% trans "Specs" %}</h4>
  <hr class="header_rule">
  <dl>
    <dt>{% trans "Size" %}</dt>
    <dd>{{ share.size }} {% trans "GB" %}</dd>
    <dt>{% trans "Protocol" %}</dt>
    <dd>{{ share.share_proto }}</dd>
    {% if share.share_type %}
    <dt>{% trans "Share type" %}</dt>
    <dd>{{ share.share_type }}</dd>
    {% endif %}
    {% if share.share_network_id %}
    <dt>{% trans "Share network" %}</dt>
    {% url 'horizon:project:shares:share_network_detail' share.share_network_id as sn_url%}
    <dd><a href="{{ sn_url }}">{{ share.share_network_id }}</a></dd>
    {% endif %}
    <dt>{% trans "Created" %}</dt>
    <dd>{{ share.created_at|parse_date }}</dd>
    <dt>{% trans "Host" %}</dt>
    <dd>{{ share.host }}</dd>
  </dl>
</div>

<div class="status row-fluid detail">
  <h4>{% trans "Access Rules" %}</h4>
  <hr class="header_rule">
  <dl>
  {% for rule in share.rules %}
    <dt>{{ rule.access_type }}</dt>
    <dd>{{ rule.access_to }}</dd>
  {% endfor %}
  </dl>
</div>

<div class="status row-fluid detail">
  <h4>{% trans "Metadata" %}</h4>
  <hr class="header_rule">
  <dl>
  {% for key, value in share.metadata.items %}
    <dt>{{ key }}</dt>
    <dd>{{ value }}</dd>
  {% endfor %}
  </dl>
</div>
