From 97a56a5c2e28bcb8739fff1b1b3667e578a82848 Mon Sep 17 00:00:00 2001 From: "Alan B. Christie" <29806285+alanbchristie@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:53:02 +0100 Subject: [PATCH] fix: Add support for target_warning_message context variable (#634) Co-authored-by: Alan Christie --- fragalysis/settings.py | 4 ++++ viewer/views.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/fragalysis/settings.py b/fragalysis/settings.py index 9ce8991d..16060d9c 100644 --- a/fragalysis/settings.py +++ b/fragalysis/settings.py @@ -630,6 +630,10 @@ TARGET_LOADER_MEDIA_DIRECTORY: str = "target_loader_data" +# A warning messages issued by the f/e. +# Used, if set, to populate the 'target_warning_message' context variable +TARGET_WARNING_MESSAGE: str = os.environ.get("TARGET_WARNING_MESSAGE", "") + # The Target Access String (TAS) Python regular expression. # The Project title (the TAS) must match this expression to be valid. # See api/utils.py validate_tas() for the current implementation. diff --git a/viewer/views.py b/viewer/views.py index f1b58e35..d0d7fcc4 100644 --- a/viewer/views.py +++ b/viewer/views.py @@ -127,6 +127,9 @@ def react(request): if sq2_rv.success and check_squonk_active(request): context['squonk_ui_url'] = _SQ2A.get_ui_url() + if settings.TARGET_WARNING_MESSAGE: + context['target_warning_message'] = settings.TARGET_WARNING_MESSAGE + return render(request, "viewer/react_temp.html", context)