{% extends "base.html" %}

{% block content %}

<script>
        $(document).ready(function(){
            // Pre-populated initial data at page load
            var content_data = {{ content_data }};

            var refresh = function() {
                $.get("{{ url_prefix }}/clients_data/" + content_data.fscid  + "/", function(data) {
                    content_data.clients = data;
                    setTimeout(refresh, 5000);
                });
            };

            console.log(content_data);

            rivets.bind($("div#content"), content_data);
            setTimeout(refresh, 5000);
        });
</script>


<section class="content-header">
    <h1>
        Clients of <a rv-href="fs_url">{fs_name}</a>
    </h1>
</section>

<section class="content">
    <div class="box">
        <div class="box-body">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>Type</th>
                    <th>State</th>
                    <th>Version</th>
                    <th>Host</th>
                    <th>Root</th>
                </tr>
                </thead>
                <tbody>
                <tr rv-each-client="clients">
                    <td>{client.id}</td>
                    <td>{client.type}</td>
                    <td>{client.state}</td>
                    <td>{client.version}</td>
                    <td>{client.hostname}</td>
                    <td>{client.root}</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>


</section>
<!-- /.content -->

{% endblock %}
