Skip to content

Commit a64c3fa

Browse files
Merge branch 'DTOSS-7817-SonarCloud-Coverage-Refinements' of github.com:NHSDigital/dtos-cohort-manager into DTOSS-7817-SonarCloud-Coverage-Refinements
2 parents 39587f7 + 99c5dcc commit a64c3fa

File tree

5 files changed

+274
-72
lines changed

5 files changed

+274
-72
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Manual Cohort Manager Image Build"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment_tag:
7+
description: Environment of the deployment
8+
required: true
9+
type: string
10+
default: development
11+
build_all_images:
12+
description: Build all images defined in compose files
13+
required: false
14+
type: boolean
15+
default: false
16+
17+
jobs:
18+
manual-build-and-push-images:
19+
name: Manual Build and Push all images
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
id-token: write
24+
pull-requests: read
25+
26+
steps:
27+
- name: "Checkout code"
28+
uses: actions/checkout@v4
29+
with:
30+
submodules: 'true'
31+
ref: 'main' # We ensure it's the main branch.
32+
33+
- name: "Call Reusable Build Images Workflow"
34+
uses: NHSDigital/dtos-devops-templates/.github/workflows/stage-3-build-images.yaml@DTOSS-8936-manual-image-rebuild-process
35+
with:
36+
docker_compose_file: application/CohortManager/compose.yaml
37+
excluded_containers_csv_list: azurite,azurite-setup,sql-edge,db-setup
38+
environment_tag: ${{ needs.metadata.outputs.environment_tag }}
39+
function_app_source_code_path: application/CohortManager/src
40+
project_name: cohort-manager
41+
build_all_services: ${{ github.event.inputs.build_all_services }}
42+
secrets: inherit

application/CohortManager/src/Functions/screeningDataServices/createParticipant/createParticipant.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ private async Task<ValidationExceptionLog> ValidateData(Participant existingPart
106106
}
107107
catch (Exception ex)
108108
{
109-
_logger.LogInformation(ex, "Lookup validation failed.\nMessage: {Message}\nParticipant: REDACTED", ex.Message);
110-
return null;
109+
_logger.LogError(ex, "Lookup validation failed.\nMessage: {Message}\nParticipant: REDACTED", ex.Message);
110+
throw new HttpRequestException("Lookup validation failed", ex);
111111
}
112112
}
113113
}
Lines changed: 65 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Link from "next/link";
2-
import { auth } from "@/app/lib/auth";
3-
import SignOut from "@/app/components/signOut";
2+
import { auth, signOut } from "@/app/lib/auth";
3+
import styles from "@/app/styles/components/header.module.scss";
44

55
interface HeaderProps {
66
readonly serviceName?: string;
@@ -12,59 +12,76 @@ export default async function Header({
1212
const session = await auth();
1313

1414
return (
15-
<header className="nhsuk-header" role="banner">
16-
<div className="nhsuk-header__container">
17-
<div className="nhsuk-header__logo">
18-
<Link href="/" legacyBehavior>
19-
<a
20-
className="nhsuk-header__link nhsuk-header__link--service"
21-
aria-label="Cohort manager overview page"
15+
<header className={styles["nhsuk-header"]} role="banner">
16+
<div className={styles["nhsuk-header__container"]}>
17+
<div className={styles["nhsuk-header__service"]}>
18+
<Link
19+
className={styles["nhsuk-header__service-logo"]}
20+
href="/"
21+
aria-label="Cohort manager overview page"
22+
>
23+
<svg
24+
className={styles["nhsuk-logo"]}
25+
xmlns="http://www.w3.org/2000/svg"
26+
viewBox="0 0 200 80"
27+
height="40"
28+
width="100"
2229
>
23-
<svg
24-
className="nhsuk-logo"
25-
xmlns="http://www.w3.org/2000/svg"
26-
viewBox="0 0 40 16"
27-
height="40"
28-
width="100"
29-
>
30-
<path
31-
className="nhsuk-logo__background"
32-
fill="#005eb8"
33-
d="M0 0h40v16H0z"
34-
></path>
35-
<path
36-
className="nhsuk-logo__text"
37-
fill="#fff"
38-
d="M3.9 1.5h4.4l2.6 9h.1l1.8-9h3.3l-2.8 13H9l-2.7-9h-.1l-1.8 9H1.1M17.3 1.5h3.6l-1 4.9h4L25 1.5h3.5l-2.7 13h-3.5l1.1-5.6h-4.1l-1.2 5.6h-3.4M37.7 4.4c-.7-.3-1.6-.6-2.9-.6-1.4 0-2.5.2-2.5 1.3 0 1.8 5.1 1.2 5.1 5.1 0 3.6-3.3 4.5-6.4 4.5-1.3 0-2.9-.3-4-.7l.8-2.7c.7.4 2.1.7 3.2.7s2.8-.2 2.8-1.5c0-2.1-5.1-1.3-5.1-5 0-3.4 2.9-4.4 5.8-4.4 1.6 0 3.1.2 4 .6"
39-
></path>
40-
</svg>
41-
42-
<span className="nhsuk-header__service-name">{serviceName}</span>
43-
</a>
30+
<path
31+
className={styles["nhsuk-logo__path"]}
32+
fill="currentcolor"
33+
d="M200 0v80H0V0h200Zm-27.5 5.5c-14.5 0-29 5-29 22 0 10.2 7.7 13.5 14.7 16.3l.7.3c5.4 2 10.1 3.9 10.1 8.4 0 6.5-8.5 7.5-14 7.5s-12.5-1.5-16-3.5L135 70c5.5 2 13.5 3.5 20 3.5 15.5 0 32-4.5 32-22.5 0-19.5-25.5-16.5-25.5-25.5 0-5.5 5.5-6.5 12.5-6.5a35 35 0 0 1 14.5 3l4-13.5c-4.5-2-12-3-20-3Zm-131 2h-22l-14 65H22l9-45h.5l13.5 45h21.5l14-65H64l-9 45h-.5l-13-45Zm63 0h-18l-13 65h17l6-28H117l-5.5 28H129l13.5-65H125L119.5 32h-20l5-24.5Z"
34+
/>
35+
</svg>
36+
<span className={styles["nhsuk-header__service-name"]}>
37+
{serviceName}
38+
</span>
4439
</Link>
4540
</div>
46-
</div>
47-
{session?.user && (
48-
<div className="nhsuk-navigation-container">
49-
<nav
50-
className="nhsuk-navigation"
51-
id="header-navigation"
52-
role="navigation"
53-
aria-label="Primary navigation"
54-
>
55-
<ul className="nhsuk-header__navigation-list">
56-
<li className="nhsuk-header__navigation-item">
57-
<Link href="/account" legacyBehavior>
58-
<a className="nhsuk-header__navigation-link">Account</a>
59-
</Link>
41+
42+
{session?.user && (
43+
<nav className={styles["nhsuk-header__account"]} aria-label="Account">
44+
<ul className={styles["nhsuk-header__account-list"]}>
45+
<li className={styles["nhsuk-header__account-item"]}>
46+
<svg
47+
className={`${styles["nhsuk-icon"]} ${styles["nhsuk-icon__user"]}`}
48+
xmlns="http://www.w3.org/2000/svg"
49+
width="20"
50+
height="20"
51+
viewBox="0 0 16 16"
52+
aria-hidden="true"
53+
focusable="false"
54+
>
55+
<path d="M8 0c4.4 0 8 3.6 8 8s-3.6 8-8 8-8-3.6-8-8 3.6-8 8-8Zm0 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm-1.5 9h3a2.5 2.5 0 0 1 2.5 2.5V14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1.5A2.5 2.5 0 0 1 6.5 10ZM8 9C6.368 9 5 7.684 5 6s1.316-3 3-3c1.632 0 3 1.316 3 3S9.632 9 8 9" />
56+
</svg>
57+
{session.user.firstName} {session.user.lastName}
58+
</li>
59+
<li className={styles["nhsuk-header__account-item"]}>
60+
<a
61+
href="/account"
62+
className={styles["nhsuk-header__account-link"]}
63+
>
64+
Account and settings
65+
</a>
6066
</li>
61-
<li className="nhsuk-header__navigation-item">
62-
<SignOut className="nhsuk-header__navigation-link" />
67+
<li className={styles["nhsuk-header__account-item"]}>
68+
<form
69+
className={styles["nhsuk-header__account-form"]}
70+
action={async () => {
71+
"use server";
72+
await signOut({ redirectTo: "/" });
73+
}}
74+
method="post"
75+
>
76+
<button className={styles["nhsuk-header__account-button"]}>
77+
Log out
78+
</button>
79+
</form>
6380
</li>
6481
</ul>
6582
</nav>
66-
</div>
67-
)}
83+
)}
84+
</div>
6885
</header>
6986
);
7087
}

application/CohortManager/src/Web/app/components/signOut.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
@import "~nhsuk-frontend/packages/core/settings/_colours.scss";
2+
@import "~nhsuk-frontend/packages/core/settings/_globals.scss";
3+
@import "~nhsuk-frontend/packages/core/settings/_spacing.scss";
4+
@import "~nhsuk-frontend/packages/core/settings/_typography.scss";
5+
@import "~nhsuk-frontend/packages/core/tools/_exports.scss";
6+
@import "~nhsuk-frontend/packages/core/tools/_focused.scss";
7+
@import "~nhsuk-frontend/packages/core/tools/_ifff.scss";
8+
@import "~nhsuk-frontend/packages/core/tools/_typography.scss";
9+
@import "~nhsuk-frontend/packages/core/tools/_sass-mq.scss";
10+
@import "~nhsuk-frontend/packages/core/tools/_spacing.scss";
11+
@import "~nhsuk-frontend/packages/core/tools/_links.scss";
12+
@import "~nhsuk-frontend/packages/core/tools/_mixins.scss";
13+
@import "~nhsuk-frontend/packages/core/objects/width-container.scss";
14+
@import "~nhsuk-frontend/packages/core/utilities/_visually-hidden.scss";
15+
16+
/// Header link styling (accounts for different header colour variants)
17+
///
18+
/// @example scss
19+
/// @include nhsuk-link-style-header;
20+
21+
@mixin nhsuk-link-style-header {
22+
color: inherit;
23+
24+
&:link,
25+
&:visited,
26+
&:hover,
27+
&:active {
28+
color: inherit;
29+
}
30+
31+
&:focus {
32+
background-color: $nhsuk-focus-color;
33+
box-shadow: 0 0 0 $nhsuk-focus-width $nhsuk-focus-color,
34+
0 $nhsuk-focus-width 0 $nhsuk-focus-width $nhsuk-focus-text-color;
35+
color: $nhsuk-focus-text-color;
36+
outline: $nhsuk-focus-width solid transparent;
37+
outline-offset: $nhsuk-focus-width;
38+
text-decoration: none;
39+
}
40+
}
41+
42+
// Account Header
43+
// https://github.com/nhsuk/nhsuk-frontend/pull/1058
44+
45+
.nhsuk-header {
46+
background-color: $color_nhsuk-blue;
47+
color: $color_nhsuk-white;
48+
49+
@include mq($media-type: print) {
50+
color: $color_nhsuk-black;
51+
}
52+
}
53+
54+
.nhsuk-header__container {
55+
@include govuk-width-container;
56+
display: flex;
57+
flex-flow: column wrap;
58+
gap: nhsuk-spacing(3);
59+
padding: nhsuk-spacing(3) 0;
60+
61+
@include mq($from: tablet) {
62+
flex-direction: row;
63+
}
64+
}
65+
66+
/// Service logo (and optional name)
67+
68+
.nhsuk-header__service,
69+
.nhsuk-header__service-logo {
70+
align-items: center;
71+
display: flex;
72+
flex-grow: 999;
73+
flex-wrap: wrap;
74+
gap: nhsuk-spacing(2) nhsuk-spacing(3);
75+
margin-right: auto;
76+
}
77+
78+
.nhsuk-header__service-logo {
79+
flex-grow: 0;
80+
}
81+
82+
.nhsuk-header__service-name {
83+
@include nhsuk-font(19, $line-height: 1.1);
84+
flex-grow: 999;
85+
text-wrap: balance;
86+
}
87+
88+
.nhsuk-header__service-logo,
89+
.nhsuk-header__service-name[href] {
90+
@include nhsuk-link-style-header;
91+
text-decoration: none;
92+
93+
&:hover {
94+
text-decoration: underline;
95+
}
96+
97+
@include mq($media-type: print) {
98+
&::after {
99+
content: "";
100+
}
101+
}
102+
}
103+
104+
/// Account
105+
106+
.nhsuk-header__account {
107+
background: shade($color_nhsuk-blue, 20%);
108+
border-radius: $nhsuk-border-radius;
109+
flex-grow: 1;
110+
outline: 1px solid shade($color_nhsuk-blue, 20%);
111+
margin-bottom: 1px;
112+
113+
@include mq($from: tablet) {
114+
align-self: start;
115+
}
116+
}
117+
118+
.nhsuk-header__account-list {
119+
display: flex;
120+
flex-wrap: wrap;
121+
gap: 1px;
122+
list-style: none;
123+
margin: 0;
124+
overflow: hidden;
125+
padding: 0;
126+
}
127+
128+
.nhsuk-header__account-item {
129+
@include nhsuk-font(16);
130+
background-color: shade($color_nhsuk-blue, 20%);
131+
display: flex;
132+
flex-grow: 1;
133+
gap: nhsuk-spacing(2);
134+
margin: 0;
135+
outline: 1px solid $color_nhsuk-blue;
136+
padding: nhsuk-spacing(2) 12px;
137+
}
138+
139+
.nhsuk-header__account-item:nth-last-child(2) {
140+
margin-right: auto;
141+
}
142+
143+
.nhsuk-header__account-item:last-child {
144+
flex-grow: 0;
145+
}
146+
147+
.nhsuk-header__account-button,
148+
.nhsuk-header__account-link {
149+
@include nhsuk-link-style-header;
150+
display: flex;
151+
gap: nhsuk-spacing(2);
152+
}
153+
154+
.nhsuk-header__account-button {
155+
@include nhsuk-font(16);
156+
background: none;
157+
border: 0;
158+
padding: 0;
159+
text-decoration: underline;
160+
161+
&:hover {
162+
cursor: pointer;
163+
text-decoration: none;
164+
}
165+
}

0 commit comments

Comments
 (0)