Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Csfd 15 ungrey back button #1706

Open
wants to merge 131 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
9c8b822
Work in progress regarding CSFD-16
joeevanshmcts Feb 12, 2024
cc20f76
Merge branch 'master' into csfd-15-ungrey-back-button
joeevanshmcts Feb 13, 2024
500d762
Resolved a couple of bugs associated with the changes for CSFD-16
joeevanshmcts Feb 13, 2024
cafd3e1
Work in progress regarding CSFD-8
joeevanshmcts Feb 13, 2024
52889ba
Included changes for the case unlink component, regarding CSFD-8
joeevanshmcts Feb 13, 2024
e847534
Work in progress regarding CSFD-15, ungrey back button
joeevanshmcts Feb 13, 2024
ce26aa4
Merge branch 'master' into csfd-15-ungrey-back-button
joeevanshmcts Feb 13, 2024
b19805a
Removed console log & also allowed previous button to work as expecte…
joeevanshmcts Feb 13, 2024
7aed3d3
I've added a change to allow the previous button to work nicely for t…
joeevanshmcts Feb 14, 2024
97c0fd5
Work in progress, unregey previous button for the case link journey
joeevanshmcts Feb 14, 2024
994bf2d
WIP: Case link previous button in progress.
joeevanshmcts Feb 16, 2024
4925d68
Merge branch 'master' into csfd-15-ungrey-back-button
joeevanshmcts Mar 5, 2024
d43ab0d
Merged with master & fixed tests
joeevanshmcts Mar 5, 2024
9a6e777
CSFD-18
johnbenjamin-hmcts Mar 5, 2024
4d8be9d
CSFD-18 v2
johnbenjamin-hmcts Mar 5, 2024
815661a
CSFD-18 v2
johnbenjamin-hmcts Mar 5, 2024
7989911
CSFD-18 v2
johnbenjamin-hmcts Mar 5, 2024
bbd3def
Merge branch 'master' into csfd-15-ungrey-back-button
joeevanshmcts Mar 12, 2024
4e92e80
Merge branch 'csfd-15-ungrey-back-button' into feature/CSFD-18-v2
johnbenjamin-hmcts Mar 15, 2024
206b342
Merge pull request #1690 from hmcts/feature/CSFD-18-v2
johnbenjamin-hmcts Mar 15, 2024
a2adad0
Merge branch 'master' into csfd-15-ungrey-back-button
joeevanshmcts Mar 26, 2024
9f93d04
More tests & removed comments
joeevanshmcts Mar 26, 2024
2718944
Fixed some tests for CaseEditPageComponent
joeevanshmcts Mar 26, 2024
e1c22f7
WIP to fixing tests
joeevanshmcts Mar 26, 2024
0caac8f
Updated version & fixed tests
joeevanshmcts Mar 26, 2024
1204083
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Jul 8, 2024
56dba5d
Fix for navigating to select-flag-type from CYA not showing end node …
Josh-HMCTS Jul 12, 2024
37dd646
Fix navigation through subjourney, fix flow when going forward and su…
Josh-HMCTS Jul 16, 2024
ad08e1b
Fix broken tests
Josh-HMCTS Jul 16, 2024
e3b6d57
Add unit tests
Josh-HMCTS Jul 16, 2024
ecc5a97
basic unit tests for select flag
Josh-HMCTS Jul 16, 2024
40a9749
Up code coverage
Josh-HMCTS Jul 17, 2024
9ab2310
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Jul 17, 2024
c603a6a
change version number
Josh-HMCTS Jul 17, 2024
6668e63
Fix when navigating from CYA not default to last sub journey
Josh-HMCTS Jul 17, 2024
6854e7a
up ver num
Josh-HMCTS Jul 17, 2024
3438afa
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Jul 25, 2024
500e7d3
change ver name
Josh-HMCTS Jul 25, 2024
9b3eb74
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Aug 1, 2024
3d7dba0
exui-2208
Josh-HMCTS Aug 1, 2024
1aab82f
2210
Josh-HMCTS Aug 2, 2024
a752f70
EXUI-2213
Josh-HMCTS Aug 7, 2024
763cd65
resolve broken unit tests
Josh-HMCTS Aug 7, 2024
3941532
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Aug 7, 2024
398cbd3
Update coverage
Josh-HMCTS Aug 8, 2024
071b2ed
Up code coverage
Josh-HMCTS Aug 8, 2024
00928bc
Update version name
Josh-HMCTS Aug 8, 2024
1198ce7
code review comments
Josh-HMCTS Aug 8, 2024
25937b4
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Aug 22, 2024
c140bd8
fix AC1 issue 1
Josh-HMCTS Aug 22, 2024
9f49840
Issue 2 - Ensure data is retained when navigating from type to location
Josh-HMCTS Aug 27, 2024
3960bb4
Issue 3 - Blocked from progressing journey
Josh-HMCTS Aug 29, 2024
4cfa3f5
Issue 5 - Previous button showing at start of journey
Josh-HMCTS Sep 2, 2024
7dc3b0c
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Sep 2, 2024
54e014b
Fix unit tests
Josh-HMCTS Sep 2, 2024
26a15d0
Update ver name
Josh-HMCTS Sep 2, 2024
73eb8f7
Remove console log
Josh-HMCTS Sep 9, 2024
e50d25a
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Sep 9, 2024
2f2b707
Fix for when user navigates using previous
Josh-HMCTS Sep 10, 2024
434773f
Fix backwards navigation not hiding previous when at start of journey
Josh-HMCTS Sep 10, 2024
61e2d0a
Manage case not progressable when adding translation
Josh-HMCTS Sep 12, 2024
9cb2033
Update ver num for translation journey
Josh-HMCTS Sep 12, 2024
6c9c31b
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Sep 12, 2024
bbdb0ca
Fix being unable to enter multiple links
Josh-HMCTS Sep 12, 2024
2b00237
fix navigating via change link not taking user to end of subjourney
Josh-HMCTS Sep 12, 2024
24c0e70
Up ver num
Josh-HMCTS Sep 12, 2024
3cb9415
Fix manage flag not showing selected value when navigating back to pa…
Josh-HMCTS Sep 13, 2024
4470a5f
reset form values if flag location is changed
Josh-HMCTS Sep 16, 2024
7d97943
Update version number
Josh-HMCTS Sep 16, 2024
02373c7
fix unit tests
Josh-HMCTS Sep 16, 2024
a9ed864
add test for new funciton
Josh-HMCTS Sep 16, 2024
46700e9
add new tests for new fuctions
Josh-HMCTS Sep 16, 2024
729787c
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Sep 25, 2024
d3f5173
Resolve issues on navigating using previous button on CYA page
Josh-HMCTS Sep 25, 2024
d68b2a2
Update version name to new pre-release ver
Josh-HMCTS Sep 25, 2024
037f65e
Update ver num, fix nav on CYA
Josh-HMCTS Sep 26, 2024
b20d3fa
add extra test case
Josh-HMCTS Sep 26, 2024
2980b1c
Fix bugs on manage case links journey
Josh-HMCTS Sep 27, 2024
4ccd198
Update ver name
Josh-HMCTS Sep 27, 2024
85bbd74
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Sep 27, 2024
bdc05ee
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Oct 24, 2024
259391a
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Oct 28, 2024
55cd544
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Oct 29, 2024
8fd59d3
temp commit
Josh-HMCTS Nov 4, 2024
ef639f5
Remove testing log
Josh-HMCTS Nov 6, 2024
bc5f4ff
Avoid changing page number on specific pages
Josh-HMCTS Nov 6, 2024
698af49
update to remove data that should not be included in request on updat…
Josh-HMCTS Nov 6, 2024
0c140fe
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Nov 6, 2024
718ab59
Improve resilience when potential missing props, fix unit tests
Josh-HMCTS Nov 6, 2024
53742f9
resolve user geting stuck in navigation on manage case links
Josh-HMCTS Nov 14, 2024
ffa917b
up ver num to test force build
Josh-HMCTS Nov 14, 2024
39ff4a1
Fix reload issue
Josh-HMCTS Nov 20, 2024
a8fe846
change ver num
Josh-HMCTS Nov 20, 2024
58795a2
update yarn audit
Josh-HMCTS Nov 20, 2024
944aade
Update code to account for challenged cases, add test
Josh-HMCTS Nov 22, 2024
4b142ee
up ver num
Josh-HMCTS Nov 22, 2024
5192946
fix ver num
Josh-HMCTS Nov 22, 2024
c99fa77
set ver num
Josh-HMCTS Nov 22, 2024
29489c0
Fix bugs, add tests (2597, 2599, 2598)
Josh-HMCTS Dec 10, 2024
6d2aff9
up ver num
Josh-HMCTS Dec 10, 2024
a38da03
yarn audit
Josh-HMCTS Dec 10, 2024
7932c8d
reenable tests
Josh-HMCTS Dec 10, 2024
a85c0ed
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Jan 2, 2025
7958e59
Fix navigation when cancelling taking user to wrong tab in case view
Josh-HMCTS Jan 3, 2025
16db69e
fix remaining issues
Josh-HMCTS Jan 13, 2025
a9afc94
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Jan 13, 2025
2019d1e
fix test files
Josh-HMCTS Jan 13, 2025
add984e
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Jan 28, 2025
9451fb6
fix tests
Josh-HMCTS Jan 28, 2025
0301872
up ver num
Josh-HMCTS Jan 28, 2025
e19bbdb
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Jan 28, 2025
5547123
Code review changes/tidying
Josh-HMCTS Jan 29, 2025
700aad8
Up ver num
Josh-HMCTS Jan 30, 2025
00f599b
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Feb 4, 2025
d6ea212
code tidy
Josh-HMCTS Feb 4, 2025
cf08b70
fix when trying to link an already existing case showing no error mes…
Josh-HMCTS Feb 5, 2025
b2f6985
update code coverage
Josh-HMCTS Feb 5, 2025
3e0fde6
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Feb 5, 2025
612f36e
update version
Josh-HMCTS Feb 5, 2025
270f121
fix broken test
Josh-HMCTS Feb 5, 2025
0b66143
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Feb 5, 2025
81a4f98
fix bug, update version
Josh-HMCTS Feb 6, 2025
83836a0
upcate fix
Josh-HMCTS Feb 6, 2025
3de5864
fix
Josh-HMCTS Feb 6, 2025
49f1cf0
fix navigtion block in case flag journey
Josh-HMCTS Feb 6, 2025
072d9f3
sonar issues, up ver num
Josh-HMCTS Feb 10, 2025
689db24
code comments
Josh-HMCTS Feb 10, 2025
154a9ef
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Feb 10, 2025
5e17bbb
fix initial links being set when using back button
Josh-HMCTS Feb 11, 2025
aeb16c4
Merge branch 'master' into csfd-15-ungrey-back-button
Josh-HMCTS Feb 12, 2025
7a0887f
trim white space on casenumber input
Josh-HMCTS Feb 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ Taken by PR
### Version 7.0.20
**EUI-1300** accessibility change

### Version 7.0.18-event-flow-cancel-navigation-v2
**CSFD-18** Ungrey back button - event flow cancel navigation

### Version 7.0.19
**EUI-1067** No error message is displayed when entering incorrect postcode
**EUI-1123** TextArea fields are not preloaded even the data is present in response intermittently
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.1.32",
"version": "7.1.32-ungrey-back-button",
"engines": {
"node": ">=18.19.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/ccd-case-ui-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.1.32",
"version": "7.1.32-ungrey-back-button",
"engines": {
"node": ">=18.19.0"
},
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { CaseEventData } from '../../../domain/case-event-data.model';
import { CaseEventTrigger } from '../../../domain/case-view/case-event-trigger.model';
import { CaseField } from '../../../domain/definition';
import { DRAFT_PREFIX } from '../../../domain/draft.model';
import { AddressesService, LoadingService } from '../../../services';
import { AddressesService, LoadingService, MultipageComponentStateService } from '../../../services';
import { CaseFieldService } from '../../../services/case-fields/case-field.service';
import { FieldsUtils } from '../../../services/fields';
import { FormErrorService } from '../../../services/form/form-error.service';
Expand All @@ -22,13 +22,16 @@ import { WizardPage } from '../domain/wizard-page.model';
import { Wizard } from '../domain/wizard.model';
import { PageValidationService } from '../services/page-validation.service';
import { ValidPageListCaseFieldsService } from '../services/valid-page-list-caseFields.service';
import { JourneyInstigator } from '../../../domain/journey';
import { LinkedCasesService } from '../../palette/linked-cases/services/linked-cases.service';
import { CaseFlagStateService } from '../services/case-flag-state.service';

@Component({
selector: 'ccd-case-edit-page',
templateUrl: 'case-edit-page.html',
styleUrls: ['./case-edit-page.scss']
})
export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestroy {
export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestroy, JourneyInstigator {
public static readonly RESUMED_FORM_DISCARD = 'RESUMED_FORM_DISCARD';
public static readonly NEW_FORM_DISCARD = 'NEW_FORM_DISCARD';
public static readonly NEW_FORM_SAVE = 'NEW_FORM_CHANGED_SAVE';
Expand Down Expand Up @@ -85,8 +88,39 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
private readonly caseEditDataService: CaseEditDataService,
private readonly loadingService: LoadingService,
private readonly validPageListCaseFieldsService: ValidPageListCaseFieldsService,
private readonly addressService: AddressesService
private readonly multipageComponentStateService: MultipageComponentStateService,
private readonly addressService: AddressesService,
private readonly linkedCasesService: LinkedCasesService,
private readonly caseFlagStateService: CaseFlagStateService
) {
this.multipageComponentStateService.setInstigator(this);
}

public onFinalNext(): void {
this.submit();
}

public onFinalPrevious(): void {
this.cancel();
}

public isAtStart(): boolean {
const pageNumberToUse = this.multipageComponentStateService.getJourneyCollection()[0]?.linkedCasesPage !== undefined ? this.multipageComponentStateService.getJourneyCollection()[0]?.linkedCasesPage : this.multipageComponentStateService.getJourneyCollection()[0]?.fieldState;
return pageNumberToUse === this.multipageComponentStateService.getJourneyCollection()[0]?.journeyStartPageNumber;
}

public isAtEnd(): boolean {
return this.multipageComponentStateService.getJourneyCollection()[0]?.fieldState === this.multipageComponentStateService.getJourneyCollection()[0]?.journeyEndPageNumber;
}

// This method will be triggered by the next button in the app component
public nextStep(): void {
this.multipageComponentStateService.next();
}

// This method will be triggered by the previous button in the app component
public previousStep(): void {
this.multipageComponentStateService.previous();
}

public ngOnInit(): void {
Expand Down Expand Up @@ -148,6 +182,7 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
this.dialogRefAfterClosedSub?.unsubscribe();
this.saveDraftSub?.unsubscribe();
this.caseFormValidationErrorsSub?.unsubscribe();
this.multipageComponentStateService.reset();
}

public applyValuesChanged(valuesChanged: boolean): void {
Expand All @@ -159,6 +194,7 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
}

public currentPageIsNotValid(): boolean {
this.editForm.updateValueAndValidity();
this.failingCaseFields = this.pageValidationService.getInvalidFields(this.currentPage, this.editForm);
return this.failingCaseFields.length > 0 ||
(this.isLinkedCasesJourney() && !this.isLinkedCasesJourneyAtFinalStep);
Expand All @@ -175,11 +211,11 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
*/
public toPreviousPage(): void {
this.caseEditDataService.clearFormValidationErrors();

const caseEventData: CaseEventData = this.buildCaseEventData(true);
caseEventData.data = caseEventData.event_data;
this.updateFormData(caseEventData);
this.previous();
this.previousStep();
CaseEditPageComponent.setFocusToTop();
}

Expand Down Expand Up @@ -289,8 +325,31 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
}
}

public checkForStagesCompleted() {
const dataControls = this.editForm.controls['data'];
if (dataControls) {
const flagLauncher = dataControls.get('flagLauncherInternal');
if (flagLauncher) {
if (flagLauncher.hasError('notAllCaseFlagStagesCompleted') && this.isAtEnd()) {
flagLauncher.setErrors(null);
}
}
}
}

public submit(): void {
// in some scenarios the fieldstate can be set to 0 even though the user is at the end of a journey, check for this case and set vars
const journeyPageNumber = this.multipageComponentStateService.getJourneyCollection()[0]?.journeyPageNumber;
const fieldState = this.caseFlagStateService?.fieldStateToNavigate;
if (this.eventTrigger.id === 'c100ManageFlags'){
if ((fieldState === 0 || fieldState === undefined || journeyPageNumber > fieldState) && fieldState !== journeyPageNumber) {
this.caseFlagStateService.fieldStateToNavigate = journeyPageNumber;
this.caseFlagStateService.lastPageFieldState = journeyPageNumber;
}
}

this.caseEditDataService.clearFormValidationErrors();
this.checkForStagesCompleted();
if (this.currentPageIsNotValid()) {
// The generateErrorMessage method filters out the hidden fields.
// The error message for LinkedCases journey will never get displayed because the
Expand Down Expand Up @@ -434,6 +493,20 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
}

public cancel(): void {
if (this.isLinkedCasesJourney()){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment - add cleanUpData method so that this can be used elsewhere if needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at least think about it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved it to its own reset function

// if the user cancels the journey we need to clean up the data
const linkedCasesTab = this.caseEdit.caseDetails.tabs.find((tab) =>
tab?.fields?.some((field) => field.id === 'caseLinks')
)?.fields?.[0] ?? null;
const initalLinks = this.linkedCasesService.initialCaseLinkRefs;
if (linkedCasesTab && linkedCasesTab?.value.length !== initalLinks.length){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another minor comment - a few assumptions made here, i.e. that there is this.caseEdit.caseDetails.tabs and that linkedCasesTab.value exists, just check that they definitely will

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added additional checks for properties

const initialCaseRefs = this.linkedCasesService.initialCaseLinkRefs;
linkedCasesTab.value = linkedCasesTab.value.filter((item) =>
initialCaseRefs.includes(item.value.CaseReference)
);
}
this.linkedCasesService.resetLinkedCaseData();
}
if (this.eventTrigger.can_save_draft) {
if (this.formValuesChanged) {
const dialogRef = this.dialog.open(SaveOrDiscardDialogComponent, this.dialogConfig);
Expand All @@ -457,6 +530,7 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
}

this.caseEditDataService.clearFormValidationErrors();
this.multipageComponentStateService.reset();
}

public submitting(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h2 class="govuk-error-summary__title" id="error-summary-title">
(callbackErrorsContext)="callbackErrorsNotify($event)">
</ccd-callback-errors>
<div class="width-50">
<form *ngIf="currentPage" class="form" [formGroup]="editForm" (submit)="submit()">
<form *ngIf="currentPage" class="form" [formGroup]="editForm" (submit)="nextStep()">
<fieldset id="fieldset-case-data">
<legend style="display: none;"></legend>
<!-- single column -->
Expand All @@ -62,7 +62,7 @@ <h2 class="govuk-error-summary__title" id="error-summary-title">
</fieldset>

<div class="form-group form-group-related">
<button class="button button-secondary" type="button" [disabled]="!(hasPreviousPage$ | async)" (click)="toPreviousPage()">
<button class="button button-secondary" type="button" (click)="toPreviousPage()" *ngIf="!isAtStart()" [disabled]="isAtStart()">
{{'Previous' | rpxTranslate}}
</button>
<button class="button" type="submit" [disabled]="submitting()">{{triggerText | rpxTranslate}}</button>
Expand Down
Loading
Loading