{% extends "layout.html" %}
{% set active_page = "dashboard" %}

{% block body %}

    <div class="container">
        <div class="card">
            <div class="card-header">Global information</div>
            <div class="card-body">
                <table class="info-table table-hover table-striped">
                    <tbody>
                    <tr>
                        <th>Version</th>
                        <td><pre>{{ version }}</pre></td>
                    </tr>
                    <tr>
                        <th>Total thumbnail cache size</th>
                        <td><pre>{{ tn_size_total }}</pre></td>
                    </tr>
                    <tr>
                        <th>Total document count</th>
                        <td><pre>{{ doc_count }}</pre></td>
                    </tr>
                    <tr>
                        <th>Total size of indexed documents</th>
                        <td><pre>{{ doc_size }}</pre></td>
                    </tr>
                    <tr>
                        <th>total index size</th>
                        <td><pre>{{ index_size }}</pre></td>
                    </tr>
                    <tr>
                        <th>User count</th>
                        <td><pre>1</pre></td>
                    </tr>
                    <tr>
                        <th>SQLite database path</th>
                        <td><pre>{{ db_path }}</pre></td>
                    </tr>
                    <tr>
                        <th>Elasticsearch URL</th>
                        <td><pre>{{ elasticsearch_url }}</pre></td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <div class="card-footer text-muted">Change global settings in <b>config.py</b></div>
        </div>

        <div class="card">
            <div class="card-header">Actions</div>
            <div class="card-body">
                <button class="btn btn-danger" onclick="resetAll()">
                    <i class="fas fa-exclamation-triangle"></i> Reset Elasticsearch
                </button>
            </div>
        </div>
    </div>

    <script>
        function resetAll() {
            if (confirm("This will entirely reset the index and documents will need to be re-indexed.\n\n" +
                    "Do you want to proceed?")) {
                window.location = "/reset_es"
            }
        }
    </script>

{% endblock body %}