From a09286bc50d16b74e3dcce0eb715ee83e233cbf1 Mon Sep 17 00:00:00 2001 From: Taka Date: Fri, 29 Jul 2022 21:25:05 +1000 Subject: [PATCH] Include the build git info in the SCENARIO template. --- vasl_templates/utils.py | 13 +++++++++- .../data/default-template-pack/scenario.j2 | 2 +- vasl_templates/webapp/main.py | 11 +++++--- vasl_templates/webapp/static/main.js | 26 ++++++++++++++++--- vasl_templates/webapp/static/snippets.js | 1 + .../templates/load-vo-notes-image-cache.html | 1 + .../templates/national-capabilities.html | 1 + 7 files changed, 45 insertions(+), 10 deletions(-) diff --git a/vasl_templates/utils.py b/vasl_templates/utils.py index 04081ee..14a1c2c 100644 --- a/vasl_templates/utils.py +++ b/vasl_templates/utils.py @@ -6,7 +6,8 @@ import logging import traceback import json -from vasl_templates.webapp.config.constants import BASE_DIR +from vasl_templates.webapp import app +from vasl_templates.webapp.config.constants import BASE_DIR, IS_FROZEN # --------------------------------------------------------------------- @@ -32,6 +33,16 @@ def get_build_info(): return result +def get_build_git_info(): + """Get the git details for the current build.""" + if IS_FROZEN: + build_info = get_build_info() + if build_info: + return build_info[ "git_info" ] + elif app.config.get( "IS_CONTAINER" ): + return os.environ.get( "BUILD_GIT_INFO" ) + return None + # --------------------------------------------------------------------- def catch_exceptions( caption="EXCEPTION", retval=None ): diff --git a/vasl_templates/webapp/data/default-template-pack/scenario.j2 b/vasl_templates/webapp/data/default-template-pack/scenario.j2 index 3b696cf..cb6d809 100644 --- a/vasl_templates/webapp/data/default-template-pack/scenario.j2 +++ b/vasl_templates/webapp/data/default-template-pack/scenario.j2 @@ -1,5 +1,5 @@ -{%if APP_NAME%}