<script id="dashboard_view-template" type="text/x-handlebars-template">
        <table class="section" id="cluster_status_container" class="cluster_status">
            <tr>
                <td class="panel availability"></td>
                <td class="panel redundancy"></td>
                <td class="panel reachability"></td>
                <td class="panel consistency"></td>
            </tr>
        </table>

        <div class="section" id="cluster_performance_container"></div>
        <div class="section" id="log-view">
            <button class="btn btn-primary view-logs">View All</button>
            <h2 class="title">Recent log entries</h2>
            <div class="recent-log-entries-container"></div>
        </div>
</script>

<script id="cluster_status-container-template" type="text/x-handlebars-template">
    <div class="status"></div>
    <div class="popup_container"></div>
</script>

<script id="cluster_status-availability_status-template" type="text/x-handlebars-template">
    <h3>Availability</h3>
    {{#if status_is_ok}}
        <p class="message"><span class="good">0</span> issues detected</p>
        <p class="details"><span class="good">{{num_masters}}/{{num_masters}}</span> masters are online</p>
    </div>
    {{else}}
        <p class="message"><span class="bad">{{num_namespaces_down}}/{{num_namespaces}} </span> <a href="#" class="show_details">tables</a> are affected</p>
        <p class="details"><span class="bad">{{num_masters_down}}/{{num_masters}}</span> <a href="#" class="show_details">masters</a> not available</p>
    {{/if}}
</script>

<script id="cluster_status-availability-popup-template" type="text/x-handlebars-template">
    <a class="close" href="#">&times;</a>
    <div class="arrow_left"></div>
    <div class="arrow_left_overlay"></div>
    <div class="inner_content">
        <h4>List of masters not available</h4>
        {{#if has_namespaces_down}}
            <ul class="ul_first_level">
                {{#each namespaces_down}}
                <li class="li_first_level">Table <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>:
                <ul class="ul_second_level">
                    {{#each namespaces_down}}
                    <li class="li_second_level">
                        Shard: {{shard}}<br/>
                        Expected master: <a href="#servers/{{machine_id}}">{{machine_name}}</a><br/>
                        Status/Goal: {{directory_status}} / {{blueprint_status}}
                    </li>
                    {{/each}}
                </ul>
                </li>
                {{/each}}
            </ul>
        {{else}}
        All masters are available
        {{/if}}
    </div>
</script>


<script id="cluster_status-redundancy_status-template" type="text/x-handlebars-template">
    <h3>Redundancy</h3>
    {{#if status_is_ok}}
        <p class="message"><span class="good">0</span> issues detected</p>
        <p class="details"><span class="good">{{num_replicas}}/{{num_replicas}}</span> replicas are online</p>
    </div>
    {{else}}
        {{#if has_unsatisfiable_goals}}
        <p class="message"><span class="bad">{{num_unsatisfiable_goals}}</span> <a href="#" class="show_details">unsatisfiable {{pluralize_noun "goal" num_unsatisfiable_goals}}</a></p>
        {{else}}
        <p class="message"><span class="bad">{{num_namespaces_down}}/{{num_namespaces}} </span> <a href="#" class="show_details">tables</a> are affected</p>
        {{/if}}

        {{#if has_namespaces_down}}
        <p class="details"><span class="bad">{{num_replicas_down}}/{{num_replicas}}</span> <a href="#" class="show_details">replicas</a> not up to date</p>
        {{else}}
        <p class="details"><span class="bad">{{num_replicas}}/{{num_replicas}}</span> replicas are online</p>
        {{/if}}
    {{/if}}
</script>


<script id="cluster_status-redundancy-popup-template" type="text/x-handlebars-template">
    <a class="close" href="#">&times;</a>
    <div class="arrow_left"></div>
    <div class="arrow_left_overlay"></div>

    {{#if has_unsatisfiable_goals}}
    <h4>List of tables with unsatisfiable goals</h4>
    <div class="inner_content">
        <ul class="ul_first_level">
            {{#each namespaces_with_unsatisfiable_goals}}
            <li class="li_first_level">Table <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>
                <ul class="ul_second_level">
                    {{#each datacenters_with_issues}}
                    <li class="li_second_level">
                        Datacenter: <a href="#datacenters/{{datacenter_id}}">{{datacenter_name}}</a><br/>
                        Number of replicas expected: {{num_replicas}}
                    </li>
                    {{/each}}
                </ul>
            </li>
            {{/each}}
        </ul>

        {{#if has_namespaces_down}}
        <h4>List of replicas with issues</h4>
        <ul class="ul_first_level">
            {{#each namespaces_down}}
            <li class="li_first_level">Table <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>:
                <ul class="ul_second_level">
                    {{#each namespaces_down}}
                    <li class="li_second_level">
                        Shard: {{shard}}<br/>
                        Server: <a href="#servers/{{machine_id}}">{{machine_name}}</a><br/>
                        Status/Goal: {{directory_status}} / {{blueprint_status}}
                    </li>
                    {{/each}}
                </ul>
            </li>
            {{/each}}
        </ul>
        {{/if}}
        </div>
    {{else}}
        {{#if has_namespaces_down}}
        <h4>List of replicas with issues</h4>
        <div class="inner_content">
            <ul class="ul_first_level">
                {{#each namespaces_down}}
                <li class="li_first_level">Table <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>:
                    <ul class="ul_second_level">
                        {{#each namespaces_down}}
                        <li class="li_second_level">
                            Shard: {{shard}}<br/>
                            Server: <a href="#servers/{{machine_id}}">{{machine_name}}</a><br/>
                            Status/Goal: {{directory_status}} / {{blueprint_status}}
                        </li>
                        {{/each}}
                    </ul>
                </li>
                {{/each}}
            </ul>
        </div>
        {{else}}
        <h4>List of replicas with issues</h4>
            <div class="inner_content">
                All replicas are working and up to date.
            </div>
        {{/if}}
    {{/if}}

</script>




<script id="cluster_status-reachability_status-template" type="text/x-handlebars-template">
    <h3>Reachability</h3>
    {{#if has_machines_down}}
    <p class="message"><span class="bad">{{num_machines_down}}</span> <a href="#" class="show_details">{{pluralize_noun "issue" num_machines_down}}</a> detected</p>
    <p class="details"><span class="bad">{{num_machines_down}}/{{num_machines}}</span> <a href="#" class="show_details">servers</a> are down</p>
    {{else}}
    <p class="message"><span class="good">0</span> issues detected</p>
    <p class="details"><span class="good">{{num_machines}}/{{num_machines}}</span> servers reachable</p>
    {{/if}}
</script>


<script id="cluster_status-reachability-popup-template" type="text/x-handlebars-template">
    <a class="close" href="#">&times;</a>
    <div class="arrow_right"></div>
    <div class="arrow_right_overlay"></div>
    <div class="inner_content">
        <h4>List of servers not available</h4>
        {{#if has_machines_down}}
        <ul class="ul_first_level">
            {{#each machines_down}}
            <li class="li_first_level">Server <a href="#servers/{{machine_id}}">{{machine_name}}</a></li>
            {{/each}}
        </ul>
        {{else}}
        All servers are available.
        {{/if}}
    </div>
</script>


<script id="cluster_status-consistency_status-template" type="text/x-handlebars-template">
    <h3>Consistency</h3>
    {{#if has_conflicts}}
    <p class="message"><span class="bad">{{num_conflicts}}</span> <a href="#" class="show_details">{{pluralize_noun "issue" num_conflicts}}</a> detected</p>
    {{#if has_multiple_types}}
    <p class="details"><span class="bad">{{num_types_conflicts}}</span> <a href="#" class="show_details">{{pluralize_noun "conflict type" num_types_conflicts}}</a> </p>
    {{else}}
    <p class="details"><span class="bad">{{num_conflicts}}</span> {{pluralize_noun type num_conflicts}} {{pluralize_verb_to_have num_conflicts}} conflicts</p>
    {{/if}}
    {{else}}
    <p class="message"><span class="good">0</span> issues detected</p>
    <p class="details"><span class="good">{{num_namespaces}}/{{num_namespaces}}</span> tables are consistent</p>
    {{/if}}
</script>



<script id="cluster_status-consistency-popup-template" type="text/x-handlebars-template">
    <a class="close" href="#">&times;</a>
    <div class="arrow_right"></div>
    <div class="arrow_right_overlay"></div>
    <div class="inner_content">
        <h4>List of conflicts</h4>
        {{#if has_conflicts}}
        <ul class="ul_first_level">
            {{#each conflicts}}
            <li class="li_first_level">{{capitalize type}} <a href="#{{type}}s/{{id}}">{{name}}</a> has a conflict for the field {{field}}</li>
            {{/each}}
        </ul>
        {{else}}
        No conflicts detected.
        {{/if}}
        <a href="#resolve_issues" class="resolve_issues_link">Resolve issues</a>
    </div>
</script>
