<commit_before><!DOCTYPE html>
<html>
<head>
    <meta name="robots" content="noindex, nofollow">
    <meta charset="utf-8"/>
    <title>Weather admin | Welome</title>

    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="<KEY>" crossorigin="anonymous">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <style>
        body {
            margin: 0;
        }

        section {
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-pack: center;
            -webkit-justify-content: center;
            -ms-flex-pack: center;
            justify-content: center;
        }

        div.panel {
            margin: 2em;
        }

        span.badge {
            margin-left: 5em;
        }
    </style>
</head>

{% macro statusColor(status) %}
    {{ status != 0 or status is null ? "#df340c" : "#01cd4f" }}
{% endmacro %}
<body>

    <section>
        {# Battery status #}

        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Station status</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(hardware.batteries.windBatteryStatus) }};">&nbsp;</span>
                        Wind sensor battery
                    </li>
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(hardware.batteries.rainBatteryStatus) }};">&nbsp;</span>
                        Rain sensor battery
                    </li>
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(hardware.batteries.outTempBatteryStatus) }};">&nbsp;</span>
                        Thermometer and hygrometer battery
                    </li>
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(hardware.batteries.inTempBatteryStatus) }};">&nbsp;</span>
                        Station console battery
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ hardware.last.format("Y-m-d H:i") }}</span>
                        Last update from console
                    </li>
                </ul>
            </div>
        </div>

        {# Database status #}
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Database status</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="badge">{{ database.count.archive }}</span>
                        Archive records count
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ database.count.day }}</span>
                        Day records count
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ database.size.total }} MB</span>
                        Total size
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ database.size.archive }} MB</span>
                        Archive table size
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ database.size.rest }} MB</span>
                        Day tables size
                    </li>
                </ul>
            </div>
        </div>

        {# Redis status #}
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Vhost status</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(not server.forecast.cached) }};">
                            {{ server.forecast.cached ? server.forecast.ttl|replace({'#': 'm.', '@': 's.'}) : 'Not cached' }}
                        </span>
                        Wunderground forecast
                    </li>

                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(not server.astronomy.cached) }};">
                            {{ server.astronomy.cached ? server.astronomy.ttl|replace({'#': 'm.', '@': 's.'}) : 'Not cached' }}
                        </span>
                        Wunderground astronomy
                    </li>

                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(not server.alerts.cached) }};">
                            {{ server.alerts.cached ? server.alerts.ttl|replace({'#': 'm.', '@': 's.'}) : 'Not cached' }}
                        </span>
                        Wunderground alerts
                    </li>

                    <li class="list-group-item">
                        <span class="badge">{{ not server.deploy ? '!!!' : server.deploy }}</span>
                         {{ not server.deploy ? 'Deploy running now' : 'Last deployment' }}
                    </li>

                    <li class="list-group-item">
                        <span class="badge">{{ server.branch }}</span>
                        Git branch
                    </li>
                </ul>
            </div>
        </div>
    </section>

    <section>
        {# Websocket status #}
        <div class="panel panel-default" style="width: 60%;">
            <div class="panel-heading">
                <h3 class="panel-title">WebSocket status</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    {% if not socket.pid %}
                        <li class="list-group-item list-group-item-danger">Server not running.</li>
                    {% else %}

                        {% for client in socket.hosts %}
                            <li class="list-group-item">
                                <span class="badge">{{ client.connected }}</span>
                                {{ client.ip }}
                            </li>
                        {% else %}
                            <li class="list-group-item list-group-item-warning">Nobody connected.</li>
                        {% endfor %}

                    {% endif %}
                </ul>
            </div>
        </div>
    </section>
</body>
</html>
<commit_msg>add actions panel to admin area<commit_after><!DOCTYPE html>
<html>
<head>
    <meta name="robots" content="noindex, nofollow">
    <meta charset="utf-8"/>
    <title>Weather admin | Welome</title>

    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="<KEY>" crossorigin="anonymous">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <style>
        body {
            margin: 0;
        }

        section {
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-pack: center;
            -webkit-justify-content: center;
            -ms-flex-pack: center;
            justify-content: center;
        }

        div.panel {
            margin: 2em;
        }

        span.badge {
            margin-left: 5em;
        }
    </style>
</head>

{% macro statusColor(status) %}
    {{ status != 0 or status is null ? "#df340c" : "#01cd4f" }}
{% endmacro %}
<body>

    <section>
        {# Battery status #}

        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Station status</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(hardware.batteries.windBatteryStatus) }};">&nbsp;</span>
                        Wind sensor battery
                    </li>
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(hardware.batteries.rainBatteryStatus) }};">&nbsp;</span>
                        Rain sensor battery
                    </li>
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(hardware.batteries.outTempBatteryStatus) }};">&nbsp;</span>
                        Thermometer and hygrometer battery
                    </li>
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(hardware.batteries.inTempBatteryStatus) }};">&nbsp;</span>
                        Station console battery
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ hardware.last.format("Y-m-d H:i") }}</span>
                        Last update from console
                    </li>
                </ul>
            </div>
        </div>

        {# Database status #}
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Database status</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="badge">{{ database.count.archive }}</span>
                        Archive records count
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ database.count.day }}</span>
                        Day records count
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ database.size.total }} MB</span>
                        Total size
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ database.size.archive }} MB</span>
                        Archive table size
                    </li>
                    <li class="list-group-item">
                        <span class="badge">{{ database.size.rest }} MB</span>
                        Day tables size
                    </li>
                </ul>
            </div>
        </div>

        {# Redis status #}
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Vhost status</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(not server.forecast.cached) }};">
                            {{ server.forecast.cached ? server.forecast.ttl|replace({'#': 'm.', '@': 's.'}) : 'Not cached' }}
                        </span>
                        Wunderground forecast
                    </li>

                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(not server.astronomy.cached) }};">
                            {{ server.astronomy.cached ? server.astronomy.ttl|replace({'#': 'm.', '@': 's.'}) : 'Not cached' }}
                        </span>
                        Wunderground astronomy
                    </li>

                    <li class="list-group-item">
                        <span class="badge" style="background: {{ _self.statusColor(not server.alerts.cached) }};">
                            {{ server.alerts.cached ? server.alerts.ttl|replace({'#': 'm.', '@': 's.'}) : 'Not cached' }}
                        </span>
                        Wunderground alerts
                    </li>

                    <li class="list-group-item">
                        <span class="badge">{{ not server.deploy ? '!!!' : server.deploy }}</span>
                         {{ not server.deploy ? 'Deploy running now' : 'Last deployment' }}
                    </li>

                    <li class="list-group-item">
                        <span class="badge">{{ server.branch }}</span>
                        Git branch
                    </li>
                </ul>
            </div>
        </div>
    </section>

    <section>
        {# Websocket status #}
        <div class="panel panel-default" style="width: 60%;">
            <div class="panel-heading">
                <h3 class="panel-title">WebSocket status</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    {% if not socket.pid %}
                        <li class="list-group-item list-group-item-danger">Server not running.</li>
                    {% else %}

                        {% for client in socket.hosts %}
                            <li class="list-group-item">
                                <span class="badge">{{ client.connected }}</span>
                                {{ client.ip }}
                            </li>
                        {% else %}
                            <li class="list-group-item list-group-item-warning">Nobody connected.</li>
                        {% endfor %}

                    {% endif %}
                </ul>
            </div>
        </div>

        {# Actions #}
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Actions</h3>
            </div>
            <div class="panel-body">
                <p>
                    <a class="btn btn-primary btn-lg" href="{{ path('syntax_error_api_home') }}" role="button">Go to API</a>
                    <a class="btn btn-primary btn-lg" href="/" role="button">Go to client</a>
                    <a class="btn btn-danger btn-lg" href="{{ path('syntax_error_api_admin_logout') }}" role="button">Logout</a>
                </p>
            </div>
        </div>
    </section>
</body>
</html>

{'fraction_non_alphanumeric': 0.14774564978329777, 'fraction_numerical': 0.004398732130150722, 'mean_word_length': 1.2812453888151099, 'pattern_counts': {'":': 0, '<': 293, '<?xml version=': 0, '>': 293, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5216914', 'n_tokens_mistral': 4253, 'n_tokens_neox': 3935, 'n_words': 788}