<script id="log-container-template" type="text/x-handlebars-template">
    <div id="log-view" class="section">
        <div class="header"><h2 class="title">Log entries</h2></div>
        <ul class="log-entries"></ul>
        <div class="any-more-log-entries no_element">
            <p class="no-more-entries">No more log entries to show</p>
            <p class="next-log-entries-container">
                <a href="#" class='next-log-entries'>Older log entries &raquo;</a>
            </p>
        </div>
    </div>
</script>

<script id="log-header-template" type="text/x-handlebars-template">
    {{#if logs_for.general}}
        <h2 class="title">Log entries{{#if has_logs}} <small>from {{from_date}} to {{to_date}}</small>{{/if}}</h2>
    {{/if}}
    {{#if logs_for.machine}}
        <h2 class="title">Logs on this server{{#if has_logs}} <small>from {{from_date}} to {{to_date}}</small>{{/if}}</h2>
    {{/if}}
    {{#if logs_for.datacenter}}
        <h2 class="title">Logs on this datacenter{{#if has_logs}} <small>from {{from_date}} to {{to_date}}</small>{{/if}}</h2>
    {{/if}}
    {{#if new_entries}}
        <div class="alert displayed_alert">
            <a href="#" class="close">×</a>
            {{#if too_many_new_entries}}
                <p>More than {{max_log_entries}} new log entries have been reported.<br/>
                <a class="update-log-entries" href="#">Reload logs</a></p>
            {{else}}
                <p>{{num_new_entries}} new log {{pluralize_noun "entry" num_new_entries}} {{pluralize_verb_to_have num_new_entries}} just been reported.<br/>
                <a class="update-log-entries" href="#">Update entries</a></p>
            {{/if}}
        </div>
    {{/if}}
</script>

<script id="log-entry-template" type="text/x-handlebars-template">
    <div class="row-fluid">
        <div class="span9">
            {{print_safe msg}}
            <p class="from-machine">Posted by <a href="#servers/{{machine_uuid}}">{{machine_name}}</a></p>
        </div>
        <div class="span3">
            <p class="datetime">{{datetime}}</p>
        </div>
    </div>
    {{#if raw_data}}    
        <pre class="details">{{raw_data}}</pre>
    {{/if}}
</script>

<script id="log-single_value-template" type="text/x-handlebars-template">
    {{#if namespace_exists}}
        <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>'s
    {{else}}
        [table no longer exists]
    {{/if}} 
    {{attribute}} to:
    {{#if value}}{{value}}{{/if}}
    {{#if datacenter_id}}
        for <a href="#datacenters/{{datacenter_id}}">{{datacenter_name}}</a>
    {{/if}}
    <br/>
</script>

<script id="log-namespace-new_name-template" type="text/x-handlebars-template">
    Set table <a href="#tables/{{namespace_id}}">{{namespace_id_trunked}}</a>'s name to {{name}}<br/>
</script>

<script id="log-machines_values-template" type="text/x-handlebars-template">
    Set table <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>'s {{attribute}} to:
    <ul class="pretty_logs_ul">
        {{#each machines}}
            <li class="pretty_logs_li">Server <a href="#servers/{{machine_id}}">{{machine_name}}: {{value}}</li>
        {{/each}}
    </ul>
</script>

<script id="log-datacenters_values-template" type="text/x-handlebars-template">
    Set table 
    {{#if namespace_exists}}
        <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>'s
    {{else}}
        [table no longer exists]
    {{/if}} 
    {{attribute}} to:
    <ul class="pretty_logs_ul">
        {{#each datacenters}}
        <li class="pretty_logs_li">Datacenter
            <a href="#datacenters/{{datacenter_id}}">{{datacenter_name}}</a>
        : {{value}}</li>
        {{/each}}
    </ul>
</script>

<script id="log-shards_values-template" type="text/x-handlebars-template">
    Set table 
    {{#if namespace_exists}}
        <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>'s
    {{else}}
        [table no longer exists]
    {{/if}} 
    {{attribute}} to:
    <ul class="pretty_logs_ul">
        {{#each shards}}
            {{#if is_null}}
                <li class="pretty_logs_li">{{shard}}: <span class="fake-link">null</span></li>
            {{else}}
                <li class="pretty_logs_li">{{shard}}: 
                {{#if machine_exists}}
                    <a href="#servers/{{machine_id}}">{{machine_name}}</a>
                {{else}}
                    [machine no longer exists]
                {{/if}}
                </li>
            {{/if}}
        {{/each}}
    </ul>
</script>

<script id="log-shards_list_values-template" type="text/x-handlebars-template">
    Set table 
    {{#if namespace_exists}}
        <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>'s
    {{else}}
        [table no longer exists]
    {{/if}} 
    {{attribute}} to:
    <ul class="pretty_logs_ul">
        {{#each shards}}
            <li class="pretty_logs_li">{{shard}}: [ {{links_to_machines machines}} ]</li>
        {{/each}}
    </ul>
</script>

<script id="log-shard_names_values-template" type="text/x-handlebars-template">
    Set table 
    {{#if namespace_exists}}
        <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>'s
    {{else}}
        [table no longer exists]
    {{/if}} 
    {{attribute}} to:
    <ul class="pretty_logs_ul">
        {{#each shards}}
            <li class="pretty_logs_li">{{this}}</li>
        {{/each}}
    </ul>
</script>

<script id="log-new_namespace-template" type="text/x-handlebars-template">
    Created a new table {{namespace_name}}
    {{#if is_universe}}
        without specifying a primary datacenter.
    {{else}}
        with primary datacenter <a href="#datacenters/{{datacenter_id}}">{{datacenter_name}}</a>.
    {{/if}}
    <br/>
</script>
<script id="log-new_datacenter-template" type="text/x-handlebars-template">
    Created a new datacenter {{datacenter_name}}<br/>
</script>
<script id="log-new_database-template" type="text/x-handlebars-template">
    Created a new database {{database_name}}<br/>
</script>
<script id="log-delete_something-template" type="text/x-handlebars-template">
    Deleted {{type}} {{id}}<br/>
</script>

<script id="log-server-new_name-template" type="text/x-handlebars-template">
    Set server <a href="#servers/{{machine_id}}">{{machine_id_trunked}}</a>'s name to {{name}}<br/>
</script>

<script id="log-server-set_datacenter-template" type="text/x-handlebars-template">
    Set server 
    {{#if machine_exists}}
        <a href="#servers/{{machine_id}}">{{machine_name}}</a>'s 
    {{else}}
        [server no longer exists]
    {{/if}} 
    datacenter to <a href="#datacenters/{{datacenter_id}}">{{datacenter_name}}</a><br/>
</script>

<script id="log-datacenter-new_name-template" type="text/x-handlebars-template">
    Set datacenter <a href="#datacenters/{{datacenter_id}}">{{datacenter_id_trunked}}</a>'s name to {{name}}<br/>
</script>
<script id="log-database-new_name-template" type="text/x-handlebars-template">
    Set database <a href="#databases/{{database_id}}">{{database_id_trunked}}</a>'s name to {{name}}<br/>
</script>

<script id="log-entry-small_template" type="text/x-handlebars-template">
    <div class="row-fluid">
        <div class="span9">
            <p class="message">{{print_safe msg}}</p>
            <p class="from-machine">Posted by <a href="#servers/{{machine_uuid}}">{{machine_name}}</a></p>
        </div>
        <div class="span3">
            <p class="datetime">{{datetime}}</p>
        </div>
    </div>
</script>

<script id="log-namespace_value-small_template" type="text/x-handlebars-template">
    Changed table
    {{#if namespace_exists}}
        <a href="#tables/{{namespace_id}}">{{namespace_name}}</a>'s
    {{else}}
        [table no longer exists]
    {{/if}} 
    {{attribute}}<br/>
</script>

<script id="log-new_something-small_template" type="text/x-handlebars-template">
    Created a new {{type}}<br/>
</script>


<script id="log-machine_value-small_template" type="text/x-handlebars-template">
    Changed server 
    {{#if machine_exists}}
        <a href="#servers/{{machine_id}}">{{machine_name}}</a>'s 
    {{else}}
        [server no longer exists]
    {{/if}} 
    {{attribute}}<br/>
</script>

<script id="log-datacenter_value-small_template" type="text/x-handlebars-template">
    Changed datacenter <a href="#datacenters/{{datacenter_id}}">{{datacenter_name}}</a>'s {{attribute}}<br/>
</script>
<script id="log-database_value-small_template" type="text/x-handlebars-template">
    Changed database 
    {{#if database_exists}}
        <a href="#databases/{{database_id}}">{{database_name}}</a>'s
    {{else}}
        [database no longer exists]
    {{/if}} 
    {{attribute}}<br/>
</script>
