From 4e862c1e6635da7b1a37c11bf4803b80384d15c9 Mon Sep 17 00:00:00 2001 From: DanielMurray97 Date: Tue, 26 Mar 2024 12:41:34 +0000 Subject: [PATCH] merge branch 'main' into NTRNL-347-add-collaborator-per-repo-page --- .env.example | 42 ++++++--------- README.md | 64 ++++++++++++++--------- docs/Project Structure and Code Style.md | 2 +- package-lock.json | 6 +-- src/views/add-collaborator.html | 2 +- src/views/add-member.html | 2 +- src/views/add-repo.html | 2 +- src/views/add-team-member.html | 2 +- src/views/add-team.html | 2 +- src/views/additional-requests.html | 2 +- src/views/check-your-answers.html | 2 +- src/views/include/phase-banner.html | 6 +++ src/views/layout.html | 65 +++++++++++++----------- 13 files changed, 108 insertions(+), 91 deletions(-) create mode 100644 src/views/include/phase-banner.html diff --git a/.env.example b/.env.example index 756fd50..1c6147e 100644 --- a/.env.example +++ b/.env.example @@ -1,33 +1,23 @@ -PATH_SSL_PRIVATE_KEY="./infrastructure/host/test.key" -PATH_SSL_CERTIFICATE="./infrastructure/host/test.cert" - -PORT=3000 -NODE_ENV=development - +AUTH_SIGN_IN_URL="https://cola.service.cabinetoffice.gov.uk/v2//login" BASE_URL="http://localhost:3000" CDN_HOST="test" -NODE_SSL_ENABLED="false" - +COOKIE_ID_NAME="github-requests" COOKIE_PARSER_SECRET="test" COOKIE_SESSION_SECRET="test" - -AUTH_SIGN_IN_URL="https://cola.service.cabinetoffice.gov.uk/v2//login" - -USER_POOL_ID="test" -USER_POOL_CLIENT_ID="test" - -COOKIE_ID_NAME="test" -SESSION_ID_NAME="test" -SESSION_APP_KEY="test" - +FEATURE_FLAG_ENABLE_AUTH="true" +GITHUB_KEY="test" GITHUB_OWNER="test" -GITHUB_TERRAFORM_REPO="test" GITHUB_REPO_ISSUE_ASSIGNEE="test" GITHUB_REPO_ISSUE_LABEL="test" - -LOG_LEVEL=info -HUMAN=true - -# Feature Flags - -FEATURE_FLAG_ENABLE_AUTH="false" \ No newline at end of file +GITHUB_TERRAFORM_REPO="test" +HUMAN="true" +LOG_LEVEL="info" +NODE_ENV="development" +NODE_SSL_ENABLED="false" +PATH_SSL_CERTIFICATE="./infrastructure/host/test.key" +PATH_SSL_PRIVATE_KEY="./infrastructure/host/test.cert" +PORT=3000 +SESSION_APP_KEY="git" +SESSION_ID_NAME="connect.sid" +USER_POOL_CLIENT_ID="test" +USER_POOL_ID="test" \ No newline at end of file diff --git a/README.md b/README.md index 6afadb9..0a83fea 100644 --- a/README.md +++ b/README.md @@ -26,27 +26,32 @@ The issue is then reviewed by the team, and further comments may be requested if ### Config variables -Key | Description | Example Value -----------------|--------------------------- |------------------------- -PATH_SSL_PRIVATE_KEY | Path to ssl private key | `./infrastructure/host/test.key` -PATH_SSL_CERTIFICATE | Path to ssl certificate | `./infrastructure/host/test.cert` -BASE_URL | Base application URL | `http://localhost:3000` (dev mode) -NODE_ENV | Node environment | `development` (or `production`) -PORT | Server port number | `3000` -CDN_HOST | CDN host | `cdn domain` -USER_POOL_ID | ID of the user pool in Amazon Cognito | `secret` -USER_POOL_CLIENT_ID | Client ID of an app registered with the user pool in Amazon Cognito | `secret` -AUTH_SIGN_IN_URL | Authentication sign in URL | `https://cola.service.cabinetoffice.gov.uk/v2//login` -COOKIE_ID_NAME | The name of the cookie | `github-requests` -COOKIE_PARSER_SECRET | Secret used in validating/calculating the cookie signature | `secret` -COOKIE_SESSION_SECRET | Secret key for signing the session cookie | `secret` -LANDING_PAGE_URL | Github Requests landing Page | `/home/` -GITHUB_OWNER | Github organization name | `cabinetoffice` -GITHUB_TERRAFORM_REPO | Github private repo with terraform configurations with members, repos and teams files | `github-requests-terraform` -GITHUB_REPO_ISSUE_ASSIGNEE | Github team responsible to solve issues and update configs files | (eg. `IDP_TEAM`) -GITHUB_REPO_ISSUE_LABEL | Github label to categorize the related issues | (eg. `github-requests-app`) -LOG_LEVEL | Logging levels | `info` -HUMAN | Formatting messages form (default JSON) | `true` (Enable human formatting for log messages) +| Key | Description | Example Value | +|-----------------------------|---------------------------------------------------------------------|---------------------------------------------------------- | +| AUTH_SIGN_IN_URL | Authentication sign in URL | `https://cola.service.cabinetoffice.gov.uk/v2//login`| +| BASE_URL | Base application URL | `http://localhost:3000` (dev mode) | +| CDN_HOST | CDN host | `cdn_domain` | +| COOKIE_ID_NAME | The name of the cookie | `github-requests` | +| COOKIE_PARSER_SECRET | Secret used in validating/calculating the cookie signature | `secret` | +| COOKIE_SESSION_SECRET | Secret key for signing the session cookie | `secret` | +| FEATURE_FLAG_ENABLE_AUTH | Enable authentication feature flag | `true` or `false` | +| GITHUB_KEY | GitHub key | `[github key]` | +| GITHUB_OWNER | GitHub organisation name | `cabinetoffice` | +| GITHUB_REPO_ISSUE_ASSIGNEE | GitHub team responsible to solve issues and update configs files | `IDP_TEAM` | +| GITHUB_REPO_ISSUE_LABEL | GitHub label to categorize the related issues | `github-requests-app` | +| GITHUB_TERRAFORM_REPO | GitHub private repo with terraform configurations with members, repos and teams files | `github-requests-terraform` | +| HUMAN | Formatting messages form (default JSON) | `true` (Enable human formatting for log messages) | +| LOG_LEVEL | Logging levels | `info` | +| NODE_ENV | Node environment | `development` or `production` | +| NODE_SSL_ENABLED | Whether SSL is enabled for Node | `true` or `false` | +| PATH_SSL_CERTIFICATE | Path to SSL certificate | `./infrastructure/host/test.cert` | +| PATH_SSL_PRIVATE_KEY | Path to SSL private key | `./infrastructure/host/test.key` | +| PORT | Server port number | `3000` | +| SESSION_APP_KEY | Session application key | `git` | +| SESSION_ID_NAME | Session ID name | `connect.sid` | +| USER_POOL_CLIENT_ID | Client ID of an app registered with the user pool in Amazon Cognito | `secret` | +| USER_POOL_ID | ID of the user pool in Amazon Cognito | `secret` | + ## Launching the web-app @@ -57,12 +62,23 @@ HUMAN | Formatting messages form (default JSON) | `true` (Enable human formattin ### Running local development environment with Docker -Docker is used to run the application in **development** mode, with tooling setup to detect changes in local `src` directory and reload the container's node server. Ensure that `NODE_ENV=development` is set in the `.env` file. +Docker is used to run the application in **development** mode, with tooling setup to detect changes in local `src` directory and reload the container's node server. + +- Ensure that `NODE_ENV=development` is set in the `.env` file. + +- In order for static assets to be loaded, the `CDN_HOST` must be set to a CDN domain which serves the GOV.UK static assets. + +### Building the application + +To build the project, run: + +```sh +make build +``` ### Building the Docker Image -1. Create a copy of the `.env.example` file and name it `.env`: -Then run: +Create a copy of the `.env.example` file and name it `.env`, then run: ```sh make docker-build diff --git a/docs/Project Structure and Code Style.md b/docs/Project Structure and Code Style.md index 6d807e7..1ecaa1b 100644 --- a/docs/Project Structure and Code Style.md +++ b/docs/Project Structure and Code Style.md @@ -78,7 +78,7 @@ Both `Nunjucks` and `GDS` style/components are utilised. To streamline the const // Nunjucks HTML inputs field for adding a team {% extends "layout.html" %} -{% block beforeContent %} +{% block backLink %} {% include "include/back-link.html" %} {% endblock %} diff --git a/package-lock.json b/package-lock.json index a7619a4..736f2e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3415,9 +3415,9 @@ "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, "node_modules/follow-redirects": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "funding": [ { "type": "individual", diff --git a/src/views/add-collaborator.html b/src/views/add-collaborator.html index 18ad80c..d74d042 100644 --- a/src/views/add-collaborator.html +++ b/src/views/add-collaborator.html @@ -1,6 +1,6 @@ {% extends "layout.html" %} -{% block beforeContent %} +{% block backLink %} {% include "include/back-link.html" %} {% endblock %} diff --git a/src/views/add-member.html b/src/views/add-member.html index 7fe86c6..f417d5d 100644 --- a/src/views/add-member.html +++ b/src/views/add-member.html @@ -1,6 +1,6 @@ {% extends "layout.html" %} -{% block beforeContent %} +{% block backLink %} {% include "include/back-link.html" %} {% endblock %} diff --git a/src/views/add-repo.html b/src/views/add-repo.html index decb192..2d030a3 100644 --- a/src/views/add-repo.html +++ b/src/views/add-repo.html @@ -1,6 +1,6 @@ {% extends "layout.html" %} -{% block beforeContent %} +{% block backLink %} {% include "include/back-link.html" %} {% endblock %} diff --git a/src/views/add-team-member.html b/src/views/add-team-member.html index 501694d..2655c3e 100644 --- a/src/views/add-team-member.html +++ b/src/views/add-team-member.html @@ -1,6 +1,6 @@ {% extends "layout.html" %} -{% block beforeContent %} +{% block backLink %} {% include "include/back-link.html" %} {% endblock %} diff --git a/src/views/add-team.html b/src/views/add-team.html index 2d2ad9b..18c9d3a 100644 --- a/src/views/add-team.html +++ b/src/views/add-team.html @@ -1,6 +1,6 @@ {% extends "layout.html" %} -{% block beforeContent %} +{% block backLink %} {% include "include/back-link.html" %} {% endblock %} diff --git a/src/views/additional-requests.html b/src/views/additional-requests.html index 048eadd..c95f6d2 100644 --- a/src/views/additional-requests.html +++ b/src/views/additional-requests.html @@ -1,6 +1,6 @@ {% extends "layout.html" %} -{% block beforeContent %} +{% block backLink %} {% include "include/back-link.html" %} {% endblock %} diff --git a/src/views/check-your-answers.html b/src/views/check-your-answers.html index 8fc3043..6a57949 100644 --- a/src/views/check-your-answers.html +++ b/src/views/check-your-answers.html @@ -1,6 +1,6 @@ {% extends "layout.html" %} -{% block beforeContent %} +{% block backLink %} {% include "include/back-link.html" %} {% endblock %} diff --git a/src/views/include/phase-banner.html b/src/views/include/phase-banner.html new file mode 100644 index 0000000..9f48548 --- /dev/null +++ b/src/views/include/phase-banner.html @@ -0,0 +1,6 @@ +{{ govukPhaseBanner({ + tag: { + text: "Alpha" + }, + html: 'This is a new service – your feedback will help us to improve it.' +}) }} \ No newline at end of file diff --git a/src/views/layout.html b/src/views/layout.html index c3128d3..04728f1 100644 --- a/src/views/layout.html +++ b/src/views/layout.html @@ -16,14 +16,13 @@ {% from "govuk/components/summary-list/macro.njk" import govukSummaryList %} {% from "govuk/components/select/macro.njk" import govukSelect %} {% from "govuk/components/cookie-banner/macro.njk" import govukCookieBanner %} +{% from "govuk/components/phase-banner/macro.njk" import govukPhaseBanner %} {% block head %} - - {% endblock %} {% block header %} @@ -35,43 +34,49 @@ containerClasses: "govuk-width-container" }) }} {% endblock %} + {% block bodyStart %} {% include "include/cookie-consent-banner.html" %} {% endblock %} +{% block beforeContent %} + {% include "include/phase-banner.html" %} + {% block backLink %} + {% endblock %} +{% endblock %} + {% block content %} -
-
- {% block pageContent %} - {% endblock %} +
+
+ {% block pageContent %} + {% endblock %} +
-
{% endblock %} - {% block footer %} - {{ govukFooter({ - meta: { - items: [ - { - href: "#", - text: "Policies" - }, - { - href: "#", - text: "Cookies" - }, - { - href: "#", - text: "Contact us" - }, - { - href: "#", - text: "Accessibility" - } - ] - } - }) }} + {{ govukFooter({ + meta: { + items: [ + { + href: "#", + text: "Policies" + }, + { + href: "#", + text: "Cookies" + }, + { + href: "#", + text: "Contact us" + }, + { + href: "#", + text: "Accessibility" + } + ] + } + }) }} {% endblock %} {% block bodyEnd %}