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/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, 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 %}