From 22dfb40fd5fce7a1c8dadd269ffc1b3f3bce644f Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 27 Jul 2023 20:48:51 +0200 Subject: [PATCH] improved system info even more --- cookbook/templates/system.html | 38 ++++++++++++++++++---------------- cookbook/views/views.py | 28 +++++++++++++++---------- recipes/settings.py | 1 + recipes/version.py | 2 +- 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/cookbook/templates/system.html b/cookbook/templates/system.html index d06e8736..1fd3cd50 100644 --- a/cookbook/templates/system.html +++ b/cookbook/templates/system.html @@ -19,30 +19,32 @@

{% trans 'System Information' %}

- - Current Version: {% if version and version != '' %} - {{ version }}{% else %} - {{ version }}{% endif %}
-
+
+
+
+ {% for v in version_info %} +
+
+ {% if v.website %} +
{{ v.name }}
+ {% else %} +
{{ v.name }}
+ {% endif %} + {% if v.commit_link %} + Commit + {% endif %} +
+
{{ v.version }}
-
- {% for v in version_info %} -
-
- {% if v.website %} -
{{ v.name }}
- {% else %} -
{{ v.name }}
- {% endif %} -
-
{{ v.version }}
+
+ {% endfor %}
- - {% endfor %} +
+

{% trans 'Media Serving' %} {% if gunicorn_media %} {% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}

{% if gunicorn_media %} diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 0b285113..44c8e213 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -1,6 +1,7 @@ import os import re import subprocess +import traceback from datetime import datetime from uuid import UUID @@ -321,25 +322,30 @@ def system(request): r = subprocess.check_output(['git', 'show', '-s'], cwd=BASE_DIR) # r = subprocess.check_output(['git', 'show', '-s'], cwd=os.path.join(BASE_DIR, 'recipes', 'plugins', 'enterprise_plugin')) version_info = [] - version_info.append({ - 'name': 'Tandoor', - 'version': re.sub(r'<.*>', '', r.decode()), - 'website': 'https://github.com/TandoorRecipes/recipes', - }) - - for p in PLUGINS: - r = subprocess.check_output(['git', 'show', '-s'], cwd=p['base_path']) + try: version_info.append({ - 'name': p['name'], + 'name': 'Tandoor ' + VERSION_NUMBER, 'version': re.sub(r'<.*>', '', r.decode()), - 'website': p['website'] + 'website': 'https://github.com/TandoorRecipes/recipes', + 'commit_link': 'https://github.com/TandoorRecipes/recipes/commit/' + r.decode().split('\n')[0].split(' ')[1], }) + for p in PLUGINS: + r = subprocess.check_output(['git', 'show', '-s'], cwd=p['base_path']) + version_info.append({ + 'name': 'Plugin: ' + p['name'], + 'version': re.sub(r'<.*>', '', r.decode()), + 'website': p['website'], + 'commit_link': p['website'] + '/commit/' + r.decode().split('\n')[0].split(' ')[1], + }) + except: + if settings.DEBUG: + traceback.print_exc() + return render(request, 'system.html', { 'gunicorn_media': settings.GUNICORN_MEDIA, 'debug': settings.DEBUG, 'postgres': postgres, - 'version': VERSION_NUMBER, 'version_info': version_info, 'ref': BUILD_REF, 'plugins': PLUGINS, diff --git a/recipes/settings.py b/recipes/settings.py index 8866b8e5..f7a4418e 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -150,6 +150,7 @@ try: 'name': plugin_class.verbose_name if hasattr(plugin_class, 'verbose_name') else plugin_class.name, 'version': plugin_class.VERSION if hasattr(plugin_class, 'VERSION') else 'unknown', 'website': plugin_class.website if hasattr(plugin_class, 'website') else '', + 'github': plugin_class.github if hasattr(plugin_class, 'github') else '', 'module': f'recipes.plugins.{d}', 'base_path': os.path.join(BASE_DIR, 'recipes', 'plugins', d), 'base_url': plugin_class.base_url, diff --git a/recipes/version.py b/recipes/version.py index 6ce6ba4c..7773c18d 100644 --- a/recipes/version.py +++ b/recipes/version.py @@ -1,2 +1,2 @@ -VERSION_NUMBER = "0.0.0" +VERSION_NUMBER = "" BUILD_REF = ""