Skip to content

Commit

Permalink
Man 183 arrange an appointment (#237)
Browse files Browse the repository at this point in the history
* MAN-183 create appointment pages initial route setup

* MAN-183 create mock endpoint for user locations

* MAN-183 add store session data middleware

* MAN-183 add form element decorator nunjucks filter

* MAN-193 templating wip

* MAN-183 add validation middleware

* MAN-183 add timepicker package

* MAN-183 create appointments wizard pages wip

* MAN-183 create appointments wizard pages wip

* MAN-183 create appointments wizard pages wip

* MAN-183 update wiremocks for user locations and sentences

* MAN-183 functional create appointments wizard pages

* MAN-183 e2e test specs wip

* MAN-183 e2e test specs wip

* MAN-183 e2e test specs wip

* MAN-183 final test specs

* MAN-183 refactor decorate form attribute nunjucks filter init

* MAN-183 fix ci security exception

* MAN-183 fix ci reliability exception

* MAN-183 fix ci reliability exception

* MAN-183 fix ci reliability exception

* MAN-183 fix ci reliability exception

* MAN-183 review fixes

* Remove .DS_Store files

* Add DS_Store to gitignore

* MAN-183 review fixes

* For ci to install npm v10 rather than latest

* MAN-183 Fix type page test spec

* MAN-183 fix sonar code issues wip

* MAN-183 fix sonar code issues wip

* MAN-183 fix sonar code issues wip

* MAN-183 fix sonar code issues wip

* MAN-183 remove timepicker package from project

* MAN-183 fix sonar code issues wip

* MAN-183 fix sonar code issues

* MAN-183 clean install to regen package-lock
  • Loading branch information
neil-mills authored Dec 19, 2024
1 parent 3f52772 commit 53134fc
Show file tree
Hide file tree
Showing 78 changed files with 7,338 additions and 2,676 deletions.
46 changes: 23 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ workflows:
- main
- hmpps/deploy_env:
name: deploy_dev
env: "dev"
env: 'dev'
jira_update: true
pipeline_id: <<pipeline.id>>
pipeline_number: <<pipeline.number>>
Expand All @@ -142,7 +142,7 @@ workflows:
helm_timeout: 5m
- hmpps/deploy_env:
name: deploy_preprod
env: "preprod"
env: 'preprod'
jira_update: true
jira_env_type: staging
pipeline_id: <<pipeline.id>>
Expand All @@ -160,30 +160,30 @@ workflows:
- integration_test
- build_docker
helm_timeout: 5m
# - request-prod-approval:
# type: approval
# requires:
# - deploy_preprod
# - hmpps/deploy_env:
# name: deploy_prod
# env: "prod"
# jira_update: true
# jira_env_type: production
# pipeline_id: <<pipeline.id>>
# pipeline_number: <<pipeline.number>>
# slack_notification: true
# slack_channel_name: << pipeline.parameters.releases-slack-channel >>
# context:
# - hmpps-common-vars
# - hmpps-manage-a-supervision-ui-prod
# requires:
# - request-prod-approval
# helm_timeout: 5m
# - request-prod-approval:
# type: approval
# requires:
# - deploy_preprod
# - hmpps/deploy_env:
# name: deploy_prod
# env: "prod"
# jira_update: true
# jira_env_type: production
# pipeline_id: <<pipeline.id>>
# pipeline_number: <<pipeline.number>>
# slack_notification: true
# slack_channel_name: << pipeline.parameters.releases-slack-channel >>
# context:
# - hmpps-common-vars
# - hmpps-manage-a-supervision-ui-prod
# requires:
# - request-prod-approval
# helm_timeout: 5m

security:
triggers:
- schedule:
cron: "5 9 * * 1-5"
cron: '5 9 * * 1-5'
filters:
branches:
only:
Expand All @@ -202,7 +202,7 @@ workflows:
security-weekly:
triggers:
- schedule:
cron: "11 9 * * 1"
cron: '11 9 * * 1'
filters:
branches:
only:
Expand Down
21 changes: 13 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@
],
"rules": {
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-unused-vars": 0,
"class-methods-use-this": 0,
"no-useless-constructor": 0,
"@typescript-eslint/no-unused-vars": [
1,
{
"argsIgnorePattern": "res|next|^err|_",
"ignoreRestSiblings": true
}
],
"import/prefer-default-export": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/semi": 0,
"import/no-unresolved": "error",
"prettier/prettier": [
Expand Down Expand Up @@ -85,7 +81,16 @@
"comma-dangle": ["error", "always-multiline"],
"import/no-extraneous-dependencies": [
"error",
{ "devDependencies": ["**/*.test.js", "**/*.test.ts", "**/testutils/**", "cypress.config.ts", "e2e_tests/**", "playwright.config.ts"] }
{
"devDependencies": [
"**/*.test.js",
"**/*.test.ts",
"**/testutils/**",
"cypress.config.ts",
"e2e_tests/**",
"playwright.config.ts"
]
}
],
"no-only-tests/no-only-tests": "error",
"prettier/prettier": [
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@ integration_tests/screenshots/
/playwright-report/
/blob-report/
/playwright/.cache/
.DS_Store
50 changes: 50 additions & 0 deletions assets/js/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* eslint-disable no-restricted-globals */
const lastAppointment = () => {
const repeatingFrequency = document.querySelector('div[data-repeating-frequency]')
if (repeatingFrequency) {
const repeatingFrequencyRadios = repeatingFrequency.querySelectorAll('input[type="radio"]')
const repeatingCount = document.querySelector('div[data-repeating-count] input')
const lastAppointmentElm = document.querySelector('div[data-last-appointment')
const lastAppointmentHandler = async () => {
const repeatingFrequencyRadioSelected = repeatingFrequency.querySelector('input:checked')
if (parseInt(repeatingCount.value, 10) > 0 && repeatingFrequencyRadioSelected) {
const divider = location.href.includes('?') ? '&' : '?'
const url = `${location.href}${divider}repeating-frequency=${encodeURI(repeatingFrequencyRadioSelected.value)}&repeating-count=${repeatingCount.value}`
const headers = {
Accept: '*/*',
'Content-Type': 'application/x-www-form-urlencoded',
}
const response = await fetch(url, {
method: 'GET',
cache: 'no-cache',
credentials: 'same-origin',
headers,
})
const html = await response.text()
const parser = new DOMParser()
const doc = parser.parseFromString(html, 'text/html')
const element = doc.querySelector('div[data-last-appointment]').innerHTML
document.querySelector('div[data-last-appointment]').innerHTML = element
} else {
lastAppointmentElm.innerHTML = ''
}
}
repeatingFrequencyRadios.forEach(input => input.addEventListener('click', lastAppointmentHandler))
repeatingCount.addEventListener('keyup', lastAppointmentHandler)
}
}
const resetConditionals = () => {
const handleReset = () => {
document.querySelectorAll('.govuk-radios__conditional input').forEach(radioBtn => {
radioBtn.checked = false
})
}
const elm = document.querySelector('[data-reset-conditional-radios]')
if (elm) {
document.querySelectorAll('[data-reset-conditional-radios]').forEach(elm => {
elm.addEventListener('click', handleReset)
})
}
}
lastAppointment()
resetConditionals()
93 changes: 85 additions & 8 deletions assets/scss/application.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$govuk-global-styles: true;
$path: "/assets/images/";
$path: '/assets/images/';

$moj-page-width: 1170px;
$govuk-page-width: $moj-page-width;
Expand All @@ -12,12 +12,14 @@ $govuk-page-width: $moj-page-width;
@import './components/card';
@import 'assets/scss/local';
@import './components/sortable-table';
@import "../../node_modules/govuk-frontend/dist/govuk/base";
@import "../../node_modules/@ministryofjustice/frontend/moj/components/sortable-table/_sortable-table";

// TM styles
.secondary-text {color: $govuk-secondary-text-colour; /* Using a GOV.UK Design System color */}
.strong { font-weight: 900;}
@import '../../node_modules/govuk-frontend/dist/govuk/base';
@import '../../node_modules/@ministryofjustice/frontend/moj/components/sortable-table/_sortable-table';
.secondary-text {
color: $govuk-secondary-text-colour; /* Using a GOV.UK Design System color */
}
.strong {
font-weight: 900;
}

.line-break {
white-space: preserve-breaks;
Expand Down Expand Up @@ -45,6 +47,81 @@ dd.govuk-summary-list__value span.app-notes-author {
}

.govuk-select--width-20 {
max-width: 41ex
max-width: 41ex;
}

.ui-timepicker-wrapper {
overflow-y: auto;
max-height: 150px;
width: auto;
background: #fff;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
outline: none;
z-index: 10052;
margin: 0;
@include govuk-font($size: 19);
border: 2px solid govuk-colour('black');
border-top: none;
max-width: 10.8ex;
box-sizing: border-box;
}

.ui-timepicker-wrapper .ui-timepicker-list li {
padding-right: 20px;
}

.ui-timepicker-list {
margin: 0;
padding: 0;
list-style: none;
}

.ui-timepicker-duration {
margin-left: 5px;
color: #888;
}

.ui-timepicker-list:hover .ui-timepicker-duration {
color: #888;
}

.ui-timepicker-list li {
cursor: pointer;
white-space: nowrap;
color: #000;
list-style: none;
margin: 0;
padding: 8px;
border-bottom: 1px solid govuk-colour('mid-grey');
}

.ui-timepicker-list:hover .ui-timepicker-selected {
background: #fff;
color: #000;
}

li.ui-timepicker-selected,
.ui-timepicker-list li:hover,
.ui-timepicker-list .ui-timepicker-selected:hover {
background: #1980ec;
color: #fff;
}

li.ui-timepicker-selected .ui-timepicker-duration,
.ui-timepicker-list li:hover .ui-timepicker-duration {
color: #ccc;
}

.ui-timepicker-list li.ui-timepicker-disabled,
.ui-timepicker-list li.ui-timepicker-disabled:hover,
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
color: #888;
cursor: default;
}

.ui-timepicker-list li.ui-timepicker-disabled:hover,
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
background: #f2f2f2;
}
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export default defineConfig({
configFile: 'reporter-config.json',
},
taskTimeout: 60000,
numTestsKeptInMemory: 20,
experimentalMemoryManagement: true,
e2e: {
baseUrl: 'http://localhost:3007',
excludeSpecPattern: '**/!(*.cy).ts',
Expand Down
Loading

0 comments on commit 53134fc

Please sign in to comment.