diff --git a/README.md b/README.md index 4649eced..2198b9ec 100644 --- a/README.md +++ b/README.md @@ -63,18 +63,19 @@ git clone https://github.com/ONSdigital/blaise-deploy-questionnaire-service.git Create a new .env file and add the following variables. -| Variable | Description | Var Example | -|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------| -| PORT | **Optional variable**, specify the Port for express server to run on. If not passed in this is set as 5000 by default.

It's best not to set this as the react project will try and use the variable as well and conflict. By default, React project locally runs on port 3000 | 5009 | -| BLAISE_API_URL | URL that the [Blaise Rest API](https://github.com/ONSdigital/blaise-api-rest) is running on to send calls to | localhost:90 | -| PROJECT_ID | GCP Project ID | ons-blaise-dev-matt55 | -| BUCKET_NAME | GCP Bucket name for the Questionnaire file to be put in | ons-blaise-dev-matt55-dqs | -| SERVER_PARK | Name of Blaise Server Park | gusty | -| BIMS_API_URL | URL that the [BIMS Service](https://github.com/ONSdigital/blaise-instrument-metadata-service) is running on to send calls to set and get the live date | localhost:5011 | -| BIMS_CLIENT_ID | GCP IAP ID for the [BIMS Service](https://github.com/ONSdigital/blaise-instrument-metadata-service) | randomKey0112 | -| BUS_API_CLIENT | Not needed for local development but the config will look for this variables in the .env file and throw an error if it is not found. Hence, give them a random string | FOO | -| BUS_CLIENT_ID | Not needed for local development but the config will look for this variables in the .env file and throw an error if it is not found. Hence, give them a random string | FOO | -| CREATE_DONOR_CASES_CLOUD_FUNCTION_URL | URL to trigger the Create Donor Cases Cloud Function in GCP. This is needed when you want to deploy donor cases for an IPS questionnaire. **The Cloud Function needs to be deployed in GCP**. | https://example-cloud-function-url.com | +| Variable | Description | Var Example | +|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------| +| PORT | **Optional variable**, specify the Port for express server to run on. If not passed in this is set as 5000 by default.

It's best not to set this as the react project will try and use the variable as well and conflict. By default, React project locally runs on port 3000 | 5009 | +| BLAISE_API_URL | URL that the [Blaise Rest API](https://github.com/ONSdigital/blaise-api-rest) is running on to send calls to | localhost:90 | +| PROJECT_ID | GCP Project ID | ons-blaise-dev-matt55 | +| BUCKET_NAME | GCP Bucket name for the Questionnaire file to be put in | ons-blaise-dev-matt55-dqs | +| SERVER_PARK | Name of Blaise Server Park | gusty | +| BIMS_API_URL | URL that the [BIMS Service](https://github.com/ONSdigital/blaise-instrument-metadata-service) is running on to send calls to set and get the live date | localhost:5011 | +| BIMS_CLIENT_ID | GCP IAP ID for the [BIMS Service](https://github.com/ONSdigital/blaise-instrument-metadata-service) | randomKey0112 | +| BUS_API_CLIENT | Not needed for local development but the config will look for this variables in the .env file and throw an error if it is not found. Hence, give them a random string | FOO | +| BUS_CLIENT_ID | Not needed for local development but the config will look for this variables in the .env file and throw an error if it is not found. Hence, give them a random string | FOO | +| CREATE_DONOR_CASES_CLOUD_FUNCTION_URL | URL to trigger the Create Donor Cases Cloud Function in GCP. This is needed when you want to deploy donor cases for an IPS questionnaire. **The Cloud Function needs to be deployed in GCP**. | https://example-cloud-function-url.com | +| REISSUE_NEW_DONOR_CASE_CLOUD_FUNCTION_URL | URL to trigger the Reissue New Donor Case Cloud Function in GCP. This is needed when you want to reissue a new donor case for an IPS questionnaire. **The Cloud Function needs to be deployed in GCP**. | https://example-cloud-function-url.com | To find the `X_CLIENT_ID`, navigate to the GCP console, search for `IAP`, click the three dots on right of the service and select `OAuth`. `Client Id` will be on the right. @@ -92,6 +93,7 @@ BIMS_CLIENT_ID=randomKey0778 BUS_API_URL=FOO BUS_CLIENT_ID=FOO CREATE_DONOR_CASES_CLOUD_FUNCTION_URL= +REISSUE_NEW_DONOR_CASE_CLOUD_FUNCTION_URL= ``` **NB** DQS environment variables for sandboxes can be found within GCP > App Engine > Versions > DQS service > Config diff --git a/src/components/questionnaireDetailsPage/sections/reissueNewDonorCase.tsx b/src/components/questionnaireDetailsPage/sections/reissueNewDonorCase.tsx index 8d317497..9137283b 100644 --- a/src/components/questionnaireDetailsPage/sections/reissueNewDonorCase.tsx +++ b/src/components/questionnaireDetailsPage/sections/reissueNewDonorCase.tsx @@ -1,6 +1,7 @@ import React, { ReactElement, useState } from "react"; import { Questionnaire } from "blaise-api-node-client"; -import { Link } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; +import { ONSButton } from "blaise-design-system-react-components"; interface Props { questionnaire: Questionnaire; @@ -8,6 +9,25 @@ interface Props { function ReissueNewDonorCase({ questionnaire }: Props): ReactElement { const [user, setUser] = useState(""); + const [error, setError] = useState(false); + const [errorMessage, setErrorMessage] = useState(""); + + const navigate = useNavigate(); + + function reissueNewDonorCaseButtonClicked() { + const trimmedUser = user.trim(); + setUser(trimmedUser); + + // Check if input is empty after trimming + if (trimmedUser === "") { + setErrorMessage("User input cannot be empty or contain only spaces"); + setError(true); + } else { + setError(false); + setErrorMessage(""); + navigate("/reissueNewDonorCaseConfirmation", { state: { section: "reissueNewDonorCase", questionnaire: questionnaire, user: trimmedUser } }); + } + } return ( <> @@ -23,25 +43,18 @@ function ReissueNewDonorCase({ questionnaire }: Props): ReactElement { - setUser(e.target.value)}/> + setUser(e.target.value)}/> + {error &&

{errorMessage}

}
-
- - Reissue Donor case - + diff --git a/src/components/reissueNewDonorCasePage/reissueNewDonorCaseConfirmation.tsx b/src/components/reissueNewDonorCasePage/reissueNewDonorCaseConfirmation.tsx index 8dc09ae0..b3736236 100644 --- a/src/components/reissueNewDonorCasePage/reissueNewDonorCaseConfirmation.tsx +++ b/src/components/reissueNewDonorCasePage/reissueNewDonorCaseConfirmation.tsx @@ -21,6 +21,7 @@ function ReissueNewDonorCaseConfirmation(): ReactElement { async function callReissueNewDonorCaseCloudFunction() { isLoading(true); + console.log(questionnaire.name, user); const payload = { questionnaire_name: questionnaire.name, user: user }; let res; try { @@ -51,7 +52,7 @@ function ReissueNewDonorCaseConfirmation(): ReactElement { ( <>

- Reissue a new donor case for {questionnaire.name} on behalf of {user}? + Reissue a new donor case for {questionnaire.name} on behalf of {user}?

@@ -24,9 +24,6 @@ function ReissueNewDonorCaseSummary({ responseMessage, statusCode, role }: Props

Error reissuing new donor case for {role}

-

- {responseMessage} -

When reporting this issue to the Service Desk, please provide the questionnaire name, time and date of the failure.