From 669d01dfd15a357881a4abafde1ff8a1a6827958 Mon Sep 17 00:00:00 2001 From: Fabien Amelinck Date: Fri, 30 May 2025 19:11:45 +0200 Subject: [PATCH] fix(edit.html): badly formatted error notification --- .../apps/logfwd_LogOMElasticSearch.html | 47 +++++++++++-------- vulture_os/services/frontend/views.py | 2 +- .../templates/services/frontend_edit.html | 5 +- .../templates/system/tls_profile_edit.html | 45 ++++++++++-------- 4 files changed, 59 insertions(+), 40 deletions(-) diff --git a/vulture_os/applications/templates/apps/logfwd_LogOMElasticSearch.html b/vulture_os/applications/templates/apps/logfwd_LogOMElasticSearch.html index 96e56c4b3..3dc5f4faf 100644 --- a/vulture_os/applications/templates/apps/logfwd_LogOMElasticSearch.html +++ b/vulture_os/applications/templates/apps/logfwd_LogOMElasticSearch.html @@ -19,40 +19,49 @@
{% csrf_token %} -
+ {% if save_error or form.non_field_errors %} +
-

 {% translate "Elasticsearch Log forwarder" %}

+ {# If there is save/configuration errors #} + {% if save_error %} + +

{% translate "Configuration error" %}

+ {% endif %} + {% if form.non_field_errors %} +

{% translate "Form errors" %}

+ {% endif %}
{# Print form errors correctly #} {% if form.non_field_errors %} -
-

Form errors

-
- {{ form.non_field_errors|safe }} -
+
+ {{ form.non_field_errors|safe }}
{% endif %} {# If there is save/configuration errors #} {% if save_error %} -
{% endif %} +
+
+ {% endif %} +
+
+

 {% translate "Elasticsearch Log forwarder" %}

+
+
diff --git a/vulture_os/services/frontend/views.py b/vulture_os/services/frontend/views.py index f3431d274..9e5f63e06 100644 --- a/vulture_os/services/frontend/views.py +++ b/vulture_os/services/frontend/views.py @@ -363,7 +363,7 @@ def render_form(front, **kwargs): reputationctx_ids = json_loads(request.POST.get('reputation_contexts', "[]")) assert isinstance(reputationctx_ids, list), "reputation_contexts field must be a list." except Exception as e: - return render_form(frontend, save_error=["Error in ReputationConext field : {}".format(e), + return render_form(frontend, save_error=["Error in ReputationContext field : {}".format(e), str.join('', format_exception(*exc_info()))]) """ For each reputation_context in list """ diff --git a/vulture_os/services/templates/services/frontend_edit.html b/vulture_os/services/templates/services/frontend_edit.html index e2795e194..4f6fff3c5 100644 --- a/vulture_os/services/templates/services/frontend_edit.html +++ b/vulture_os/services/templates/services/frontend_edit.html @@ -35,7 +35,7 @@

{% translate "Form errors
{# Print form errors correctly #} {% if form.non_field_errors %} -
+
{{ form.non_field_errors|safe }}
{% endif %} @@ -56,6 +56,9 @@

{% translate "Form errors

{% endif %}
+
+

 {% translate "Listeners" %}

+