{% load i18n sizeformat %}
{% load url from future %}
<h3>{% trans "Node Groups" %}</h3>
<div class="status row detail">
    {% for node_group in template.node_groups %}
        <dl class="well">
            <h4>{% blocktrans with node_group_name=node_group.name %}Node Group: {{ node_group_name }}{% endblocktrans %}</h4>
            <dt>{% trans "Nodes Count" %}</dt>
            <dd>{{ node_group.count }}</dd>

            <dt>{% trans "Flavor" %}</dt>
            <dd>{{ node_group.flavor_id|default:_("Flavor is not specified") }}</dd>

            <dt>{% trans "Template" %}</dt>
            {% if node_group.node_group_template_id %}
                <dd><a href="{% url 'horizon:project:data_processing.nodegroup_templates:details' node_group.node_group_template_id %}">{{ node_group.node_group_template.name }} </a></dd>
            {% else %}
                <dd>{% trans "Template not specified" %}</dd>
            {% endif %}

            {% if node_group.availability_zone %}
                <dt>{% trans "Availability Zone" %}</dt>
                <dd>{{ node_group.availability_zone }}</dd>
            {% endif %}

            <dt>{% trans "Use auto-configuration" %}</dt>
            <dd>{{ node_group.use_autoconfig }}</dd>

            <dt>{% trans "Proxy Gateway" %}</dt>
            <dd>{{ node_group.is_proxy_gateway|yesno }}</dd>

            <dt>{% trans "Auto Security Group" %}</dt>
            <dd>{{ node_group.auto_security_group|yesno }}</dd>

            <dt>{% trans "Security Groups" %}</dt>
            <dd>
                <ul class="list-bullet">
                    {% for group in node_group.security_groups_full %}
                        {% if group.id %}
                            <li><a href="{% url 'horizon:project:access_and_security:security_groups:detail' group.id %}">{{ group.name }}</a></li>
                        {% else %}
                            <li>{{ group.name }}</li>
                        {% endif %}
                    {% endfor %}
                </ul>
            </dd>

            <dt>{% trans "Node Processes" %}</dt>
            {% if node_group.node_processes %}
                <dd>
                    <ul class="list-bullet">
                        {% for process in node_group.node_processes %}
                            <li>{{ process }}</li>
                        {% endfor %}
                    </ul>
                </dd>
            {% else %}
                <dd>{% trans "Node processes are not specified" %}</dd>
            {% endif %}

            <dt>{% trans "Node Configurations" %}</dt>
            {% if node_group.node_configs %}
                <dd>
                    {% for service, service_conf in node_group.node_configs.items %}
                        <h6>{{ service }}</h6>
                        {% 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 "Node configurations are not specified" %}</dd>
            {% endif %}
        </dl>
    {% endfor %}
</div>
