From 4332a750d1b711ea6c86e23d05ba196868082851 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 12 Mar 2024 10:32:05 +0100 Subject: [PATCH 1/2] # Message rendering * adds icons to message danger, info and success rendering --- konova/static/css/konova.css | 3 +++ templates/base.html | 13 ++++++++++++- templates/public_base.html | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/konova/static/css/konova.css b/konova/static/css/konova.css index eb727894..b365076f 100644 --- a/konova/static/css/konova.css +++ b/konova/static/css/konova.css @@ -275,4 +275,7 @@ Similar to bootstraps 'shadow-lg' } .tree-label.badge{ font-size: 90%; +} +.alert{ + margin-bottom: 0 !important; } \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index ec79ca62..0bbe976a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -27,7 +27,18 @@
{% for message in messages %}
- {{ message }} +
+ + {% if "danger" in message.tags %} + {% fa5_icon 'exclamation' %} + {% elif "info" in message.tags %} + {% fa5_icon 'info' %} + {% elif "success" in message.tags %} + {% fa5_icon 'check' %} + {% endif %} + + {{ message }} +
{% endfor %}
diff --git a/templates/public_base.html b/templates/public_base.html index 69a25d9b..3107544a 100644 --- a/templates/public_base.html +++ b/templates/public_base.html @@ -23,13 +23,22 @@ {% endblock %}
-
{% for message in messages %} -
+
+
+ + {% if "danger" in message.tags %} + {% fa5_icon 'exclamation' %} + {% elif "info" in message.tags %} + {% fa5_icon 'info' %} + {% elif "success" in message.tags %} + {% fa5_icon 'check' %} + {% endif %} + {{ message }}
- {% endfor %}
+ {% endfor %} {% block body %} From b1cd7dee4097e071451b145ef4cf310ef29cacfd Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Fri, 15 Mar 2024 09:10:06 +0100 Subject: [PATCH 2/2] # JSON Decode error catch * adds error catching on wfs parcel resolving --- konova/views/map_proxy.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/konova/views/map_proxy.py b/konova/views/map_proxy.py index 6b6e3861..d6ebe03e 100644 --- a/konova/views/map_proxy.py +++ b/konova/views/map_proxy.py @@ -93,14 +93,23 @@ class ClientProxyParcelWFS(BaseClientProxyView): auth = HTTPDigestAuth(CLIENT_PROXY_AUTH_USER, CLIENT_PROXY_AUTH_PASSWORD) content, response_code = self.perform_url_call(url, auth=auth) - body = json.loads(content) + error_detected = response_code != 200 + error_code = f"response code:{response_code}" + try: + body = json.loads(content) + except JSONDecodeError: + body = {} + error_code = "json invalid" + error_detected = True + body["crs"] = { "type": "name", "properties": { - "name": "urn:ogc:def:crs:EPSG::25832" + "name": "urn:ogc:def:crs:EPSG::25832", } } - if response_code != 200: + if error_detected: + body["crs"]["properties"]["msg"] = f"Error detected ({error_code})" return JsonResponse({ "status_code": response_code, "content": body,