From b4f2af2694323627ccdb8a5703c9d480dec8a718 Mon Sep 17 00:00:00 2001 From: Olu <142989683+olusegz07@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:17:28 +0000 Subject: [PATCH 01/11] Copy update (#1817) --- .../qualifying-question-options.component.spec.ts | 2 +- .../qualifying-question-options.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts index 50d3f0acd..463a3b7d9 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts @@ -66,7 +66,7 @@ describe('QualifyingQuestionOptionsComponent', () => { it('should have the link to case details queries tab', () => { component.click(); - expect(router.navigate).toHaveBeenCalledWith(['cases', 'case-details', '12345'], { fragment: 'Query Management' }); + expect(router.navigate).toHaveBeenCalledWith(['cases', 'case-details', '12345'], { fragment: 'Queries' }); }); describe('displayError', () => { diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts index f809a37a5..765a6115b 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts @@ -33,7 +33,7 @@ export class QualifyingQuestionOptionsComponent implements OnInit { } public click(): void { - this.router.navigate(['cases', 'case-details', this.caseId], { fragment: 'Query Management' }); + this.router.navigate(['cases', 'case-details', this.caseId], { fragment: 'Queries' }); } public get displayError(): boolean { From a39024eca5dca1127994868c1e115ed5c6d6e441 Mon Sep 17 00:00:00 2001 From: Olu <142989683+olusegz07@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:18:51 +0000 Subject: [PATCH 02/11] update response status (#1816) --- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- .../enums/query-item-response-status.enum.ts | 3 +- .../query-list-item.model.spec.ts | 36 +++++++++++++++++-- .../query-list-item/query-list-item.model.ts | 7 +++- 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 2a3aabeef..d880e1187 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.15-fix-event-hiding", + "version": "7.1.16-response-status", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 5afc666ad..9b6c7220c 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.15-fix-event-hiding", + "version": "7.1.16-response-status", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts index 7cf440f59..d4138e919 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts @@ -1,4 +1,5 @@ export enum QueryItemResponseStatus { NEW = 'New', - RESPONDED = 'Responded' + RESPONDED = 'Responded', + Awaiting = 'Awaiting Response' } diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts index e52e9b2a0..6fc5f4b12 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts @@ -56,11 +56,11 @@ describe('QueryListItem', () => { hearingDate: '', createdOn: new Date('2023-06-01'), createdBy: 'Person D', - parentId: '444-444', + parentId: '444-444' } ]; - const childrenItems = items.map(item => { + const childrenItems = items.map((item) => { const listItem = new QueryListItem(); Object.assign(listItem, item); return listItem; @@ -163,7 +163,37 @@ describe('QueryListItem', () => { it('should return "No response required" when it has no children', () => { queryListItem.children = []; expect(queryListItem.children).toEqual([]); - expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.NEW); + expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.Awaiting); + }); + + it('should return "Awaiting Response" when it has children and is for Follow up question', () => { + // Create additional child items + const additionalChildren = [ + new QueryListItem(), + new QueryListItem(), + new QueryListItem(), + new QueryListItem() + ].map((child, index) => { + Object.assign(child, { + id: `child-${index + 1}`, + subject: `Subject ${index + 2}`, + name: `Name ${index + 2}`, + body: `Body ${index + 2}`, + attachments: [], + isHearingRelated: false, + hearingDate: '', + createdOn: new Date(`2021-0${index + 2}-01`), + createdBy: `Person ${String.fromCharCode(65 + index + 1)}`, + parentId: queryListItem.id, + children: [] + }); + return child; + }); + + // Assign these new children to queryListItem + queryListItem.children = additionalChildren; + expect(queryListItem.children.length).toEqual(4); + expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.Awaiting); }); }); }); diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts index 57c54dd27..69248557d 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts @@ -50,6 +50,11 @@ export class QueryListItem implements CaseMessage { } public get responseStatus(): QueryItemResponseStatus { - return this.children?.length > 0 ? QueryItemResponseStatus.RESPONDED : QueryItemResponseStatus.NEW; + if (this.children?.length > 0) { + return this.children.length % 2 === 1 + ? QueryItemResponseStatus.RESPONDED + : QueryItemResponseStatus.Awaiting; + } + return QueryItemResponseStatus.Awaiting; } } From 4dadc42314e16dc622146a3f5e81faec65618688 Mon Sep 17 00:00:00 2001 From: olusegun odunukan Date: Tue, 3 Dec 2024 13:25:13 +0000 Subject: [PATCH 03/11] Update yarn-audit-known-issues --- yarn-audit-known-issues | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/yarn-audit-known-issues b/yarn-audit-known-issues index d19f2e9d5..45f280c7e 100644 --- a/yarn-audit-known-issues +++ b/yarn-audit-known-issues @@ -5,9 +5,11 @@ {"value":"cookie","children":{"ID":1099846,"Issue":"cookie accepts cookie name, path, and domain with out of bounds characters","URL":"https://github.com/advisories/GHSA-pxg6-pf52-xh8x","Severity":"low","Vulnerable Versions":"<0.7.0","Tree Versions":["0.5.0"],"Dependents":["express@npm:4.18.2"]}} {"value":"copy-concurrently","children":{"ID":"copy-concurrently (deprecation)","Issue":"This package is no longer supported.","Severity":"moderate","Vulnerable Versions":"1.0.5","Tree Versions":["1.0.5"],"Dependents":["move-concurrently@npm:1.0.1"]}} {"value":"core-js","children":{"ID":"core-js (deprecation)","Issue":"core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.","Severity":"moderate","Vulnerable Versions":"1.2.7","Tree Versions":["1.2.7"],"Dependents":["fbjs@npm:0.8.18"]}} +{"value":"cross-spawn","children":{"ID":1100562,"Issue":"Regular Expression Denial of Service (ReDoS) in cross-spawn","URL":"https://github.com/advisories/GHSA-3xgq-45jj-v275","Severity":"high","Vulnerable Versions":"<6.0.6","Tree Versions":["5.1.0"],"Dependents":["execa@npm:0.7.0"]}} +{"value":"cross-spawn","children":{"ID":1100563,"Issue":"Regular Expression Denial of Service (ReDoS) in cross-spawn","URL":"https://github.com/advisories/GHSA-3xgq-45jj-v275","Severity":"high","Vulnerable Versions":">=7.0.0 <7.0.5","Tree Versions":["7.0.3"],"Dependents":["foreground-child@npm:3.1.1"]}} {"value":"domexception","children":{"ID":"domexception (deprecation)","Issue":"Use your platform's native DOMException instead","Severity":"moderate","Vulnerable Versions":"4.0.0","Tree Versions":["4.0.0"],"Dependents":["jsdom@virtual:ce56289c4b7a2e9003d709997e253c1c80dcaee4c6fbe440cbe9ba5de5db8af3a7b7ad41bbdec5a5e3d40dc9c3c54bef92dd6885ff84cd436d636d5a1b380a61#npm:20.0.3"]}} {"value":"express","children":{"ID":1096820,"Issue":"Express.js Open Redirect in malformed URLs","URL":"https://github.com/advisories/GHSA-rv95-896h-c2vc","Severity":"moderate","Vulnerable Versions":"<4.19.2","Tree Versions":["4.18.2"],"Dependents":["json-server@npm:0.15.1"]}} -{"value":"express","children":{"ID":1099529,"Issue":"express vulnerable to XSS via response.redirect()","URL":"https://github.com/advisories/GHSA-qw6h-vgh9-j6wx","Severity":"moderate","Vulnerable Versions":"<4.20.0","Tree Versions":["4.18.2"],"Dependents":["json-server@npm:0.15.1"]}} +{"value":"express","children":{"ID":1100530,"Issue":"express vulnerable to XSS via response.redirect()","URL":"https://github.com/advisories/GHSA-qw6h-vgh9-j6wx","Severity":"low","Vulnerable Versions":"<4.20.0","Tree Versions":["4.18.2"],"Dependents":["json-server@npm:0.15.1"]}} {"value":"figgy-pudding","children":{"ID":"figgy-pudding (deprecation)","Issue":"This module is no longer supported.","Severity":"moderate","Vulnerable Versions":"3.5.2","Tree Versions":["3.5.2"],"Dependents":["npm-registry-fetch@npm:4.0.7"]}} {"value":"fs-write-stream-atomic","children":{"ID":"fs-write-stream-atomic (deprecation)","Issue":"This package is no longer supported.","Severity":"moderate","Vulnerable Versions":"1.0.10","Tree Versions":["1.0.10"],"Dependents":["move-concurrently@npm:1.0.1"]}} {"value":"gauge","children":{"ID":"gauge (deprecation)","Issue":"This package is no longer supported.","Severity":"moderate","Vulnerable Versions":"4.0.4","Tree Versions":["4.0.4"],"Dependents":["npmlog@npm:6.0.2"]}} @@ -36,9 +38,9 @@ {"value":"request","children":{"ID":1096727,"Issue":"Server-Side Request Forgery in Request","URL":"https://github.com/advisories/GHSA-p8p7-x288-28g6","Severity":"moderate","Vulnerable Versions":"<=2.88.2","Tree Versions":["2.88.2"],"Dependents":["json-server@npm:0.15.1"]}} {"value":"resolve-url","children":{"ID":"resolve-url (deprecation)","Issue":"https://github.com/lydell/resolve-url#deprecated","Severity":"moderate","Vulnerable Versions":"0.2.1","Tree Versions":["0.2.1"],"Dependents":["source-map-resolve@npm:0.5.3"]}} {"value":"rimraf","children":{"ID":"rimraf (deprecation)","Issue":"Rimraf versions prior to v4 are no longer supported","Severity":"moderate","Vulnerable Versions":"3.0.2","Tree Versions":["3.0.2"],"Dependents":["@mapbox/node-pre-gyp@npm:1.0.11"]}} -{"value":"send","children":{"ID":1099525,"Issue":"send vulnerable to template injection that can lead to XSS","URL":"https://github.com/advisories/GHSA-m6fv-jmcg-4jfg","Severity":"moderate","Vulnerable Versions":"<0.19.0","Tree Versions":["0.18.0"],"Dependents":["express@npm:4.18.2"]}} -{"value":"serve-static","children":{"ID":1099527,"Issue":"serve-static vulnerable to template injection that can lead to XSS","URL":"https://github.com/advisories/GHSA-cm22-4g7w-348p","Severity":"moderate","Vulnerable Versions":"<1.16.0","Tree Versions":["1.15.0"],"Dependents":["express@npm:4.18.2"]}} -{"value":"socket.io-parser","children":{"ID":1098329,"Issue":"Insufficient validation when decoding a Socket.IO packet","URL":"https://github.com/advisories/GHSA-cqmj-92xf-r6r9","Severity":"high","Vulnerable Versions":">=4.0.4 <4.2.3","Tree Versions":["4.0.5"],"Dependents":["socket.io-client@npm:3.1.3"]}} +{"value":"send","children":{"ID":1100526,"Issue":"send vulnerable to template injection that can lead to XSS","URL":"https://github.com/advisories/GHSA-m6fv-jmcg-4jfg","Severity":"low","Vulnerable Versions":"<0.19.0","Tree Versions":["0.18.0"],"Dependents":["express@npm:4.18.2"]}} +{"value":"serve-static","children":{"ID":1100528,"Issue":"serve-static vulnerable to template injection that can lead to XSS","URL":"https://github.com/advisories/GHSA-cm22-4g7w-348p","Severity":"low","Vulnerable Versions":"<1.16.0","Tree Versions":["1.15.0"],"Dependents":["express@npm:4.18.2"]}} +{"value":"socket.io-parser","children":{"ID":1100541,"Issue":"Insufficient validation when decoding a Socket.IO packet","URL":"https://github.com/advisories/GHSA-cqmj-92xf-r6r9","Severity":"moderate","Vulnerable Versions":">=4.0.4 <4.2.3","Tree Versions":["4.0.5"],"Dependents":["socket.io-client@npm:3.1.3"]}} {"value":"source-map-resolve","children":{"ID":"source-map-resolve (deprecation)","Issue":"See https://github.com/lydell/source-map-resolve#deprecated","Severity":"moderate","Vulnerable Versions":"0.5.3","Tree Versions":["0.5.3"],"Dependents":["snapdragon@npm:0.8.2"]}} {"value":"source-map-url","children":{"ID":"source-map-url (deprecation)","Issue":"See https://github.com/lydell/source-map-url#deprecated","Severity":"moderate","Vulnerable Versions":"0.4.1","Tree Versions":["0.4.1"],"Dependents":["source-map-resolve@npm:0.5.3"]}} {"value":"tar","children":{"ID":1097493,"Issue":"Denial of service while parsing a tar file due to lack of folders count validation","URL":"https://github.com/advisories/GHSA-f5x3-32g6-xq36","Severity":"moderate","Vulnerable Versions":"<6.2.1","Tree Versions":["6.1.15"],"Dependents":["@mapbox/node-pre-gyp@npm:1.0.11"]}} From cd2175bc9dda26f81163410b7ce06f85ef03f7f7 Mon Sep 17 00:00:00 2001 From: Olu <142989683+olusegz07@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:11:52 +0000 Subject: [PATCH 04/11] Update case-header.component.ts (#1814) * Update query-case-details-header.component.ts * Update yarn-audit-known-issues * update toolkit version * code tidy and fix sonar cloud issue * code tidy * version update --- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- .../services/page-validation.service.ts | 15 ++++++------ .../case-header/case-header.component.ts | 16 +++++++++---- .../select-flag-type.component.ts | 18 --------------- .../query-case-details-header.component.ts | 23 ++++--------------- .../jurisdiction/jurisdiction.service.ts | 1 - 7 files changed, 26 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index d880e1187..7b0425fcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.16-response-status", + "version": "7.1.17-response-status-case-name", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 9b6c7220c..099c2b04a 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.16-response-status", + "version": "7.1.17-response-status-case-name", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/page-validation.service.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/page-validation.service.ts index e4d13b478..d8f559349 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/page-validation.service.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/page-validation.service.ts @@ -14,15 +14,15 @@ export class PageValidationService { public getInvalidFields(page: WizardPage, editForm: FormGroup): CaseField[] { const failingCaseFields = []; page.case_fields - .filter(caseField => !this.caseFieldService.isReadOnly(caseField)) - .filter(caseField => !this.isHidden(caseField, editForm)) - .map(caseField => { + .filter((caseField) => !this.caseFieldService.isReadOnly(caseField)) + .filter((caseField) => !this.isHidden(caseField, editForm)) + .forEach((caseField) => { const theControl = FieldsUtils.isCaseFieldOfType(caseField, ['JudicialUser']) - ? editForm.controls['data'].get(`${caseField.id}_judicialUserControl`) - : editForm.controls['data'].get(caseField.id); + ? editForm.controls.data.get(`${caseField.id}_judicialUserControl`) + : editForm.controls.data.get(caseField.id); if (!(this.checkDocumentField(caseField, theControl) && this.checkOptionalField(caseField, theControl))) { failingCaseFields.push(caseField); - }; + } }); return failingCaseFields; } @@ -46,9 +46,8 @@ export class PageValidationService { private checkOptionalField(caseField: CaseField, theControl: AbstractControl): boolean { if (!theControl) { return this.caseFieldService.isOptional(caseField); - } else { - return theControl.valid || theControl.disabled; } + return theControl.valid || theControl.disabled; } private checkMandatoryField(caseField: CaseField, theControl: AbstractControl): boolean { diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-header/case-header.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-header/case-header.component.ts index ddbb43715..7c38d0f90 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-header/case-header.component.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-header/case-header.component.ts @@ -10,17 +10,25 @@ import { Draft } from '../../domain/draft.model'; }) export class CaseHeaderComponent implements OnInit { - @Input() public caseDetails: CaseView; + + @Input() + public caseDetails: CaseView; public caseTitle: CaseField; public caseFields: CaseField[]; public ngOnInit(): void { this.caseTitle = new CaseField(); - this.caseTitle.label = this.caseDetails.state.title_display; - this.caseFields = this.getCaseFieldsInfo(); + if (!this.isDraft() && this.caseDetails.state.title_display) { + this.caseTitle.label = this.caseDetails.state.title_display; + this.caseFields = this.getCaseFields(); + } + } + + public isDraft(): boolean { + return Draft.isDraft(this.caseDetails.case_id); } - private getCaseFieldsInfo(): CaseField[] { + private getCaseFields(): CaseField[] { const caseDataFields = this.caseDetails.tabs.reduce((acc, tab) => { return acc.concat(tab.fields); }, []); diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.ts index a7215ad5b..ad077e38e 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.ts @@ -98,24 +98,6 @@ export class SelectFlagTypeComponent implements OnInit, OnDestroy { } ); - this.formGroup.addControl(CaseFlagFormFields.FLAG_TYPE, new FormControl('')); - this.formGroup.addControl(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION, new FormControl('')); - this.formGroup.addControl(CaseFlagFormFields.IS_VISIBLE_INTERNALLY_ONLY, new FormControl('')); - - // Should clear descriptionControlName if flagTypeControlName is changed - this.flagTypeControlChangesSubscription = this.formGroup.get(CaseFlagFormFields.FLAG_TYPE).valueChanges - .subscribe(_ => { - this.formGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION).setValue(''); - this.cachedPath = []; - - // required to clear language interpreter - this.formGroup.patchValue({ - [SearchLanguageInterpreterControlNames.LANGUAGE_SEARCH_TERM]: '', - [SearchLanguageInterpreterControlNames.MANUAL_LANGUAGE_ENTRY]: '' - }); - } - ); - // If hmctsServiceId is present, use this to retrieve the relevant list of flag types if (this.hmctsServiceId) { this.flagRefdata$ = this.caseFlagRefdataService diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-case-details-header/query-case-details-header.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-case-details-header/query-case-details-header.component.ts index e923fddb1..b664b3738 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-case-details-header/query-case-details-header.component.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-case-details-header/query-case-details-header.component.ts @@ -1,37 +1,24 @@ import { Component, Input, OnInit } from '@angular/core'; import { CaseView } from '../../../../../domain/case-view/case-view.model'; import { CaseField } from '../../../../../domain/definition/case-field.model'; -import { Draft } from '../../../../../domain/draft.model'; -import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'ccd-query-case-details-header', templateUrl: './query-case-details-header.component.html' }) + export class QueryCaseDetailsHeaderComponent implements OnInit { - @Input() - public caseDetails: CaseView; + @Input() public caseDetails: CaseView; public caseTitle: CaseField; public caseFields: CaseField[]; - public caseView: CaseView; - - constructor(activatedRoute: ActivatedRoute) { - this.caseView = activatedRoute.snapshot.data.case; - } public ngOnInit(): void { this.caseTitle = new CaseField(); - if (!this.isDraft() && this.caseDetails.state.title_display) { - this.caseTitle.label = this.caseDetails.state.title_display; - this.caseFields = this.getCaseFields(); - } - } - - public isDraft(): boolean { - return Draft.isDraft(this.caseDetails.case_id); + this.caseTitle.label = this.caseDetails.state.title_display; + this.caseFields = this.getCaseFieldsInfo(); } - private getCaseFields(): CaseField[] { + private getCaseFieldsInfo(): CaseField[] { const caseDataFields = this.caseDetails.tabs.reduce((acc, tab) => { return acc.concat(tab.fields); }, []); diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/services/jurisdiction/jurisdiction.service.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/services/jurisdiction/jurisdiction.service.ts index 8955ea21b..158695b50 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/services/jurisdiction/jurisdiction.service.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/services/jurisdiction/jurisdiction.service.ts @@ -20,7 +20,6 @@ export class JurisdictionService { } public announceSelectedJurisdiction(jurisdiction: Jurisdiction): void { - console.info ('Announcing selected jurisdiction = ' + jurisdiction?.id); this.selectedJurisdictionSource.next(jurisdiction); this.selectedJurisdictionBS.next(jurisdiction); } From 20d63c613c7a5d8d6c3f8ad94aff9d1b07a757e6 Mon Sep 17 00:00:00 2001 From: Olu <142989683+olusegz07@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:01:12 +0000 Subject: [PATCH 05/11] Remove copy and link (#1820) --- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- .../qualifying-question-options.component.html | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 7b0425fcd..7fc04f7f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.17-response-status-case-name", + "version": "7.1.18-extra-query-options", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 099c2b04a..0e084ff2c 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.17-response-status-case-name", + "version": "7.1.18-extra-query-options", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.html b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.html index 50eaef843..ab76b7d82 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.html +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.html @@ -27,10 +27,6 @@

type="radio" [formControl]="qualifyingQuestionsControl" [value]="qualifyingQuestion"> -
- {{ '(To follow-up on an existing query' | rpxTranslate }} - {{ 'click here' | rpxTranslate }}.) -
From 1c30236a5cdfa7e931ab21deef27460ab6df502e Mon Sep 17 00:00:00 2001 From: olusegun odunukan Date: Thu, 12 Dec 2024 15:41:54 +0000 Subject: [PATCH 06/11] version update --- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7ceeca976..b2307dfac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.18-extra-query-options", + "version": "7.1.19-qm-with-master", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 0e084ff2c..69a00b26f 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.18-extra-query-options", + "version": "7.1.19-qm-with-master", "engines": { "node": ">=18.19.0" }, From 9f7b1c55c7c786bd874ef1bdaafd22a82153627c Mon Sep 17 00:00:00 2001 From: olusegun odunukan Date: Thu, 12 Dec 2024 15:59:38 +0000 Subject: [PATCH 07/11] version update --- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b2307dfac..7f6a11bfa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.19-qm-with-master", + "version": "7.1.20-qm-with-srt-master", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 69a00b26f..5970e30cf 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.19-qm-with-master", + "version": "7.1.20-qm-with-srt-master", "engines": { "node": ">=18.19.0" }, From 48165a2d3adac074f977600e1c60d971caaa6576 Mon Sep 17 00:00:00 2001 From: olusegun odunukan Date: Thu, 12 Dec 2024 16:36:48 +0000 Subject: [PATCH 08/11] version toolkit --- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7f6a11bfa..2281a02f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.20-qm-with-srt-master", + "version": "7.1.21-qm-with-srt-master", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 5970e30cf..f4ae323fe 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.20-qm-with-srt-master", + "version": "7.1.21-qm-with-srt-master", "engines": { "node": ">=18.19.0" }, From d34dc491c9adc862faee00e9e6282375c875265d Mon Sep 17 00:00:00 2001 From: olusegun odunukan Date: Thu, 12 Dec 2024 16:43:57 +0000 Subject: [PATCH 09/11] Update qualifying-question-options.component.spec.ts --- .../qualifying-question-options.component.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts index 463a3b7d9..7a6ae9463 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts @@ -109,5 +109,15 @@ describe('QualifyingQuestionOptionsComponent', () => { expect(errorMessageEl).toBeTruthy(); expect(errorMessageEl.nativeElement.textContent.trim()).toBe(`Error: ${QualifyingQuestionsErrorMessage.SELECT_AN_OPTION}`); }); + + it('should initialize qualifyingQuestionsControl with saved selection if available', () => { + const savedSelection = 'saved-option'; + qualifyingQuestionService.getQualifyingQuestionSelection.and.returnValue(savedSelection); + + component.ngOnInit(); + + expect(qualifyingQuestionService.getQualifyingQuestionSelection).toHaveBeenCalled(); + expect(component.qualifyingQuestionsControl.value).toBe(savedSelection); + }); }); }); From b312dc33ea37aa9039ed67b51bf1b7159e5b2d37 Mon Sep 17 00:00:00 2001 From: olusegun odunukan Date: Fri, 13 Dec 2024 11:15:07 +0000 Subject: [PATCH 10/11] Code tidy --- .../query-management/enums/query-item-response-status.enum.ts | 2 +- .../query-list/query-list-item/query-list-item.model.spec.ts | 4 ++-- .../query-list/query-list-item/query-list-item.model.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts index d4138e919..5d37a728f 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts @@ -1,5 +1,5 @@ export enum QueryItemResponseStatus { NEW = 'New', RESPONDED = 'Responded', - Awaiting = 'Awaiting Response' + AWAITING = 'Awaiting Response' } diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts index 6fc5f4b12..8241ce41d 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts @@ -163,7 +163,7 @@ describe('QueryListItem', () => { it('should return "No response required" when it has no children', () => { queryListItem.children = []; expect(queryListItem.children).toEqual([]); - expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.Awaiting); + expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.AWAITING); }); it('should return "Awaiting Response" when it has children and is for Follow up question', () => { @@ -193,7 +193,7 @@ describe('QueryListItem', () => { // Assign these new children to queryListItem queryListItem.children = additionalChildren; expect(queryListItem.children.length).toEqual(4); - expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.Awaiting); + expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.AWAITING); }); }); }); diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts index 69248557d..739adbc1c 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts @@ -53,8 +53,8 @@ export class QueryListItem implements CaseMessage { if (this.children?.length > 0) { return this.children.length % 2 === 1 ? QueryItemResponseStatus.RESPONDED - : QueryItemResponseStatus.Awaiting; + : QueryItemResponseStatus.AWAITING; } - return QueryItemResponseStatus.Awaiting; + return QueryItemResponseStatus.AWAITING; } } From a7d641fbd2e266935f2f2510247951f28b8ad5e2 Mon Sep 17 00:00:00 2001 From: olusegun odunukan Date: Mon, 16 Dec 2024 08:46:05 +0000 Subject: [PATCH 11/11] release version --- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2281a02f0..6327a05e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.21-qm-with-srt-master", + "version": "7.1.22", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index f4ae323fe..350cda0a4 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.1.21-qm-with-srt-master", + "version": "7.1.22", "engines": { "node": ">=18.19.0" },