Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
@@ -1,5 +1,8 @@
## RELEASE NOTES

### Version 7.3.54-exui-4648-rc-1
**EXUI-4648** Redact Sensitive Information Logged In through Console

### Version 7.3.54
**EXUI-4636** Revert CME-220 and EXUI-2111
**EXUI-4637** Revert EXUI-2645
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.3.54",
"version": "7.3.54-exui-4648-rc-1",
"engines": {
"node": ">=20.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.3.54",
"version": "7.3.54-exui-4648-rc-1",
"engines": {
"node": ">=20.19.0"
},
Expand Down
5 changes: 4 additions & 1 deletion projects/ccd-case-ui-toolkit/src/lib/app-config.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import {
AccessManagementBasicViewMockModel,
AccessManagementRequestReviewMockModel
} from './app.config';
import { StructuredLoggerService } from './shared/services/logging';

export class AppMockConfig implements AbstractAppConfig {
private readonly logger = new StructuredLoggerService();

public getActivityBatchCollectionDelayMs(): number {
return 0;
}
Expand Down Expand Up @@ -220,7 +223,7 @@ export class AppMockConfig implements AbstractAppConfig {
}

public logMessage(msg: string): void {
console.log(msg);
this.logger.info('Application log message.', { message: msg });
}

public getEnableServiceSpecificMultiFollowups(): string[] {
Expand Down
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, MultipageComponentStateService } from '../../../services';
import { AddressesService, LoadingService, MultipageComponentStateService, StructuredLoggerService } 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 Down Expand Up @@ -65,6 +65,7 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
public dialogRefAfterClosedSub: Subscription;
public saveDraftSub: Subscription;
public caseFormValidationErrorsSub: Subscription;
private readonly logger = new StructuredLoggerService();

private static scrollToTop(): void {
window.scrollTo(0, 0);
Expand Down Expand Up @@ -409,7 +410,6 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro

if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
this.addressService.setMandatoryError(false);
console.log('Case Edit Error', this.caseEdit.error);
if (this.caseEdit.validPageList.findIndex(page=> page.id === this.currentPage.id) === -1) {
this.caseEdit.validPageList.push(this.currentPage);
}
Expand Down Expand Up @@ -648,7 +648,7 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked, OnDestro
this.formErrorService
.mapFieldErrors(this.caseEdit.error.details.field_errors, this.editForm?.controls?.['data'] as FormGroup, 'validation');
}
console.log('handleError ', error);
this.logger.error('Case edit page handled an error.', { error });
}

private resetErrors(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
RoleRequestPayload, SpecificAccessRequest
} from '../../../domain';
import { UserInfo } from '../../../domain/user/user-info.model';
import { FieldsUtils, HttpErrorService, HttpService, LoadingService, OrderService, RetryUtil, SessionStorageService } from '../../../services';
import { FieldsUtils, HttpErrorService, HttpService, LoadingService, OrderService, RetryUtil, SessionStorageService, StructuredLoggerService } from '../../../services';
import { LinkedCasesResponse } from '../../palette/linked-cases/domain/linked-cases.model';
import { CaseAccessUtils } from '../case-access-utils';
import { WizardPage } from '../domain';
Expand All @@ -26,6 +26,8 @@ import { CaseEditComponent } from '../case-edit';

@Injectable()
export class CasesService {
private readonly logger = new StructuredLoggerService();

// Internal (UI) API
public static readonly V2_MEDIATYPE_CASE_VIEW = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-case-view.v2+json';
public static readonly V2_MEDIATYPE_START_CASE_TRIGGER =
Expand Down Expand Up @@ -107,11 +109,10 @@ export class CasesService {

const artificialDelay: number = this.appConfig.getTimeoutsCaseRetrievalArtificialDelay();
const timeoutPeriods = this.appConfig.getTimeoutsForCaseRetrieval();
console.log(`Timeout periods: ${timeoutPeriods} seconds.`);
if (timeoutPeriods && timeoutPeriods.length > 0 && timeoutPeriods[0] > 0) {
http$ = this.retryUtil.pipeTimeoutMechanismOn(http$, artificialDelay, timeoutPeriods);
} else {
console.warn('Skipping to pipe a retry mechanism!');
this.logger.warn('Skipping retry mechanism for case view retrieval.');
}

http$ = this.pipeErrorProcessor(http$);
Expand All @@ -123,8 +124,11 @@ export class CasesService {

private pipeErrorProcessor(in$: Observable<CaseView>): Observable<CaseView> {
const out$ = in$.pipe(catchError(error => {
console.error(`Error while getting case view with getCaseViewV2! Error type: '${typeof error}, Error name: '${error?.name}'`);
console.error(error);
this.logger.error('Error while getting case view with getCaseViewV2.', {
error,
errorName: error?.name,
errorType: typeof error
});
this.errorService.setError(error);
return throwError(error);
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ export class EventCompletionStateMachineService {

public entryActionForStateFinal(state: State, context: EventCompletionStateMachineContext): void {
// Final actions can be performed here, the state machine finished running
console.log('FINAL');
}

public addTransitionsForStateCheckTasksCanBeCompleted(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export class WorkAllocationService {
// explicitly eat away 401 error and 400 error
if (error && error.status && (error.status === 401 || error.status === 400)) {
// do nothing
console.log('error status 401 or 400', error);
} else {
return throwError(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { CaseTab } from '../../domain/case-view/case-tab.model';
import { CaseView } from '../../domain/case-view/case-view.model';
import { HttpError } from '../../domain/http/http-error.model';
import { AlertService } from '../../services/alert/alert.service';
import { StructuredLoggerService } from '../../services/logging';
import { OrderService } from '../../services/order/order.service';
import { CaseNotifier } from '../case-editor/services/case.notifier';
import { CaseHistory } from './domain/case-history.model';
Expand All @@ -19,6 +20,8 @@ import { CaseHistoryService } from './services/case-history.service';
standalone: false
})
export class CaseHistoryComponent implements OnInit, OnDestroy {
private readonly logger = new StructuredLoggerService();

public static readonly PARAM_EVENT_ID = 'eid';

private static readonly ERROR_MESSAGE = 'No case history to show';
Expand Down Expand Up @@ -59,7 +62,7 @@ export class CaseHistoryComponent implements OnInit, OnDestroy {
this.tabs = this.sortTabFieldsAndFilterTabs(this.tabs);
}),
catchError(error => {
console.error(error);
this.logger.error('Error while getting case history.', { error });
if (error.status !== 401 && error.status !== 403) {
this.alertService.error(error.message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export class CaseEventTriggerComponent implements OnInit, OnDestroy {
if (this.activityPollingService.isEnabled) {
this.ngZone.runOutsideAngular( () => {
this.activitySubscription = this.postEditActivity().subscribe(() => {
// console.log('Posted EDIT activity and result is: ' + JSON.stringify(_resolved));
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { CasesService } from '../../case-editor/services/cases.service';
standalone: false
})
export class CaseViewComponent implements OnInit, OnDestroy {

@Input()
public case: string;
@Input()
Expand Down Expand Up @@ -79,8 +78,6 @@ export class CaseViewComponent implements OnInit, OnDestroy {

private checkErrorGettingCaseView(error: any) {
// TODO Should be logged to remote logging infrastructure
console.error('Called checkErrorGettingCaseView.');
console.error(error);
if (error.status !== 401 && error.status !== 403) {
this.alertService.error(error.message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export class CaseViewerComponent implements OnInit, OnDestroy {
this.setUserAccessType(this.caseDetails);
} else {
this.caseSubscription = this.caseNotifier.caseView.subscribe((caseDetails) => {
console.info('Setting the case into case viewer component as retrieved from XHR request.');
this.caseDetails = caseDetails;
this.setUserAccessType(this.caseDetails);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class CaseResolver implements Resolve<CaseView> {

public static defaultWAPage = '/work/my-work/list';
public static defaultPage = '/cases';

// we need to run the CaseResolver on every child route of 'case/:jid/:ctid/:cid'
// this is achieved with runGuardsAndResolvers: 'always' configuration
// we cache the case view to avoid retrieving it for each child route
Expand All @@ -42,12 +43,10 @@ export class CaseResolver implements Resolve<CaseView> {

// Prevent resolving if eventId=queryManagementRespondQuery is in the URL
if (currentUrl.includes(CaseResolver.EVENT_ID_QM_RESPOND_TO_QUERY)) {
console.info('Skipping resolve for event queryManagementRespondQuery.');
this.goToDefaultPage();
}

if (!cid) {
console.info('No case ID available in the route. Will navigate to case list.');
// when redirected to case view after a case created, and the user has no READ access,
// the post returns no id
this.navigateToCaseList();
Expand Down Expand Up @@ -112,8 +111,6 @@ export class CaseResolver implements Resolve<CaseView> {
}

private processErrorInCaseFetch(error: any, caseReference: string) {
console.error('!!! processErrorInCaseFetch !!!');
console.error(error);
// TODO Should be logged to remote logging infrastructure
if (error.status === 400) {
this.router.navigate(['/search/noresults']);
Expand Down Expand Up @@ -142,7 +139,6 @@ export class CaseResolver implements Resolve<CaseView> {

// as discussed for EUI-5456, need functionality to go to default page
private goToDefaultPage(): void {
console.info('Going to default page!');
const userDetails = safeJsonParse<any>(this.sessionStorage.getItem(USER_DETAILS));
userDetails && userDetails.roles
&& !userDetails.roles.includes(PUI_CASE_MANAGER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ export class EventStartStateMachineService {
task = context.tasks[0];
}

const taskStr = JSON.stringify(task);
this.abstractConfig?.logMessage?.(`entryActionForStateOneTaskAssignedToUser: task_state ${task?.task_state} for task id ${task?.id}`);
console.log('entryActionForStateOneTaskAssignedToUser: setting client context task_data to ' + taskStr);
// Store task to session
const currentLanguage = context.cookieService.getCookie('exui-preferred-language');
const clientContext = {
Expand Down Expand Up @@ -232,7 +230,6 @@ export class EventStartStateMachineService {

public finalAction(state: State): void {
// Final actions can be performed here, the state machine finished running
// console.log('FINAL', state);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,19 @@ describe('WriteAddressFieldComponent', () => {
const errorMessage = 'Service error';
const errorSubject = new Subject();
addressesService.getAddressesForPostcode.and.returnValue(errorSubject.asObservable());
spyOn(console, 'log');
const logSpy = spyOn(console, 'log');
const errorSpy = spyOn(console, 'error');
writeAddressFieldComponent.postcode.setValue(POSTCODE);
writeAddressFieldComponent.findAddress();
expect(writeAddressFieldComponent.loadingAddresses).toBeTruthy();
errorSubject.error(errorMessage);
expect(writeAddressFieldComponent.loadingAddresses).toBeFalsy();
expect(console.log).toHaveBeenCalledWith(`An error occurred retrieving addresses for postcode ${POSTCODE}. ${errorMessage}`);
expect(logSpy).not.toHaveBeenCalled();
expect(errorSpy.calls.mostRecent().args[0]).toEqual(jasmine.objectContaining({
level: 'error',
message: 'An error occurred retrieving addresses for postcode.'
}));
expect(JSON.stringify(errorSpy.calls.mostRecent().args[0])).not.toContain(POSTCODE);
});

it('should not set loadingAddresses to true when postcode is missing', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AddressValidationConstants } from '../../../commons/address-validation-
import { FocusElementDirective } from '../../../directives/focus-element';
import { AddressModel } from '../../../domain/addresses/address.model';
import { AddressesService } from '../../../services/addresses/addresses.service';
import { StructuredLoggerService } from '../../../services/logging';
import { AbstractFieldWriteComponent } from '../base-field/abstract-field-write.component';
import { WriteComplexFieldComponent } from '../complex/write-complex-field.component';
import { IsCompoundPipe } from '../utils/is-compound.pipe';
Expand All @@ -16,6 +17,8 @@ import { AddressOption } from './address-option.model';
standalone: false
})
export class WriteAddressFieldComponent extends AbstractFieldWriteComponent implements OnInit, OnChanges {
private readonly logger = new StructuredLoggerService();

@ViewChild('writeComplexFieldComponent', { static: false })
public writeComplexFieldComponent: WriteComplexFieldComponent;

Expand Down Expand Up @@ -81,7 +84,7 @@ export class WriteAddressFieldComponent extends AbstractFieldWriteComponent impl
);
}, (error) => {
this.loadingAddresses = false;
console.log(`An error occurred retrieving addresses for postcode ${postcode}. ${error}`);
this.logger.error('An error occurred retrieving addresses for postcode.', { error });
});
this.addressList.setValue(undefined);
this.refocusElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { CaseField } from '../../../domain/definition/case-field.model';
import { Profile } from '../../../domain/profile/profile.model';
import { FieldsUtils } from '../../../services/fields/fields.utils';
import { FormValidatorsService } from '../../../services/form/form-validators.service';
import { StructuredLoggerService } from '../../../services/logging';
import { ProfileNotifier } from '../../../services/profile/profile.notifier';
import { RemoveDialogComponent } from '../../dialogs/remove-dialog/remove-dialog.component';
import { AbstractFieldWriteComponent } from '../base-field/abstract-field-write.component';
Expand All @@ -31,6 +32,8 @@ type CollectionItem = {
standalone: false
})
export class WriteCollectionFieldComponent extends AbstractFieldWriteComponent implements OnInit, OnDestroy {
private readonly logger = new StructuredLoggerService();

@Input()
public caseFields: CaseField[] = [];

Expand Down Expand Up @@ -195,7 +198,7 @@ export class WriteCollectionFieldComponent extends AbstractFieldWriteComponent i
duration: 1000,
offset: -150,
})
.subscribe(() => { }, console.error);
.subscribe(() => { }, error => this.logger.error('Error while scrolling collection item into view.', { error }));
}

this.focusLastItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export class WriteDocumentFieldComponent extends AbstractFieldWriteComponent imp
this.jurisdictionId = parts[parts.indexOf('case-create') + 1];
this.caseTypeId = parts[parts.indexOf('case-create') + 2];
this.caseId = null;
console.log(this.jurisdictionId); console.log(this.caseTypeId);
}

// use the documentManagement service to check if the document upload should use CDAM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -873,12 +873,15 @@ describe('QueryCheckYourAnswersComponent', () => {
component.fieldId = 'anyField';
component.qmCaseQueriesCollectionData = { anyField: { partyName: '', roleOnCase: '', caseMessages: [] } };

spyOn(console, 'error');
const errorSpy = spyOn(console, 'error');
spyOn(window, 'scrollTo');

component.submit();

expect(console.error).toHaveBeenCalledWith('Error: No task to complete was found');
expect(errorSpy.calls.mostRecent().args[0]).toEqual(jasmine.objectContaining({
level: 'error',
message: 'No task to complete was found.'
}));

// errorMessages should be set with fallback content
expect(component.errorMessages?.length).toBeGreaterThan(0);
Expand Down
Loading
Loading