From 5ee9e563038c47b827b72cc750f098a137af51dd Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 2 Sep 2024 10:21:43 +0200 Subject: [PATCH 1/4] Implements #566 --- app/__init__.py | 4 +++- app/templates/error_pages/500.html | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 93b1c40ff..8ec236274 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1557,7 +1557,9 @@ def page_not_found(error): @app.errorhandler(500) def internal_server_error(error): app.logger.error('Server Error: %s', (error)) - return render_template('error_pages/500.html', support_email=app.config.get('SUPPORT_EMAIL')), 500 + return render_template('error_pages/500.html', support_email=app.config.get('SUPPORT_EMAIL'), + support_link=app.config.get('SUPPORT_LINK'), + support_link_name=app.config.get('SUPPORT_LINK_NAME')), 500 @app.errorhandler(CSRFError) def handle_csrf_error(e): diff --git a/app/templates/error_pages/500.html b/app/templates/error_pages/500.html index eb9882892..f791216f8 100644 --- a/app/templates/error_pages/500.html +++ b/app/templates/error_pages/500.html @@ -19,7 +19,8 @@

500 Internal Server Error

Sorry, something went wrong..Please, try again. - Contact the support {%if support_email %}({{ support_email }}){%endif %} if the error persists. + {%if support_email %} Contact the support ({{ support_email }}) if the error persists.{% endif %} + {%if support_link %} Contact the support ({{ support_link_name }}) if the error persists.{% endif %}
From 33d210b54387dd08508c91d0dd4f71886176ad06 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 2 Sep 2024 10:36:57 +0200 Subject: [PATCH 2/4] Implements #566 --- README.md | 2 ++ app/__init__.py | 3 +++ app/templates/error_pages/500.html | 5 +++-- app/templates/footer.html | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ee7b24fec..2c71c6c9c 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,8 @@ Create the `config.json` file (see the [example](app/config-sample.json)) settin | IM_URL | Infrastructure Manager service URL | Y | N/A | | IM_TIMEOUT | Infrastructure Manager service calls timeout | N | 60 | | SUPPORT_EMAIL | Email address that will be shown in case of errors | N | "" | +| SUPPORT_LINK | Link that will be shown in case of errors | N | "" | +| SUPPORT_LINK_NAME | Text Link that that will be shown in case of errors | N | "" | | EXTERNAL_LINKS | List of dictionaries ({ "url": "example.com" , "menu_item_name": "Example link"}) specifying links that will be shown under the "External Links" menu | N | [] | | LOG_LEVEL | Set Logging level | N | info | | DB_URL | URL to the DB to store dashboard data | N | sqlite:///creds.db | diff --git a/app/__init__.py b/app/__init__.py index 8ec236274..1edf5c6a5 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -242,6 +242,9 @@ def home(): else: session['gravatar'] = utils.avatar(account_info_json['sub'], 26) else: + return render_template('error_pages/500.html', support_email=app.config.get('SUPPORT_EMAIL'), + support_link=app.config.get('SUPPORT_LINK'), + support_link_name=app.config.get('SUPPORT_LINK_NAME')), 500 flash("Error getting User info: \n" + account_info.text, 'error') return render_template('home.html', oidc_name=settings.oidcName) diff --git a/app/templates/error_pages/500.html b/app/templates/error_pages/500.html index f791216f8..ed8b13a0c 100644 --- a/app/templates/error_pages/500.html +++ b/app/templates/error_pages/500.html @@ -19,8 +19,9 @@

500 Internal Server Error

Sorry, something went wrong..Please, try again. - {%if support_email %} Contact the support ({{ support_email }}) if the error persists.{% endif %} - {%if support_link %} Contact the support ({{ support_link_name }}) if the error persists.{% endif %} + {%if support_email %} Contact the support ({{ support_email }}) if the error persists. + {%elif support_link %} Contact the support ({{ support_link_name }}) if the error persists + {% endif %}
diff --git a/app/templates/footer.html b/app/templates/footer.html index 49d05b870..616b0e705 100644 --- a/app/templates/footer.html +++ b/app/templates/footer.html @@ -18,6 +18,8 @@
+ + From c1291fb85db95e82e7847aca9a988c5e3c83af86 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 2 Sep 2024 10:38:53 +0200 Subject: [PATCH 3/4] Implements #566 --- app/templates/footer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/footer.html b/app/templates/footer.html index 616b0e705..a2a112558 100644 --- a/app/templates/footer.html +++ b/app/templates/footer.html @@ -18,7 +18,7 @@
- + From b0c38de87a4cd5fd49c73558a618db1710f7e085 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 2 Sep 2024 10:41:20 +0200 Subject: [PATCH 4/4] Implements #566 --- app/__init__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 1edf5c6a5..ac8fef111 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -242,9 +242,6 @@ def home(): else: session['gravatar'] = utils.avatar(account_info_json['sub'], 26) else: - return render_template('error_pages/500.html', support_email=app.config.get('SUPPORT_EMAIL'), - support_link=app.config.get('SUPPORT_LINK'), - support_link_name=app.config.get('SUPPORT_LINK_NAME')), 500 flash("Error getting User info: \n" + account_info.text, 'error') return render_template('home.html', oidc_name=settings.oidcName) @@ -1561,8 +1558,8 @@ def page_not_found(error): def internal_server_error(error): app.logger.error('Server Error: %s', (error)) return render_template('error_pages/500.html', support_email=app.config.get('SUPPORT_EMAIL'), - support_link=app.config.get('SUPPORT_LINK'), - support_link_name=app.config.get('SUPPORT_LINK_NAME')), 500 + support_link=app.config.get('SUPPORT_LINK'), + support_link_name=app.config.get('SUPPORT_LINK_NAME')), 500 @app.errorhandler(CSRFError) def handle_csrf_error(e):