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

CDPS-746: Alerts API #138

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/controllers/homepageController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ describe('Homepage Controller', () => {
heading: 'Global search',
href: `${config.serviceUrls.digitalPrisons}/global-search`,
id: 'global-search',
navEnabled: true,
},
{
description: 'View your key worker cases.',
heading: 'My key worker allocation',
href: `${config.apis.omic.url}/key-worker/${staffId}`,
id: 'key-worker-allocations',
navEnabled: true,
},
],
todayLastUpdated: '2023-07-20T12:45',
Expand Down Expand Up @@ -166,12 +168,14 @@ describe('Homepage Controller', () => {
heading: 'Global search',
href: `${config.serviceUrls.digitalPrisons}/global-search`,
id: 'global-search',
navEnabled: true,
},
{
description: 'View your key worker cases.',
heading: 'My key worker allocation',
href: `${config.apis.omic.url}/key-worker/${res.locals.user.staffId}`,
id: 'key-worker-allocations',
navEnabled: true,
},
],
searchViewAllUrl: `${config.serviceUrls.digitalPrisons}/prisoner-search?keywords=&location=${res.locals.user.activeCaseLoadId}`,
Expand Down
13 changes: 7 additions & 6 deletions server/controllers/homepageController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ export default class HomepageController {
const apiController = new ApiController(this.homepageService)
const servicesData = await apiController.getDpsServices(req, res)
return servicesData
.filter(task => task.enabled())
.map(task => ({
id: task.id,
href: task.href,
heading: task.heading,
description: task.description,
.filter(service => service.enabled())
.map(service => ({
id: service.id,
href: service.href,
heading: service.heading,
description: service.description,
navEnabled: true,
}))
}

Expand Down
1 change: 1 addition & 0 deletions server/data/interfaces/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Service {
heading: string
description: string
href: string
navEnabled: boolean
}

interface HeaderFooterMeta {
Expand Down
4 changes: 3 additions & 1 deletion server/views/partials/homepage/services.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<h2 id="homepage-services" class="govuk-!-font-size-24" data-qa="homepage-services-heading">Services</h2>
<div class="hmpps-services">
{% for service in services %}
{% if service.navEnabled %}
<div class="hmpps-service-item">
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible govuk-!-static-margin-top-0" />
<div class="hmpps-service-item__header">
<a href="{{ service.href }} " class="govuk-link govuk-!-font-weight-bold govuk-link--no-visited-state">{{ service.heading}}</a>
</div>
<p class="govuk-!-static-margin-top-3 govuk-!-static-margin-bottom-0">{{ service.description}}</p>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</section>