2025-01-17 11:03:00 +01:00
|
|
|
{% import 'macro/accordion.html' as accordion %}
|
|
|
|
|
|
|
|
{{ accordion.header('Database', 'database', 'admin', expanded=open_database, icon='database-2-line') }}
|
|
|
|
<h5 class="border-bottom">Status</h5>
|
2025-01-20 17:43:15 +01:00
|
|
|
{% 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 %}
|
2025-01-22 11:50:31 +01:00
|
|
|
{% if database_upgrade_needed %}
|
2025-01-17 11:03:00 +01:00
|
|
|
<div class="alert alert-warning" role="alert">
|
2025-01-20 17:43:15 +01:00
|
|
|
<p>Your database needs to be upgraded.</p>
|
2025-01-17 11:03:00 +01:00
|
|
|
<hr>
|
2025-01-20 17:43:15 +01:00
|
|
|
<div class="text-end">
|
2025-01-24 10:09:12 +01:00
|
|
|
<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>
|
2025-01-17 17:19:31 +01:00
|
|
|
</div>
|
2025-01-20 17:43:15 +01:00
|
|
|
</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>
|
2025-01-24 10:09:12 +01:00
|
|
|
<a href="{{ url_for('admin_database.download') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Download the database file</a>
|
2025-01-20 17:43:15 +01:00
|
|
|
</p>
|
|
|
|
{% if database_counters %}
|
2025-01-17 11:03:00 +01:00
|
|
|
<h5 class="border-bottom">Records</h5>
|
|
|
|
<div class="d-flex justify-content-start">
|
2025-01-20 17:43:15 +01:00
|
|
|
<ul class="list-group me-2">
|
|
|
|
{% for counter in database_counters %}
|
2025-01-26 10:29:33 +01:00
|
|
|
<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>
|
2025-01-20 16:36:31 +01:00
|
|
|
</li>
|
2025-01-24 10:03:53 +01:00
|
|
|
{% if not (loop.index % 5) %}
|
|
|
|
</ul>
|
|
|
|
<ul class="list-group me-2">
|
|
|
|
{% endif %}
|
2025-01-20 16:36:31 +01:00
|
|
|
{% endfor %}
|
2025-01-17 11:03:00 +01:00
|
|
|
</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 %}
|
2025-01-24 10:09:12 +01:00
|
|
|
<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>
|
2025-01-17 11:03:00 +01:00
|
|
|
{{ accordion.footer() }}
|