From 2b5a86ce5352b9127e5d867b81afe95223218f7b Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 27 Jul 2023 20:40:25 +0200 Subject: [PATCH] improved system page --- cookbook/templates/system.html | 46 ++++++++++++++++++++-------------- cookbook/views/views.py | 17 +++++++++++-- recipes/settings.py | 1 + 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/cookbook/templates/system.html b/cookbook/templates/system.html index d8e06b94..d06e8736 100644 --- a/cookbook/templates/system.html +++ b/cookbook/templates/system.html @@ -11,31 +11,39 @@ {% block content %}

{% trans 'System' %}

- -
-
-
-
- -

{% trans 'System Information' %}

- {% blocktrans %} Django Recipes is an open source free software application. It can be found on GitHub. Changelogs can be found here. {% endblocktrans %} -
-
- Current Version: {% if version and version != '' %} - {{ version }}{% else %} - {{ version }}{% endif %}
- Ref: {{ ref }} -
{{ version_info }}
-
-
-
-

{% trans 'Media Serving' %} {% if gunicorn_media %} +

{% 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 %} +
+
{{ v.version }}
+ +
+ + {% endfor %} +
+ + +

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

{% if gunicorn_media %} {% blocktrans %}Serving media files directly using gunicorn/python is not recommend! diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 00e1a331..0b285113 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -319,8 +319,21 @@ def system(request): secret_key = False if os.getenv('SECRET_KEY') else True 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 = r.decode() + # 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']) + version_info.append({ + 'name': p['name'], + 'version': re.sub(r'<.*>', '', r.decode()), + 'website': p['website'] + }) return render(request, 'system.html', { 'gunicorn_media': settings.GUNICORN_MEDIA, diff --git a/recipes/settings.py b/recipes/settings.py index d2c45264..8866b8e5 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -149,6 +149,7 @@ try: plugin_config = { '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 '', 'module': f'recipes.plugins.{d}', 'base_path': os.path.join(BASE_DIR, 'recipes', 'plugins', d), 'base_url': plugin_class.base_url,