From 3816dbf3dd9668ce7f6a8ef7e39a24aee939f7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Thu, 26 Aug 2021 20:49:15 +0300 Subject: [PATCH] Curly & pretty --- .eslintrc.json | 1 + apps/red-ui/.eslintrc.json | 5 +- apps/red-ui/jest.config.js | 5 +- .../notifications/notifications.component.ts | 4 +- .../src/app/models/file/annotation.wrapper.ts | 4 +- .../combo-chart/combo-chart.component.ts | 8 +++- .../combo-series-vertical.component.ts | 4 +- .../add-edit-dictionary-dialog.component.ts | 4 +- ...edit-dossier-attribute-dialog.component.ts | 4 +- ...-edit-dossier-template-dialog.component.ts | 4 +- ...dd-edit-file-attribute-dialog.component.ts | 4 +- .../user-details/user-details.component.ts | 4 +- .../active-fields-listing.component.ts | 4 +- ...-attributes-csv-import-dialog.component.ts | 22 ++++----- .../dictionary-listing-screen.component.ts | 10 ++-- .../general-config-screen.component.ts | 8 +++- .../components/comments/comments.component.ts | 4 +- .../dossier-listing-actions.component.ts | 4 +- .../file-actions/file-actions.component.ts | 2 +- .../file-workload/file-workload.component.ts | 8 +++- .../edit-dossier-dialog.component.ts | 4 +- .../dossier-listing-screen.component.ts | 20 ++++++-- .../dossier-overview-screen.component.ts | 48 ++++++++++++++----- .../search-screen/search-screen.component.ts | 4 +- .../services/annotation-processing.service.ts | 16 +++++-- .../assign-user-dropdown.component.ts | 4 +- .../dictionary-manager.component.ts | 12 +++-- .../initials-avatar.component.ts | 16 +++++-- .../page-header/page-header.component.ts | 4 +- .../components/select/select.component.ts | 8 +++- .../simple-doughnut-chart.component.ts | 4 +- .../confirmation-dialog.component.ts | 4 +- .../src/app/modules/shared/pipes/date.pipe.ts | 36 ++++++++++---- .../services/dictionary-save.service.ts | 4 +- .../src/app/services/permissions.service.ts | 4 +- apps/red-ui/src/app/services/user.service.ts | 6 ++- .../red-ui/src/app/state/app-state.service.ts | 4 +- .../app/utils/custom-route-reuse.strategy.ts | 4 +- .../src/app/utils/sorters/status-sorter.ts | 4 +- libs/common-ui | 2 +- 40 files changed, 229 insertions(+), 92 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index de604b636..80be9ca5c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -177,6 +177,7 @@ "no-var": "error", "prefer-const": "error", "radix": "error", + "curly": "error", "max-len": [ "error", { diff --git a/apps/red-ui/.eslintrc.json b/apps/red-ui/.eslintrc.json index 4a28d3d82..bf5b058b8 100644 --- a/apps/red-ui/.eslintrc.json +++ b/apps/red-ui/.eslintrc.json @@ -4,10 +4,7 @@ "overrides": [ { "files": ["*.ts"], - "extends": [ - "plugin:@nrwl/nx/angular", - "plugin:@angular-eslint/template/process-inline-templates" - ], + "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], "parserOptions": { "project": ["apps/red-ui/tsconfig.*?.json"] }, diff --git a/apps/red-ui/jest.config.js b/apps/red-ui/jest.config.js index 01f238567..0bb344826 100644 --- a/apps/red-ui/jest.config.js +++ b/apps/red-ui/jest.config.js @@ -5,10 +5,7 @@ module.exports = { 'ts-jest': { stringifyContentPathRegex: '\\.(html|svg)$', astTransformers: { - before: [ - 'jest-preset-angular/build/InlineFilesTransformer', - 'jest-preset-angular/build/StripStylesTransformer' - ] + before: ['jest-preset-angular/build/InlineFilesTransformer', 'jest-preset-angular/build/StripStylesTransformer'] }, tsconfig: '/tsconfig.spec.json' } diff --git a/apps/red-ui/src/app/components/notifications/notifications.component.ts b/apps/red-ui/src/app/components/notifications/notifications.component.ts index 0b8d4b06e..212351a57 100644 --- a/apps/red-ui/src/app/components/notifications/notifications.component.ts +++ b/apps/red-ui/src/app/components/notifications/notifications.component.ts @@ -84,7 +84,9 @@ export class NotificationsComponent { const res = {}; for (const notification of notifications) { const date = this._datePipe.transform(notification.creationDate, 'sophisticatedDate'); - if (!res[date]) res[date] = []; + if (!res[date]) { + res[date] = []; + } res[date].push(notification); } for (const key of Object.keys(res)) { diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index 98cbf1342..5b113dd43 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -409,7 +409,9 @@ export class AnnotationWrapper { private static _getShortContent(annotationWrapper: AnnotationWrapper, entry: RedactionLogEntryWrapper) { if (annotationWrapper.legalBasis) { const lb = entry.legalBasisMapping?.find(lbm => lbm.reason.toLowerCase().includes(annotationWrapper.legalBasis.toLowerCase())); - if (lb) return lb.name; + if (lb) { + return lb.name; + } } return annotationWrapper.legalBasis; diff --git a/apps/red-ui/src/app/modules/admin/components/combo-chart/combo-chart.component.ts b/apps/red-ui/src/app/modules/admin/components/combo-chart/combo-chart.component.ts index babc8dfef..25973390b 100644 --- a/apps/red-ui/src/app/modules/admin/components/combo-chart/combo-chart.component.ts +++ b/apps/red-ui/src/app/modules/admin/components/combo-chart/combo-chart.component.ts @@ -198,8 +198,12 @@ export class ComboChartComponent extends BaseChartComponent { } } - if (date) return 'time'; - if (num) return 'linear'; + if (date) { + return 'time'; + } + if (num) { + return 'linear'; + } return 'ordinal'; } diff --git a/apps/red-ui/src/app/modules/admin/components/combo-chart/combo-series-vertical.component.ts b/apps/red-ui/src/app/modules/admin/components/combo-chart/combo-series-vertical.component.ts index 65ad98824..6cab46e13 100644 --- a/apps/red-ui/src/app/modules/admin/components/combo-chart/combo-series-vertical.component.ts +++ b/apps/red-ui/src/app/modules/admin/components/combo-chart/combo-series-vertical.component.ts @@ -178,7 +178,9 @@ export class ComboSeriesVerticalComponent implements OnChanges { } isActive(entry): boolean { - if (!this.activeEntries) return false; + if (!this.activeEntries) { + return false; + } const item = this.activeEntries.find(d => entry.name === d.name && entry.series === d.series); return item !== undefined; } diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts index 2184356a8..8ca6130a2 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts @@ -64,7 +64,9 @@ export class AddEditDictionaryDialogComponent { } get changed(): boolean { - if (!this.dictionary) return true; + if (!this.dictionary) { + return true; + } for (const key of Object.keys(this.dictionaryForm.getRawValue())) { if (key === 'caseSensitive') { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-attribute-dialog/add-edit-dossier-attribute-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-attribute-dialog/add-edit-dossier-attribute-dialog.component.ts index 5d4bce5e1..dcb61f207 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-attribute-dialog/add-edit-dossier-attribute-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-attribute-dialog/add-edit-dossier-attribute-dialog.component.ts @@ -49,7 +49,9 @@ export class AddEditDossierAttributeDialogComponent extends AutoUnsubscribe impl } get changed(): boolean { - if (!this.dossierAttribute) return true; + if (!this.dossierAttribute) { + return true; + } for (const key of Object.keys(this.dossierAttributeForm.getRawValue())) { if (this.dossierAttribute[key] !== this.dossierAttributeForm.get(key).value) { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-dossier-template-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-dossier-template-dialog.component.ts index 5d5fdc909..91ee66019 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-dossier-template-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-dossier-template-dialog.component.ts @@ -67,7 +67,9 @@ export class AddEditDossierTemplateDialogComponent implements OnInit { } get changed(): boolean { - if (!this.dossierTemplate) return true; + if (!this.dossierTemplate) { + return true; + } for (const key of Object.keys(this.dossierTemplateForm.getRawValue())) { if (key === 'validFrom') { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.ts index f6b36782f..d330096a7 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.ts @@ -39,7 +39,9 @@ export class AddEditFileAttributeDialogComponent { } get changed(): boolean { - if (!this.fileAttribute) return true; + if (!this.fileAttribute) { + return true; + } for (const key of Object.keys(this.fileAttributeForm.getRawValue())) { if (key === 'readonly') { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts index 44b45b190..cec6db3f5 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts @@ -30,7 +30,9 @@ export class UserDetailsComponent implements OnInit { ) {} get changed(): boolean { - if (!this.user) return true; + if (!this.user) { + return true; + } if (this.user.roles.length !== this.activeRoles.length) { return true; diff --git a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.ts index 1c1eaf30a..f2bfbeb36 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.ts @@ -75,7 +75,9 @@ export class ActiveFieldsListingComponent extends ListingComponent implem return; } - for (const f of this.allEntities) f.primaryAttribute = false; + for (const f of this.allEntities) { + f.primaryAttribute = false; + } field.primaryAttribute = true; } } diff --git a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/file-attributes-csv-import-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/file-attributes-csv-import-dialog.component.ts index 3f1762d14..62337bc6b 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/file-attributes-csv-import-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/file-attributes-csv-import-dialog.component.ts @@ -1,12 +1,12 @@ -import {Component, Inject, Injector} from '@angular/core'; -import {AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators} from '@angular/forms'; -import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; +import { Component, Inject, Injector } from '@angular/core'; +import { AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import * as Papa from 'papaparse'; -import {FileAttributeConfig, FileAttributesConfig, FileAttributesControllerService} from '@redaction/red-ui-http'; -import {Observable} from 'rxjs'; -import {map, startWith} from 'rxjs/operators'; -import {DefaultListingServices, Listable, ListingComponent, TableColumnConfig, Toaster} from '@iqser/common-ui'; -import {marker as _} from '@biesbjerg/ngx-translate-extract-marker'; +import { FileAttributeConfig, FileAttributesConfig, FileAttributesControllerService } from '@redaction/red-ui-http'; +import { Observable } from 'rxjs'; +import { map, startWith } from 'rxjs/operators'; +import { DefaultListingServices, Listable, ListingComponent, TableColumnConfig, Toaster } from '@iqser/common-ui'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; export interface Field extends Listable { id: string; @@ -75,7 +75,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent !d.virtual); - if (!loadEntries) + if (!loadEntries) { this.entitiesService.setEntities( entities.map(dict => { dict.entries = this.allEntities.find(d => d.type === dict.type)?.entries || []; return dict; }) ); - else this.entitiesService.setEntities(entities); + } else { + this.entitiesService.setEntities(entities); + } - if (!loadEntries) return; + if (!loadEntries) { + return; + } const dataObs = this.allEntities.map(dict => this._dictionaryControllerService.getDictionaryForType(this._appStateService.activeDossierTemplateId, dict.type).pipe( diff --git a/apps/red-ui/src/app/modules/admin/screens/general-config/general-config-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/general-config/general-config-screen.component.ts index a38b10fc3..fbb4c87ab 100644 --- a/apps/red-ui/src/app/modules/admin/screens/general-config/general-config-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/general-config/general-config-screen.component.ts @@ -67,7 +67,9 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribe implements OnI } get smtpConfigurationChanged(): boolean { - if (!this._initialSMTPConfiguration) return true; + if (!this._initialSMTPConfiguration) { + return true; + } for (const key of Object.keys(this.smtpForm.getRawValue())) { if (this._initialSMTPConfiguration[key] !== this.smtpForm.get(key).value) { @@ -79,7 +81,9 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribe implements OnI } get generalConfigurationChanged(): boolean { - if (!this._initialGeneralConfiguration) return true; + if (!this._initialGeneralConfiguration) { + return true; + } for (const key of Object.keys(this.configForm.getRawValue())) { if (this._initialGeneralConfiguration[key] !== this.configForm.get(key).value) { diff --git a/apps/red-ui/src/app/modules/dossier/components/comments/comments.component.ts b/apps/red-ui/src/app/modules/dossier/components/comments/comments.component.ts index 6b49b7fea..e5fbd8e13 100644 --- a/apps/red-ui/src/app/modules/dossier/components/comments/comments.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/comments/comments.component.ts @@ -21,7 +21,9 @@ export class CommentsComponent { ) {} addComment(value: string): void { - if (!value) return; + if (!value) { + return; + } this._manualAnnotationService .addComment(value, this.annotation.id) .toPromise() diff --git a/apps/red-ui/src/app/modules/dossier/components/dossier-listing-actions/dossier-listing-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/dossier-listing-actions/dossier-listing-actions.component.ts index 351e78f7b..4699138eb 100644 --- a/apps/red-ui/src/app/modules/dossier/components/dossier-listing-actions/dossier-listing-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/dossier-listing-actions/dossier-listing-actions.component.ts @@ -42,7 +42,9 @@ export class DossierListingActionsComponent { } get statusConfig(): readonly StatusBarConfig[] { - if (!this.dossier) return []; + if (!this.dossier) { + return []; + } const obj = this.dossier.files.reduce((acc, file) => { const status = file.status; diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts index 0181aa07d..2cc8d3868 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts @@ -5,7 +5,7 @@ import { AppStateService } from '@state/app-state.service'; import { FileActionService } from '../../services/file-action.service'; import { DossiersDialogService } from '../../services/dossiers-dialog.service'; import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component'; -import {AutoUnsubscribe, CircleButtonType, CircleButtonTypes, LoadingService, StatusBarConfig, Toaster} from '@iqser/common-ui'; +import { AutoUnsubscribe, CircleButtonType, CircleButtonTypes, LoadingService, StatusBarConfig, Toaster } from '@iqser/common-ui'; import { FileManagementControllerService, FileStatus } from '@redaction/red-ui-http'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { UserService } from '@services/user.service'; diff --git a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts index a996ce166..112a2cf00 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts @@ -148,14 +148,18 @@ export class FileWorkloadComponent { primary: NestedFilter[], secondary: NestedFilter[] = [] ): Map { - if (!primary) return; + if (!primary) { + return; + } this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary); this.displayedPages = [...this.displayedAnnotations.keys()]; return this.displayedAnnotations; } annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent): void { - if (($event.target as IqserEventTarget).localName === 'input') return; + if (($event.target as IqserEventTarget).localName === 'input') { + return; + } this.pagesPanelActive = false; this.logAnnotation(annotation); if (this.isSelected(annotation)) { diff --git a/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/edit-dossier-dialog.component.ts b/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/edit-dossier-dialog.component.ts index 1291080b7..8b37c64fe 100644 --- a/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/edit-dossier-dialog.component.ts +++ b/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/edit-dossier-dialog.component.ts @@ -112,7 +112,9 @@ export class EditDossierDialogComponent { } afterSave() { - if (this._data?.afterSave) this._data.afterSave(); + if (this._data?.afterSave) { + this._data.afterSave(); + } } async save() { diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts index fcd588b0d..f7f38ee90 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts @@ -177,11 +177,21 @@ export class DossierListingScreenComponent // Needs work entry.files.forEach(file => { allDistinctFileStatus.add(file.status); - if (file.analysisRequired) allDistinctNeedsWork.add('analysis'); - if (entry.hintsOnly) allDistinctNeedsWork.add('hint'); - if (entry.hasRedactions) allDistinctNeedsWork.add('redaction'); - if (entry.hasSuggestions) allDistinctNeedsWork.add('suggestion'); - if (entry.hasNone) allDistinctNeedsWork.add('none'); + if (file.analysisRequired) { + allDistinctNeedsWork.add('analysis'); + } + if (entry.hintsOnly) { + allDistinctNeedsWork.add('hint'); + } + if (entry.hasRedactions) { + allDistinctNeedsWork.add('redaction'); + } + if (entry.hasSuggestions) { + allDistinctNeedsWork.add('suggestion'); + } + if (entry.hasNone) { + allDistinctNeedsWork.add('none'); + } }); allDistinctDossierTemplates.add(entry.dossierTemplateId); diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts index 1497fb6dd..0dd563231 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts @@ -219,7 +219,9 @@ export class DossierOverviewScreenComponent extends ListingComponent(); const allDistinctPeople = new Set(); @@ -320,14 +328,30 @@ export class DossierOverviewScreenComponent extends ListingComponent { diff --git a/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.ts index 2e03f3eae..16b439354 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.ts @@ -140,7 +140,9 @@ export class SearchScreenComponent extends ListingComponent implements private _toListItem({ dossierId, fileId, unmatchedTerms, highlights }: MatchedDocument): ListItem { const fileWrapper = this._getFileWrapper(dossierId, fileId); - if (!fileWrapper) return undefined; + if (!fileWrapper) { + return undefined; + } return { id: fileId, diff --git a/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts b/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts index ee64fb5a7..e426b0bf7 100644 --- a/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts @@ -141,20 +141,28 @@ export class AnnotationProcessingService { } private _matchesOne = (filters: NestedFilter[], condition: (filter: NestedFilter) => boolean): boolean => { - if (filters.length === 0) return true; + if (filters.length === 0) { + return true; + } for (const filter of filters) { - if (condition(filter)) return true; + if (condition(filter)) { + return true; + } } return false; }; private _matchesAll = (filters: NestedFilter[], condition: (filter: NestedFilter) => boolean): boolean => { - if (filters.length === 0) return true; + if (filters.length === 0) { + return true; + } for (const filter of filters) { - if (!condition(filter)) return false; + if (!condition(filter)) { + return false; + } } return true; diff --git a/apps/red-ui/src/app/modules/shared/components/assign-user-dropdown/assign-user-dropdown.component.ts b/apps/red-ui/src/app/modules/shared/components/assign-user-dropdown/assign-user-dropdown.component.ts index 40cce4227..c804f9f2b 100644 --- a/apps/red-ui/src/app/modules/shared/components/assign-user-dropdown/assign-user-dropdown.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/assign-user-dropdown/assign-user-dropdown.component.ts @@ -22,7 +22,9 @@ export class AssignUserDropdownComponent { @Input() set value(value: UserWrapper | string) { - if (this.oldUser === undefined) this.oldUser = value; + if (this.oldUser === undefined) { + this.oldUser = value; + } this._currentUser = value; } diff --git a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts index 0d24c4b96..dceeade0d 100644 --- a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts @@ -75,7 +75,9 @@ export class DictionaryManagerComponent implements OnChanges, OnInit { .subscribe(entries => { this.diffEditorText = entries; this.showDiffEditor = true; - if (this.showDiffEditor) this._diffEditor?.getOriginalEditor().setValue(this.diffEditorText); + if (this.showDiffEditor) { + this._diffEditor?.getOriginalEditor().setValue(this.diffEditorText); + } }); } @@ -145,14 +147,18 @@ export class DictionaryManagerComponent implements OnChanges, OnInit { } nextSearchMatch(): void { - if (this.findMatches.length <= 0) return; + if (this.findMatches.length <= 0) { + return; + } this.currentMatch = this.currentMatch < this.findMatches.length ? this.currentMatch + 1 : 1; this._scrollToCurrentMatch(); } previousSearchMatch(): void { - if (this.findMatches.length <= 0) return; + if (this.findMatches.length <= 0) { + return; + } this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.findMatches.length; this._scrollToCurrentMatch(); diff --git a/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.ts b/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.ts index 2cc569821..cd85fa28f 100644 --- a/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.ts @@ -42,9 +42,15 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnChange } private get _colorClass() { - if (this._isCurrentUser) return 'red-white'; - if (this.disabled) return 'inactive'; - if (this.color.includes('-')) return this.color; + if (this._isCurrentUser) { + return 'red-white'; + } + if (this.disabled) { + return 'inactive'; + } + if (this.color.includes('-')) { + return this.color; + } return `${this.color}-dark`; } @@ -79,7 +85,9 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnChange } private _getInitials(): string { - if (!this.displayName) return '?'; + if (!this.displayName) { + return '?'; + } return this.displayName .split(' ') diff --git a/apps/red-ui/src/app/modules/shared/components/page-header/page-header.component.ts b/apps/red-ui/src/app/modules/shared/components/page-header/page-header.component.ts index 04d3725a8..fb1bc8eda 100644 --- a/apps/red-ui/src/app/modules/shared/components/page-header/page-header.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/page-header/page-header.component.ts @@ -31,7 +31,9 @@ export class PageHeaderComponent { constructor(@Optional() readonly filterService: FilterService, @Optional() readonly searchService: SearchService) {} get _showResetFilters$(): Observable { - if (!this.filterService) return of(false); + if (!this.filterService) { + return of(false); + } return combineLatest([this.filterService.showResetFilters$, this.searchService.valueChanges$]).pipe( map(([showResetFilters, searchValue]) => showResetFilters || !!searchValue), diff --git a/apps/red-ui/src/app/modules/shared/components/select/select.component.ts b/apps/red-ui/src/app/modules/shared/components/select/select.component.ts index 4ed10eb3c..21885bf85 100644 --- a/apps/red-ui/src/app/modules/shared/components/select/select.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/select/select.component.ts @@ -72,7 +72,9 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor { } toggleSelection(chip: MatChip): void { - if (!this.disabled) chip.toggleSelected(true); + if (!this.disabled) { + chip.toggleSelected(true); + } } selectAll($event) { @@ -100,6 +102,8 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor { } private _propagateChange(value: any[]): void { - if (this._onChange) this._onChange(value); + if (this._onChange) { + this._onChange(value); + } } } diff --git a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.ts b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.ts index 3581ad006..07271d371 100644 --- a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.ts @@ -62,7 +62,9 @@ export class SimpleDoughnutChartComponent implements OnChanges { calculateChartData() { let angleOffset = -90; this.chartData = this.config.map(dataVal => { - if (dataVal.value === 0) return null; + if (dataVal.value === 0) { + return null; + } const res = { degrees: angleOffset }; angleOffset = this.dataPercentage(dataVal.value) * 360 + angleOffset; diff --git a/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts b/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts index e64004ec1..4fee8c4fc 100644 --- a/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts @@ -79,7 +79,9 @@ export class ConfirmationDialogComponent { translate(obj: T): T { const translateKeys = ['title', 'question', 'details', 'confirmationText', 'alternativeConfirmationText', 'denyText']; - if (typeof obj === 'string') return this._translateService.instant(obj, this.config.translateParams); + if (typeof obj === 'string') { + return this._translateService.instant(obj, this.config.translateParams); + } const stringKeys = Object.keys(obj).filter(key => typeof key === 'string' && !!obj[key] && translateKeys.includes(key)); stringKeys.forEach(key => (obj[key] = this.translate(obj[key]))); diff --git a/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts b/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts index d71ff3295..33b2cfc32 100644 --- a/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts +++ b/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts @@ -31,25 +31,39 @@ export class DatePipe extends BaseDatePipe implements PipeTransform { transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null; transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null; transform(value: any, format?: string, timezone?: string, locale?: string): string { - if (format === 'timeFromNow') return this._getTimeFromNow(value); - if (format === 'sophisticatedDate') return this._getSophisticatedDate(value); - if (format === 'exactDate') return this._getExactDate(value); + if (format === 'timeFromNow') { + return this._getTimeFromNow(value); + } + if (format === 'sophisticatedDate') { + return this._getSophisticatedDate(value); + } + if (format === 'exactDate') { + return this._getExactDate(value); + } return super.transform(value, format, timezone, locale); } private _getTimeFromNow(value: string) { const { daysLeft, hoursLeft, minutesLeft } = getLeftDateTime(value); - if (daysLeft === 0 && hoursLeft === 0 && minutesLeft > 0) return this._translateService.instant('time.less-than-an-hour'); + if (daysLeft === 0 && hoursLeft === 0 && minutesLeft > 0) { + return this._translateService.instant('time.less-than-an-hour'); + } const hoursDisplay = this._translateService.instant('time.hours', { hours: hoursLeft }); - if (daysLeft === 0 && hoursLeft > 0) return hoursDisplay; + if (daysLeft === 0 && hoursLeft > 0) { + return hoursDisplay; + } const daysDisplay = this._translateService.instant('time.days', { days: daysLeft }); - if (daysLeft > 0 && hoursLeft > 0) return `${daysDisplay} ${hoursDisplay}`; - if (daysLeft > 0) return daysDisplay; + if (daysLeft > 0 && hoursLeft > 0) { + return `${daysDisplay} ${hoursDisplay}`; + } + if (daysLeft > 0) { + return daysDisplay; + } return this._translateService.instant(`time.no-time-left`); } @@ -67,10 +81,14 @@ export class DatePipe extends BaseDatePipe implements PipeTransform { const thisYear = now.year(); const isTodayFormat = date.isSame(new Date(), 'day'); - if (isTodayFormat) return moment(date, ['h:mm A']).format('HH:mm'); + if (isTodayFormat) { + return moment(date, ['h:mm A']).format('HH:mm'); + } const isYesterdayFormat = date.isSame(yesterday, 'd'); - if (isYesterdayFormat) return this._translateService.instant('yesterday'); + if (isYesterdayFormat) { + return this._translateService.instant('yesterday'); + } const isShortMonthFormat = day < thisDay - 1 && (year === thisYear || month >= thisMonth - 3); if (isShortMonthFormat) { diff --git a/apps/red-ui/src/app/modules/shared/services/dictionary-save.service.ts b/apps/red-ui/src/app/modules/shared/services/dictionary-save.service.ts index 7b32010e9..dd4382b47 100644 --- a/apps/red-ui/src/app/modules/shared/services/dictionary-save.service.ts +++ b/apps/red-ui/src/app/modules/shared/services/dictionary-save.service.ts @@ -40,7 +40,9 @@ export class DictionarySaveService { return obs.pipe( tap( () => { - if (showToast) this._toaster.success(_('dictionary-overview.success.generic')); + if (showToast) { + this._toaster.success(_('dictionary-overview.success.generic')); + } }, () => this._toaster.error(_('dictionary-overview.error.generic')) ) diff --git a/apps/red-ui/src/app/services/permissions.service.ts b/apps/red-ui/src/app/services/permissions.service.ts index 5debf1f04..4e961c043 100644 --- a/apps/red-ui/src/app/services/permissions.service.ts +++ b/apps/red-ui/src/app/services/permissions.service.ts @@ -118,7 +118,9 @@ export class PermissionsService { canDownloadFiles(fileStatus = this._activeFile): boolean { const dossier = this._appStateService.getDossierById(fileStatus?.dossierId); - if (!dossier) return false; + if (!dossier) { + return false; + } return fileStatus.isApproved && this.isApprover(dossier); } diff --git a/apps/red-ui/src/app/services/user.service.ts b/apps/red-ui/src/app/services/user.service.ts index 88d30aa6e..f0eeaf28f 100644 --- a/apps/red-ui/src/app/services/user.service.ts +++ b/apps/red-ui/src/app/services/user.service.ts @@ -116,7 +116,11 @@ export class UserService { hasAnyRole(requiredRoles: string[], user: UserWrapper = this._currentUser) { if (requiredRoles?.length > 0) { - for (const role of requiredRoles) if (user.roles.indexOf(role) >= 0) return true; + for (const role of requiredRoles) { + if (user.roles.indexOf(role) >= 0) { + return true; + } + } return false; } diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 1657d0ecd..be1017fdf 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -296,7 +296,9 @@ export class AppStateService { } async activateFile(dossierId: string, fileId: string) { - if (this.activeDossierId === dossierId && this.activeFileId === fileId) return; + if (this.activeDossierId === dossierId && this.activeFileId === fileId) { + return; + } await this.activateDossier(dossierId); if (this.activeDossier) { this._appState.activeFileId = fileId; diff --git a/apps/red-ui/src/app/utils/custom-route-reuse.strategy.ts b/apps/red-ui/src/app/utils/custom-route-reuse.strategy.ts index cde02a2eb..392a6d27d 100644 --- a/apps/red-ui/src/app/utils/custom-route-reuse.strategy.ts +++ b/apps/red-ui/src/app/utils/custom-route-reuse.strategy.ts @@ -28,7 +28,9 @@ export class CustomRouteReuseStrategy implements RouteReuseStrategy { } store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void { - if (handle === null) return; + if (handle === null) { + return; + } CustomRouteReuseStrategy._removeTooltips(); const element: any = handle; diff --git a/apps/red-ui/src/app/utils/sorters/status-sorter.ts b/apps/red-ui/src/app/utils/sorters/status-sorter.ts index 1e826c787..1a984acf3 100644 --- a/apps/red-ui/src/app/utils/sorters/status-sorter.ts +++ b/apps/red-ui/src/app/utils/sorters/status-sorter.ts @@ -1,7 +1,9 @@ type StatusSorterItem = { key?: string } | string; const byStatus = (a: StatusSorterItem, b: StatusSorterItem) => { - if (typeof a !== typeof b) return; + if (typeof a !== typeof b) { + return; + } const x = typeof a === 'string' ? a : a.key; const y = typeof b === 'string' ? b : b.key; diff --git a/libs/common-ui b/libs/common-ui index 6d9806160..1afafe0e2 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 6d9806160ac35b0db437c3ea0fbf5596e29fda1e +Subproject commit 1afafe0e28239da365d9f1e663763b210b9a9b6f