From 264b01d26494075550794938dc8dbc632d081707 Mon Sep 17 00:00:00 2001 From: Ramakrishna Date: Tue, 7 Mar 2023 13:39:48 +0530 Subject: [PATCH 1/2] Hot fix to put preservation tab under maintenance --- .../testbook/articles_preservation/user_test_script.yml | 8 ++++++++ portality/settings.py | 7 ++++++- portality/templates/publisher/readonly.html | 9 +++++++++ portality/view/publisher.py | 3 +++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 portality/templates/publisher/readonly.html diff --git a/doajtest/testbook/articles_preservation/user_test_script.yml b/doajtest/testbook/articles_preservation/user_test_script.yml index 063994cf26..051673c68d 100644 --- a/doajtest/testbook/articles_preservation/user_test_script.yml +++ b/doajtest/testbook/articles_preservation/user_test_script.yml @@ -75,3 +75,11 @@ tests: - if the status is 'partially success', show details link will be displayed. When clicked on the link details of how many articles successful and how many not successful will be displayed +- title: Test maintenance mode for 'Upload preservation file' tab + context: + role: publisher + steps: + - step: Set the value of 'PRESERVATION_PAGE_UNDER_MAINTENANCE' to True in the configuration file (app.cfg/dev.cfg/test.cfg) + - step: Go to preservation area /publisher/preservation + results: + - Maintenance page should be displayed with the content as 'This page is currently offline for maintenance' \ No newline at end of file diff --git a/portality/settings.py b/portality/settings.py index eb2066d2a6..10fbaf7256 100644 --- a/portality/settings.py +++ b/portality/settings.py @@ -1371,4 +1371,9 @@ ## Public data dump settings # how long should the temporary URL for public data dumps last -PUBLIC_DATA_DUMP_URL_TIMEOUT = 3600 \ No newline at end of file +PUBLIC_DATA_DUMP_URL_TIMEOUT = 3600 + +################################################## +# Pages under maintenance + +PRESERVATION_PAGE_UNDER_MAINTENANCE = False diff --git a/portality/templates/publisher/readonly.html b/portality/templates/publisher/readonly.html new file mode 100644 index 0000000000..48458f8677 --- /dev/null +++ b/portality/templates/publisher/readonly.html @@ -0,0 +1,9 @@ +{% extends "publisher/publisher_base.html" %} + +{% block page_title %}Down for maintenance{% endblock %} + +{% block publisher_content %} +

This page is currently offline for maintenance

+

This page is currently unavailable while we carry out some essential maintenance. Please check again later.

+
+{% endblock %} \ No newline at end of file diff --git a/portality/view/publisher.py b/portality/view/publisher.py index 412b22a454..db3b177975 100644 --- a/portality/view/publisher.py +++ b/portality/view/publisher.py @@ -247,6 +247,9 @@ def preservation(): This feature is available for the users who has 'preservation' role. """ + if app.config.get('PRESERVATION_PAGE_UNDER_MAINTENANCE', False): + return render_template('publisher/readonly.html') + previous = [] try: previous = models.PreservationState.by_owner(current_user.id) From f8a12d6629a3d6f0d2a64f87103f0450b2ad1dcc Mon Sep 17 00:00:00 2001 From: Steve Eardley Date: Tue, 7 Mar 2023 16:46:18 +0000 Subject: [PATCH 2/2] Put preservation page in maintenance mode in prod --- production.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/production.cfg b/production.cfg index 01f7d0ffa9..24465b6a59 100644 --- a/production.cfg +++ b/production.cfg @@ -59,3 +59,6 @@ PLAUSIBLE_URL = "https://plausible.io" # Run notifications through Kafka in production. #EVENT_SEND_FUNCTION = "portality.events.kafka_producer.send_event" EVENT_SEND_FUNCTION = "portality.events.shortcircuit.send_event" + +# https://github.com/DOAJ/doajPM/issues/3565 2023-03-07 +PRESERVATION_PAGE_UNDER_MAINTENANCE = True