BrickTracker/templates/admin/database.html

44 lines
2.6 KiB
HTML

{% import 'macro/accordion.html' as accordion %}
{{ accordion.header('Database', 'database', 'admin', expanded=open_database, icon='database-2-line') }}
<h5 class="border-bottom">Status</h5>
{% if database_exception %}<div class="alert alert-danger" role="alert">An exception occured while loading this page: {{ database_exception }}</div>{% endif %}
{% if database_error %}<div class="alert alert-danger" role="alert"><strong>Error:</strong> {{ database_error }}.</div>{% endif %}
{% if database_upgrade_needed %}
<div class="alert alert-warning" role="alert">
<p>Your database needs to be upgraded.</p>
<hr>
<div class="text-end">
<a href="{{ url_for('admin_database.upgrade') }}" class="btn btn-warning" role="button"><i class="ri-arrow-up-double-line"></i> Upgrade the database</a>
</div>
</div>
{% endif %}
<p>The database file is: <code>{{ config['DATABASE_PATH'] }}</code> at version <span class="badge rounded-pill text-bg-light border fw-normal"><i class="ri-hashtag"></i>{{ database_version }}</span></p>
<p>
<a href="{{ url_for('admin_database.download') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Download the database file</a>
</p>
{% if database_counters %}
<h5 class="border-bottom">Records</h5>
<div class="d-flex justify-content-start">
<ul class="list-group me-2">
{% for counter in database_counters %}
<li class="list-group-item d-flex justify-content-between align-items-start {% if counter.legacy %}list-group-item-dark{% endif %}">
<span><i class="ri-{{ counter.icon }}"></i> {{ counter.name }}</span> <span class="badge {% if counter.legacy %}text-bg-light border{% else %}text-bg-primary{% endif %} rounded-pill ms-2">{{ counter.count }}</span>
</li>
{% if not (loop.index % 5) %}
</ul>
<ul class="list-group me-2">
{% endif %}
{% endfor %}
</ul>
</div>
{% endif %}
{{ accordion.footer() }}
{{ accordion.header('Database danger zone', 'database-danger', 'admin', danger=true, class='text-end') }}
{% if error %}<div class="alert alert-danger text-start" role="alert"><strong>Error:</strong> {{ error }}.</div>{% endif %}
<a href="{{ url_for('admin_database.upload') }}" class="btn btn-warning" role="button"><i class="ri-upload-line"></i> Import a database file</a>
<a href="{{ url_for('admin_database.drop') }}" class="btn btn-danger" role="button"><i class="ri-close-line"></i> Drop the database</a>
<a href="{{ url_for('admin_database.delete') }}" class="btn btn-danger" role="button"><i class="ri-delete-bin-2-line"></i> Delete the database file</a>
{{ accordion.footer() }}