From 0fed6b9fb3c61b85bee82ee8c275b13583476ab8 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 16 Dec 2023 14:03:32 +0100 Subject: [PATCH] added migration status to system page --- .idea/dictionaries/vaben.xml | 1 + .../inspectionProfiles/profiles_settings.xml | 1 + cookbook/templates/system.html | 140 ++++++++++++------ cookbook/views/views.py | 38 ++++- requirements.txt | 2 +- 5 files changed, 127 insertions(+), 55 deletions(-) diff --git a/.idea/dictionaries/vaben.xml b/.idea/dictionaries/vaben.xml index 3568ee84..e910c82d 100644 --- a/.idea/dictionaries/vaben.xml +++ b/.idea/dictionaries/vaben.xml @@ -3,6 +3,7 @@ pinia selfhosted + unapplied \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml index 105ce2da..dd4c951e 100644 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -1,5 +1,6 @@ + diff --git a/cookbook/templates/system.html b/cookbook/templates/system.html index de68a197..873d4665 100644 --- a/cookbook/templates/system.html +++ b/cookbook/templates/system.html @@ -83,51 +83,94 @@ {% trans 'Everything is fine!' %} {% endif %} -

{% trans 'Database' %} - +

{% trans 'Database' %} + {% if postgres_status == 'warning' %} {% trans 'Info' %} - {% elif postgres_status == 'danger'%} + {% elif postgres_status == 'danger' %} {% trans 'Warning' %} {% else %} {% trans 'Ok' %} {% endif %}

- {{postgres_message}} + {{ postgres_message }} -{#

#} -{# {% trans 'Orphaned Files' %}#} -{##} -{# #} -{# {% if orphans|length == 0 %}{% trans 'Success' %}#} -{# {% elif orphans|length <= 25 %}{% trans 'Warning' %}#} -{# {% else %}{% trans 'Danger' %}#} -{# {% endif %}#} -{# #} -{#

#} +

{% trans 'Migrations' %} + {% if missing_migration %} + {% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}

- {% if orphans|length == 0 %} - {% trans 'Everything is fine!' %} - {% else %} - {% blocktrans with orphan_count=orphans|length %} - There are currently {{ orphan_count }} orphaned files. +

+ {% blocktrans %} + Migrations should never fail! + Failed migrations will likely cause major parts of the app to not function correctly. + If a migration fails make sure you are on the latest version and if so please post the migration log and the overview below in a GitHub issue. {% endblocktrans %} -
- - - {% endif %} - +

+ + + + + + + + + {% for key,value in migration_info.items %} + + + + + + {% for u in value.unapplied_migrations %} + + + + + {% endfor %} + + {% endfor %} +
App{% trans 'Migrations' %}
{{ value.app }} + + {{ value.applied_migrations|length }} / {{ value.total }} + +
+ {{ u }} +
+ + + {#

#} + {# {% trans 'Orphaned Files' %}#} + {##} + {# #} + {# {% if orphans|length == 0 %}{% trans 'Success' %}#} + {# {% elif orphans|length <= 25 %}{% trans 'Warning' %}#} + {# {% else %}{% trans 'Danger' %}#} + {# {% endif %}#} + {# #} + {#

#} + + {# {% if orphans|length == 0 %}#} + {# {% trans 'Everything is fine!' %}#} + {# {% else %}#} + {# {% blocktrans with orphan_count=orphans|length %}#} + {# There are currently {{ orphan_count }} orphaned files.#} + {# {% endblocktrans %}#} + {#
#} + {# #} + {# #} + {# {% endif %}#} + {# #}

Debug