{% extends "base.html" %}

{% block content %}
    <ul class="top-level-list">
        {% for env in view_envs %}
        <li>
            <h4 style="color:#666">
                <span>{{'Environment: ' + env['environment']}}</span>
            </h4>
            <ul class="top-level-list">
                {% for group in env['groups'] %}
                    {% set group_title = '_'.join(group['_name'].split(' ')) %}
                    <div onclick="{{"return collapse_group(event, '" + env['environment'] + "-" + group_title + "');" | safe}}" class="group-boxstyle">
                        <h5 style='margin:10px 5px 10px 5px; color:#666'}}>
                            <span>
                                {{group['_name']}}
                            </span>
                            <span class="pull-right">
                                <!-- this is all very particular to formatting in check_utils.py-->
                                {% for status in group['_statuses'] %}
                                    {% if group['_statuses'][status] != '0' %}
                                        <span class="{{'check-' + status.lower()}}" style="margin-left:8px; background:none">
                                            {{group['_statuses'][status] + ' ' + status}}
                                        </span>
                                    {% endif %}
                                {% endfor %}
                            </span>
                        </h5>
                        <div class="collapse collapse-div commonstyle container-fluid" id="{{env['environment'] + '-' + group_title | safe}}">
                            {% for title in group %}
                                {% if title != '_statuses' and title != '_name'%}
                                    <li>
                                        {{check_result(group[title], title, env['environment'], is_admin, context)}}
                                    </li>
                                {% endif %}
                            {% endfor %}
                        </div>
                    </div>
                {% endfor %}
            </ul>
        </li>
        <hr>
        {% endfor %}
    </ul>
{% endblock %}
