From 6ed4db0502e0b4b09cf6b88f07fdda8e33881be4 Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 30 Nov 2024 16:13:20 +0930 Subject: [PATCH] feat(api): Add API version details to the metadata ref: #411 nofusscomputing/centurion_erp_ui#29 --- app/api/react_ui_metadata.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/api/react_ui_metadata.py b/app/api/react_ui_metadata.py index 2ea73030d..1b9f6fff6 100644 --- a/app/api/react_ui_metadata.py +++ b/app/api/react_ui_metadata.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.utils.encoding import force_str from rest_framework import serializers @@ -139,6 +140,32 @@ def determine_metadata(self, request, view): metadata['layout'] = view.get_page_layout() + build_repo: str = None + + if settings.BUILD_REPO: + + build_repo = settings.BUILD_REPO + + build_sha: str = None + + if settings.BUILD_SHA: + + build_sha = settings.BUILD_SHA + + build_version: str = 'development' + + if settings.BUILD_VERSION: + + build_version = settings.BUILD_VERSION + + + metadata['version']: dict = { + 'project_url': build_repo, + 'sha': build_sha, + 'version': build_version, + } + + metadata['navigation'] = [ { "display_name": "Access",