From 2f77a74dcc8666d4c975a1476bdf105cff7d19f2 Mon Sep 17 00:00:00 2001 From: Chris Arridge Date: Mon, 23 Sep 2024 14:29:31 +0100 Subject: [PATCH 1/4] feat: Reinstate development server This commit reinstates the development server which was removed some time ago but is useful for live testing. This closes issue https://github.com/IATI/IATI-Dashboard/issues/569 and basically repeats PR https://github.com/IATI/IATI-Dashboard/pull/570 that was closed and not merged. --- make_html.py | 64 +++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/make_html.py b/make_html.py index 94d2d7a602..537c8baec4 100644 --- a/make_html.py +++ b/make_html.py @@ -250,33 +250,41 @@ def image_development_publisher(image): parser.add_argument("--url", help="Link to connect dashboard to publishing stats", default="") + parser.add_argument("--live", action="store_true", + help="Run a development server") args = parser.parse_args() app.jinja_env.globals['pubstats_url'] = args.url - from flask_frozen import Freezer - app.config['FREEZER_DESTINATION'] = 'out' - app.config['FREEZER_REMOVE_EXTRA_FILES'] = False - app.debug = False # Comment to turn off debugging - app.testing = True # Comment to turn off debugging - freezer = Freezer(app) - - @freezer.register_generator - def url_generator(): - for page_name in basic_page_names: - yield 'basic_page', {'page_name': page_name} - for publisher in current_stats['inverted_publisher']['activities'].keys(): - yield 'publisher', {'publisher': publisher} - for slug in slugs['element']['by_slug']: - yield 'element', {'slug': slug} - for major_version, codelist_slugs in slugs['codelist'].items(): - for slug in codelist_slugs['by_slug']: - yield 'codelist', { - 'slug': slug, - 'major_version': major_version - } - for license in licenses.licenses: - if license is None: - license = 'None' - yield 'licenses_individual_license', {'license': license} - - - freezer.freeze() + + if args.live: + app.debug = True + app.run() + + else: + from flask_frozen import Freezer + app.config['FREEZER_DESTINATION'] = 'out' + app.config['FREEZER_REMOVE_EXTRA_FILES'] = False + app.debug = False # Comment to turn off debugging + app.testing = True # Comment to turn off debugging + freezer = Freezer(app) + + @freezer.register_generator + def url_generator(): + for page_name in basic_page_names: + yield 'basic_page', {'page_name': page_name} + for publisher in current_stats['inverted_publisher']['activities'].keys(): + yield 'publisher', {'publisher': publisher} + for slug in slugs['element']['by_slug']: + yield 'element', {'slug': slug} + for major_version, codelist_slugs in slugs['codelist'].items(): + for slug in codelist_slugs['by_slug']: + yield 'codelist', { + 'slug': slug, + 'major_version': major_version + } + for license in licenses.licenses: + if license is None: + license = 'None' + yield 'licenses_individual_license', {'license': license} + + + freezer.freeze() From dec35d013533a78523b37486d856ec7c0ea215c7 Mon Sep 17 00:00:00 2001 From: Chris Arridge Date: Mon, 23 Sep 2024 14:36:29 +0100 Subject: [PATCH 2/4] fix: Update validator links Validator links on the publisher page were broken and this commit fixes this (closing https://github.com/IATI/IATI-Dashboard/issues/597). This commit also updates the validator links in the validation page so that they go directly to the appropriate page at the validator without going via a redirection. --- static/templates/publisher.html | 2 +- static/templates/validation.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/templates/publisher.html b/static/templates/publisher.html index ab605b7395..e53122904e 100644 --- a/static/templates/publisher.html +++ b/static/templates/publisher.html @@ -167,7 +167,7 @@

Data Quality

{% if publisher in ckan and dataset in ckan[publisher] %} - validator + validator {% endif %}
diff --git a/static/templates/validation.html b/static/templates/validation.html index 34c6c7685b..9058da87b1 100644 --- a/static/templates/validation.html +++ b/static/templates/validation.html @@ -37,7 +37,7 @@

List of files that fail validation, grouped by publisher

{% if publisher in ckan and dataset in ckan[publisher] %} - validator + validator {% endif %}
From e64961eda9b8cb950c420149c7830946cecd7168 Mon Sep 17 00:00:00 2001 From: Chris Arridge Date: Mon, 23 Sep 2024 14:47:19 +0100 Subject: [PATCH 3/4] update: Remove Google Analytics tracking Removed Google Analytics code from the base template so that cookies will not be stored in the user browser to support analytics. --- static/templates/base.html | 9 --------- 1 file changed, 9 deletions(-) diff --git a/static/templates/base.html b/static/templates/base.html index cae05353ad..05806e194f 100644 --- a/static/templates/base.html +++ b/static/templates/base.html @@ -223,15 +223,6 @@

{{page_titles[page]}}

{% block tablesorterscript %}{% endblock %} - {% block extrafooter %}{% endblock %} From 6d45e5e4a4dfb262679ff6dd9a2ef8be94a5c114 Mon Sep 17 00:00:00 2001 From: Chris Arridge Date: Wed, 9 Oct 2024 09:29:16 +0100 Subject: [PATCH 4/4] fix: Updated stats to fetch JSON files via HTTPS Updated stats fetching script to get ckan.json and gitdate.json from dashboard.iatistandard.org via HTTPS rather than HTTP. --- get_stats.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get_stats.sh b/get_stats.sh index eb2601626e..4739f18995 100755 --- a/get_stats.sh +++ b/get_stats.sh @@ -2,7 +2,7 @@ # but with only the dated historical aggregates. mkdir stats-calculated for f in ckan gitdate; do - curl --compressed "http://dashboard.iatistandard.org/stats/${f}.json" > stats-calculated/${f}.json + curl --compressed "https://dashboard.iatistandard.org/stats/${f}.json" > stats-calculated/${f}.json done mkdir stats-blacklist