{% load i18n sizeformat %}

<div class="detail">
  <dl class="dl-horizontal">
    <dt>{% trans "Name" %}</dt>
    <dd>{{ cluster.name }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ cluster.id }}</dd>
    <dt>{% trans "Description" %}</dt>
    <dd>{{ cluster.description|default:_("None") }}</dd>
    <dt>{% trans "Status" %}</dt>
    <dd>{{ cluster.status }}</dd>
  </dl>

  {% if cluster.error_description %}
    <h4>{% trans "Error Details" %}</h4>
    <p class="well">
        {{ cluster.error_description }}
    </p>
  {% endif %}

  <dl class="dl-horizontal">
    <dt>{% trans "Plugin" %}</dt>
    <dd><a href="{% url 'horizon:project:data_processing.data_plugins:details' cluster.plugin_name %}">{{ cluster.plugin_name }}</a></dd>
    <dt>{% trans "Version" %}</dt>
    <dd>{{ cluster.hadoop_version }}</dd>
  </dl>
  <dl class="dl-horizontal">
    <dt>{% trans "Template" %}</dt>
    {% if cluster_template %}
      <dd><a href="{% url 'horizon:project:data_processing.cluster_templates:details' cluster_template.id %}">{{ cluster_template.name }} </a></dd>
    {% else %}
      <dd>{% trans "Template not specified" %}</dd>
    {% endif %}
    <dt>{% trans "Base Image" %}</dt>
    <dd><a href="{% url 'horizon:project:images:images:detail' base_image.id %}">{{ base_image.name }}</a></dd>
    {% if network %}
      <dt>{% trans "Neutron Management Network" %}</dt>
      <dd>{{ network }}</dd>
    {% endif %}
    <dt>{% trans "Keypair" %}</dt>
    <dd>{{ cluster.user_keypair_id }}</dd>
    <dt>{% trans "Use auto-configuration" %}</dt>
    <dd>{{ cluster.use_autoconfig }}</dd>
  </dl>
  <dl class="dl-horizontal">
    <dt>{% trans "Anti-affinity enabled for" %}</dt>
      {% if cluster.anti_affinity %}
        <dd>
          <ul class="list-bullet">
          {% for process in cluster.anti_affinity %}
            <li>{{ process }}</li>
          {% endfor %}
          </ul>
        </dd>
      {% else %}
        <h6>{% trans "no processes" %}</h6>
      {% endif %}
    </dl>
  <dl class="dl-horizontal">
    <dt>{% trans "Node Configurations" %}</dt>
    {% if cluster.cluster_configs %}
      <dd>
        {% for service, service_conf in cluster.cluster_configs.items %}
          <h4>{{ service }}</h4>
          {% if service_conf %}
            <ul>
              {% for conf_name, conf_value in service_conf.items %}
                <li>{% blocktrans %}{{ conf_name }}: {{ conf_value }}{% endblocktrans %}</li>
              {% endfor %}
            </ul>
          {% else %}
            <h6>{% trans "No configurations" %}</h6>
          {% endif %}
        {% endfor %}
      </dd>
    {% else %}
      <dd>{% trans "Cluster configurations are not specified" %}</dd>
    {% endif %}
  </dl>

  <dl class="dl-horizontal">
    {% for info_key, info_val in cluster.info.items %}
      <dt>{{ info_key }}</dt>
      {% for key, val in info_val.items %}
        <dd>
          {% autoescape off %}{% blocktrans %}{{ key }}: {{ val }}{% endblocktrans %}{% endautoescape %}
        </dd>
      {% endfor %}
    {% endfor %}
  </dl>
</div>
