improved system info even more

This commit is contained in:
vabene1111 2023-07-27 20:48:51 +02:00
parent 2b5a86ce53
commit 22dfb40fd5
4 changed files with 39 additions and 30 deletions

View File

@ -19,30 +19,32 @@
<h3 class="mt-5">{% trans 'System Information' %}</h3>
<span class="mt-3">
Current Version: {% if version and version != '' %}
<a href="https://github.com/vabene1111/recipes/releases/tag/{{ version }}">{{ version }}</a>{% else %}
{{ version }}{% endif %}<br/>
</span>
<div class="row">
<div class="col col-md-6">
<div class="list-group">
{% for v in version_info %}
<div class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
{% if v.website %}
<a href="{{ v.website }}" target="_blank"><h5 class="mb-1">{{ v.name }}</h5></a>
{% else %}
<h5 class="mb-1">{{ v.name }}</h5>
{% endif %}
{% if v.commit_link %}
<a href="{{ v.commit_link }}" target="_blank">Commit</a>
{% endif %}
</div>
<pre class="card-text">{{ v.version }}</pre>
<div class="list-group">
{% for v in version_info %}
<div class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
{% if v.website %}
<a href="{{ v.website }}" target="_blank"><h5 class="mb-1">{{ v.name }}</h5></a>
{% else %}
<h5 class="mb-1">{{ v.name }}</h5>
{% endif %}
</div>
<pre class="card-text">{{ v.version }}</pre>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
<h4 class="mt-3">{% trans 'Media Serving' %} <span class="badge badge-{% if gunicorn_media %}danger{% else %}success{% endif %}">{% if gunicorn_media %}
{% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
{% if gunicorn_media %}

View File

@ -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,

View File

@ -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,

View File

@ -1,2 +1,2 @@
VERSION_NUMBER = "0.0.0"
VERSION_NUMBER = ""
BUILD_REF = ""