Skip to content

Commit d8f7240

Browse files
commit after pulling from release and resolving conflicts
2 parents ad9c575 + f6d811e commit d8f7240

File tree

8 files changed

+39
-34
lines changed

8 files changed

+39
-34
lines changed

RELEASE-NOTES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
## RELEASE NOTES
22

3-
### Version 7.2.58-exui-3053
3+
### Version 7.2.59-exui-3053
44
**EXUI-3053** Media Viewer - Improve keyboard movement within media viewer screen
55

6+
### Version 7.2.59
7+
**EXUI-3661** Performance issues on screens to return data
8+
**EXUI-3681** Users unable to upload documents
9+
610
### Version 7.2.58
711
**EXUI-2821** Media Viewer - Search/Present button issues
812

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hmcts/ccd-case-ui-toolkit",
3-
"version": "7.2.58-exui-3053",
3+
"version": "7.2.59-exui-3053",
44
"engines": {
55
"node": ">=18.19.0"
66
},

projects/ccd-case-ui-toolkit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hmcts/ccd-case-ui-toolkit",
3-
"version": "7.2.58-exui-3053",
3+
"version": "7.2.59-exui-3053",
44
"engines": {
55
"node": ">=18.19.0"
66
},

projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/document/write-document-field.component.spec.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -773,49 +773,53 @@ describe('WriteDocumentFieldComponent with Mandatory casefield', () => {
773773
});
774774

775775
it('should be logged as enabled if file is securemode', () => {
776-
component.caseField = CASE_FIELD_MANDATORY;
776+
const blobParts: BlobPart[] = ['some contents for blob'];
777+
const file: File = new File(blobParts, 'test.pdf');
777778
mockDocumentManagementService.isDocumentSecureModeEnabled.and.returnValue(true);
778779
caseNotifier.caseView = of({ case_id: '12345', case_type: { id: 'test', jurisdiction: { id: 'test-jurisdiction' } } });
779780
component.ngOnInit();
780781
expect(component.caseField.value).toBeTruthy();
781-
782782
component.fileChangeEvent({
783783
target: {
784-
files: []
784+
files: [
785+
file
786+
]
785787
}
786788
});
789+
expect(mockFileUploadStateService.setUploadInProgress).toHaveBeenCalledWith(true);
790+
expect(mockDocumentManagementService.uploadFile).toHaveBeenCalledWith(any(FormData));
787791
expect(appConfig.logMessage).toHaveBeenCalledWith('CDAM is enabled for case with case ref:: 12345');
788792
});
789793

790794
it('should be logged as disabled if file is NOT securemode', () => {
791-
component.caseField = CASE_FIELD_MANDATORY;
795+
const blobParts: BlobPart[] = ['some contents for blob'];
796+
const file: File = new File(blobParts, 'test.pdf');
792797
mockDocumentManagementService.isDocumentSecureModeEnabled.and.returnValue(false);
793798
caseNotifier.caseView = of({ case_id: '12345', case_type: { id: 'test', jurisdiction: { id: 'test-jurisdiction' } } });
794799
component.ngOnInit();
795-
expect(component.caseField.value).toBeTruthy();
796-
797800
component.fileChangeEvent({
798801
target: {
799-
files: []
802+
files: [
803+
file
804+
]
800805
}
801806
});
802807
expect(appConfig.logMessage).toHaveBeenCalledWith('CDAM is disabled for case with case ref:: 12345');
803808
});
804809

805-
it('should be valid if no document specified for upload for not read only. Empty file.', () => {
806-
// Initialization.
807-
component.valid = true;
808-
component.caseField = CASE_FIELD;
810+
it('should set caseId from caseNotifier', () => {
811+
component.caseField = CASE_FIELD_MANDATORY;
812+
mockDocumentManagementService.isDocumentSecureModeEnabled.and.returnValue(false);
813+
caseNotifier.caseView = of({ case_id: '12345', case_type: { id: 'test', jurisdiction: { id: 'test-jurisdiction' } } });
809814
component.ngOnInit();
810815
expect(component.caseField.value).toBeTruthy();
811-
expect(component.valid).toBeTruthy();
812816

813817
component.fileChangeEvent({
814818
target: {
815819
files: []
816820
}
817821
});
818-
expect(component.valid).toBeTruthy();
822+
expect(component.caseId).toBe('12345');
819823
});
820824

821825
it('should cancel file upload', () => {

projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/document/write-document-field.component.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class WriteDocumentFieldComponent extends AbstractFieldWriteComponent imp
5353
public jurisdictionId: string;
5454
public caseTypeId: string;
5555
public caseTypeExclusions: string;
56+
public caseId: string;
5657
// Should the file upload use CDAM
5758
public fileSecureModeOn: boolean = false;
5859

@@ -76,6 +77,7 @@ export class WriteDocumentFieldComponent extends AbstractFieldWriteComponent imp
7677
if (caseDetails) {
7778
this.caseTypeId = caseDetails?.case_type?.id;
7879
this.jurisdictionId = caseDetails?.case_type?.jurisdiction?.id;
80+
this.caseId = caseDetails?.case_id;
7981
}
8082
if (jurisdiction) {
8183
this.jurisdictionId = jurisdiction.id;
@@ -94,10 +96,7 @@ export class WriteDocumentFieldComponent extends AbstractFieldWriteComponent imp
9496
}
9597
// use the documentManagement service to check if the document upload should use CDAM
9698
if (this.documentManagement.isDocumentSecureModeEnabled()) {
97-
this.appConfig.logMessage(`CDAM is enabled for case with case ref:: ${caseDetails?.case_id}`);
9899
this.fileSecureModeOn = true;
99-
} else {
100-
this.appConfig.logMessage(`CDAM is disabled for case with case ref:: ${caseDetails?.case_id}`);
101100
}
102101
this.dialogConfig = initDialog();
103102
let document = this.caseField.value || { document_url: null, document_binary_url: null, document_filename: null };
@@ -364,6 +363,12 @@ export class WriteDocumentFieldComponent extends AbstractFieldWriteComponent imp
364363
}
365364

366365
private handleDocumentUploadResult(result: DocumentData): void {
366+
// use the documentManagement service to check if the document upload should use CDAM
367+
if (this.documentManagement.isDocumentSecureModeEnabled()) {
368+
this.appConfig.logMessage(`CDAM is enabled for case with case ref:: ${this.caseId}`);
369+
} else {
370+
this.appConfig.logMessage(`CDAM is disabled for case with case ref:: ${this.caseId}`);
371+
}
367372
if (!this.uploadedDocument) {
368373
if (this.fileSecureModeOn) {
369374
this.createDocumentForm({ document_url: null, document_binary_url: null, document_filename: null, document_hash: null });

projects/ccd-case-ui-toolkit/src/lib/shared/directives/substitutor/label-substitutor.directive.spec.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -846,24 +846,18 @@ describe('LabelSubstitutorDirective', () => {
846846
expect(comp.caseField.isTranslated).toBe(false);
847847
});
848848

849-
it('should handle language change timeout correctly', fakeAsync(() => {
849+
it('should handle language change correctly', fakeAsync(() => {
850850
const label = 'Label with ${placeholder}';
851851
comp.caseField = textField('LabelB', '', label);
852852
comp.caseFields = [comp.caseField, textField('LabelA', 'ValueA', '')];
853853

854-
placeholderService.resolvePlaceholders.and.returnValues('Label with ValueA', '', '');
854+
placeholderService.resolvePlaceholders.and.returnValues('Label with ValueA', 'Label with ValueA', '', '');
855855
fixture.detectChanges();
856856

857857
placeholderService.resolvePlaceholders.calls.reset();
858858

859859
translationService.setLanguage('cy');
860860

861-
expect(placeholderService.resolvePlaceholders).not.toHaveBeenCalled();
862-
863-
tick(50);
864-
expect(placeholderService.resolvePlaceholders).not.toHaveBeenCalled();
865-
866-
tick(50);
867861
fixture.detectChanges();
868862
expect(placeholderService.resolvePlaceholders).toHaveBeenCalled();
869863
}));

projects/ccd-case-ui-toolkit/src/lib/shared/directives/substitutor/label-substitutor.directive.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CaseField } from '../../domain/definition/case-field.model';
55
import { FieldsUtils } from '../../services/fields/fields.utils';
66
import { PlaceholderService } from './services/placeholder.service';
77
import { RpxTranslatePipe, RpxTranslationService } from 'rpx-xui-translation';
8-
import { Subscription } from 'rxjs';
8+
import { skip, Subscription } from 'rxjs';
99

1010
@Directive({ selector: '[ccdLabelSubstitutor]' })
1111
/**
@@ -33,11 +33,10 @@ export class LabelSubstitutorDirective implements OnInit, OnDestroy {
3333
this.caseField.originalLabel = this.caseField.label;
3434
this.formGroup = this.formGroup || new FormGroup({});
3535

36-
this.languageSubscription = this.rpxTranslationService.language$.subscribe(() => {
37-
// timeout is required to prevent race conditions with translation pipe
38-
setTimeout(() => {
39-
this.onLanguageChange();
40-
}, 100);
36+
this.languageSubscription = this.rpxTranslationService.language$.pipe(
37+
skip(1)
38+
).subscribe(() => {
39+
this.onLanguageChange();
4140
});
4241

4342
this.applySubstitutions()

projects/ccd-case-ui-toolkit/src/lib/shared/services/document-management/document-management.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ export class DocumentManagementService {
146146
public isDocumentSecureModeEnabled(): boolean {
147147
const documentSecureModeCaseTypeExclusions = this.appConfig.getCdamExclusionList()?.split(',');
148148
const isDocumentOnExclusionList = documentSecureModeCaseTypeExclusions?.includes(this.caseTypeId);
149-
this.appConfig.logMessage(`isDocumentOnExclusionList: ${isDocumentOnExclusionList}`);
150149
if (!isDocumentOnExclusionList){
151150
return true;
152151
}

0 commit comments

Comments
 (0)