Split the uncomfortably big admin view into smaller admin views

This commit is contained in:
2025-01-24 10:09:12 +01:00
parent e2bcd61ace
commit 798226932f
19 changed files with 472 additions and 353 deletions
+5 -5
View File
@@ -9,13 +9,13 @@
<p>Your database needs to be upgraded.</p>
<hr>
<div class="text-end">
<a href="{{ url_for('admin.upgrade_database') }}" class="btn btn-warning" role="button"><i class="ri-arrow-up-double-line"></i> Upgrade the database</a>
<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.download_database') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Download the database file</a>
<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>
@@ -37,7 +37,7 @@
{{ 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.import_database') }}" class="btn btn-warning" role="button"><i class="ri-upload-line"></i> Import a database file</a>
<a href="{{ url_for('admin.drop_database') }}" class="btn btn-danger" role="button"><i class="ri-close-line"></i> Drop the database</a>
<a href="{{ url_for('admin.delete_database') }}" class="btn btn-danger" role="button"><i class="ri-delete-bin-2-line"></i> Delete the database file</a>
<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() }}
+1 -1
View File
@@ -1,7 +1,7 @@
{% import 'macro/accordion.html' as accordion %}
{{ accordion.header('Database danger zone', 'database-danger', 'admin', expanded=true, danger=true, class='text-end') }}
<form action="{{ url_for('admin.do_delete_database') }}" method="post">
<form action="{{ url_for('admin_database.do_delete') }}" method="post">
{% if error %}<div class="alert alert-danger text-start" role="alert"><strong>Error:</strong> {{ error }}.</div>{% endif %}
<div class="alert alert-danger text-center" role="alert">You are about to <strong>delete the database file</strong>. This action is irreversible.</div>
<a class="btn btn-danger" href="{{ url_for('admin.admin') }}" role="button"><i class="ri-arrow-left-long-line"></i> Back to the admin</a>
+1 -1
View File
@@ -1,7 +1,7 @@
{% import 'macro/accordion.html' as accordion %}
{{ accordion.header('Database danger zone', 'database-danger', 'admin', expanded=true, danger=true, class='text-end') }}
<form action="{{ url_for('admin.do_drop_database') }}" method="post">
<form action="{{ url_for('admin_database.do_drop') }}" method="post">
{% if error %}<div class="alert alert-danger text-start" role="alert"><strong>Error:</strong> {{ error }}.</div>{% endif %}
<div class="alert alert-danger text-center" role="alert">You are about to <strong>drop all the tables from the database</strong>. This action is irreversible.</div>
<a class="btn btn-danger" href="{{ url_for('admin.admin') }}" role="button"><i class="ri-arrow-left-long-line"></i> Back to the admin</a>
+1 -1
View File
@@ -1,7 +1,7 @@
{% import 'macro/accordion.html' as accordion %}
{{ accordion.header('Database danger zone', 'database-danger', 'admin', expanded=true, danger=true) }}
<form action="{{ url_for('admin.do_import_database') }}" method="post" enctype="multipart/form-data">
<form action="{{ url_for('admin_database.do_upload') }}" method="post" enctype="multipart/form-data">
{% if error %}<div class="alert alert-danger text-start" role="alert"><strong>Error:</strong> {{ error }}.</div>{% endif %}
<div class="alert alert-warning text-center" role="alert">You are about to <strong>import a database file</strong>. This will replace the <strong>whole content</strong> of the database. This action is irreversible.</div>
<div class="mb-3">
+2 -2
View File
@@ -1,7 +1,7 @@
{% import 'macro/accordion.html' as accordion %}
{{ accordion.header('Database', 'database', 'admin', expanded=true, icon='database-2-line') }}
<form action="{{ url_for('admin.do_upgrade_database') }}" method="post">
<form action="{{ url_for('admin_database.do_upgrade') }}" method="post">
{% if error %}<div class="alert alert-danger text-start" role="alert"><strong>Error:</strong> {{ error }}.</div>{% endif %}
<div class="alert alert-warning text-center" role="alert">
You are about to <strong>upgrade your database file</strong>. This action is irreversible.<br>
@@ -22,7 +22,7 @@
</ul>
<div class="text-end">
<a class="btn btn-danger" href="{{ url_for('admin.admin') }}" role="button"><i class="ri-arrow-left-long-line"></i> Back to the admin</a>
<a href="{{ url_for('admin.download_database') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Download the database file</a>
<a href="{{ url_for('admin_database.download') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Download the database file</a>
<button type="submit" class="btn btn-warning"><i class="ri-arrow-up-double-line"></i> Upgrade the database</button>
</div>
</form>
+1 -1
View File
@@ -9,6 +9,6 @@
<img class="table-img border mx-1" src="{{ nil_part_url }}" alt="{{ nil_part_name }}">
</div>
<p>
<a href="{{ url_for('admin.update_image') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Update the images</a>
<a href="{{ url_for('admin_image.update') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Update the images</a>
</p>
{{ accordion.footer() }}
+1 -1
View File
@@ -27,6 +27,6 @@
</p>
<h5 class="border-bottom">Refresh</h5>
<p>
<a href="{{ url_for('admin.refresh_instructions') }}" class="btn btn-primary" role="button"><i class="ri-refresh-line"></i> Refresh the instructions cache</a>
<a href="{{ url_for('admin_instructions.refresh') }}" class="btn btn-primary" role="button"><i class="ri-refresh-line"></i> Refresh the instructions cache</a>
</p>
{{ accordion.footer() }}
+2 -2
View File
@@ -20,7 +20,7 @@
</p>
<h5 class="border-bottom">Refresh</h5>
<p>
<a href="{{ url_for('admin.refresh_retired') }}" class="btn btn-primary" role="button"><i class="ri-refresh-line"></i> Refresh the retired sets cache</a>
<a href="{{ url_for('admin.update_retired') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Update the retired sets file</a>
<a href="{{ url_for('admin_retired.refresh') }}" class="btn btn-primary" role="button"><i class="ri-refresh-line"></i> Refresh the retired sets cache</a>
<a href="{{ url_for('admin_retired.update') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Update the retired sets file</a>
</p>
{{ accordion.footer() }}
+2 -2
View File
@@ -20,7 +20,7 @@
</p>
<h5 class="border-bottom">Refresh</h5>
<p>
<a href="{{ url_for('admin.refresh_themes') }}" class="btn btn-primary" role="button"><i class="ri-refresh-line"></i> Refresh the themes cache</a>
<a href="{{ url_for('admin.update_themes') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Update the themes file</a>
<a href="{{ url_for('admin_theme.refresh') }}" class="btn btn-primary" role="button"><i class="ri-refresh-line"></i> Refresh the themes cache</a>
<a href="{{ url_for('admin_theme.update') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Update the themes file</a>
</p>
{{ accordion.footer() }}