new version script

This commit is contained in:
vabene1111
2023-07-29 08:32:10 +02:00
parent 2fdcdba889
commit 0688f46d8b
9 changed files with 98 additions and 88 deletions

View File

@@ -18,32 +18,30 @@
{% endblocktrans %}
<h3 class="mt-5">{% trans 'System Information' %}</h3>
<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 version_if %}
<div class="row">
<div class="col">
<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">
<h5 class="mb-1">{{ v.name }} ({{ v.branch }}) {% if v.tag %}- {{ v.tag }}{% endif %}</h5>
</div>
<pre class="card-text p-2" style="border: 1px solid lightgrey; border-radius: 5px" target="_blank">{{ v.version }}</pre>
<a href="{{ v.website }}">Website</a>
{% if v.commit_link %}
<a href="{{ v.commit_link }}" target="_blank">Commit</a>
- <a href="{{ v.commit_link }}" target="_blank">Commit</a>
{% endif %}
</div>
<pre class="card-text">{{ v.version }}</pre>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
</div>
</div>
{% else %}
{% blocktrans %}
You need to execute <code>version.py</code> in your update script to generate version information (done automatically in docker).
{% endblocktrans %}
{% endif %}
<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>
@@ -56,10 +54,9 @@
{% else %}
{% trans 'Everything is fine!' %}
{% endif %}
<br/>
<br/>
<h4>{% trans 'Secret Key' %} <span
<h4 class="mt-3">{% trans 'Secret Key' %} <span
class="badge badge-{% if secret_key %}danger{% else %}success{% endif %}">{% if secret_key %}
{% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
{% if secret_key %}
@@ -72,10 +69,8 @@
{% else %}
{% trans 'Everything is fine!' %}
{% endif %}
<br/>
<br/>
<h4>{% trans 'Debug Mode' %} <span
<h4 class="mt-3">{% trans 'Debug Mode' %} <span
class="badge badge-{% if debug %}danger{% else %}success{% endif %}">{% if debug %}
{% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
{% if debug %}
@@ -87,10 +82,8 @@
{% else %}
{% trans 'Everything is fine!' %}
{% endif %}
<br/>
<br/>
<h4>{% trans 'Database' %} <span
<h4 class="mt-3">{% trans 'Database' %} <span
class="badge badge-{% if postgres %}warning{% else %}success{% endif %}">{% if postgres %}
{% trans 'Info' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
{% if postgres %}
@@ -101,12 +94,6 @@
{% else %}
{% trans 'Everything is fine!' %}
{% endif %}
<br/>
<br/>
<h4>Plugins</h4>
{% for p in plugins %}
{{ p.name }} - {{ p.version }} <br/>
{% endfor %}
<h4 class="mt-3">Debug</h4>
<textarea class="form-control" rows="20">

View File

@@ -7,7 +7,7 @@ from rest_framework.schemas import get_schema_view
from cookbook.helper import dal
from recipes.settings import DEBUG, PLUGINS
from recipes.version import VERSION_NUMBER
from version_info import TANDOOR_VERSION
from .models import (Automation, Comment, CustomFilter, Food, InviteLink, Keyword, MealPlan, Recipe,
RecipeBook, RecipeBookEntry, RecipeImport, ShoppingList, Step, Storage,
@@ -148,7 +148,7 @@ urlpatterns = [
path('docs/search/', views.search_info, name='docs_search'),
path('docs/api/', views.api_info, name='docs_api'),
path('openapi/', get_schema_view(title="Django Recipes", version=VERSION_NUMBER, public=True,
path('openapi/', get_schema_view(title="Django Recipes", version=TANDOOR_VERSION, public=True,
permission_classes=(permissions.AllowAny,)), name='openapi-schema'),
path('api/', include((router.urls, 'api'))),

View File

@@ -24,8 +24,9 @@ from cookbook.helper.permission_helper import group_required, has_group_permissi
from cookbook.models import (Comment, CookLog, InviteLink, SearchFields, SearchPreference, ShareLink,
Space, ViewLog, UserSpace)
from cookbook.tables import (CookLogTable, ViewLogTable)
from recipes.settings import PLUGINS, BASE_DIR
from recipes.version import BUILD_REF, VERSION_NUMBER
from recipes.settings import PLUGINS
from version_info import VERSION_INFO
def index(request):
@@ -319,34 +320,11 @@ def system(request):
secret_key = False if os.getenv('SECRET_KEY') else True
version_info = []
try:
r = subprocess.check_output(['git', 'show', '-s'], cwd=BASE_DIR)
version_info.append({
'name': 'Tandoor ' + VERSION_NUMBER,
'version': re.sub(r'<.*>', '', r.decode()),
'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_info': version_info,
'ref': BUILD_REF,
'version_info': VERSION_INFO,
'plugins': PLUGINS,
'secret_key': secret_key
})