@hmcts/ccd-case-ui-toolkit 7.3.60-fix-case-filter-issue → 7.3.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,11 +8,10 @@ import * as i1$1 from '@angular/router';
|
|
|
8
8
|
import { RouterModule, NavigationStart, NavigationEnd } from '@angular/router';
|
|
9
9
|
import * as i4 from '@angular/forms';
|
|
10
10
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormArray, FormGroup, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
11
|
-
import { BehaviorSubject, throwError, Subject, EMPTY, Observable, skip, of,
|
|
11
|
+
import { BehaviorSubject, throwError, Subject, EMPTY, concat, defer, timer, Observable, skip, of, forkJoin, fromEvent, Subscription, combineLatest } from 'rxjs';
|
|
12
|
+
import { distinctUntilChanged, catchError, map, switchMap, repeat, retry, publish, refCount, debounceTime, delay, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, first, takeUntil, filter } from 'rxjs/operators';
|
|
12
13
|
import * as i1$2 from '@angular/common/http';
|
|
13
14
|
import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
14
|
-
import { distinctUntilChanged, catchError, map, publish, refCount, switchMap, debounceTime, delay, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, first, takeUntil, filter } from 'rxjs/operators';
|
|
15
|
-
import { polling } from 'rx-polling-hmcts';
|
|
16
15
|
import { Type, Exclude, Expose, plainToClassFromExist, plainToClass } from 'class-transformer';
|
|
17
16
|
import moment from 'moment';
|
|
18
17
|
import { __decorate, __metadata } from 'tslib';
|
|
@@ -1829,8 +1828,7 @@ class ActivityPollingService {
|
|
|
1829
1828
|
this.config = config;
|
|
1830
1829
|
this.pollConfig = {
|
|
1831
1830
|
interval: config.getActivityNexPollRequestMs(),
|
|
1832
|
-
attempts: config.getActivityRetry()
|
|
1833
|
-
backgroundPolling: true
|
|
1831
|
+
attempts: config.getActivityRetry()
|
|
1834
1832
|
};
|
|
1835
1833
|
this.batchCollectionDelayMs = config.getActivityBatchCollectionDelayMs();
|
|
1836
1834
|
this.maxRequestsPerBatch = config.getActivityMaxRequestPerBatch();
|
|
@@ -1847,17 +1845,18 @@ class ActivityPollingService {
|
|
|
1847
1845
|
subject.subscribe(done);
|
|
1848
1846
|
}
|
|
1849
1847
|
else {
|
|
1848
|
+
// Only the first pending request should start the batch collection timer.
|
|
1849
|
+
const wasEmpty = this.pendingRequests.size === 0;
|
|
1850
1850
|
subject = new Subject();
|
|
1851
1851
|
subject.subscribe(done);
|
|
1852
|
-
this.
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
});
|
|
1852
|
+
this.addPendingRequest(caseId, subject);
|
|
1853
|
+
if (wasEmpty) {
|
|
1854
|
+
this.ngZone.runOutsideAngular(() => {
|
|
1855
|
+
this.currentTimeoutHandle = setTimeout(() => this.ngZone.run(() => {
|
|
1856
|
+
this.flushRequests();
|
|
1857
|
+
}), this.batchCollectionDelayMs);
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1861
1860
|
}
|
|
1862
1861
|
if (this.pendingRequests.size >= this.maxRequestsPerBatch) {
|
|
1863
1862
|
// console.log('max pending hit: flushing requests');
|
|
@@ -1875,6 +1874,9 @@ class ActivityPollingService {
|
|
|
1875
1874
|
clearTimeout(this.currentTimeoutHandle);
|
|
1876
1875
|
this.currentTimeoutHandle = undefined;
|
|
1877
1876
|
}
|
|
1877
|
+
if (!this.pendingRequests.size) {
|
|
1878
|
+
return;
|
|
1879
|
+
}
|
|
1878
1880
|
const requests = new Map(this.pendingRequests);
|
|
1879
1881
|
this.pendingRequests.clear();
|
|
1880
1882
|
this.performBatchRequest(requests);
|
|
@@ -1883,7 +1885,7 @@ class ActivityPollingService {
|
|
|
1883
1885
|
if (!this.isEnabled) {
|
|
1884
1886
|
return EMPTY;
|
|
1885
1887
|
}
|
|
1886
|
-
return polling(this.activityService.getActivities(...caseIds), this.pollConfig);
|
|
1888
|
+
return this.polling(this.activityService.getActivities(...caseIds), this.pollConfig);
|
|
1887
1889
|
}
|
|
1888
1890
|
postViewActivity(caseId) {
|
|
1889
1891
|
return this.postActivity(caseId, ActivityService.ACTIVITY_VIEW);
|
|
@@ -1896,17 +1898,19 @@ class ActivityPollingService {
|
|
|
1896
1898
|
// console.log('issuing batch request for cases: ' + caseIds);
|
|
1897
1899
|
this.ngZone.runOutsideAngular(() => {
|
|
1898
1900
|
// run polling outside angular zone so it does not trigger change detection
|
|
1899
|
-
this.pollActivitiesSubscription = this.pollActivities(caseIds).subscribe(
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1901
|
+
this.pollActivitiesSubscription = this.pollActivities(caseIds).subscribe({
|
|
1902
|
+
// process activity inside zone so it triggers change detection for activity.component.ts
|
|
1903
|
+
next: (activities) => this.ngZone.run(() => {
|
|
1904
|
+
activities.forEach((activity) => {
|
|
1905
|
+
// Ignore activities returned for cases outside this local batch.
|
|
1906
|
+
requests.get(activity.caseId)?.next(activity);
|
|
1907
|
+
});
|
|
1908
|
+
}),
|
|
1909
|
+
error: (err) => this.ngZone.run(() => {
|
|
1910
|
+
console.log(`error: ${err}`);
|
|
1911
|
+
Array.from(requests.values()).forEach((subject) => subject.error(err));
|
|
1912
|
+
})
|
|
1913
|
+
});
|
|
1910
1914
|
});
|
|
1911
1915
|
}
|
|
1912
1916
|
postActivity(caseId, activityType) {
|
|
@@ -1917,7 +1921,42 @@ class ActivityPollingService {
|
|
|
1917
1921
|
...this.pollConfig,
|
|
1918
1922
|
interval: 5000 // inline with CCD Backend
|
|
1919
1923
|
};
|
|
1920
|
-
return polling(this.activityService.postActivity(caseId, activityType), pollingConfig);
|
|
1924
|
+
return this.polling(this.activityService.postActivity(caseId, activityType), pollingConfig);
|
|
1925
|
+
}
|
|
1926
|
+
addPendingRequest(caseId, subject) {
|
|
1927
|
+
this.pendingRequests.set(caseId, subject);
|
|
1928
|
+
// Components complete their returned Subject on destroy; remove it so a later same-case subscription gets a fresh Subject.
|
|
1929
|
+
subject.subscribe({
|
|
1930
|
+
complete: () => this.removePendingRequest(caseId, subject),
|
|
1931
|
+
error: () => this.removePendingRequest(caseId, subject)
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
removePendingRequest(caseId, subject) {
|
|
1935
|
+
if (this.pendingRequests.get(caseId) !== subject) {
|
|
1936
|
+
return;
|
|
1937
|
+
}
|
|
1938
|
+
this.pendingRequests.delete(caseId);
|
|
1939
|
+
if (!this.pendingRequests.size && this.currentTimeoutHandle) {
|
|
1940
|
+
clearTimeout(this.currentTimeoutHandle);
|
|
1941
|
+
this.currentTimeoutHandle = undefined;
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
polling(request$, options) {
|
|
1945
|
+
const pollingOptions = {
|
|
1946
|
+
interval: options.interval,
|
|
1947
|
+
attempts: options.attempts ?? 9,
|
|
1948
|
+
exponentialUnit: options.exponentialUnit ?? 1000
|
|
1949
|
+
};
|
|
1950
|
+
return concat(request$, defer(() => timer(pollingOptions.interval).pipe(switchMap(() => request$))).pipe(repeat())).pipe(
|
|
1951
|
+
// Preserve consecutive-failure retry behaviour using the current RxJS retry config.
|
|
1952
|
+
retry({
|
|
1953
|
+
count: pollingOptions.attempts,
|
|
1954
|
+
delay: (_error, retryCount) => timer(this.getExponentialRetryDelay(retryCount, pollingOptions.exponentialUnit)),
|
|
1955
|
+
resetOnSuccess: true
|
|
1956
|
+
}));
|
|
1957
|
+
}
|
|
1958
|
+
getExponentialRetryDelay(consecutiveErrorsCount, exponentialUnit) {
|
|
1959
|
+
return Math.pow(2, consecutiveErrorsCount - 1) * exponentialUnit;
|
|
1921
1960
|
}
|
|
1922
1961
|
static ɵfac = function ActivityPollingService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityPollingService)(i0.ɵɵinject(ActivityService), i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(AbstractAppConfig)); };
|
|
1923
1962
|
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityPollingService, factory: ActivityPollingService.ɵfac });
|
|
@@ -11398,6 +11437,7 @@ class CaseEditPageComponent {
|
|
|
11398
11437
|
}
|
|
11399
11438
|
ngOnInit() {
|
|
11400
11439
|
initDialog();
|
|
11440
|
+
this.clearValidationErrors();
|
|
11401
11441
|
this.eventTrigger = this.caseEdit.eventTrigger;
|
|
11402
11442
|
this.editForm = this.caseEdit.form;
|
|
11403
11443
|
this.wizard = this.caseEdit.wizard;
|
|
@@ -11453,6 +11493,7 @@ class CaseEditPageComponent {
|
|
|
11453
11493
|
this.dialogRefAfterClosedSub?.unsubscribe();
|
|
11454
11494
|
this.saveDraftSub?.unsubscribe();
|
|
11455
11495
|
this.caseFormValidationErrorsSub?.unsubscribe();
|
|
11496
|
+
this.clearValidationErrors();
|
|
11456
11497
|
this.multipageComponentStateService.reset();
|
|
11457
11498
|
}
|
|
11458
11499
|
applyValuesChanged(valuesChanged) {
|
|
@@ -11476,7 +11517,7 @@ class CaseEditPageComponent {
|
|
|
11476
11517
|
* EUI-3732 - Breathing space data not persisted on Previous button click with ExpUI Demo
|
|
11477
11518
|
*/
|
|
11478
11519
|
toPreviousPage() {
|
|
11479
|
-
this.
|
|
11520
|
+
this.clearValidationErrors();
|
|
11480
11521
|
const caseEventData = this.buildCaseEventData(true);
|
|
11481
11522
|
caseEventData.data = caseEventData.event_data;
|
|
11482
11523
|
this.updateFormData(caseEventData);
|
|
@@ -11649,7 +11690,7 @@ class CaseEditPageComponent {
|
|
|
11649
11690
|
this.editForm.controls['data'].removeControl('caseLinksFlag');
|
|
11650
11691
|
}
|
|
11651
11692
|
}
|
|
11652
|
-
this.
|
|
11693
|
+
this.clearValidationErrors();
|
|
11653
11694
|
this.checkForStagesCompleted();
|
|
11654
11695
|
if (this.currentPageIsNotValid()) {
|
|
11655
11696
|
// The generateErrorMessage method filters out the hidden fields.
|
|
@@ -11813,7 +11854,7 @@ class CaseEditPageComponent {
|
|
|
11813
11854
|
else {
|
|
11814
11855
|
this.caseEdit.cancelled.emit();
|
|
11815
11856
|
}
|
|
11816
|
-
this.
|
|
11857
|
+
this.clearValidationErrors();
|
|
11817
11858
|
this.multipageComponentStateService.reset();
|
|
11818
11859
|
}
|
|
11819
11860
|
resetLinkedCaseJourney() {
|
|
@@ -11881,6 +11922,7 @@ class CaseEditPageComponent {
|
|
|
11881
11922
|
console.log('handleError ', error);
|
|
11882
11923
|
}
|
|
11883
11924
|
resetErrors() {
|
|
11925
|
+
this.clearValidationErrors();
|
|
11884
11926
|
this.caseEdit.error = null;
|
|
11885
11927
|
this.caseEdit.ignoreWarning = false;
|
|
11886
11928
|
this.triggerText = this.getTriggerText();
|
|
@@ -11888,6 +11930,10 @@ class CaseEditPageComponent {
|
|
|
11888
11930
|
this.caseEdit.callbackErrorsSubject.next(null);
|
|
11889
11931
|
}
|
|
11890
11932
|
}
|
|
11933
|
+
clearValidationErrors() {
|
|
11934
|
+
this.validationErrors = [];
|
|
11935
|
+
this.caseEditDataService?.clearFormValidationErrors?.();
|
|
11936
|
+
}
|
|
11891
11937
|
saveDraft() {
|
|
11892
11938
|
if (this.eventTrigger.can_save_draft) {
|
|
11893
11939
|
const draftCaseEventData = this.formValueService.sanitise(this.editForm.value);
|
|
@@ -34461,7 +34507,6 @@ class WorkbasketFiltersComponent {
|
|
|
34461
34507
|
}
|
|
34462
34508
|
}
|
|
34463
34509
|
onJurisdictionIdChange() {
|
|
34464
|
-
this.clearStoredWorkbasketFilterValues();
|
|
34465
34510
|
if (this.selected.jurisdiction) {
|
|
34466
34511
|
this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
|
|
34467
34512
|
this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes.length > 0
|
|
@@ -34476,7 +34521,7 @@ class WorkbasketFiltersComponent {
|
|
|
34476
34521
|
this.selected.caseState = null;
|
|
34477
34522
|
this.clearWorkbasketInputs();
|
|
34478
34523
|
if (!this.isApplyButtonDisabled()) {
|
|
34479
|
-
this.onCaseTypeIdChange(
|
|
34524
|
+
this.onCaseTypeIdChange();
|
|
34480
34525
|
}
|
|
34481
34526
|
}
|
|
34482
34527
|
else {
|
|
@@ -34484,10 +34529,7 @@ class WorkbasketFiltersComponent {
|
|
|
34484
34529
|
this.resetCaseState();
|
|
34485
34530
|
}
|
|
34486
34531
|
}
|
|
34487
|
-
onCaseTypeIdChange(
|
|
34488
|
-
if (clearStoredValues) {
|
|
34489
|
-
this.clearStoredWorkbasketFilterValues();
|
|
34490
|
-
}
|
|
34532
|
+
onCaseTypeIdChange() {
|
|
34491
34533
|
if (this.selected.caseType) {
|
|
34492
34534
|
this.selectedCaseTypeStates = this.sortStates(this.selected.caseType.states);
|
|
34493
34535
|
this.selected.caseState = null;
|
|
@@ -34583,7 +34625,7 @@ class WorkbasketFiltersComponent {
|
|
|
34583
34625
|
this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes;
|
|
34584
34626
|
this.selected.caseType = this.selectCaseType(this.selected, this.selectedJurisdictionCaseTypes, routeSnapshot);
|
|
34585
34627
|
if (this.selected.caseType) {
|
|
34586
|
-
this.onCaseTypeIdChange(
|
|
34628
|
+
this.onCaseTypeIdChange();
|
|
34587
34629
|
this.selected.caseState = this.selectCaseState(this.selected.caseType, routeSnapshot);
|
|
34588
34630
|
}
|
|
34589
34631
|
this.workbasketDefaults = true;
|
|
@@ -34630,9 +34672,6 @@ class WorkbasketFiltersComponent {
|
|
|
34630
34672
|
this.workbasketInputsReady = false;
|
|
34631
34673
|
this.workbasketInputs = [];
|
|
34632
34674
|
}
|
|
34633
|
-
clearStoredWorkbasketFilterValues() {
|
|
34634
|
-
this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
|
|
34635
|
-
}
|
|
34636
34675
|
resetCaseState() {
|
|
34637
34676
|
this.defaults.state_id = null;
|
|
34638
34677
|
this.selected.caseState = null;
|