feat(UI): show build details with page footer

!12 #25
This commit is contained in:
2024-05-27 13:32:20 +09:30
parent 19d24b54a2
commit da0d3a816d
3 changed files with 33 additions and 1 deletions

View File

@ -2,11 +2,21 @@ import re
from app.urls import urlpatterns
from django.conf import settings
from django.urls import URLPattern, URLResolver
from settings.models.user_settings import UserSettings
def build_details(context) -> dict:
return {
'project_url': settings.BUILD_REPO,
'sha': settings.BUILD_SHA,
'version': settings.BUILD_VERSION,
}
def request(request):
return request.get_full_path()
@ -115,6 +125,7 @@ def nav_items(context) -> list(dict()):
def common(context):
return {
'build_details': build_details(context),
'nav_items': nav_items(context),
'user_settings': user_settings(context),
}

View File

@ -9,6 +9,7 @@ https://docs.djangoproject.com/en/5.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/ref/settings/
"""
import os
from pathlib import Path
@ -18,6 +19,11 @@ from split_settings.tools import optional, include
BASE_DIR = Path(__file__).resolve().parent.parent
SETTINGS_DIR = '/etc/itsm' # Primary Settings Directory
BUILD_REPO = os.getenv('CI_PROJECT_URL')
BUILD_SHA = os.getenv('CI_COMMIT_SHA')
BUILD_VERSION = os.getenv('CI_COMMIT_TAG')
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
@ -222,4 +228,6 @@ if DEBUG:
# Apps Under Development
INSTALLED_APPS += [
'information.apps.InformationConfig',
'config_management.apps.ConfigManagementConfig',
'project_management.apps.ProjectManagementConfig',
]

View File

@ -92,7 +92,20 @@ section h2 span svg {
{% block body%}{% endblock %}
</article>
{% endblock %}
<footer>{% block footer%}{% endblock %}</footer>
<footer>
<span style="position:relative; font-size: 12px">
Build details:
{% if build_details.version %}
version: {{ build_details.version }}
{% else %}
development
{% endif %}
({% if build_details.url%}(<a href="{{ build_details.url }}/-/commit/{{ build_details.sha }}" target="_blank">{% endif %}
{{ build_details.sha }}
{% if build_details.url%}</a>{% endif %})
</span>
<span></span>
</footer>
</section>
</main>