Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature flag to enable the system licence view #1130

Merged
merged 8 commits into from
Jun 24, 2024
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ COOKIE_SECRET=
# Feature flags
ENABLE_REISSUING_BILLING_BATCHES=false
ENABLE_REQUIREMENTS_FOR_RETURNS=false
ENABLE_SYSTEM_LICENCE_VIEW=true
6 changes: 5 additions & 1 deletion app/plugins/views.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* @module ViewsPlugin
*/

const path = require('path')
const Nunjucks = require('nunjucks')
const Vision = require('@hapi/vision')
const path = require('path')
jonathangoulding marked this conversation as resolved.
Show resolved Hide resolved
const { enableSystemLicenceView } = require('../../config/feature-flags.config.js')

const ServerConfig = require('../../config/server.config.js')

Expand Down Expand Up @@ -100,6 +101,9 @@ function context (request) {
scope: request.auth.credentials?.scope,
permission: request.auth.credentials?.permission
},
featureFlag: {
jonathangoulding marked this conversation as resolved.
Show resolved Hide resolved
enableSystemLicenceView
},
navigationLinks: _navigationLinks(request.auth)
}
}
Expand Down
6 changes: 5 additions & 1 deletion app/views/bill-licences/view-presroc.njk
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
href: removeLicenceLink
}) }}
{% endif %}
<a class="govuk-link" href="/licences/{{ licenceId }}">View licence summary</a>
{% if featureFlag.enableSystemLicenceView %}
<a class="govuk-link" href="/system/licences/{{ licenceId }}/summary">View licence summary</a>
{% else %}
<a class="govuk-link" href="/licences/{{ licenceId }}">View licence summary</a>
{% endif %}
</div>
</section>
</div>
Expand Down
6 changes: 5 additions & 1 deletion app/views/bill-licences/view-sroc.njk
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
href: removeLicenceLink
}) }}
{% endif %}
<a class="govuk-link" href="/licences/{{ licenceId }}">View licence summary</a>
{% if featureFlag.enableSystemLicenceView %}
<a class="govuk-link" href="/system/licences/{{ licenceId }}/summary">View licence summary</a>
{% else %}
<a class="govuk-link" href="/licences/{{ licenceId }}">View licence summary</a>
{% endif %}
</div>
</section>
</div>
Expand Down
51 changes: 42 additions & 9 deletions app/views/bill-runs/match-details.njk
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,48 @@

{# Licence nav bars #}
<ul class="govuk-summary-list__actions-list govuk-!-margin-bottom-3">
<li class="govuk-summary-list__actions-list-item"><a class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline" href="/licences/{{ licenceId }}#summary">
Summary
</a></li>
<li class="govuk-summary-list__actions-list-item"><a class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline" href="/licences/{{ licenceId }}#returns">
Returns
</a></li>
<li class="govuk-summary-list__actions-list-item"><a class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline" href="/licences/{{ licenceId }}#charge">
Charge information
</a></li>
{% if featureFlag.enableSystemLicenceView %}
<li class="govuk-summary-list__actions-list-item">
<a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/system/licences/{{ licenceId }}/summary">
Summary
</a>
</li>
<li class="govuk-summary-list__actions-list-item">
<a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/system/licences/{{ licenceId }}/returns">
Returns
</a>
</li>
<li class="govuk-summary-list__actions-list-item">
<a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/system/licences/{{ licenceId }}/set-up">
Charge information
</a>
</li>
{% else %}
<li class="govuk-summary-list__actions-list-item"><a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/licences/{{ licenceId }}#summary">
Summary
</a>
</li>
<li class="govuk-summary-list__actions-list-item"><a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/licences/{{ licenceId }}#returns">
Returns
</a>
</li>
<li class="govuk-summary-list__actions-list-item"><a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/licences/{{ licenceId }}#charge">
Charge information
</a>
</li>
{% endif %}
</ul>
</div>
</div>
Expand Down
51 changes: 42 additions & 9 deletions app/views/bill-runs/review-licence.njk
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,48 @@

{# Licence nav bars #}
<ul class="govuk-summary-list__actions-list govuk-!-margin-bottom-3">
<li class="govuk-summary-list__actions-list-item" data-test="summary-link"><a class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline" href="/licences/{{ licence.licenceId }}#summary">
Summary
</a></li>
<li class="govuk-summary-list__actions-list-item" data-test="returns-link"><a class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline" href="/licences/{{ licence.licenceId }}#returns">
Returns
</a></li>
<li class="govuk-summary-list__actions-list-item" data-test="charge-information-link"><a class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline" href="/licences/{{ licence.licenceId }}#charge">
Charge information
</a></li>
{% if featureFlag.enableSystemLicenceView %}
<li class="govuk-summary-list__actions-list-item">
<a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/system/licences/{{ licence.licenceId }}/summary">
Summary
</a>
</li>
<li class="govuk-summary-list__actions-list-item">
<a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/system/licences/{{ licence.licenceId }}/returns">
Returns
</a>
</li>
<li class="govuk-summary-list__actions-list-item">
<a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/system/licences/{{ licence.licenceId }}/set-up">
Charge information
</a>
</li>
{% else %}
<li class="govuk-summary-list__actions-list-item"><a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/licences/{{ licence.licenceId }}#summary">
Summary
</a>
</li>
<li class="govuk-summary-list__actions-list-item"><a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/licences/{{ licence.licenceId }}#returns">
Returns
</a>
</li>
<li class="govuk-summary-list__actions-list-item"><a
class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state govuk-link--no-underline"
href="/licences/{{ licence.licenceId }}#charge">
Charge information
</a>
</li>
{% endif %}
</ul>

{# Licence in review text #}
Expand Down
6 changes: 5 additions & 1 deletion app/views/bills/view-single-licence-presroc.njk
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@
<div class="govuk-grid-column-full">
<section>
<div class="govuk-button-group">
<a class="govuk-link" href="/licences/{{ licenceId }}">View licence summary</a>
{% if featureFlag.enableSystemLicenceView %}
<a class="govuk-link" href="/system/licences/{{ licenceId }}/summary">View licence summary</a>
{% else %}
<a class="govuk-link" href="/licences/{{ licenceId }}">View licence summary</a>
{% endif %}
</div>
</section>
</div>
Expand Down
6 changes: 5 additions & 1 deletion app/views/bills/view-single-licence-sroc.njk
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@
<div class="govuk-grid-column-full">
<section>
<div class="govuk-button-group">
<a class="govuk-link" href="/licences/{{ licenceId }}">View licence summary</a>
{% if featureFlag.enableSystemLicenceView %}
<a class="govuk-link" href="/system/licences/{{ licenceId }}/summary">View licence summary</a>
{% else %}
<a class="govuk-link" href="/licences/{{ licenceId }}">View licence summary</a>
{% endif %}
</div>
</section>
</div>
Expand Down
6 changes: 5 additions & 1 deletion app/views/return-requirements/approved.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<h2 class="govuk-heading-m">What happens next</h2>
<p class="govuk-body">These return requirements are now active and returns will be opened for this licence in the next returns cycle.</p>
<p class="govuk-body">
<a href="/licences/{{ licenceId }}#charge" class="govuk-link">Return to licence set up</a>
{% if featureFlag.enableSystemLicenceView %}
<a class="govuk-link" href="/system/licences/{{ licenceId }}/set-up">Return to licence set up</a>
{% else %}
<a class="govuk-link" href="/licences/{{ licenceId }}#charge">Return to licence set up</a>
{% endif %}
</p>
{% endblock %}
4 changes: 2 additions & 2 deletions config/feature-flags.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading