<script id="namespace_view-container-template" type="text/x-handlebars-template">
    <div id="table-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 table</a></li>
                    <li><a href="#" class="delete">Delete table</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="row">
            <div class="span5">
                <div class="section sharding"></div>
            </div>
            <div class="span7">
                <div class="section replication"></div>
                <div class="section secondary_indexes"></div>
            </div>
        </div>
        <div class="section server-assignments tree-view"></div>
    </div>
</script>

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

<script id="namespace_view-profile-template" type="text/x-handlebars-template">
    <div class="summary">
        <div class="stat-row first">
            <p class="availability"><span class="big">{{humanize_namespace_reachability reachability}}</span></p>
        </div>
        <div class="stat-row">
            {{#if total_keys_available}}
            <p class="documents"><span class="big">About {{total_keys}} </span>documents</p>
            {{else}}
            <p class="documents"><span class="big">N/A </span>documents</p>
            {{/if}}
        </div>
        <div class="stat-row">
            <p class="masters"><span class="big">{{nashards}}/{{nshards}} </span> masters reachable</p>
        </div>
        <div class="stat-row">
            <p class="replicas"><span class="big">{{nareplicas}}/{{nreplicas}} </span> replicas reachable</p>
        </div>
    </div>
</script>


<script id="namespace_view-secondary_indexes-template" type="text/x-handlebars-template">
    <h2 class="title">Secondary indexes</h2>
    <div class="alert main_alert">
      <a class="close_hide" href="#">&times;</a>
      <div class="alert_content"></div>
    </div>
    <div class="alert alert-error main_alert_error">
        <a class="close_hide" href="#">&times;</a>
        <div class="alert_error_content"></div>
    </div>
    <div class="alert alert-error"></div>
    <div class="content"></div>
</script>

<script id="namespace_view-secondary_indexes-content-template" type="text/x-handlebars-template">
    {{#if loading}}
        <p>Loading...</p>
    {{else}}
        {{#if error}}
            <div class="alert alert-error displayed_alert">
                {{#if connect}}
                <p>An error occured: Could not open a connection. <a href="#" class="reconnect_link">Try again</a>.</p>
                {{/if}}
                {{#if index_list}}
                <p>An error occurred: could not retrieve secondary indexes. <a href="#" class="reconnect_link">Try again</a>.</p>
                {{/if}}
            </div>
        {{else}}
             <ul class="list_secondary_indexes">
            {{#if no_secondary_indexes}}
                <li class="square_li">No secondary indexes found.</li>
            {{else}}
                {{#each secondary_indexes}}
                <li class="square_li">{{#if is_empty}}<em>[empty string]</em>{{else}}{{name}}{{/if}} — <a href="#" data-name="{{name}}" class="delete_link">delete</a></li>
                <li class="alert_li">
                <div class="alert {{#if display}}displayed_alert{{/if}} alert_confirm_delete alert_confirm_delete_{{name}}">
                        <div class="content">
                            Are you sure you want to delete the secondary index {{#if is_empty}}<em>[empty string]</em>{{else}}<strong>{{name}}</strong>{{/if}}?<br/>
                            <button class="btn cancel_delete_btn" data-name="{{name}}">Cancel</button><button class="btn delete_index_btn" data-name="{{name}}">Delete</button>
                        </div>
                    </div>
                </li>
                {{/each}}
            {{/if}}
            {{#if show_add_index}}
            <li class="square_li input_li"><input type="text" class="secondary_index_name" value="{{secondary_index_name}}" placeholder="name of the key" /><button class="btn cancel_btn">Cancel</button><button class="btn create_btn">Create</button></li>
            {{/if}}
            </ul>

            {{#unless show_add_index}}
                <div class="create_container"><a href="#" class="create_link">Create a new secondary index &rarr;</a></div>
            {{/unless}}

        {{/if}}
    {{/if}}
</script>

<script id="secondary_indexes-alert_msg-template" type="text/x-handlebars-template">
    {{#if delete_ok}}
    <p>You successfully deleted the secondary index <strong>{{name}}</strong>.</p>
    {{/if}}
    {{#if create_ok}}
    <p>You successfully created the secondary index <strong>{{name}}</strong>.</p>
    {{/if}}
</script>

<script id="secondary_indexes-error-template" type="text/x-handlebars-template">
    {{#if create_fail}}
    <p>The secondary index could not be created:</p>
    <div class="error_detail">
        {{print_safe message}}
    </div>
    {{/if}}
    {{#if delete_fail}}
    <p>The secondary index could not be deleted:</p>
    <div class="error_detail">
        {{print_safe message}}
    </div>
    {{/if}}
</script>
