From 120056702a435b93878cf7915a7781a11c23f31c Mon Sep 17 00:00:00 2001 From: jonathangoulding Date: Thu, 20 Jun 2024 14:12:37 +0100 Subject: [PATCH 1/4] Add feature flag to enable the system licence view There are currently links directing the pages to the legacy licence view pages, built previously in the water-abstraction-ui repo. This service is slowly being replaced. We have rebuilt these pages (with some tweaks) in this repo with the intention of using the water-abstraction-system to view and manage licences. This change will allow us to navigate to the water-abstraction-system licence view pages instead of the 'legacy' licence view pages in a controlled manner. This change will be mirrored in water-abstraction-ui. https://eaflood.atlassian.net/browse/WATER-4466 --- .env.example | 1 + app/plugins/views.plugin.js | 6 ++- app/views/bill-licences/view-presroc.njk | 6 ++- app/views/bill-licences/view-sroc.njk | 6 ++- app/views/bill-runs/match-details.njk | 54 +++++++++++++++---- app/views/bill-runs/review-licence.njk | 54 +++++++++++++++---- .../bills/view-single-licence-presroc.njk | 6 ++- app/views/bills/view-single-licence-sroc.njk | 6 ++- app/views/return-requirements/approved.njk | 6 ++- config/feature-flags.config.js | 4 +- 10 files changed, 123 insertions(+), 26 deletions(-) diff --git a/.env.example b/.env.example index 78ebce6b28..010f61863f 100644 --- a/.env.example +++ b/.env.example @@ -68,3 +68,4 @@ COOKIE_SECRET= # Feature flags ENABLE_REISSUING_BILLING_BATCHES=false ENABLE_REQUIREMENTS_FOR_RETURNS=false +ENABLE_SYSTEM_LICENCE_VIEW=true diff --git a/app/plugins/views.plugin.js b/app/plugins/views.plugin.js index 58805cf367..8d0be0b217 100644 --- a/app/plugins/views.plugin.js +++ b/app/plugins/views.plugin.js @@ -10,9 +10,10 @@ * @module ViewsPlugin */ -const path = require('path') const Nunjucks = require('nunjucks') const Vision = require('@hapi/vision') +const path = require('path') +const { enableSystemLicenceView } = require('../../config/feature-flags.config.js') const ServerConfig = require('../../config/server.config.js') @@ -100,6 +101,9 @@ function context (request) { scope: request.auth.credentials?.scope, permission: request.auth.credentials?.permission }, + featureFlag: { + enableSystemLicenceView + }, navigationLinks: _navigationLinks(request.auth) } } diff --git a/app/views/bill-licences/view-presroc.njk b/app/views/bill-licences/view-presroc.njk index 87df66f0e7..1e1c01380d 100644 --- a/app/views/bill-licences/view-presroc.njk +++ b/app/views/bill-licences/view-presroc.njk @@ -33,7 +33,11 @@ href: removeLicenceLink }) }} {% endif %} - View licence summary + {% if featureFlag.enableSystemLicenceView %} + View licence summary + {% else %} + View licence summary + {% endif %} diff --git a/app/views/bill-licences/view-sroc.njk b/app/views/bill-licences/view-sroc.njk index 0ec1ad30e4..928a23eeff 100644 --- a/app/views/bill-licences/view-sroc.njk +++ b/app/views/bill-licences/view-sroc.njk @@ -33,7 +33,11 @@ href: removeLicenceLink }) }} {% endif %} - View licence summary + {% if featureFlag.enableSystemLicenceView %} + View licence summary + {% else %} + View licence summary + {% endif %} diff --git a/app/views/bill-runs/match-details.njk b/app/views/bill-runs/match-details.njk index b9fb63ed9d..5b529e2eca 100644 --- a/app/views/bill-runs/match-details.njk +++ b/app/views/bill-runs/match-details.njk @@ -37,15 +37,51 @@ {# Licence nav bars #} diff --git a/app/views/bill-runs/review-licence.njk b/app/views/bill-runs/review-licence.njk index ca36ac0bd2..695f1d9a30 100644 --- a/app/views/bill-runs/review-licence.njk +++ b/app/views/bill-runs/review-licence.njk @@ -42,15 +42,51 @@ {# Licence nav bars #} {# Licence in review text #} diff --git a/app/views/bills/view-single-licence-presroc.njk b/app/views/bills/view-single-licence-presroc.njk index 394914f2e0..fa4d583ef6 100644 --- a/app/views/bills/view-single-licence-presroc.njk +++ b/app/views/bills/view-single-licence-presroc.njk @@ -166,7 +166,11 @@
- View licence summary + {% if featureFlag.enableSystemLicenceView %} + View licence summary + {% else %} + View licence summary + {% endif %}
diff --git a/app/views/bills/view-single-licence-sroc.njk b/app/views/bills/view-single-licence-sroc.njk index 9f5bafaeec..72b543fe9d 100644 --- a/app/views/bills/view-single-licence-sroc.njk +++ b/app/views/bills/view-single-licence-sroc.njk @@ -166,7 +166,11 @@
- View licence summary + {% if featureFlag.enableSystemLicenceView %} + View licence summary + {% else %} + View licence summary + {% endif %}
diff --git a/app/views/return-requirements/approved.njk b/app/views/return-requirements/approved.njk index 094a77bccb..f0d3788da0 100644 --- a/app/views/return-requirements/approved.njk +++ b/app/views/return-requirements/approved.njk @@ -10,6 +10,10 @@

What happens next

These return requirements are now active and returns will be opened for this licence in the next returns cycle.

- Return to licence set up + {% if featureFlag.enableSystemLicenceView %} + Return to licence set up + {% else %} + Return to licence set up + {% endif %}

{% endblock %} diff --git a/config/feature-flags.config.js b/config/feature-flags.config.js index b92d8d858d..a1f863d561 100644 --- a/config/feature-flags.config.js +++ b/config/feature-flags.config.js @@ -13,8 +13,8 @@ const config = { // Credit to https://stackoverflow.com/a/323546/6117745 for how to handle // converting the env var to a boolean enableReissuingBillingBatches: (String(process.env.ENABLE_REISSUING_BILLING_BATCHES) === 'true') || false, - enableRequirementsForReturns: (String(process.env.ENABLE_REQUIREMENTS_FOR_RETURNS) === 'true') || false - + enableRequirementsForReturns: (String(process.env.ENABLE_REQUIREMENTS_FOR_RETURNS) === 'true') || false, + enableSystemLicenceView: (String(process.env.ENABLE_SYSTEM_LICENCE_VIEW) === 'true') || false } module.exports = config From 688a57d0c731e5ef116eb935d6ce1b254bf1e0d0 Mon Sep 17 00:00:00 2001 From: jonathangoulding Date: Thu, 20 Jun 2024 14:19:10 +0100 Subject: [PATCH 2/4] refactor: simplify li if else --- app/views/bill-runs/match-details.njk | 49 ++++++++++++-------------- app/views/bill-runs/review-licence.njk | 49 ++++++++++++-------------- 2 files changed, 46 insertions(+), 52 deletions(-) diff --git a/app/views/bill-runs/match-details.njk b/app/views/bill-runs/match-details.njk index 5b529e2eca..41de142b28 100644 --- a/app/views/bill-runs/match-details.njk +++ b/app/views/bill-runs/match-details.njk @@ -37,51 +37,48 @@ {# Licence nav bars #} diff --git a/app/views/bill-runs/review-licence.njk b/app/views/bill-runs/review-licence.njk index 695f1d9a30..973b280bef 100644 --- a/app/views/bill-runs/review-licence.njk +++ b/app/views/bill-runs/review-licence.njk @@ -42,51 +42,48 @@ {# Licence nav bars #} {# Licence in review text #} From 4130fa638221bb24763d54bdd17013ed8c0a8376 Mon Sep 17 00:00:00 2001 From: jonathangoulding Date: Fri, 21 Jun 2024 09:27:31 +0100 Subject: [PATCH 3/4] fix: licence id var --- app/views/bill-runs/review-licence.njk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/bill-runs/review-licence.njk b/app/views/bill-runs/review-licence.njk index 973b280bef..3f6c0e28ad 100644 --- a/app/views/bill-runs/review-licence.njk +++ b/app/views/bill-runs/review-licence.njk @@ -46,40 +46,40 @@
  • + href="/system/licences/{{ licence.licenceId }}/summary"> Summary
  • + href="/system/licences/{{ licence.licenceId }}/returns"> Returns
  • + href="/system/licences/{{ licence.licenceId }}/set-up"> Charge information
  • {% else %}
  • + href="/licences/{{ licence.licenceId }}#summary"> Summary
  • + href="/licences/{{ licence.licenceId }}#returns"> Returns
  • + href="/licences/{{ licence.licenceId }}#charge"> Charge information
  • From ac915eea8b7c77badf70f8b9ecf25c688784343b Mon Sep 17 00:00:00 2001 From: jonathangoulding Date: Mon, 24 Jun 2024 11:08:49 +0100 Subject: [PATCH 4/4] chore: fix pr issues --- app/plugins/views.plugin.js | 6 +++--- app/views/bill-licences/view-presroc.njk | 2 +- app/views/bill-licences/view-sroc.njk | 2 +- app/views/bill-runs/match-details.njk | 2 +- app/views/bill-runs/review-licence.njk | 2 +- app/views/bills/view-single-licence-presroc.njk | 2 +- app/views/bills/view-single-licence-sroc.njk | 2 +- app/views/return-requirements/approved.njk | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/plugins/views.plugin.js b/app/plugins/views.plugin.js index 8d0be0b217..bf14facf90 100644 --- a/app/plugins/views.plugin.js +++ b/app/plugins/views.plugin.js @@ -10,12 +10,12 @@ * @module ViewsPlugin */ +const path = require('path') const Nunjucks = require('nunjucks') const Vision = require('@hapi/vision') -const path = require('path') -const { enableSystemLicenceView } = require('../../config/feature-flags.config.js') const ServerConfig = require('../../config/server.config.js') +const { enableSystemLicenceView } = require('../../config/feature-flags.config.js') const ViewsPlugin = { plugin: Vision, @@ -101,7 +101,7 @@ function context (request) { scope: request.auth.credentials?.scope, permission: request.auth.credentials?.permission }, - featureFlag: { + featureFlags: { enableSystemLicenceView }, navigationLinks: _navigationLinks(request.auth) diff --git a/app/views/bill-licences/view-presroc.njk b/app/views/bill-licences/view-presroc.njk index 1e1c01380d..d64010b775 100644 --- a/app/views/bill-licences/view-presroc.njk +++ b/app/views/bill-licences/view-presroc.njk @@ -33,7 +33,7 @@ href: removeLicenceLink }) }} {% endif %} - {% if featureFlag.enableSystemLicenceView %} + {% if featureFlags.enableSystemLicenceView %} View licence summary {% else %} View licence summary diff --git a/app/views/bill-licences/view-sroc.njk b/app/views/bill-licences/view-sroc.njk index 928a23eeff..6ab6227db5 100644 --- a/app/views/bill-licences/view-sroc.njk +++ b/app/views/bill-licences/view-sroc.njk @@ -33,7 +33,7 @@ href: removeLicenceLink }) }} {% endif %} - {% if featureFlag.enableSystemLicenceView %} + {% if featureFlags.enableSystemLicenceView %} View licence summary {% else %} View licence summary diff --git a/app/views/bill-runs/match-details.njk b/app/views/bill-runs/match-details.njk index 41de142b28..c42f1eb472 100644 --- a/app/views/bill-runs/match-details.njk +++ b/app/views/bill-runs/match-details.njk @@ -37,7 +37,7 @@ {# Licence nav bars #}