<script id="datacenter_view-container-template" type="text/x-handlebars-template">
    <div id="datacenter-view">
        <div class="operations">
            <div class="dropdown">
                <button class="btn dropdown-toggle" data-toggle="dropdown">Operations</button>
                <ul class="dropdown-menu">
                    <li><a href="#" class="rename">Rename datacenter</a></li>
                    <li><a href="#" class="delete">Delete datacenter</a></li> 
                </ul>
            </div>
        </div>
        <div class="main_title"></div>
        <div id="user-alert-space"></div>
        <div class="section statistics">
            <h2 class="title">Statistics</h3>
            <div class="content row-fluid">
                <div class="span4 profile"></div>
                <div class="span8 performance-graph"></div>
            </div>
        </div>
        <div class="section server-list list-view"></div>
        <div class="recent-log-entries"></div>
    </div>
</script>

<script id="datacenter_view_title-template" type="text/x-handlebars-template">
    <h1 class="title">Datacenter overview for {{name}}</h1>
</script>

<script id="datacenter_view_profile-template" type="text/x-handlebars-template">
    <div class="summary">
        <div class="stat-row first">
            <p class="availability"><span class="big">{{humanize_datacenter_reachability status}}</span></p>
        </div>
        <div class="stat-row">
            <p class="servers"><span class="big">{{status.reachable}}/{{status.total}} </span>servers reachable</p>
        </div>
        <div class="stat-row">
            <p class="masters"><span class="big">{{nshards}} </span>{{pluralize_noun "shard" nshards}}</p>
        </div>
        <div class="stat-row">
            <p class="replicas"><span class="big">{{nreplicas}} </span>{{pluralize_noun "replica" nreplicas}}</p>
        </div>
    </div>
</script>

<script id="datacenter_view-machine_list-template" type="text/x-handlebars-template">
    <h2 class="title">Servers in this datacenter</h2>
    {{#if has_servers}}
    <ul class="servers">
        {{#each servers}}
            <li class="server">
                <p class="name"><a href="/#servers/{{id}}">{{name}}</a></p>
                <p class="info">{{num_primaries}} {{pluralize_noun "primary" num_primaries}}, {{num_secondaries}} {{pluralize_noun "secondary" num_secondaries}}</p>
                <p class="status">{{humanize_machine_reachability status}}</p>
            </li>
        {{/each}}
    </ul>
    {{else}}
    <div class="no_element">
        This datacenter does not contain any servers.
    </div>
    {{/if}}
</script>

<script id="datacenter_view_OLD_data-template" type="text/x-handlebars-template">
    <h3 class="title">Data in this datacenter</h3>
    {{#unless data.namespaces}}
    <p>No data found in this datacenter.</p>
    {{/unless}}
    {{#each data.namespaces}}
    <div class="namespace">
      <h4>Shards for table <a href="/#tables/{{uuid}}">{{name}}</a>:</h4>
      <ul class="shard_ul">
        {{#each shards}}
        <li class="shard_li">
            <h4>{{name}}</h4>
            <p>{{#if keys}}About {{keys}} keys{{else}}Loading number of keys...{{/if}}, {{nprimaries}} {{pluralize_noun "primary" nprimaries}}, {{nsecondaries}} {{pluralize_noun "secondary" nsecondaries}}</p>
        </li>
        {{/each}}
      </ul>
    </div>
    {{/each}}
</script>

<script id="datacenter_view-recent_log_entry-template" type="text/x-handlebars-template">
    <div class="entry-metadata">
        <p class="from-machine">Reported from <a href="#servers/{{machine_uuid}}">{{machine_name}}</a></p>
        <p class="datetime"><abbr class="timeago" title="{{timeago_timestamp}}">{{timeago_timestamp}}</abbr></p>
    </div>
    <p class="level">{{level}}</p>
    <p class="message">
        {{formatted_message}}
        {{#if json}}
                <a href="#" class="json" rel="popover" data-content="<pre>{{json}}</pre>" data-title="JSON applied to server">examine JSON</a>
        {{/if}}
    </p>
</script>

<script id="remove_datacenter-modal-template" type="text/x-handlebars-template">
    {{#if datacenter_is_primary}}
    <div class="alert alert-error displayed_alert">
        <p>This datacenter is primary for the following tables: {{links_to_namespaces_inline namespaces_where_primary}}.<br/>
        Deleting this datacenter will result in a loss of availability.</p>
    </div>
    {{/if}}
    <div class="alert alert-error displayed_alert">Deleting this datacenter will remove all the responsibilities of the servers in it.</div>
    <div class="alert alert-error error_answer"></div>
    <p>Are you sure you want to delete this datacenter <a href="#datacenters/{{id}}">{{name}}</a>?</p>
</script>
