From f11b44eb1e7d7b5ff14c6035b53ff3b10d1d2537 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 30 Apr 2024 17:12:26 +0100 Subject: [PATCH 01/60] Update deployment.yaml rename `deve-infrasctructure` branch to `dev` following branch cleanup --- deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment.yaml b/deployment.yaml index a059395..e7e97ad 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -8,7 +8,7 @@ deployments: - branch: "preprod" deploy: "preprod" publish: "preprod" - - branch: "dev-infrastructure" + - branch: "dev" deploy: "dev" publish: "dev" - branch: "[A-z0-9/-_]+" From 496cdf5fb8072f0ba935c82df364959bd673244e Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Tue, 6 Aug 2024 16:05:10 +0100 Subject: [PATCH 02/60] updates the readme for local development --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 3d46289..f4e5458 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,36 @@ required configuration is captured in the `Makefile`. ### Locally +Create a .bundle directory in the root of the application + +```sh +mkdir .bundle + +cd bundle +``` + +Add a config file to the .bundle directory + +```sh +touch config +``` + +Then edit the config file + +```sh +nano config +``` + +In the config file add the following details + +BUNDLE_RUBYGEMS__PKG__GITHUB__COM: "epimorphics:< your git hub personal access token >" + +Then run + +```sh +bundle install +``` + For developing rails applications you can start the server locally using the following command: From 11483a5c4384e2b96723abe8f65cf091a97b8b52 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Wed, 7 Aug 2024 12:09:29 +0100 Subject: [PATCH 03/60] fixes fieldset and contrast input border accessibility issues --- app/assets/stylesheets/ppd.scss | 12 ++++++++++++ app/views/ppd/index.html.haml | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/ppd.scss b/app/assets/stylesheets/ppd.scss index f80ecbe..bf8f3cf 100644 --- a/app/assets/stylesheets/ppd.scss +++ b/app/assets/stylesheets/ppd.scss @@ -5,6 +5,18 @@ } } +.form-control { + border: 1px solid #646464; +} + +.control-legend { + border: none; + font-size: 16px; + line-height: 1.31578947; + font-family: "nta", Arial, sans-serif; + font-weight: bold; +} + .lr { .container { max-width: 960px; diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index eedc8f1..5fd54c6 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -45,8 +45,8 @@ .col-sm-8 %input#postcode.form-control{ type: "text", name: "postcode", value: @preferences.param( :postcode ), placeholder: "Use a full postcode, or just the first group e.g. PL6 5WS or PL6." } - .form-group - %label.col-sm-4.control-label{ for: "ptype" } Property type + %fieldset.form-group + %legend.control-legend.col-sm-4.control-label{ for: "ptype" } Property type .col-sm-8 %ul.list-inline %li @@ -75,8 +75,8 @@ %input{ type: "checkbox", name: "ptype[]", value: "lrcommon:otherPropertyType", checked: @preferences.display_checked?( :ptype, "lrcommon:otherPropertyType") } other - .form-group - %label.col-sm-4.control-label{ for: "nb" } New build? + %fieldset.form-group + %legend.control-legend.col-sm-4.control-label{ for: "nb" } New build? .col-sm-8 %ul.list-inline %li @@ -90,8 +90,8 @@ %input{ type: "checkbox", name: "nb[]", value: "false", checked: @preferences.display_checked?( :nb, "false" ) } not new-build - .form-group - %label.col-sm-4.control-label{ for: "et" } Estate type + %fieldset.form-group + %legend.control-legend.col-sm-4.control-label{ for: "et" } Estate type .col-sm-8 %ul.list-inline %li @@ -105,8 +105,8 @@ %input{ type: "checkbox", name: "et[]", value: "lrcommon:leasehold", checked: @preferences.display_checked?( :et, "lrcommon:leasehold" ) } leasehold - .form-group - %label.col-sm-4.control-label{ for: "tc" } Transaction category + %fieldset.form-group + %legend.control-legend.col-sm-4.control-label{ for: "tc" } Transaction category .col-sm-8 %ul.list-inline %li @@ -160,8 +160,8 @@ latest: %input{ type: 'date', name: :max_date, value: @preferences.param( :max_date ), min: "1995-01-01", max: Date.today.iso8601 } - .form-group - %label.col-sm-4.control-label{ for: "limit" } How many results? + %fieldset.form-group + %legend.control-legend.col-sm-4.control-label{ for: "limit" } How many results? .col-sm-8 %ul.list-inline %li From de215fe2a79ae5eebfc422b13a91e94943c1d0f6 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Wed, 7 Aug 2024 14:08:20 +0100 Subject: [PATCH 04/60] fixes programatic label issues --- app/views/ppd/_bookmark_modal.html.haml | 3 ++- app/views/ppd/index.html.haml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/views/ppd/_bookmark_modal.html.haml b/app/views/ppd/_bookmark_modal.html.haml index 9d52743..fc3ca54 100644 --- a/app/views/ppd/_bookmark_modal.html.haml +++ b/app/views/ppd/_bookmark_modal.html.haml @@ -17,7 +17,8 @@ %code cmd-C on a Mac) to copy a link to this page. %p - = text_field_tag 'bookmark', "", class: "form-control bookmark-url" + = label_tag 'bookmark', 'URL bookmark' + = text_field_tag 'bookmark', "", class: "form-control bookmark-url", autocomplete: "off", type: "url", name: "bookmark" .social-media.text-center .twitter %a.twitter-share-button{ href: "https://twitter.com/share", data: {url: "", text: "Open data from Land Registry", hashtags: "opendata"}} diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index 5fd54c6..b8fa72a 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -13,37 +13,37 @@ .form-group %label.col-sm-4.control-label{ for: "paon" } Building name or number .col-sm-8 - %input#paon.form-control{ type: "text", name: "paon", value: @preferences.param( :paon ), placeholder: "For example: Rose Cottage or 17" } + %input#paon.form-control{ type: "text", autocomplete: "on", name: "paon", value: @preferences.param( :paon ), placeholder: "For example: Rose Cottage or 17" } .form-group %label.col-sm-4.control-label{ for: "street" } Street .col-sm-8 - %input#street.form-control{ type: "text", name: "street", value: @preferences.param( :street ), placeholder: "Use the full name, or just part of it e.g: Harbour Road or Colston" } + %input#street.form-control{ type: "text", autocomplete: "street-address", name: "street", value: @preferences.param( :street ), placeholder: "Use the full name, or just part of it e.g: Harbour Road or Colston" } .form-group %label.col-sm-4.control-label{ for: "town" } Town or city .col-sm-8 - %input#town.form-control{ type: "text", name: "town", value: @preferences.param( :town ), placeholder: "For example: Plymouth" } + %input#town.form-control{ type: "text", autocomplete: "address-level2", name: "town", value: @preferences.param( :town ), placeholder: "For example: Plymouth" } .form-group %label.col-sm-4.control-label{ for: "district" } District .col-sm-8 - %input#district.form-control{ type: "text", name: "district", value: @preferences.param( :district ), placeholder: "For example: City of Westminster" } + %input#district.form-control{ type: "text", autocomplete: "address-level3", name: "district", value: @preferences.param( :district ), placeholder: "For example: City of Westminster" } .form-group %label.col-sm-4.control-label{ for: "county" } County .col-sm-8 - %input#county.form-control{ type: "text", name: "county", value: @preferences.param( :county ), placeholder: "For example: Devon" } + %input#county.form-control{ type: "text", autocomplete: "county", name: "county", value: @preferences.param( :county ), placeholder: "For example: Devon" } .form-group %label.col-sm-4.control-label{ for: "locality" } Locality .col-sm-8 - %input#locality.form-control{ type: "text", name: "locality", value: @preferences.param( :locality ), placeholder: "For example: Thurloxton" } + %input#locality.form-control{ type: "text", autocomplete: "on", name: "locality", value: @preferences.param( :locality ), placeholder: "For example: Thurloxton" } .form-group %label.col-sm-4.control-label{ for: "postcode" } Postcode .col-sm-8 - %input#postcode.form-control{ type: "text", name: "postcode", value: @preferences.param( :postcode ), placeholder: "Use a full postcode, or just the first group e.g. PL6 5WS or PL6." } + %input#postcode.form-control{ type: "text", autocomplete: "postal-code", name: "postcode", value: @preferences.param( :postcode ), placeholder: "Use a full postcode, or just the first group e.g. PL6 5WS or PL6." } %fieldset.form-group %legend.control-legend.col-sm-4.control-label{ for: "ptype" } Property type @@ -146,7 +146,7 @@ Please enter a valid numerical value, or leave blank .form-group - %label.col-sm-4.control-label.control-label-adjust{ for: 'date' } Date + %label.col-sm-4.control-label.control-label-adjust Date .col-sm-8 %ul.list-inline %li From 151def9156dff08f418beabbe3105c818cb35406 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Wed, 7 Aug 2024 14:22:08 +0100 Subject: [PATCH 05/60] updates changelog and version cadence --- CHANGELOG.md | 4 ++++ app/lib/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f02764d..87b506d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This app allows the user to explore HMLR price-paid open linked data. +## 1.7.7 - 2024-08 + +- (Dan) updates the form to meet various accessibility requirments [GH-217](https://github.com/epimorphics/ppd-explorer/issues/217) + ## 1.7.6 - 2024-03-08 - (Jon) Updated the application_controller to include an diff --git a/app/lib/version.rb b/app/lib/version.rb index 2e2f290..73e3c60 100644 --- a/app/lib/version.rb +++ b/app/lib/version.rb @@ -3,7 +3,7 @@ module Version MAJOR = 1 MINOR = 7 - PATCH = 6 + PATCH = 7 SUFFIX = nil VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}#{SUFFIX && ".#{SUFFIX}"}" end From d1621a43669bdee8df608c0defd70e631cd924b1 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 08:59:31 +0100 Subject: [PATCH 06/60] fixes flow control on search modal --- app/views/ppd/_bookmark_modal.html.haml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/views/ppd/_bookmark_modal.html.haml b/app/views/ppd/_bookmark_modal.html.haml index 9d52743..0365da9 100644 --- a/app/views/ppd/_bookmark_modal.html.haml +++ b/app/views/ppd/_bookmark_modal.html.haml @@ -22,10 +22,6 @@ .twitter %a.twitter-share-button{ href: "https://twitter.com/share", data: {url: "", text: "Open data from Land Registry", hashtags: "opendata"}} Tweet - .gplus - #plus-one - .facebook - .fb-share-button{ data: {href: "", type: "button_count"}} .modal-footer .row From afb111fbaef6e997a1fcc98a2e8381bd2789620f Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 09:06:11 +0100 Subject: [PATCH 07/60] updates changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b506d..60c1c01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This app allows the user to explore HMLR price-paid open linked data. ## 1.7.7 - 2024-08 +- (Dan) updates the search results modal to include focus flow [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) - (Dan) updates the form to meet various accessibility requirments [GH-217](https://github.com/epimorphics/ppd-explorer/issues/217) ## 1.7.6 - 2024-03-08 From 5d3acd94c9c7f3a47c08afae2c0888bd0175d934 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 12:05:03 +0100 Subject: [PATCH 08/60] adds focus trap logic to share results modal --- app/assets/javascripts/bookmark-modal.js | 37 ++++++++++++++++++++++++ app/views/ppd/_bookmark_modal.html.haml | 3 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/bookmark-modal.js diff --git a/app/assets/javascripts/bookmark-modal.js b/app/assets/javascripts/bookmark-modal.js new file mode 100644 index 0000000..96e3444 --- /dev/null +++ b/app/assets/javascripts/bookmark-modal.js @@ -0,0 +1,37 @@ +document.addEventListener("DOMContentLoaded", function () { + const focusableElements = 'input, .btn, .close' + const modal = document.querySelector('#bookmark-dialog'); + const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; + const focusableContent = modal.querySelectorAll(focusableElements); + const lastFocusableElement = focusableContent[focusableContent.length - 1]; + const shareViewButton = document.querySelector(".action-bookmark") + + function onModalOpen() { + document.addEventListener('keydown', function(e) { + let isTabPressed = e.key === 'Tab' || e.keyCode === 9; + + if (!isTabPressed) { + return; + } + + if (e.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus(); + e.preventDefault(); + } + } else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus(); + e.preventDefault(); + } + } + }); + + firstFocusableElement.focus(); + } + + shareViewButton.addEventListener("click", function (event) { + event.preventDefault() + onModalOpen() + }) +}) diff --git a/app/views/ppd/_bookmark_modal.html.haml b/app/views/ppd/_bookmark_modal.html.haml index 822eefe..03fb1f6 100644 --- a/app/views/ppd/_bookmark_modal.html.haml +++ b/app/views/ppd/_bookmark_modal.html.haml @@ -1,11 +1,12 @@ -# frozen_string_literal: true #bookmark-modal.modal - .modal-dialog + #bookmark-dialog.modal-dialog{role: "dialog", "aria-labelledby": "bookmark-link", "aria-modal": "true"} .modal-content .modal-header %button.close{ type: "button", data: {dismiss: "modal"}, aria: {hidden: "true"}} × + #bookmark-link %h2.modal-title Link to the current search .modal-body From 60cda00749fdd73748b2fdbe711ca1e5b1c13730 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 12:12:33 +0100 Subject: [PATCH 09/60] updates js syntax --- app/assets/javascripts/bookmark-modal.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/bookmark-modal.js b/app/assets/javascripts/bookmark-modal.js index 96e3444..b8cae25 100644 --- a/app/assets/javascripts/bookmark-modal.js +++ b/app/assets/javascripts/bookmark-modal.js @@ -1,10 +1,10 @@ document.addEventListener("DOMContentLoaded", function () { - const focusableElements = 'input, .btn, .close' - const modal = document.querySelector('#bookmark-dialog'); - const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; - const focusableContent = modal.querySelectorAll(focusableElements); - const lastFocusableElement = focusableContent[focusableContent.length - 1]; - const shareViewButton = document.querySelector(".action-bookmark") + var focusableElements = 'input, .btn, .close' + var modal = document.querySelector('#bookmark-dialog'); + var firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; + var focusableContent = modal.querySelectorAll(focusableElements); + var lastFocusableElement = focusableContent[focusableContent.length - 1]; + var shareViewButton = document.querySelector(".action-bookmark") function onModalOpen() { document.addEventListener('keydown', function(e) { From 408b6e7fac56e69f271008ca329049e32555df00 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 13:55:52 +0100 Subject: [PATCH 10/60] updates js syntax --- app/assets/javascripts/bookmark-modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/bookmark-modal.js b/app/assets/javascripts/bookmark-modal.js index b8cae25..b6e37e1 100644 --- a/app/assets/javascripts/bookmark-modal.js +++ b/app/assets/javascripts/bookmark-modal.js @@ -8,7 +8,7 @@ document.addEventListener("DOMContentLoaded", function () { function onModalOpen() { document.addEventListener('keydown', function(e) { - let isTabPressed = e.key === 'Tab' || e.keyCode === 9; + var isTabPressed = e.key === 'Tab' || e.keyCode === 9; if (!isTabPressed) { return; From c496313c8fb070fdebf184fab869453ba21008e8 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 14:26:04 +0100 Subject: [PATCH 11/60] updates changelog and removes depricated js --- CHANGELOG.md | 2 +- app/assets/javascripts/bookmark-modal.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60c1c01..c8a8ee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ This app allows the user to explore HMLR price-paid open linked data. ## 1.7.7 - 2024-08 -- (Dan) updates the search results modal to include focus flow [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) +- (Dan) updates the search results modal focus flow to meet accessibility requirments [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) - (Dan) updates the form to meet various accessibility requirments [GH-217](https://github.com/epimorphics/ppd-explorer/issues/217) ## 1.7.6 - 2024-03-08 diff --git a/app/assets/javascripts/bookmark-modal.js b/app/assets/javascripts/bookmark-modal.js index b6e37e1..8432a22 100644 --- a/app/assets/javascripts/bookmark-modal.js +++ b/app/assets/javascripts/bookmark-modal.js @@ -8,7 +8,7 @@ document.addEventListener("DOMContentLoaded", function () { function onModalOpen() { document.addEventListener('keydown', function(e) { - var isTabPressed = e.key === 'Tab' || e.keyCode === 9; + var isTabPressed = e.key === 'Tab'; if (!isTabPressed) { return; From b0eb437a7d37e40a86b73a296960d63897533b02 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 15:29:15 +0100 Subject: [PATCH 12/60] creates a focus trap for help modal --- app/assets/javascripts/help-modal.js | 42 ++++++++++++++++++++++++++++ app/views/ppd/_help_modal.html.haml | 7 +++-- 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/help-modal.js diff --git a/app/assets/javascripts/help-modal.js b/app/assets/javascripts/help-modal.js new file mode 100644 index 0000000..ee298a6 --- /dev/null +++ b/app/assets/javascripts/help-modal.js @@ -0,0 +1,42 @@ +document.addEventListener("DOMContentLoaded", function () { + var focusableElements = ".close, .trouble-shooting, .email-address, .btn" + var modal = document.querySelector("#help-dialog") + var firstFocusableElement = modal.querySelectorAll(focusableElements)[0] + var secondFocusableElement = modal.querySelectorAll(focusableElements)[1] + var focusableContent = modal.querySelectorAll(focusableElements) + var lastFocusableElement = focusableContent[focusableContent.length - 1] + var shareViewButton = document.querySelectorAll(".action-help") + + function onModalOpen() { + setTimeout(function () { + secondFocusableElement.focus() + }, 10) + document.addEventListener("keydown", function (e) { + var isTabPressed = e.key === "Tab" + + if (!isTabPressed) { + return + } + + if (e.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus() + e.preventDefault() + } + } else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus() + e.preventDefault() + } + } + console.log('modal open') + }) + } + + shareViewButton.forEach(button => { + button.addEventListener("click", function (event) { + event.preventDefault(); + onModalOpen(); + }); + }); +}) diff --git a/app/views/ppd/_help_modal.html.haml b/app/views/ppd/_help_modal.html.haml index 8513e7c..b5a34a2 100644 --- a/app/views/ppd/_help_modal.html.haml +++ b/app/views/ppd/_help_modal.html.haml @@ -1,18 +1,19 @@ -# frozen_string_literal: true #help-modal.modal - .modal-dialog + #help-dialog.modal-dialog{role: "dialog", "aria-labelledby": "help-title", "aria-modal": "true"} .modal-content .modal-header %button.close{ type: "button", data: {dismiss: "modal"}, aria: {hidden: "true"}} × + #help-title %h2.modal-title Help and suggestions .modal-body %h3 Troubleshooting guide %p See the - %a{href: "https://www.gov.uk/about-the-price-paid-data#price-paid-data-report-builder"} troubleshooting guide + %a.trouble-shooting{href: "https://www.gov.uk/about-the-price-paid-data#price-paid-data-report-builder"} troubleshooting guide for answers to commonly encountered difficulties in using this dataset. %h3 Tips @@ -39,7 +40,7 @@ %p If you have additional questions, or you have feedback on this beta service, please email - = mail_to(Rails.application.config.contact_email_address) + .email-address= mail_to(Rails.application.config.contact_email_address) .modal-footer .row From bf5b8ee5e0fe809a6055f76c4e418a792e07f97d Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 15:31:37 +0100 Subject: [PATCH 13/60] updates js to take into account second action button for modal --- app/assets/javascripts/bookmark-modal.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/bookmark-modal.js b/app/assets/javascripts/bookmark-modal.js index 8432a22..ebac335 100644 --- a/app/assets/javascripts/bookmark-modal.js +++ b/app/assets/javascripts/bookmark-modal.js @@ -4,7 +4,7 @@ document.addEventListener("DOMContentLoaded", function () { var firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; var focusableContent = modal.querySelectorAll(focusableElements); var lastFocusableElement = focusableContent[focusableContent.length - 1]; - var shareViewButton = document.querySelector(".action-bookmark") + var shareViewButton = document.querySelectorAll(".action-bookmark") function onModalOpen() { document.addEventListener('keydown', function(e) { @@ -30,8 +30,10 @@ document.addEventListener("DOMContentLoaded", function () { firstFocusableElement.focus(); } - shareViewButton.addEventListener("click", function (event) { - event.preventDefault() - onModalOpen() - }) + shareViewButton.forEach(button => { + button.addEventListener("click", function (event) { + event.preventDefault(); + onModalOpen(); + }); + }); }) From fbc2955219d456f3f285b3ba21a5a22f99b491c0 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 15:59:34 +0100 Subject: [PATCH 14/60] combines help and search modals into one js file --- app/assets/javascripts/modal.js | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 app/assets/javascripts/modal.js diff --git a/app/assets/javascripts/modal.js b/app/assets/javascripts/modal.js new file mode 100644 index 0000000..8eba3d1 --- /dev/null +++ b/app/assets/javascripts/modal.js @@ -0,0 +1,51 @@ +document.addEventListener("DOMContentLoaded", function () { + function handleModal(modalSelector, focusableElementsSelector, openButtonsSelector, focusOnOpenIndex = 0) { + var modal = document.querySelector(modalSelector); + var focusableElements = modal.querySelectorAll(focusableElementsSelector); + var firstFocusableElement = focusableElements[0]; + var lastFocusableElement = focusableElements[focusableElements.length - 1]; + var focusOnOpenElement = focusableElements[focusOnOpenIndex]; + var openButtons = document.querySelectorAll(openButtonsSelector); + + function onModalOpen() { + + if(modalSelector === '#help-dialog') { + setTimeout(function () { + focusOnOpenElement.focus(); + }, 10); + } + + document.addEventListener('keydown', function(e) { + var isTabPressed = e.key === 'Tab'; + + if (!isTabPressed) { + return; + } + + if (e.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus(); + e.preventDefault(); + } + } else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus(); + e.preventDefault(); + } + } + }); + } + + openButtons.forEach(button => { + button.addEventListener("click", function (event) { + event.preventDefault(); + onModalOpen(); + }); + }); + } + + handleModal('#bookmark-dialog', 'input, .btn, .close', '.action-bookmark'); + + handleModal('#help-dialog', '.close, .trouble-shooting, .email-address, .btn', '.action-help', 1); + }); + \ No newline at end of file From cb9d6f34598d9cb03fd0936985dc68c08bfc1b4f Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 16:03:34 +0100 Subject: [PATCH 15/60] updates changelog --- CHANGELOG.md | 1 + app/assets/javascripts/bookmark-modal.js | 39 ---------------------- app/assets/javascripts/help-modal.js | 42 ------------------------ 3 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 app/assets/javascripts/bookmark-modal.js delete mode 100644 app/assets/javascripts/help-modal.js diff --git a/CHANGELOG.md b/CHANGELOG.md index c8a8ee2..5afeb98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This app allows the user to explore HMLR price-paid open linked data. - (Dan) updates the search results modal focus flow to meet accessibility requirments [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) - (Dan) updates the form to meet various accessibility requirments [GH-217](https://github.com/epimorphics/ppd-explorer/issues/217) +- (Dan) updates the search results modal focus flow to meet accessibility requirments [GH-218](https://github.com/epimorphics/ppd-explorer/issues/218) ## 1.7.6 - 2024-03-08 diff --git a/app/assets/javascripts/bookmark-modal.js b/app/assets/javascripts/bookmark-modal.js deleted file mode 100644 index ebac335..0000000 --- a/app/assets/javascripts/bookmark-modal.js +++ /dev/null @@ -1,39 +0,0 @@ -document.addEventListener("DOMContentLoaded", function () { - var focusableElements = 'input, .btn, .close' - var modal = document.querySelector('#bookmark-dialog'); - var firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; - var focusableContent = modal.querySelectorAll(focusableElements); - var lastFocusableElement = focusableContent[focusableContent.length - 1]; - var shareViewButton = document.querySelectorAll(".action-bookmark") - - function onModalOpen() { - document.addEventListener('keydown', function(e) { - var isTabPressed = e.key === 'Tab'; - - if (!isTabPressed) { - return; - } - - if (e.shiftKey) { - if (document.activeElement === firstFocusableElement) { - lastFocusableElement.focus(); - e.preventDefault(); - } - } else { - if (document.activeElement === lastFocusableElement) { - firstFocusableElement.focus(); - e.preventDefault(); - } - } - }); - - firstFocusableElement.focus(); - } - - shareViewButton.forEach(button => { - button.addEventListener("click", function (event) { - event.preventDefault(); - onModalOpen(); - }); - }); -}) diff --git a/app/assets/javascripts/help-modal.js b/app/assets/javascripts/help-modal.js deleted file mode 100644 index ee298a6..0000000 --- a/app/assets/javascripts/help-modal.js +++ /dev/null @@ -1,42 +0,0 @@ -document.addEventListener("DOMContentLoaded", function () { - var focusableElements = ".close, .trouble-shooting, .email-address, .btn" - var modal = document.querySelector("#help-dialog") - var firstFocusableElement = modal.querySelectorAll(focusableElements)[0] - var secondFocusableElement = modal.querySelectorAll(focusableElements)[1] - var focusableContent = modal.querySelectorAll(focusableElements) - var lastFocusableElement = focusableContent[focusableContent.length - 1] - var shareViewButton = document.querySelectorAll(".action-help") - - function onModalOpen() { - setTimeout(function () { - secondFocusableElement.focus() - }, 10) - document.addEventListener("keydown", function (e) { - var isTabPressed = e.key === "Tab" - - if (!isTabPressed) { - return - } - - if (e.shiftKey) { - if (document.activeElement === firstFocusableElement) { - lastFocusableElement.focus() - e.preventDefault() - } - } else { - if (document.activeElement === lastFocusableElement) { - firstFocusableElement.focus() - e.preventDefault() - } - } - console.log('modal open') - }) - } - - shareViewButton.forEach(button => { - button.addEventListener("click", function (event) { - event.preventDefault(); - onModalOpen(); - }); - }); -}) From 1e255d12438bde3e09331d172195ba17ca464519 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 16:18:10 +0100 Subject: [PATCH 16/60] updates syntax --- app/assets/javascripts/modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/modal.js b/app/assets/javascripts/modal.js index 8eba3d1..d03a545 100644 --- a/app/assets/javascripts/modal.js +++ b/app/assets/javascripts/modal.js @@ -36,7 +36,7 @@ document.addEventListener("DOMContentLoaded", function () { }); } - openButtons.forEach(button => { + openButtons.forEach(function(button) { button.addEventListener("click", function (event) { event.preventDefault(); onModalOpen(); From 62bf9f6e00eaae839fd79bab31c0224dc32e9a74 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Thu, 8 Aug 2024 16:39:04 +0100 Subject: [PATCH 17/60] updates js syntax to fix build issue --- app/assets/javascripts/modal.js | 100 ++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 45 deletions(-) diff --git a/app/assets/javascripts/modal.js b/app/assets/javascripts/modal.js index d03a545..35c1878 100644 --- a/app/assets/javascripts/modal.js +++ b/app/assets/javascripts/modal.js @@ -1,51 +1,61 @@ document.addEventListener("DOMContentLoaded", function () { - function handleModal(modalSelector, focusableElementsSelector, openButtonsSelector, focusOnOpenIndex = 0) { - var modal = document.querySelector(modalSelector); - var focusableElements = modal.querySelectorAll(focusableElementsSelector); - var firstFocusableElement = focusableElements[0]; - var lastFocusableElement = focusableElements[focusableElements.length - 1]; - var focusOnOpenElement = focusableElements[focusOnOpenIndex]; - var openButtons = document.querySelectorAll(openButtonsSelector); - - function onModalOpen() { + function handleModal( + modalSelector, + focusableElementsSelector, + openButtonsSelector, + focusOnOpenIndex + ) { + if (focusOnOpenIndex === undefined) focusOnOpenIndex = 0 + + var modal = document.querySelector(modalSelector) + var focusableElements = modal.querySelectorAll(focusableElementsSelector) + var firstFocusableElement = focusableElements[0] + var lastFocusableElement = focusableElements[focusableElements.length - 1] + var focusOnOpenElement = focusableElements[focusOnOpenIndex] + var openButtons = document.querySelectorAll(openButtonsSelector) - if(modalSelector === '#help-dialog') { - setTimeout(function () { - focusOnOpenElement.focus(); - }, 10); + function onModalOpen() { + if (modalSelector === "#help-dialog") { + setTimeout(function () { + focusOnOpenElement.focus() + }, 10) + } + + document.addEventListener("keydown", function (e) { + var isTabPressed = e.key === "Tab" + + if (!isTabPressed) { + return } - - document.addEventListener('keydown', function(e) { - var isTabPressed = e.key === 'Tab'; - - if (!isTabPressed) { - return; + + if (e.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus() + e.preventDefault() } - - if (e.shiftKey) { - if (document.activeElement === firstFocusableElement) { - lastFocusableElement.focus(); - e.preventDefault(); - } - } else { - if (document.activeElement === lastFocusableElement) { - firstFocusableElement.focus(); - e.preventDefault(); - } + } else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus() + e.preventDefault() } - }); - } - - openButtons.forEach(function(button) { - button.addEventListener("click", function (event) { - event.preventDefault(); - onModalOpen(); - }); - }); + } + }) } - - handleModal('#bookmark-dialog', 'input, .btn, .close', '.action-bookmark'); - - handleModal('#help-dialog', '.close, .trouble-shooting, .email-address, .btn', '.action-help', 1); - }); - \ No newline at end of file + + openButtons.forEach(function (button) { + button.addEventListener("click", function (event) { + event.preventDefault() + onModalOpen() + }) + }) + } + + handleModal("#bookmark-dialog", "input, .btn, .close", ".action-bookmark") + + handleModal( + "#help-dialog", + ".close, .trouble-shooting, .email-address, .btn", + ".action-help", + 1 + ) +}) From 8ae0b229a9238acf785a4ff764311f4c921270e1 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 9 Aug 2024 11:56:03 +0100 Subject: [PATCH 18/60] increases icon size to meet accessibility standards --- app/assets/stylesheets/ppd.scss | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/ppd.scss b/app/assets/stylesheets/ppd.scss index bf8f3cf..82e7858 100644 --- a/app/assets/stylesheets/ppd.scss +++ b/app/assets/stylesheets/ppd.scss @@ -69,6 +69,10 @@ border: 1px solid #d8d8d8; border-radius: 4px; } + + i { + padding: 4px; + } } .search-selection > span { @@ -89,7 +93,7 @@ } .search-zoom-button { - margin: 1px 3px; + padding: 4px 4.75px; } } @@ -158,6 +162,10 @@ border-radius: 5px; } + .transaction-url a i { + padding: 4px; + } + .transaction-category { background-color: lighten( $lr-logo-grey, 20% ); padding: 3px; From e3a8dd6c2657494203934d186e842839cdce5fbf Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 9 Aug 2024 12:08:37 +0100 Subject: [PATCH 19/60] updates changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b506d..aac1685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This app allows the user to explore HMLR price-paid open linked data. ## 1.7.7 - 2024-08 +- (Dan) Increases target size of clickable elements to meet accessibility requirments [GH](https://github.com/epimorphics/ppd-explorer/issues/225) - (Dan) updates the form to meet various accessibility requirments [GH-217](https://github.com/epimorphics/ppd-explorer/issues/217) ## 1.7.6 - 2024-03-08 From e60b1ebc00c070c63aa7a8a06fe98f24c197eb0c Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 9 Aug 2024 14:02:31 +0100 Subject: [PATCH 20/60] adds buttons to the top of the page --- app/views/ppd/_search_action_buttons.html.haml | 15 +++++++++++++++ app/views/ppd/index.html.haml | 17 +++-------------- 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 app/views/ppd/_search_action_buttons.html.haml diff --git a/app/views/ppd/_search_action_buttons.html.haml b/app/views/ppd/_search_action_buttons.html.haml new file mode 100644 index 0000000..4127a80 --- /dev/null +++ b/app/views/ppd/_search_action_buttons.html.haml @@ -0,0 +1,15 @@ +.row + .col-sm-12 + .pull-right.search-form-actions + .search-form-action + %a.js.hidden.button.button--secondary.action-help{ href: "#", alt: "Help and tips", title: "Help and tips" } + %i.fa.fa-question-circle + help + .search-form-action + = link_to( {controller: :ppd, action: :index}, {class: "button button--secondary"} ) do + %i.fa.fa-refresh + reset the form + .search-form-action + %button.button{ type: 'submit' } + %i.fa.fa-search + show results \ No newline at end of file diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index b8fa72a..a728d8a 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -1,5 +1,7 @@ -# frozen_string_literal: true += render partial: "search_action_buttons" + .row %h1.col-md-12 Search the price paid dataset: @@ -179,20 +181,7 @@ %label %input{ type: "radio", name: :limit, value: "all", checked: @preferences.selected_limit == "all" } all - .col-sm-12 - .pull-right.search-form-actions - .search-form-action - %a.js.hidden.button.button--secondary.action-help{ href: "#", alt: "Help and tips", title: "Help and tips" } - %i.fa.fa-question-circle - help - .search-form-action - = link_to( {controller: :ppd, action: :index}, {class: "button button--secondary"} ) do - %i.fa.fa-refresh - reset the form - .search-form-action - %button.button{ type: 'submit' } - %i.fa.fa-search - show results += render partial: "search_action_buttons" = render partial: "bookmark_modal" = render partial: "help_modal" From 912f96eefdc9f712a4e557e022e083adbeb4a22a Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 9 Aug 2024 14:14:01 +0100 Subject: [PATCH 21/60] removes show results from top of the page --- CHANGELOG.md | 3 ++- app/views/ppd/index.html.haml | 29 ++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 377ceac..17f5a2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ This app allows the user to explore HMLR price-paid open linked data. ## 1.7.7 - 2024-08 -- (Dan) Increases target size of clickable elements to meet accessibility requirments [GH](https://github.com/epimorphics/ppd-explorer/issues/225) +- (Dan) Adds search actions buttons to the top of the page [226](https://github.com/epimorphics/ppd-explorer/issues/226) +- (Dan) Increases target size of clickable elements to meet accessibility requirments [GH-225](https://github.com/epimorphics/ppd-explorer/issues/225) - (Dan) updates the search results modal focus flow to meet accessibility requirments [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) - (Dan) updates the form to meet various accessibility requirments [GH-217](https://github.com/epimorphics/ppd-explorer/issues/217) - (Dan) updates the help modal focus flow to meet accessibility requirments [GH-218](https://github.com/epimorphics/ppd-explorer/issues/218) diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index a728d8a..7b90e81 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -1,6 +1,16 @@ -# frozen_string_literal: true -= render partial: "search_action_buttons" +.row + .col-sm-12 + .pull-right.search-form-actions + .search-form-action + %a.js.hidden.button.button--secondary.action-help{ href: "#", alt: "Help and tips", title: "Help and tips" } + %i.fa.fa-question-circle + help + .search-form-action + = link_to( {controller: :ppd, action: :index}, {class: "button button--secondary"} ) do + %i.fa.fa-refresh + reset the form .row %h1.col-md-12 @@ -181,7 +191,20 @@ %label %input{ type: "radio", name: :limit, value: "all", checked: @preferences.selected_limit == "all" } all -= render partial: "search_action_buttons" + .col-sm-12 + .pull-right.search-form-actions + .search-form-action + %a.js.hidden.button.button--secondary.action-help{ href: "#", alt: "Help and tips", title: "Help and tips" } + %i.fa.fa-question-circle + help + .search-form-action + = link_to( {controller: :ppd, action: :index}, {class: "button button--secondary"} ) do + %i.fa.fa-refresh + reset the form + .search-form-action + %button.button{ type: 'submit' } + %i.fa.fa-search + show results = render partial: "bookmark_modal" -= render partial: "help_modal" += render partial: "help_modal" \ No newline at end of file From d1fd02e14d538aa00b0286e7940cd98e21054e56 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 9 Aug 2024 14:14:33 +0100 Subject: [PATCH 22/60] deletes partial --- app/views/ppd/_search_action_buttons.html.haml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 app/views/ppd/_search_action_buttons.html.haml diff --git a/app/views/ppd/_search_action_buttons.html.haml b/app/views/ppd/_search_action_buttons.html.haml deleted file mode 100644 index 4127a80..0000000 --- a/app/views/ppd/_search_action_buttons.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -.row - .col-sm-12 - .pull-right.search-form-actions - .search-form-action - %a.js.hidden.button.button--secondary.action-help{ href: "#", alt: "Help and tips", title: "Help and tips" } - %i.fa.fa-question-circle - help - .search-form-action - = link_to( {controller: :ppd, action: :index}, {class: "button button--secondary"} ) do - %i.fa.fa-refresh - reset the form - .search-form-action - %button.button{ type: 'submit' } - %i.fa.fa-search - show results \ No newline at end of file From b4f0b96e3d856c2928ab760f79baf1faa20e9126 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 9 Aug 2024 14:18:44 +0100 Subject: [PATCH 23/60] adds blank line --- app/views/ppd/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index 7b90e81..1a6a267 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -207,4 +207,4 @@ show results = render partial: "bookmark_modal" -= render partial: "help_modal" \ No newline at end of file += render partial: "help_modal" From a5299df943b932ca8db8821937b09e2506d14fad Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 16 Aug 2024 12:09:25 +0100 Subject: [PATCH 24/60] updates page titles --- CHANGELOG.md | 1 + app/views/ppd/index.html.haml | 2 ++ app/views/search/_search_results.html.haml | 1 + 3 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17f5a2a..244e62f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This app allows the user to explore HMLR price-paid open linked data. ## 1.7.7 - 2024-08 +- (Dan) Adds more descriptive page titles [220](https://github.com/epimorphics/ppd-explorer/issues/220) - (Dan) Adds search actions buttons to the top of the page [226](https://github.com/epimorphics/ppd-explorer/issues/226) - (Dan) Increases target size of clickable elements to meet accessibility requirments [GH-225](https://github.com/epimorphics/ppd-explorer/issues/225) - (Dan) updates the search results modal focus flow to meet accessibility requirments [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index 1a6a267..a607ff6 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -1,5 +1,7 @@ -# frozen_string_literal: true += content_for(:title, "Search the price paid dataset".html_safe) + .row .col-sm-12 .pull-right.search-form-actions diff --git a/app/views/search/_search_results.html.haml b/app/views/search/_search_results.html.haml index 4089c8d..0313be5 100644 --- a/app/views/search/_search_results.html.haml +++ b/app/views/search/_search_results.html.haml @@ -1,4 +1,5 @@ -# frozen_string_literal: true += content_for(:title, "Search results".html_safe) - sr = @query_command.search_results = render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true} From 90e2fbaf37c9036647c0b6784573601ea584bdb4 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 16 Aug 2024 13:36:38 +0100 Subject: [PATCH 25/60] removes html_safe --- app/views/ppd/index.html.haml | 2 +- app/views/search/_search_results.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index a607ff6..b7c10c7 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -1,6 +1,6 @@ -# frozen_string_literal: true -= content_for(:title, "Search the price paid dataset".html_safe) += content_for(:title, "Search the price paid dataset") .row .col-sm-12 diff --git a/app/views/search/_search_results.html.haml b/app/views/search/_search_results.html.haml index 0313be5..9b73733 100644 --- a/app/views/search/_search_results.html.haml +++ b/app/views/search/_search_results.html.haml @@ -1,5 +1,5 @@ -# frozen_string_literal: true -= content_for(:title, "Search results".html_safe) += content_for(:title, "Search results") - sr = @query_command.search_results = render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true} From 19cefdf8ea1c7ba0baa15f2d2bc6ecdb215118c3 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Mon, 19 Aug 2024 11:38:31 +0100 Subject: [PATCH 26/60] updates gemfile lr_common_styles --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index cdb87ef..bc9ad78 100644 --- a/Gemfile +++ b/Gemfile @@ -84,5 +84,5 @@ gem 'yajl-ruby', require: 'yajl' source 'https://rubygems.pkg.github.com/epimorphics' do gem 'data_services_api', '~> 1.3.3' gem 'json_rails_logger', '~>1.0.0' - gem 'lr_common_styles', '~> 1.9.3' + gem 'lr_common_styles', '~> 1.9', '>= 1.9.5' end From 3f1d8d8da087b8ebfedb6e66ff5a1ed1e77a71f2 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Mon, 19 Aug 2024 11:42:18 +0100 Subject: [PATCH 27/60] updates changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17f5a2a..9515c9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This app allows the user to explore HMLR price-paid open linked data. ## 1.7.7 - 2024-08 +- (Dan) Updates gemfile to use v1.9.5 lr_common_styles - (Dan) Adds search actions buttons to the top of the page [226](https://github.com/epimorphics/ppd-explorer/issues/226) - (Dan) Increases target size of clickable elements to meet accessibility requirments [GH-225](https://github.com/epimorphics/ppd-explorer/issues/225) - (Dan) updates the search results modal focus flow to meet accessibility requirments [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) From 67c0aafb05ea44ddb2017c46860ffa005ae9f2ed Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 20 Aug 2024 09:34:01 +0100 Subject: [PATCH 28/60] style: rubocop linting rule update Added `CountAsOne: ['array', 'hash', 'heredoc', 'method_call']` to Metrics/ClassLength and Metrics/MethodLength --- .rubocop.yml | 3 +++ app/controllers/application_controller.rb | 4 ++-- app/controllers/concerns/dsapi_turtle_formatter.rb | 6 +++--- app/controllers/search_controller.rb | 6 ++---- app/helpers/ppd_helper.rb | 4 ++-- app/models/concerns/turtle_formatter.rb | 6 +++--- app/models/paon.rb | 6 +++--- app/models/query_command.rb | 2 +- app/models/search_aspect.rb | 2 +- app/models/search_result.rb | 2 +- app/subscribers/api_prometheus_subscriber.rb | 2 +- config/boot.rb | 2 +- config/environments/production.rb | 2 +- config/initializers/sentry.rb | 2 +- test/test_helper.rb | 2 +- 15 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index f4fadce..5d8e35b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,6 +14,7 @@ Layout/LineLength: - test/**/* Metrics/ClassLength: + CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] Exclude: - test/**/* @@ -24,7 +25,9 @@ Metrics/BlockLength: - lib/tasks/**/* Metrics/MethodLength: + CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] Exclude: + - test/**/* - lib/tasks/location.rake Style/FormatStringToken: diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 21c3b27..4c7543d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -84,7 +84,7 @@ def reset_response self.response_body = nil end - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize + # rubocop:disable Metrics/AbcSize def detailed_request_log(duration) env = request.env @@ -112,7 +112,7 @@ def detailed_request_log(duration) Rails.logger.info(JSON.generate(log_fields)) end end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize + # rubocop:enable Metrics/AbcSize def instrument_internal_error(exception) ActiveSupport::Notifications.instrument('internal_error.application', exception: exception) diff --git a/app/controllers/concerns/dsapi_turtle_formatter.rb b/app/controllers/concerns/dsapi_turtle_formatter.rb index eb67e11..d7b3728 100644 --- a/app/controllers/concerns/dsapi_turtle_formatter.rb +++ b/app/controllers/concerns/dsapi_turtle_formatter.rb @@ -17,7 +17,7 @@ def results_to_ttl(results) results.map { |r| result_to_ttl(r) } end - def result_to_ttl(result) # rubocop:disable Metrics/MethodLength + def result_to_ttl(result) ttl_value = { properties: [] } result.map do |property, value| @@ -34,7 +34,7 @@ def result_to_ttl(result) # rubocop:disable Metrics/MethodLength ttl_value end - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize + # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity def format_ttl_value(value) f = @@ -60,6 +60,6 @@ def format_ttl_value(value) f.html_safe end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize + # rubocop:enable Metrics/AbcSize # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index ec0ce04..cb64b90 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -8,7 +8,6 @@ def index create end - # rubocop:disable Metrics/MethodLength def create @preferences = UserPreferences.new(params) @@ -36,7 +35,6 @@ def create render_error_page(e, e.message, status) end - # rubocop:enable Metrics/MethodLength, Metrics/PerceivedComplexity def use_compact_json? non_compact_formats.exclude?(request.format) @@ -48,7 +46,7 @@ def non_compact_formats private - # rubocop:disable Layout/LineLength, Metrics/MethodLength + # rubocop:disable Layout/LineLength def render_error_page(err, message, status, template = 'ppd/error') # link the error to the actual request id otherwise generate one for this error uuid = Thread.current[:request_id] || SecureRandom.uuid @@ -69,5 +67,5 @@ def render_error_page(err, message, status, template = 'ppd/error') ].join.html_safe render(template: template, status: status) end - # rubocop:enable Layout/LineLength, Metrics/MethodLength + # rubocop:enable Layout/LineLength end diff --git a/app/helpers/ppd_helper.rb b/app/helpers/ppd_helper.rb index 0ee118b..dd64b09 100644 --- a/app/helpers/ppd_helper.rb +++ b/app/helpers/ppd_helper.rb @@ -10,7 +10,7 @@ def address_detail_header(aspect, result) end end - def address_detail_filter(aspect, result, preferences) # rubocop:disable Metrics/MethodLength + def address_detail_filter(aspect, result, preferences) vp = result.presentation_value_of_property(aspect.aspect_key_property) val = result.value_of_property(aspect.aspect_key_property) @@ -31,7 +31,7 @@ def address_detail_filter(aspect, result, preferences) # rubocop:disable Metrics end end - def results_selection(limit, preferences) # rubocop:disable Metrics/MethodLength + def results_selection(limit, preferences) if preferences.selected_limit == limit content_tag('strong') do results_selection_summary(limit) diff --git a/app/models/concerns/turtle_formatter.rb b/app/models/concerns/turtle_formatter.rb index 6d7ff68..c34d257 100644 --- a/app/models/concerns/turtle_formatter.rb +++ b/app/models/concerns/turtle_formatter.rb @@ -7,7 +7,7 @@ def each_property(result, ignore_pattern = nil, &block) props.reject { |pv| ignore_pattern && pv[:p] =~ ignore_pattern }.each(&block) end - def result_to_ttl(result) # rubocop:disable Metrics/MethodLength + def result_to_ttl(result) ttl_value = { properties: [] } result.map do |property, value| @@ -24,7 +24,7 @@ def result_to_ttl(result) # rubocop:disable Metrics/MethodLength ttl_value end - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize + # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity def format_ttl_value(value) f = @@ -54,6 +54,6 @@ def format_ttl_value(value) f.html_safe end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize + # rubocop:enable Metrics/AbcSize # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity end diff --git a/app/models/paon.rb b/app/models/paon.rb index a6c8af2..218c0be 100644 --- a/app/models/paon.rb +++ b/app/models/paon.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true # LR PAONs, which are strings with a custom sort order -class Paon < String # rubocop:disable Metrics/ClassLength - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize +class Paon < String + # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def <=>(other) pe0 = elements(self) @@ -51,7 +51,7 @@ def <=>(other) 0 end end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize + # rubocop:enable Metrics/AbcSize # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def self.to_paon(value) diff --git a/app/models/query_command.rb b/app/models/query_command.rb index a959c26..31f5133 100644 --- a/app/models/query_command.rb +++ b/app/models/query_command.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Command object providing a service for driving the DsAPI -class QueryCommand < DataService # rubocop:disable Metrics/ClassLength +class QueryCommand < DataService include TurtleFormatter attr_reader :all_results, :search_results, :error_message diff --git a/app/models/search_aspect.rb b/app/models/search_aspect.rb index f38a748..2999052 100644 --- a/app/models/search_aspect.rb +++ b/app/models/search_aspect.rb @@ -34,7 +34,7 @@ def search_term(_value, preferences) end # Sanitise input and convert to Lucene expression - def text_index_term(preferences) # rubocop:disable Metrics/MethodLength + def text_index_term(preferences) terms = sanitise_punctuation(preference_value(preferences)) .split .reject { |token| LUCENE_KEYWORDS.include?(token.downcase) } diff --git a/app/models/search_result.rb b/app/models/search_result.rb index cf4f677..9605a5f 100644 --- a/app/models/search_result.rb +++ b/app/models/search_result.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # An individual result returned from the search service -class SearchResult # rubocop:disable Metrics/ClassLength +class SearchResult attr_reader :result PPD = 'http://landregistry.data.gov.uk/def/ppi/' diff --git a/app/subscribers/api_prometheus_subscriber.rb b/app/subscribers/api_prometheus_subscriber.rb index da00382..dc43b09 100644 --- a/app/subscribers/api_prometheus_subscriber.rb +++ b/app/subscribers/api_prometheus_subscriber.rb @@ -4,7 +4,7 @@ class ApiPrometheusSubscriber < ActiveSupport::Subscriber attach_to :api - def response(event) # rubocop:disable Metrics/MethodLength + def response(event) response = event.payload[:response] duration = event.payload[:duration] diff --git a/config/boot.rb b/config/boot.rb index a7f5578..9f19953 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -3,4 +3,4 @@ # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV.fetch('BUNDLE_GEMFILE', nil)) diff --git a/config/environments/production.rb b/config/environments/production.rb index 1ae1d75..0944456 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -89,7 +89,7 @@ # API_SERVICE_URL should also be specified in the entrypoint.sh file and # set in the Makefile as an env variable for the docker container when run as an image. # API_SERVICE_URL is required by both Docker image and Rails - config.api_service_url = ENV['API_SERVICE_URL'] + config.api_service_url = ENV.fetch('API_SERVICE_URL', nil) # Use default paths for documentation. config.accessibility_document_path = '/accessibility' diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index d35ef4e..a8c1602 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -3,7 +3,7 @@ if ENV['SENTRY_API_KEY'] Sentry.init do |config| config.dsn = ENV['SENTRY_API_KEY'] - config.environment = ENV['DEPLOYMENT_ENVIRONMENT'] || Rails.env + config.environment = ENV.fetch('DEPLOYMENT_ENVIRONMENT') { Rails.env } config.enabled_environments = %w[production] config.release = Version::VERSION config.breadcrumbs_logger = %i[active_support_logger http_logger] diff --git a/test/test_helper.rb b/test/test_helper.rb index 8ab21f6..409c29b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -82,7 +82,7 @@ class TestCase end # To see the Chrome window while tests are running, set this var to true -see_visible_window_while_test_run = ENV['TEST_BROWSER_VISIBLE'] +see_visible_window_while_test_run = ENV.fetch('TEST_BROWSER_VISIBLE', nil) # Set Capybara to use Chrome via Selenium driver = see_visible_window_while_test_run ? :chrome : :headless_chrome From e05eb6d7b52556736a8174149d8496a49b282270 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 20 Aug 2024 12:36:40 +0100 Subject: [PATCH 29/60] style: rubocop rule reordering now alphabetically sorted --- .rubocop.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 5d8e35b..e6dca5f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,10 +13,18 @@ Layout/LineLength: - config/**/* - test/**/* -Metrics/ClassLength: - CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] +Lint/ConstantDefinitionInBlock: + Exclude: + - test/**/* + +Lint/DuplicateBranch: + Enabled: false + +Metrics/AbcSize: + Max: 30 Exclude: - test/**/* + - lib/tasks/**/* Metrics/BlockLength: Max: 30 @@ -24,25 +32,23 @@ Metrics/BlockLength: - test/**/* - lib/tasks/**/* +Metrics/ClassLength: + CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] + Exclude: + - test/**/* + Metrics/MethodLength: CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] Exclude: - test/**/* - lib/tasks/location.rake -Style/FormatStringToken: - Enabled: false - Style/Documentation: Exclude: - test/**/* -Style/OptionalBooleanParameter: +Style/FormatStringToken: Enabled: false -Lint/ConstantDefinitionInBlock: - Exclude: - - test/**/* - -Lint/DuplicateBranch: +Style/OptionalBooleanParameter: Enabled: false From f370153c7a5615938086eba16c25277fa6321065 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 20 Aug 2024 12:38:16 +0100 Subject: [PATCH 30/60] style: renaming `registry` to `prometheus` as per other integrations for metrics --- config/initializers/prometheus.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/initializers/prometheus.rb b/config/initializers/prometheus.rb index 204cd04..c802544 100644 --- a/config/initializers/prometheus.rb +++ b/config/initializers/prometheus.rb @@ -1,42 +1,42 @@ # frozen_string_literal: true -registry = Prometheus::Client.registry +prometheus = Prometheus::Client.registry # Prometheus counters -registry.counter( +prometheus.counter( :api_status, docstring: 'Response from back-end API', labels: [:status] ) -registry.counter( +prometheus.counter( :api_requests, docstring: 'Overall count of back-end API requests', labels: [:result] ) -registry.counter( +prometheus.counter( :api_connection_failure, docstring: 'Reasons for back-end API connection failure', labels: [:message] ) -registry.counter( +prometheus.counter( :api_service_exception, docstring: 'The response from the back-end data API was not processed', labels: [:message] ) -registry.counter( +prometheus.counter( :internal_application_error, docstring: 'Unexpected events and internal error count', labels: [:message] ) # Prometheus gauges -registry.gauge( +prometheus.gauge( :memory_used_mb, docstring: 'Process memory usage in mb' ) # Prometheus histograms -registry.histogram( +prometheus.histogram( :api_response_times, docstring: 'Histogram of response times for API requests', buckets: Prometheus::Client::Histogram.exponential_buckets(start: 0.005, count: 16) From d8c8ffd97ed8307a0d3a0c81dbfd447144c17b4f Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 20 Aug 2024 12:39:36 +0100 Subject: [PATCH 31/60] feat: additional thread specific metrics - `:thread_count`: The number of threads currently alive - `:process_threads`: The number of currently running threads --- .../action_controller_prometheus_subscriber.rb | 10 ++++++++++ config/initializers/prometheus.rb | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/app/subscribers/action_controller_prometheus_subscriber.rb b/app/subscribers/action_controller_prometheus_subscriber.rb index 63f5879..441e167 100644 --- a/app/subscribers/action_controller_prometheus_subscriber.rb +++ b/app/subscribers/action_controller_prometheus_subscriber.rb @@ -7,11 +7,21 @@ class ActionControllerPrometheusSubscriber < ActiveSupport::Subscriber attach_to :action_controller + # rubocop:disable Metric/AbcSize def process_action(_event) mem = GetProcessMem.new Prometheus::Client.registry .get(:memory_used_mb) .set(mem.mb) + + Prometheus::Client.registry + .get(:thread_count) + .set(Thread.list.select { |thread| %w[run sleep].include?(thread.status) }.count) + + Prometheus::Client.registry + .get(:process_threads) + .set(Thread.list.select { |thread| thread.status == 'run' }.count) end + # rubocop:enable Metric/AbcSize end diff --git a/config/initializers/prometheus.rb b/config/initializers/prometheus.rb index c802544..cceeef0 100644 --- a/config/initializers/prometheus.rb +++ b/config/initializers/prometheus.rb @@ -35,6 +35,16 @@ docstring: 'Process memory usage in mb' ) +prometheus.gauge( + :thread_count, + docstring: 'The number of threads currently alive' +) + +prometheus.gauge( + :process_threads, + docstring: 'The number of currently running threads' +) + # Prometheus histograms prometheus.histogram( :api_response_times, From 3d88672c6181ef0727bea93f416713d5d15a9764 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Tue, 20 Aug 2024 15:33:41 +0100 Subject: [PATCH 32/60] updates page titles for PPD --- Gemfile | 2 +- app/views/ppd/error.html.haml | 5 ++++- app/views/ppd/index.html.haml | 4 +++- app/views/ppd_data/_download_options.html.haml | 4 +++- app/views/search/_search_results.html.haml | 4 +++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index cdb87ef..bc9ad78 100644 --- a/Gemfile +++ b/Gemfile @@ -84,5 +84,5 @@ gem 'yajl-ruby', require: 'yajl' source 'https://rubygems.pkg.github.com/epimorphics' do gem 'data_services_api', '~> 1.3.3' gem 'json_rails_logger', '~>1.0.0' - gem 'lr_common_styles', '~> 1.9.3' + gem 'lr_common_styles', '~> 1.9', '>= 1.9.5' end diff --git a/app/views/ppd/error.html.haml b/app/views/ppd/error.html.haml index ab62baa..6f4f936 100644 --- a/app/views/ppd/error.html.haml +++ b/app/views/ppd/error.html.haml @@ -1,7 +1,10 @@ -# frozen_string_literal: true += content_for(:title, "We're sorry, that didn't work") + .row - %h2 We're sorry, that didn't work + %h2 + = yield(:title) %p We're very sorry, but the query you have just run did not complete. Reasons for this are commonly due to large queries exceeding the time limit, diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index 1a6a267..020d9ad 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -1,5 +1,7 @@ -# frozen_string_literal: true += content_for(:title, 'Search the price paid dataset') + .row .col-sm-12 .pull-right.search-form-actions @@ -14,7 +16,7 @@ .row %h1.col-md-12 - Search the price paid dataset: + = yield(:title) + ":" %p.col-md-12 Enter one or more search terms to locate the property transactions you are interested in. diff --git a/app/views/ppd_data/_download_options.html.haml b/app/views/ppd_data/_download_options.html.haml index ce02380..6b1615f 100644 --- a/app/views/ppd_data/_download_options.html.haml +++ b/app/views/ppd_data/_download_options.html.haml @@ -1,5 +1,7 @@ -# frozen_string_literal: true += content_for(:title, 'Download price paid data') + - if params[:format] A format has been specified, but the default view has been selected. This suggests a bug, or that the format requested is not one that is currently supported. @@ -9,7 +11,7 @@ .col-md-12 = render partial: "ppd/workflow_action_buttons", locals: {no_download: true, no_print: true, no_help: true, no_bookmark: true} %h1 - Download price paid data + = yield(:title) .row.spacer diff --git a/app/views/search/_search_results.html.haml b/app/views/search/_search_results.html.haml index 4089c8d..796a0c0 100644 --- a/app/views/search/_search_results.html.haml +++ b/app/views/search/_search_results.html.haml @@ -1,10 +1,12 @@ -# frozen_string_literal: true += content_for(:title, 'Search results') + - sr = @query_command.search_results = render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true} %h1 - Search results + = yield(:title) .search-summary %p From fdf76c99eb934664a0b5fc7ba8ca800b2399eb3d Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Tue, 20 Aug 2024 15:37:56 +0100 Subject: [PATCH 33/60] removes extra title --- app/views/search/_search_results.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/search/_search_results.html.haml b/app/views/search/_search_results.html.haml index 951a585..4eced59 100644 --- a/app/views/search/_search_results.html.haml +++ b/app/views/search/_search_results.html.haml @@ -1,8 +1,6 @@ -# frozen_string_literal: true = content_for(:title, "Search results") -= content_for(:title, 'Search results') - - sr = @query_command.search_results = render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true} From b445e5335327dfc585971adbcb2d674c67031231 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Tue, 20 Aug 2024 15:41:08 +0100 Subject: [PATCH 34/60] updates changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b212e07..6496d6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This app allows the user to explore HMLR price-paid open linked data. ## 1.7.7 - 2024-08 +- (Dan) Adds page titles to donwload page and error page. Improves code dryness [220](https://github.com/epimorphics/ppd-explorer/issues/220) - (Dan) Updates gemfile to use v1.9.5 lr_common_styles - (Dan) Adds more descriptive page titles [220](https://github.com/epimorphics/ppd-explorer/issues/220) - (Dan) Adds search actions buttons to the top of the page [226](https://github.com/epimorphics/ppd-explorer/issues/226) From 7be7d662541fd5e52ccba34560b9455007ef7189 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Tue, 20 Aug 2024 16:35:26 +0100 Subject: [PATCH 35/60] updates syntax --- app/views/ppd/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/ppd/index.html.haml b/app/views/ppd/index.html.haml index 2708437..f422980 100644 --- a/app/views/ppd/index.html.haml +++ b/app/views/ppd/index.html.haml @@ -16,7 +16,7 @@ .row %h1.col-md-12 - = yield(:title) + ":" + = "#{yield(:title)}:" %p.col-md-12 Enter one or more search terms to locate the property transactions you are interested in. From dd201bd11e9a989ee603b7c8c5e47b0aa0990786 Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 23 Aug 2024 14:59:34 +0100 Subject: [PATCH 36/60] fixes search results bug --- Gemfile.lock | 4 ++-- app/views/search/_search_results.html.haml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8bec532..446a38a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -345,7 +345,7 @@ GEM json lograge railties - lr_common_styles (1.9.3) + lr_common_styles (1.9.5) bootstrap-sass (~> 3.4.0) font-awesome-rails (~> 4.7.0.1) govuk_elements_rails (~> 2.0.0) @@ -386,7 +386,7 @@ DEPENDENCIES json_expressions json_rails_logger (~> 1.0.0)! libv8-node (>= 16.10.0.0) - lr_common_styles (~> 1.9.3)! + lr_common_styles (~> 1.9, >= 1.9.5)! memory_profiler minitest-rails minitest-reporters diff --git a/app/views/search/_search_results.html.haml b/app/views/search/_search_results.html.haml index 4eced59..7093d62 100644 --- a/app/views/search/_search_results.html.haml +++ b/app/views/search/_search_results.html.haml @@ -5,7 +5,7 @@ = render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true} %h1 - = yield(:title) + = yield(:title) .search-summary %p From 0df239ba1362ac89d388253cd167de207523219b Mon Sep 17 00:00:00 2001 From: Daniel Couzens Date: Fri, 23 Aug 2024 15:01:02 +0100 Subject: [PATCH 37/60] updates changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6496d6b..4f7c818 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This app allows the user to explore HMLR price-paid open linked data. ## 1.7.7 - 2024-08 +- (Dan) Fixes the bug search results not displaying [232](https://github.com/epimorphics/ppd-explorer/issues/232) - (Dan) Adds page titles to donwload page and error page. Improves code dryness [220](https://github.com/epimorphics/ppd-explorer/issues/220) - (Dan) Updates gemfile to use v1.9.5 lr_common_styles - (Dan) Adds more descriptive page titles [220](https://github.com/epimorphics/ppd-explorer/issues/220) From 8dbd0f8378eddb927cf7f5f69b88a46b2663af6f Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:00:23 +0100 Subject: [PATCH 38/60] build: updated .gitignore mirrors the current approach in the other HMLR apps --- .gitignore | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index e99b22f..5c1b39b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,21 +4,51 @@ # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile '~/.gitignore_global' +# Ignore vscode config +.vscode + +## Ignore bundler configuration: +/.bundle +/vendor/bundle +/lib/bundler/man/ + +# Ignore all logfiles and tempfiles. +/log/* +/tmp/* !/log/.keep +!/tmp/.keep + +# Ignore Byebug command history file. .byebug_history -.github-token -.tags -/.bundle -/db/*.sqlite3 -/db/*.sqlite3-journal -/log/*.log -/tmp + +# Ignore node_modules +node_modules/ + +# Ignore precompiled javascript packs /public/packs /public/packs-test -/public/assets/ -coverage/ +/public/assets + +# Ignore uploaded files in development +/storage/* +!/storage/.keep +/public/uploads + +### Rails specific ### +.byebug_history +/public/system +/coverage/ +tmp + +# Ignore files specific to the development environment fc.json fc_simple.json index-names.txt index.json tags + +# Ignore dot files used by environment or IDE tools +.tags +.tool-versions +.github-token +.npmrc From cc79d0a3b35fc0767a14881d0732bff656e381a9 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:01:06 +0100 Subject: [PATCH 39/60] build: updated makefile Reorganised makefile targets alphabetically as well as mirrored other improvements from the other applications in the suite --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b394b53..05728f5 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,6 @@ BUNDLER_VERSION?=$(shell tail -1 Gemfile.lock | tr -d ' ') ECR?=${ACCOUNT}.dkr.ecr.eu-west-1.amazonaws.com GPR_OWNER?=epimorphics NAME?=$(shell awk -F: '$$1=="name" {print $$2}' deployment.yaml | sed -e 's/[[:blank:]]//g') -SHORTNAME?=$(shell echo ${NAME} | cut -f2 -d/) PAT?=$(shell read -p 'Github access token:' TOKEN; echo $$TOKEN) PORT?=3001 RUBY_VERSION?=$(shell cat .ruby-version) @@ -29,14 +28,14 @@ REPO?=${ECR}/${IMAGE} GITHUB_TOKEN=.github-token BUNDLE_CFG=.bundle/config -all: image - ${BUNDLE_CFG}: ${GITHUB_TOKEN} @./bin/bundle config set --local rubygems.pkg.github.com ${GPR_OWNER}:`cat ${GITHUB_TOKEN}` ${GITHUB_TOKEN}: @echo ${PAT} > ${GITHUB_TOKEN} +all: image + assets: auth @./bin/bundle config set --local without 'development test' @./bin/bundle install @@ -49,6 +48,7 @@ check: lint test clean: @[ -d public/assets ] && ./bin/rails assets:clobber || : + @@ rm -rf bundle coverage log node_modules image: auth @echo Building ${REPO}:${TAG} ... @@ -112,7 +112,6 @@ vars: @echo "ECR = ${ECR}" @echo "GPR_OWNER = ${GPR_OWNER}" @echo "NAME = ${NAME}" - @echo "SHORTNAME = ${SHORTNAME}" @echo "RUBY_VERSION = ${RUBY_VERSION}" @echo "SHORTNAME = ${SHORTNAME}" @echo "STAGE = ${STAGE}" From 8a46123911524331c019eedb1ce2a95ea1121e07 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:02:14 +0100 Subject: [PATCH 40/60] build: Updated `lr_common_styles` gem version from v1.9.5 ~> 1.9.6 --- Gemfile | 2 +- Gemfile.lock | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index bc9ad78..7d0b195 100644 --- a/Gemfile +++ b/Gemfile @@ -84,5 +84,5 @@ gem 'yajl-ruby', require: 'yajl' source 'https://rubygems.pkg.github.com/epimorphics' do gem 'data_services_api', '~> 1.3.3' gem 'json_rails_logger', '~>1.0.0' - gem 'lr_common_styles', '~> 1.9', '>= 1.9.5' + gem 'lr_common_styles', '~> 1.9', '>= 1.9.6' end diff --git a/Gemfile.lock b/Gemfile.lock index 446a38a..b90fc84 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -162,6 +162,19 @@ GEM loofah (2.21.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) + lr_common_styles (1.9.6) + bootstrap-sass (~> 3.4.0) + font-awesome-rails (~> 4.7.0.1) + govuk_elements_rails (~> 2.0.0) + govuk_frontend_toolkit (~> 4.18.1) + govuk_template (~> 0.18.1) + haml-rails (~> 2.0.0) + jquery-rails (~> 4.3.5) + lodash-rails (~> 4.17.14) + modernizr-rails (~> 2.7.1) + modulejs-rails (~> 2.2.0.0) + rails (~> 5.2.4) + sass-rails (~> 5.0.4) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) @@ -345,19 +358,6 @@ GEM json lograge railties - lr_common_styles (1.9.5) - bootstrap-sass (~> 3.4.0) - font-awesome-rails (~> 4.7.0.1) - govuk_elements_rails (~> 2.0.0) - govuk_frontend_toolkit (~> 4.18.1) - govuk_template (~> 0.18.1) - haml-rails (~> 2.0.0) - jquery-rails (~> 4.3.5) - lodash-rails (~> 4.17.14) - modernizr-rails (~> 2.7.1) - modulejs-rails (~> 2.2.0.0) - rails (~> 5.2.4) - sass-rails (~> 5.0.4) PLATFORMS -darwin-20 @@ -386,7 +386,7 @@ DEPENDENCIES json_expressions json_rails_logger (~> 1.0.0)! libv8-node (>= 16.10.0.0) - lr_common_styles (~> 1.9, >= 1.9.5)! + lr_common_styles (~> 1.9, >= 1.9.6)! memory_profiler minitest-rails minitest-reporters From 5648e9e711fcfe7afef8d5e9aba952db0b8f55fe Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:02:58 +0100 Subject: [PATCH 41/60] style: rubocop lint update --- app/controllers/concerns/dsapi_turtle_formatter.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/controllers/concerns/dsapi_turtle_formatter.rb b/app/controllers/concerns/dsapi_turtle_formatter.rb index d7b3728..1eb1b15 100644 --- a/app/controllers/concerns/dsapi_turtle_formatter.rb +++ b/app/controllers/concerns/dsapi_turtle_formatter.rb @@ -34,7 +34,6 @@ def result_to_ttl(result) ttl_value end - # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity def format_ttl_value(value) f = @@ -60,6 +59,5 @@ def format_ttl_value(value) f.html_safe end - # rubocop:enable Metrics/AbcSize # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity end From abf8129378da4b3d114e37c45860d97efdeca4d9 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:13:12 +0100 Subject: [PATCH 42/60] build: additional puma metrics Additional metrics from the Puma server to be exposed in the /metrics endpoint via the `puma-metrics` gem --- Gemfile | 5 ++++- Gemfile.lock | 4 ++++ config/puma.rb | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 7d0b195..21dfa44 100644 --- a/Gemfile +++ b/Gemfile @@ -72,12 +72,15 @@ gem 'prometheus-client', '~> 4.0' gem 'sentry-rails', '~> 5.2' gem 'yajl-ruby', require: 'yajl' +gem 'puma-metrics' + + # rubocop:disable Layout/LineLength # TODO: While running the rails app locally for testing you can set gems to your local path # ! These "local" paths do not work with a docker image - use the repo instead # gem 'data_services_api', '~> 1.3.3', path: '~/Epimorphics/shared/data_services_api/' # gem 'json_rails_logger', '~>1.0.0', path: '~/Epimorphics/shared/json-rails-logger/' -# gem 'lr_common_styles', '~> 1.9.3', path: '~/Epimorphics/clients/land-registry/projects/lr_common_styles/' +# gem 'lr_common_styles', '~> 1.9', '>= 1.9.6', path: '~/Epimorphics/clients/land-registry/projects/lr_common_styles/' # rubocop:enable Layout/LineLength # TODO: In production you want to set this to the gem from the epimorphics package repo diff --git a/Gemfile.lock b/Gemfile.lock index b90fc84..e7b332f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -223,6 +223,9 @@ GEM public_suffix (5.0.0) puma (5.6.7) nio4r (~> 2.0) + puma-metrics (1.2.5) + prometheus-client (>= 0.10) + puma (>= 5.0) racc (1.6.2) rack (2.2.8) rack-test (1.1.0) @@ -395,6 +398,7 @@ DEPENDENCIES mocha prometheus-client (~> 4.0) puma + puma-metrics rails (< 6.0.0) rb-readline rubocop diff --git a/config/puma.rb b/config/puma.rb index b53cc47..68b7ddc 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -36,6 +36,9 @@ # # preload_app! +# Additional metrics from the Puma server to be exposed in the /metrics endpoint +plugin 'metrics' + # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart From ea2b068561f08687337139c0c5a5ef359ec6ec5d Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:25:54 +0100 Subject: [PATCH 43/60] feat: adding process_threads metric alongside adding labels to be able to fine-tune the metrics --- ...action_controller_prometheus_subscriber.rb | 52 ++++++++++++++++--- config/initializers/prometheus.rb | 19 +++---- 2 files changed, 52 insertions(+), 19 deletions(-) diff --git a/app/subscribers/action_controller_prometheus_subscriber.rb b/app/subscribers/action_controller_prometheus_subscriber.rb index 441e167..2f557b9 100644 --- a/app/subscribers/action_controller_prometheus_subscriber.rb +++ b/app/subscribers/action_controller_prometheus_subscriber.rb @@ -7,21 +7,57 @@ class ActionControllerPrometheusSubscriber < ActiveSupport::Subscriber attach_to :action_controller - # rubocop:disable Metric/AbcSize + # rubocop:disable Metrics/AbcSize, Metrics/MethodLength def process_action(_event) mem = GetProcessMem.new - Prometheus::Client.registry .get(:memory_used_mb) .set(mem.mb) - + # description: 'Thread is aborting' Prometheus::Client.registry - .get(:thread_count) - .set(Thread.list.select { |thread| %w[run sleep].include?(thread.status) }.count) - + .get(:process_threads) + .set( + Thread.list.select { |thread| thread.status == 'aborting' }.count, + labels: { + status: 'aborting' + } + ) + # description: 'Thread is sleeping or waiting on I/O' + Prometheus::Client.registry + .get(:process_threads) + .set( + Thread.list.select { |thread| thread.status == 'sleep' }.count, + labels: { + status: 'sleep' + } + ) + # description: 'Thread is executing' + Prometheus::Client.registry + .get(:process_threads) + .set( + Thread.list.select { |thread| thread.status == 'run' }.count, + labels: { + status: 'run' + } + ) + # description: 'Thread is terminated normally' + Prometheus::Client.registry + .get(:process_threads) + .set( + Thread.list.select { |thread| thread.status == false }.count, + labels: { + status: 'false' + } + ) + # description: 'Thread is terminated with an exception' Prometheus::Client.registry .get(:process_threads) - .set(Thread.list.select { |thread| thread.status == 'run' }.count) + .set( + Thread.list.select { |thread| thread.status.nil? }.count, + labels: { + status: 'nil' + } + ) end - # rubocop:enable Metric/AbcSize + # rubocop:enable Metrics/AbcSize, Metrics/MethodLength end diff --git a/config/initializers/prometheus.rb b/config/initializers/prometheus.rb index cceeef0..5691075 100644 --- a/config/initializers/prometheus.rb +++ b/config/initializers/prometheus.rb @@ -5,27 +5,27 @@ # Prometheus counters prometheus.counter( :api_status, - docstring: 'Response from back-end API', + docstring: 'Response from back-end API, labelled by status', labels: [:status] ) prometheus.counter( :api_requests, - docstring: 'Overall count of back-end API requests', + docstring: 'Overall count of back-end API requests, labelled by result', labels: [:result] ) prometheus.counter( :api_connection_failure, - docstring: 'Reasons for back-end API connection failure', + docstring: 'Reasons for back-end API connection failure, labelled by message', labels: [:message] ) prometheus.counter( :api_service_exception, - docstring: 'The response from the back-end data API was not processed', + docstring: 'The response from the back-end data API was not processed, labelled by message', labels: [:message] ) prometheus.counter( :internal_application_error, - docstring: 'Unexpected events and internal error count', + docstring: 'Unexpected events and internal error count, labelled by message', labels: [:message] ) @@ -35,14 +35,11 @@ docstring: 'Process memory usage in mb' ) -prometheus.gauge( - :thread_count, - docstring: 'The number of threads currently alive' -) - prometheus.gauge( :process_threads, - docstring: 'The number of currently running threads' + docstring: 'The number of process threads, labelled by status', + labels: [:status], + preset_labels: { status: 'total' } ) # Prometheus histograms From f016a579c766e5dce5ed490e58af8d7d28e18009 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:53:50 +0100 Subject: [PATCH 44/60] refactor: rubocop linting fixes --- app/controllers/application_controller.rb | 4 ++-- app/controllers/search_controller.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4c7543d..d2aed82 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -84,7 +84,7 @@ def reset_response self.response_body = nil end - # rubocop:disable Metrics/AbcSize + # rubocop:disable Metrics/AbcSize, Metrics/MethodLength def detailed_request_log(duration) env = request.env @@ -112,7 +112,7 @@ def detailed_request_log(duration) Rails.logger.info(JSON.generate(log_fields)) end end - # rubocop:enable Metrics/AbcSize + # rubocop:enable Metrics/AbcSize, Metrics/MethodLength def instrument_internal_error(exception) ActiveSupport::Notifications.instrument('internal_error.application', exception: exception) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index cb64b90..a46e3c7 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -46,7 +46,7 @@ def non_compact_formats private - # rubocop:disable Layout/LineLength + # rubocop:disable Layout/LineLength, Metrics/MethodLength def render_error_page(err, message, status, template = 'ppd/error') # link the error to the actual request id otherwise generate one for this error uuid = Thread.current[:request_id] || SecureRandom.uuid @@ -64,8 +64,8 @@ def render_error_page(err, message, status, template = 'ppd/error') '

Include the following information to support staff so that they can investigate this specific incident.

', "

#{@message}.

", "

The trace reference for this error is Code: #{uuid}

" - ].join.html_safe + ].join.html_safe # rubocop:disable Rails/OutputSafety render(template: template, status: status) end - # rubocop:enable Layout/LineLength + # rubocop:enable Layout/LineLength, Metrics/MethodLength end From 0859f124e631b9ea7ba8abb2958a19b3d0d7c6a3 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:55:23 +0100 Subject: [PATCH 45/60] refactor: reorganising of methods also improved doc comments --- app/controllers/application_controller.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d2aed82..e438145 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,10 +5,12 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. - # temporarily disable csrf for load testing. Was: protect_from_forgery with: :exception + # Temporarily disable csrf for load testing. + # Was: protect_from_forgery with: :exception protect_from_forgery with: :null_session - before_action :set_phase, :change_default_caching_policy + before_action :set_phase + before_action :change_default_caching_policy around_action :log_request_result def set_phase @@ -114,6 +116,11 @@ def detailed_request_log(duration) end # rubocop:enable Metrics/AbcSize, Metrics/MethodLength + # Notify subscriber(s) of an internal error event with the payload of the + # exception once done + # @param [Exception] exp the exception that caused the error + # @return [ActiveSupport::Notifications::Event] provides an object-oriented + # interface to the event def instrument_internal_error(exception) ActiveSupport::Notifications.instrument('internal_error.application', exception: exception) end From d1e7725d19fc9fb6d50a1871c39461bf77b0c162 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 12:57:28 +0100 Subject: [PATCH 46/60] fix: reorganising error handlers `rescue_from` handlers are inherited. They are searched from right to left, from bottom to top, and up the hierarchy, which meant the exception handler was the only handler firing as well as preventing the additional filtering for specific errors. --- app/controllers/application_controller.rb | 31 +++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e438145..25db02c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -35,21 +35,26 @@ def log_request_result # Handle specific types of exceptions and render the appropriate error page # or attempt to render a generic error page if no specific error page exists unless Rails.application.config.consider_all_requests_local - rescue_from ActionController::InvalidCrossOriginRequest, with: :render403 - rescue_from ActionController::RoutingError, with: :render404 - rescue_from ActionController::BadRequest, with: :render400 - rescue_from ActionView::MissingTemplate, with: :render404 - rescue_from Exception, with: :render_exception + rescue_from StandardError do |e| + case e.class + when ActiveRecord::RecordNotFound, ActionController::RoutingError, ActionView::MissingTemplate + :render404 + when ActionController::InvalidCrossOriginRequest + :render403 + when ActiveRecord::RecordInvalid, ActionController::ParameterMissing + :render400 + else + :handle_internal_error + end + end end - def render_exception(exception) + def handle_internal_error(exception) + instrument_internal_error(exception) unless exception.status == 404 if exception.instance_of? ArgumentError render_error(400) - elsif exception.instance_of? ActionController::InvalidCrossOriginRequest - render_error(403) else Rails.logger.warn "No explicit error page for exception #{exception} - #{exception.class}" - instrument_internal_error(exception) render_error(500) end end @@ -58,12 +63,16 @@ def render_400(_exception = nil) # rubocop:disable Naming/VariableNumber render_error(400) end + def render_403(_exception = nil) # rubocop:disable Naming/VariableNumber + render_error(403) + end + def render_404(_exception = nil) # rubocop:disable Naming/VariableNumber render_error(404) end - def render_403(_exception = nil) # rubocop:disable Naming/VariableNumber - render_error(403) + def render_500(_exception = nil) # rubocop:disable Naming/VariableNumber + render_error(500) end def render_error(status) From e09ef8ef12cf1815e8c639538d271fa525a8beb2 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 16:06:40 +0100 Subject: [PATCH 47/60] build: updated version patch cadence from v1.7.7 ~> 1.7.8 --- app/lib/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/version.rb b/app/lib/version.rb index 73e3c60..3e0677b 100644 --- a/app/lib/version.rb +++ b/app/lib/version.rb @@ -3,7 +3,7 @@ module Version MAJOR = 1 MINOR = 7 - PATCH = 7 + PATCH = 8 SUFFIX = nil VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}#{SUFFIX && ".#{SUFFIX}"}" end From 5b1066e7f754c88fc392abd2994e4486edc11b27 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 28 Aug 2024 16:06:54 +0100 Subject: [PATCH 48/60] docs: Updated CHANGELOG --- CHANGELOG.md | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f7c818..220ce2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,17 +2,41 @@ This app allows the user to explore HMLR price-paid open linked data. +## 1.7.8 - 2024-08 + +- (Jon) Implemented improved boilerplate metrics integration to offer analysis + of current application usage stats +- (Jon) Additional metrics from the Puma server to be exposed in the /metrics + endpoint via the puma-metrics gem +- (Jon) Tweaked the application controller to improve error handling and + ensuring additional filtering for specific errors completes when able +- (Jon) Reorganised makefile targets alphabetically as well as mirrored other + improvements from the other applications in the suite +- (Jon) Updated .gitignore file to mirror the current approach in the other HMLR + apps +- (Jon) Updated .rubocop.yml file with rules to reduce the need to set overrides + inline +- (Jon) Updated the `lr_common_styles` gem to the latest 1.9.6 patch release. + ## 1.7.7 - 2024-08 -- (Dan) Fixes the bug search results not displaying [232](https://github.com/epimorphics/ppd-explorer/issues/232) -- (Dan) Adds page titles to donwload page and error page. Improves code dryness [220](https://github.com/epimorphics/ppd-explorer/issues/220) +- (Dan) Fixes the bug search results not displaying + [232](https://github.com/epimorphics/ppd-explorer/issues/232) +- (Dan) Adds page titles to donwload page and error page. Improves code dryness + [220](https://github.com/epimorphics/ppd-explorer/issues/220) - (Dan) Updates gemfile to use v1.9.5 lr_common_styles -- (Dan) Adds more descriptive page titles [220](https://github.com/epimorphics/ppd-explorer/issues/220) -- (Dan) Adds search actions buttons to the top of the page [226](https://github.com/epimorphics/ppd-explorer/issues/226) -- (Dan) Increases target size of clickable elements to meet accessibility requirments [GH-225](https://github.com/epimorphics/ppd-explorer/issues/225) -- (Dan) updates the search results modal focus flow to meet accessibility requirments [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) -- (Dan) updates the form to meet various accessibility requirments [GH-217](https://github.com/epimorphics/ppd-explorer/issues/217) -- (Dan) updates the help modal focus flow to meet accessibility requirments [GH-218](https://github.com/epimorphics/ppd-explorer/issues/218) +- (Dan) Adds more descriptive page titles + [220](https://github.com/epimorphics/ppd-explorer/issues/220) +- (Dan) Adds search actions buttons to the top of the page + [226](https://github.com/epimorphics/ppd-explorer/issues/226) +- (Dan) Increases target size of clickable elements to meet accessibility + requirments [GH-225](https://github.com/epimorphics/ppd-explorer/issues/225) +- (Dan) updates the search results modal focus flow to meet accessibility + requirments [GH-216](https://github.com/epimorphics/ppd-explorer/issues/216) +- (Dan) updates the form to meet various accessibility requirments + [GH-217](https://github.com/epimorphics/ppd-explorer/issues/217) +- (Dan) updates the help modal focus flow to meet accessibility requirments + [GH-218](https://github.com/epimorphics/ppd-explorer/issues/218) ## 1.7.6 - 2024-03-08 @@ -35,7 +59,8 @@ This app allows the user to explore HMLR price-paid open linked data. - (Jon) Updated the `app/controllers/application_controller.rb` to include the `before_action` for the `change_default_caching_policy` method to ensure the - default `Cache-Control` header for all requests is set to 5 minutes (300 seconds). + default `Cache-Control` header for all requests is set to 5 minutes (300 + seconds). ## 1.7.3 - 2023-06-07 @@ -62,8 +87,8 @@ This app allows the user to explore HMLR price-paid open linked data. Epimorphics specific gems locally during the development of those gems. - (Jon) Updated the production `data_services_api` gem version to be at least the current version`~>1.3.3` (this is to cover out of sync release versions) -- (Jon) Updated the production `json_rails_logger` gem version to be at least the - current version `~>1.3.5` (this is to cover out of sync release versions) +- (Jon) Updated the production `json_rails_logger` gem version to be at least + the current version `~>1.3.5` (this is to cover out of sync release versions) - (Jon) Updated the production `lr_common_styles` gem version to be at least the current version `~>1.9.1` (this is to cover out of sync release versions) - (Jon) Refactored better guards in `entrypoint.sh` to ensure the required env From 58f52b7dc42c13829980d3976bff830639e9f791 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 3 Sep 2024 14:28:29 +0100 Subject: [PATCH 49/60] Update Gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 21dfa44..3ebc70b 100644 --- a/Gemfile +++ b/Gemfile @@ -87,5 +87,5 @@ gem 'puma-metrics' source 'https://rubygems.pkg.github.com/epimorphics' do gem 'data_services_api', '~> 1.3.3' gem 'json_rails_logger', '~>1.0.0' - gem 'lr_common_styles', '~> 1.9', '>= 1.9.6' + gem 'lr_common_styles', '~> 1.9.6' end From 6b309ae6090d737902f38e07df4a4d8ca9bd2c65 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 3 Sep 2024 14:45:09 +0100 Subject: [PATCH 50/60] Update Gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 3ebc70b..21252bb 100644 --- a/Gemfile +++ b/Gemfile @@ -87,5 +87,5 @@ gem 'puma-metrics' source 'https://rubygems.pkg.github.com/epimorphics' do gem 'data_services_api', '~> 1.3.3' gem 'json_rails_logger', '~>1.0.0' - gem 'lr_common_styles', '~> 1.9.6' + gem 'lr_common_styles', '~> 1.9', '>=1.9.6' end From 9476cd0d56a132a20a7f1c9f2d2a32ff937cb67e Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 3 Sep 2024 14:49:45 +0100 Subject: [PATCH 51/60] Update Gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 21252bb..21dfa44 100644 --- a/Gemfile +++ b/Gemfile @@ -87,5 +87,5 @@ gem 'puma-metrics' source 'https://rubygems.pkg.github.com/epimorphics' do gem 'data_services_api', '~> 1.3.3' gem 'json_rails_logger', '~>1.0.0' - gem 'lr_common_styles', '~> 1.9', '>=1.9.6' + gem 'lr_common_styles', '~> 1.9', '>= 1.9.6' end From 5709f2287cb03c2b85fc22843949c4e89fbb83ec Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Tue, 3 Sep 2024 14:54:38 +0100 Subject: [PATCH 52/60] Update Gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 21dfa44..b142738 100644 --- a/Gemfile +++ b/Gemfile @@ -87,5 +87,5 @@ gem 'puma-metrics' source 'https://rubygems.pkg.github.com/epimorphics' do gem 'data_services_api', '~> 1.3.3' gem 'json_rails_logger', '~>1.0.0' - gem 'lr_common_styles', '~> 1.9', '>= 1.9.6' + gem 'lr_common_styles', '~> 1.9.6' # set as this version as bundler breaks otherwise end From 6b41a683f89e9d77d16c3bfae77c121bf791b55c Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 4 Sep 2024 09:35:05 +0100 Subject: [PATCH 53/60] docs: Updated CHANGELOG revised post patch merge --- CHANGELOG.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5b57c0..9031ca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,6 @@ This app allows the user to explore HMLR price-paid open linked data. ## Changelog -## 1.7.7 - 2024-09 - -- (Jon) Updated search query processing and rendering to santise supplied input - for HTML output and resolve discovered XSS vulnerability in displayed results - [GH-236](https://github.com/epimorphics/hmlr-linked-data/issues/236) ## 1.7.8 - 2024-08 - (Jon) Implemented improved boilerplate metrics integration to offer analysis @@ -25,8 +20,11 @@ This app allows the user to explore HMLR price-paid open linked data. inline - (Jon) Updated the `lr_common_styles` gem to the latest 1.9.6 patch release. -## 1.7.7 - 2024-08 +## 1.7.7 - 2024-09 +- (Jon) Updated search query processing and rendering to santise supplied input + for HTML output and resolve discovered XSS vulnerability in displayed results + [GH-236](https://github.com/epimorphics/hmlr-linked-data/issues/236) - (Dan) Fixes the bug search results not displaying [232](https://github.com/epimorphics/ppd-explorer/issues/232) - (Dan) Adds page titles to donwload page and error page. Improves code dryness From 5b3e37799d9ba43834359ad40be4aa1eaf90fdde Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 4 Sep 2024 09:40:42 +0100 Subject: [PATCH 54/60] build: removed comment from prod step The need for this to be handled manually has passed therefore the comment is no longer needed --- deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment.yaml b/deployment.yaml index cc3bccb..e7e97ad 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -3,7 +3,7 @@ name: epimorphics/ppd-explorer key: ppd deployments: - branch: "prod" - # deploy: "prod" + deploy: "prod" publish: "prod" - branch: "preprod" deploy: "preprod" From c23ba5594e7569b0a27c7c91a5b9ab1489c24d70 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 4 Sep 2024 11:44:40 +0100 Subject: [PATCH 55/60] build: Updated `LR_Common_Styles.gem` to v.1.9.7 --- Gemfile | 4 ++-- Gemfile.lock | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Gemfile b/Gemfile index b142738..3571289 100644 --- a/Gemfile +++ b/Gemfile @@ -80,12 +80,12 @@ gem 'puma-metrics' # ! These "local" paths do not work with a docker image - use the repo instead # gem 'data_services_api', '~> 1.3.3', path: '~/Epimorphics/shared/data_services_api/' # gem 'json_rails_logger', '~>1.0.0', path: '~/Epimorphics/shared/json-rails-logger/' -# gem 'lr_common_styles', '~> 1.9', '>= 1.9.6', path: '~/Epimorphics/clients/land-registry/projects/lr_common_styles/' +# gem 'lr_common_styles', '~> 1.9.0', path: '~/Epimorphics/clients/land-registry/projects/lr_common_styles/' # rubocop:enable Layout/LineLength # TODO: In production you want to set this to the gem from the epimorphics package repo source 'https://rubygems.pkg.github.com/epimorphics' do gem 'data_services_api', '~> 1.3.3' gem 'json_rails_logger', '~>1.0.0' - gem 'lr_common_styles', '~> 1.9.6' # set as this version as bundler breaks otherwise + gem 'lr_common_styles', '~> 1.9.0' # set as this version as bundler breaks otherwise end diff --git a/Gemfile.lock b/Gemfile.lock index e7b332f..cde7b85 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -162,19 +162,6 @@ GEM loofah (2.21.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lr_common_styles (1.9.6) - bootstrap-sass (~> 3.4.0) - font-awesome-rails (~> 4.7.0.1) - govuk_elements_rails (~> 2.0.0) - govuk_frontend_toolkit (~> 4.18.1) - govuk_template (~> 0.18.1) - haml-rails (~> 2.0.0) - jquery-rails (~> 4.3.5) - lodash-rails (~> 4.17.14) - modernizr-rails (~> 2.7.1) - modulejs-rails (~> 2.2.0.0) - rails (~> 5.2.4) - sass-rails (~> 5.0.4) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) @@ -361,6 +348,19 @@ GEM json lograge railties + lr_common_styles (1.9.7) + bootstrap-sass (~> 3.4.0) + font-awesome-rails (~> 4.7.0.1) + govuk_elements_rails (~> 2.0.0) + govuk_frontend_toolkit (~> 4.18.1) + govuk_template (~> 0.18.1) + haml-rails (~> 2.0.0) + jquery-rails (~> 4.3.5) + lodash-rails (~> 4.17.14) + modernizr-rails (~> 2.7.1) + modulejs-rails (~> 2.2.0.0) + rails (~> 5.2.4) + sass-rails (~> 5.0.4) PLATFORMS -darwin-20 @@ -389,7 +389,7 @@ DEPENDENCIES json_expressions json_rails_logger (~> 1.0.0)! libv8-node (>= 16.10.0.0) - lr_common_styles (~> 1.9, >= 1.9.6)! + lr_common_styles (~> 1.9.0)! memory_profiler minitest-rails minitest-reporters From fc0235d87e9e7882b4678e56f2ef1ddad594ddf7 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Thu, 5 Sep 2024 16:09:16 +0100 Subject: [PATCH 56/60] build: application configuration unification Moved all mirrored configuration settings from individual environments into the application configuration to reduce the need to manage multiple sources --- config/application.rb | 7 +++++++ config/environments/development.rb | 7 ------- config/environments/production.rb | 7 ------- config/environments/test.rb | 7 ------- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/config/application.rb b/config/application.rb index ddc72ea..994cd11 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,6 +20,13 @@ class Application < Rails::Application # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. + # Use default paths for documentation. + config.accessibility_document_path = '/accessibility' + config.privacy_document_path = '/privacy' + + # Default contact email address to Land Registry Data Services + config.contact_email_address = 'data.services@mail.landregistry.gov.uk' + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' diff --git a/config/environments/development.rb b/config/environments/development.rb index 1ea9c01..2e56ec1 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -54,11 +54,4 @@ # API location can be specified in the environment but defaults to the dev service config.api_service_url = ENV.fetch('API_SERVICE_URL', 'http://localhost:8888') - - # Use default paths for documentation. - config.accessibility_document_path = '/doc/accessibility' - config.privacy_document_path = '/doc/privacy' - - # Set the contact email address to Land Registry supplied address - config.contact_email_address = 'data.services@mail.landregistry.gov.uk' end diff --git a/config/environments/production.rb b/config/environments/production.rb index 0944456..b7b61bb 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -90,13 +90,6 @@ # set in the Makefile as an env variable for the docker container when run as an image. # API_SERVICE_URL is required by both Docker image and Rails config.api_service_url = ENV.fetch('API_SERVICE_URL', nil) - - # Use default paths for documentation. - config.accessibility_document_path = '/accessibility' - config.privacy_document_path = '/privacy' - - # Set the contact email address to Land Registry supplied address - config.contact_email_address = 'data.services@mail.landregistry.gov.uk' end # Set the default url options for the relative url root diff --git a/config/environments/test.rb b/config/environments/test.rb index be2165c..6681759 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -47,11 +47,4 @@ # API location can be specified in the environment # But defaults to the dev service config.api_service_url = ENV.fetch('API_SERVICE_URL', 'http://localhost:8888') - - # Use default paths for documentation. - config.accessibility_document_path = '/doc/accessibility' - config.privacy_document_path = '/doc/privacy' - - # Set the contact email address to Land Registry supplied address - config.contact_email_address = 'data.services@mail.landregistry.gov.uk' end From 8c0bba9e58844f4992ff78c6f6862a3218f6bdcb Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Thu, 5 Sep 2024 16:10:57 +0100 Subject: [PATCH 57/60] docs: Updated CHANGELOG --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9031ca5..608d81e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,11 @@ This app allows the user to explore HMLR price-paid open linked data. ## Changelog -## 1.7.8 - 2024-08 +## 1.7.8 - 2024-09 +- (Jon) Moved all mirrored configuration settings from individual environments + into the application configuration to reduce the need to manage multiple + sources of truth - (Jon) Implemented improved boilerplate metrics integration to offer analysis of current application usage stats - (Jon) Additional metrics from the Puma server to be exposed in the /metrics From d1dd11a84580e157fd84c7d578377c6805573b6a Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Thu, 5 Sep 2024 16:25:57 +0100 Subject: [PATCH 58/60] build: update to `lr_common_styles` gem v1.9.8 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cde7b85..b6a5613 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -348,14 +348,14 @@ GEM json lograge railties - lr_common_styles (1.9.7) + lr_common_styles (1.9.8) bootstrap-sass (~> 3.4.0) font-awesome-rails (~> 4.7.0.1) govuk_elements_rails (~> 2.0.0) govuk_frontend_toolkit (~> 4.18.1) govuk_template (~> 0.18.1) haml-rails (~> 2.0.0) - jquery-rails (~> 4.3.5) + jquery-rails (>= 4.3.5, < 4.7.0) lodash-rails (~> 4.17.14) modernizr-rails (~> 2.7.1) modulejs-rails (~> 2.2.0.0) From 7be0ec58d387c9050e983d2c47c8646c71d71495 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Fri, 6 Sep 2024 12:02:34 +0100 Subject: [PATCH 59/60] Update CHANGELOG.md --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 608d81e..0db5acb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,12 +22,6 @@ This app allows the user to explore HMLR price-paid open linked data. - (Jon) Updated .rubocop.yml file with rules to reduce the need to set overrides inline - (Jon) Updated the `lr_common_styles` gem to the latest 1.9.6 patch release. - -## 1.7.7 - 2024-09 - -- (Jon) Updated search query processing and rendering to santise supplied input - for HTML output and resolve discovered XSS vulnerability in displayed results - [GH-236](https://github.com/epimorphics/hmlr-linked-data/issues/236) - (Dan) Fixes the bug search results not displaying [232](https://github.com/epimorphics/ppd-explorer/issues/232) - (Dan) Adds page titles to donwload page and error page. Improves code dryness @@ -46,6 +40,12 @@ This app allows the user to explore HMLR price-paid open linked data. - (Dan) updates the help modal focus flow to meet accessibility requirments [GH-218](https://github.com/epimorphics/ppd-explorer/issues/218) +## 1.7.7 - 2024-09 + +- (Jon) Updated search query processing and rendering to santise supplied input + for HTML output and resolve discovered XSS vulnerability in displayed results + [GH-236](https://github.com/epimorphics/hmlr-linked-data/issues/236) + ## 1.7.6 - 2024-03-08 - (Jon) Updated the application_controller to include an From c92c8492000850299b79402c48319389322c46de Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Fri, 6 Sep 2024 12:04:28 +0100 Subject: [PATCH 60/60] Update CHANGELOG.md Fixes typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0db5acb..6f7d93d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ This app allows the user to explore HMLR price-paid open linked data. - (Jon) Updated the `lr_common_styles` gem to the latest 1.9.6 patch release. - (Dan) Fixes the bug search results not displaying [232](https://github.com/epimorphics/ppd-explorer/issues/232) -- (Dan) Adds page titles to donwload page and error page. Improves code dryness +- (Dan) Adds page titles to download page and error page. Improves code dryness [220](https://github.com/epimorphics/ppd-explorer/issues/220) - (Dan) Updates gemfile to use v1.9.5 lr_common_styles - (Dan) Adds more descriptive page titles