Make instructions failsafe in the admin
This commit is contained in:
parent
7ce029029d
commit
3d660c594b
@ -34,6 +34,7 @@ def admin() -> str:
|
||||
database_exception: Exception | None = None
|
||||
database_upgrade_needed: bool = False
|
||||
database_version: int = -1
|
||||
instructions: BrickInstructionsList | None = None
|
||||
metadata_owners: list[BrickSetOwner] = []
|
||||
metadata_statuses: list[BrickSetStatus] = []
|
||||
metadata_storages: list[BrickSetStorage] = []
|
||||
@ -50,6 +51,8 @@ def admin() -> str:
|
||||
database_version = database.version
|
||||
database_counters = BrickSQL().count_records()
|
||||
|
||||
instructions = BrickInstructionsList()
|
||||
|
||||
metadata_owners = BrickSetOwnerList.list()
|
||||
metadata_statuses = BrickSetStatusList.list(all=True)
|
||||
metadata_storages = BrickSetStorageList.list()
|
||||
@ -104,7 +107,7 @@ def admin() -> str:
|
||||
database_exception=database_exception,
|
||||
database_upgrade_needed=database_upgrade_needed,
|
||||
database_version=database_version,
|
||||
instructions=BrickInstructionsList(),
|
||||
instructions=instructions,
|
||||
metadata_owners=metadata_owners,
|
||||
metadata_statuses=metadata_statuses,
|
||||
metadata_storages=metadata_storages,
|
||||
|
@ -6,6 +6,7 @@
|
||||
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>
|
||||
{% if instructions %}
|
||||
<h5 class="border-bottom">Counters</h5>
|
||||
<p>
|
||||
<div class="d-flex justify-content-start">
|
||||
@ -25,6 +26,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</p>
|
||||
{% endif %}
|
||||
<h5 class="border-bottom">Refresh</h5>
|
||||
<p>
|
||||
<a href="{{ url_for('admin_instructions.refresh') }}" class="btn btn-primary" role="button"><i class="ri-refresh-line"></i> Refresh the instructions cache</a>
|
||||
|
Loading…
Reference in New Issue
Block a user