Don't store complex objects in Flash config that could mask existing config items, rather store the values and handle the actual list of conf differently

This commit is contained in:
2025-01-20 15:20:07 +01:00
parent 3712356caa
commit e232e2ab7f
37 changed files with 126 additions and 118 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
{% block main %}
<div class="container">
{% if not config['HIDE_ADD_BULK_SET'].value %}
{% if not config['HIDE_ADD_BULK_SET'] %}
<div class="alert alert-primary" role="alert">
<h4 class="alert-heading">Too many to add?</h4>
<p class="mb-0">You can import multiple sets at once with <a href="{{ url_for('add.bulk') }}" class="btn btn-primary"><i class="ri-function-add-line"></i> Bulk add</a>.</p>
+1 -1
View File
@@ -21,7 +21,7 @@
{% else %}
{% include 'admin/logout.html' %}
{% include 'admin/instructions.html' %}
{% if not config['USE_REMOTE_IMAGES'].value %}
{% if not config['USE_REMOTE_IMAGES'] %}
{% include 'admin/image.html' %}
{% endif %}
{% include 'admin/theme.html' %}
+2 -2
View File
@@ -6,7 +6,7 @@
{% if error %}<div class="alert alert-danger" role="alert"><strong>Error:</strong> {{ error }}.</div>{% endif %}
{% if not is_init %}
<div class="alert alert-warning" role="alert">
<p>The database file is: <code>{{ config['DATABASE_PATH'].value }}</code>. The database is not initialized.</p>
<p>The database file is: <code>{{ config['DATABASE_PATH'] }}</code>. The database is not initialized.</p>
<hr>
<form action="{{ url_for('admin.init_database') }}" method="post" class="text-end">
<button type="submit" class="btn btn-warning"><i class="ri-reset-right-fill"></i> Initialize the database</button>
@@ -25,7 +25,7 @@
</form>
</div>
{% endif %}
<p>The database file is: <code>{{ config['DATABASE_PATH'].value }}</code>. <i class="ri-checkbox-circle-line"></i> The database is initialized.</p>
<p>The database file is: <code>{{ config['DATABASE_PATH'] }}</code>. <i class="ri-checkbox-circle-line"></i> The database is initialized.</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>
</p>
+2 -2
View File
@@ -3,8 +3,8 @@
{{ accordion.header('Instructions', 'instructions', 'admin', expanded=open_instructions, icon='file-line') }}
<h5 class="border-bottom">Folder</h5>
<p>
The instructions files folder is: <code>{{ config['INSTRUCTIONS_FOLDER'].value }}</code>. <br>
Allowed file formats for instructions are the following: <code>{{ ', '.join(config['INSTRUCTIONS_ALLOWED_EXTENSIONS'].value) }}</code>.
The instructions files folder is: <code>{{ config['INSTRUCTIONS_FOLDER'] }}</code>. <br>
Allowed file formats for instructions are the following: <code>{{ ', '.join(config['INSTRUCTIONS_ALLOWED_EXTENSIONS']) }}</code>.
</p>
<h5 class="border-bottom">Counters</h5>
<p>
+1 -1
View File
@@ -4,7 +4,7 @@
<h5 class="border-bottom">File</h5>
{% if retired.exception %}<div class="alert alert-danger" role="alert">An exception occured while loading processing the retired sets: {{ retired.exception }}</div>{% endif %}
<p>
The retired sets file is: <code>{{ config['RETIRED_SETS_PATH'].value }}</code>.
The retired sets file is: <code>{{ config['RETIRED_SETS_PATH'] }}</code>.
{% if retired.size %}<span class="badge rounded-pill text-bg-info fw-normal"><i class="ri-hard-drive-line"></i> {{ retired.human_size() }}</span>{% endif %}
{% if retired.mtime %}<span class="badge rounded-pill text-bg-light border fw-normal"><i class="ri-calendar-line"></i> {{ retired.human_time() }}</span>{% endif %}
</p>
+1 -1
View File
@@ -4,7 +4,7 @@
<h5 class="border-bottom">File</h5>
{% if theme.exception %}<div class="alert alert-danger" role="alert">An exception occured while loading processing the themes: {{ theme.exception }}</div>{% endif %}
<p>
The themes file is: <code>{{ config['THEMES_PATH'].value }}</code>.
The themes file is: <code>{{ config['THEMES_PATH'] }}</code>.
{% if theme.size %}<span class="badge rounded-pill text-bg-info fw-normal"><i class="ri-hard-drive-line"></i> {{ theme.human_size() }}</span>{% endif %}
{% if theme.mtime %}<span class="badge rounded-pill text-bg-light border fw-normal"><i class="ri-calendar-line"></i> {{ theme.human_time() }}</span>{% endif %}
</p>
+2 -2
View File
@@ -25,7 +25,7 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
{% for item in config['_NAVBAR'] %}
{% if item.flag and not config[item.flag].value %}
{% if item.flag and not config[item.flag] %}
<li class="nav-item px-1">
<a {% if request.url_rule.endpoint == item.endpoint %}class="nav-link active" aria-current="page"{% else %}class="nav-link"{% endif %} href="{{ url_for(item.endpoint) }}">
{% if item.icon %}
@@ -61,7 +61,7 @@
<div class="col-md-6 d-flex justify-content-center">
<small>
<i class="ri-timer-2-line"></i> {{ g.request_time() }}
{%if config['DEBUG'].value and g.database_stats %}
{%if config['DEBUG'] and g.database_stats %}
| <i class="ri-database-2-line"></i> {{g.database_stats.print() }}
{% endif %}
</small>
+4 -4
View File
@@ -3,8 +3,8 @@
{% block main %}
<div class="container-fluid">
<h2 class="border-bottom lh-base pb-1">
<i class="ri-hashtag"></i> {% if config['RANDOM'].value %}Random selection of{% else %}Latest added{% endif %} sets
{% if not config['HIDE_ALL_SETS'].value %}
<i class="ri-hashtag"></i> {% if config['RANDOM'] %}Random selection of{% else %}Latest added{% endif %} sets
{% if not config['HIDE_ALL_SETS'] %}
<a href="{{ url_for('set.list') }}" class="btn btn-sm btn-primary ms-1">All sets</a>
{% endif %}
</h2>
@@ -23,8 +23,8 @@
{% endif %}
{% if minifigure_collection | length %}
<h2 class="border-bottom lh-base pb-1">
<i class="ri-group-line"></i> {% if config['RANDOM'].value %}Random selection of{% else %}Latest added{% endif %} minifigures
{% if not config['HIDE_ALL_MINIFIGURES'].value %}
<i class="ri-group-line"></i> {% if config['RANDOM'] %}Random selection of{% else %}Latest added{% endif %} minifigures
{% if not config['HIDE_ALL_MINIFIGURES'] %}
<a href="{{ url_for('minifigure.list') }}" class="btn btn-sm btn-primary ms-1">All minifigures</a>
{% endif %}
</h2>
+2 -2
View File
@@ -26,8 +26,8 @@
<div class="mb-3">
<label for="file" class="form-label">Instructions file</label>
<div class="input-group">
<input type="file" class="form-control" id="file" name="file" accept="{{ ','.join(config['INSTRUCTIONS_ALLOWED_EXTENSIONS'].value) }}">
<span class="input-group-text">{{ ', '.join(config['INSTRUCTIONS_ALLOWED_EXTENSIONS'].value) }}</span>
<input type="file" class="form-control" id="file" name="file" accept="{{ ','.join(config['INSTRUCTIONS_ALLOWED_EXTENSIONS']) }}">
<span class="input-group-text">{{ ', '.join(config['INSTRUCTIONS_ALLOWED_EXTENSIONS']) }}</span>
</div>
</div>
<div class="text-end">
+1 -1
View File
@@ -16,7 +16,7 @@
{% endif %}
</button>
</h2>
<div id="{{ id }}" class="accordion-collapse collapse {% if expanded %}show{% endif %}" {% if not config['INDEPENDENT_ACCORDIONS'].value %}data-bs-parent="#{{ parent }}"{% endif %}>
<div id="{{ id }}" class="accordion-collapse collapse {% if expanded %}show{% endif %}" {% if not config['INDEPENDENT_ACCORDIONS'] %}data-bs-parent="#{{ parent }}"{% endif %}>
<div class="accordion-body {% if class %}{{ class }}{% endif %}">
{% endmacro %}
+1 -1
View File
@@ -60,7 +60,7 @@
{% if number %}{ select: [{{ number }}], type: "number", searchable: false },{% endif %}
],
pagerDelta: 1,
perPage: {{ config['DEFAULT_TABLE_PER_PAGE'].value }},
perPage: {{ config['DEFAULT_TABLE_PER_PAGE'] }},
perPageSelect: [10, 25, 50, 100, 500, 1000],
searchable: true,
searchQuerySeparator: "",