{% extends "base.html" %}
{% set active_page = 'dashboard' %}
{% block custom_head %}
    <script type="text/javascript">
    if (!window.location.pathname.endsWith('/')) {
        window.location.assign(window.location.pathname + '/'
            + window.location.search + window.location.hash);
    }
    </script>
{% endblock %}
{% block body %}
    <div class="row">
        <div><h2>Scheduler Summary</h2></div>
        <table class="table">
            <thead>
            <tr>
                <th>Item</th>
                <th>Value</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>Count</td>
                <td><pre class="plain-pre">{{ scheduler_summary['count'] }}</pre></td>
            </tr>
            <tr>
                <td>CPU Info</td>
                <td><pre class="plain-pre">Usage: {{ '%0.2f' % scheduler_summary['cpu_used'] }}
Total: {{ scheduler_summary['cpu_total'] }}</pre></td>
            </tr>
            <tr>
                <td>Memory Info</td>
                <td><pre class="plain-pre">Usage: {{ scheduler_summary['memory_used'] | readable_size }}
Total: {{ scheduler_summary['memory_total'] | readable_size }}</pre></td>
            </tr>
            <tr>
                <td>Git Branches</td>
                <td><pre class="plain-pre">{{ scheduler_summary['git_branches'] | join('\n') }}</pre></td>
            </tr>
            </tbody>
        </table>
        <div><h2>Worker Summary</h2></div>
        <table class="table">
            <thead>
            <tr>
                <th>Item</th>
                <th>Value</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>Count</td>
                <td><pre class="plain-pre">{{ worker_summary['count'] }}</pre></td>
            </tr>
            <tr>
                <td>CPU Info</td>
                <td><pre class="plain-pre">Usage: {{ '%0.2f' % worker_summary['cpu_used'] }}
Total: {{ worker_summary['cpu_total'] }}</pre></td>
            </tr>
            <tr>
                <td>Memory Info</td>
                <td><pre class="plain-pre">Usage: {{ worker_summary['memory_used'] | readable_size }}
Total: {{ worker_summary['memory_total'] | readable_size }}</pre></td>
            </tr>
            <tr>
                <td>Git Branches</td>
                <td><pre class="plain-pre">{{ worker_summary['git_branches'] | join('\n') }}</pre></td>
            </tr>
            </tbody>
        </table>
    </div>
{% endblock %}
