diff --git a/.eslintrc.json b/.eslintrc.json index 5474cedbf..e3fb306bc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -62,14 +62,45 @@ "@angular-eslint/use-pipe-transform-interface": "error", "@typescript-eslint/consistent-type-definitions": "error", "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/ban-types": "off", "@typescript-eslint/explicit-member-accessibility": [ - "off", + "warn", { - "accessibility": "explicit" + "accessibility": "no-public" } ], "@typescript-eslint/member-ordering": "error", - "@typescript-eslint/naming-convention": "error", + "@typescript-eslint/naming-convention": [ + "error", + { + "selector": "memberLike", + "modifiers": ["readonly"], + "format": ["UPPER_CASE", "camelCase"] + }, + { + "selector": "enumMember", + "format": ["UPPER_CASE"] + }, + { + "selector": "memberLike", + "modifiers": ["private"], + "format": ["camelCase"], + "leadingUnderscore": "require" + }, + { + "selector": "memberLike", + "modifiers": ["protected"], + "format": ["camelCase"], + "leadingUnderscore": "require" + }, + { + "selector": "memberLike", + "modifiers": ["private", "readonly"], + "format": ["UPPER_CASE", "camelCase"], + "leadingUnderscore": "require" + } + ], "@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-inferrable-types": [ diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index 34210459f..ab67d4208 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -29,9 +29,9 @@ import { UserProfileScreenComponent } from './components/user-profile/user-profi import { PlatformLocation } from '@angular/common'; import { BASE_HREF } from './tokens'; -declare var ace; +declare let ace; -export function HttpLoaderFactory(httpClient: HttpClient) { +export function httpLoaderFactory(httpClient: HttpClient) { return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json'); } @@ -68,7 +68,7 @@ const components = [AppComponent, LogoComponent, AuthErrorComponent, ToastCompon TranslateModule.forRoot({ loader: { provide: TranslateLoader, - useFactory: HttpLoaderFactory, + useFactory: httpLoaderFactory, deps: [HttpClient] } }), diff --git a/apps/red-ui/src/app/components/base-screen/base-screen.component.ts b/apps/red-ui/src/app/components/base-screen/base-screen.component.ts index 02cb60d9d..37c41d960 100644 --- a/apps/red-ui/src/app/components/base-screen/base-screen.component.ts +++ b/apps/red-ui/src/app/components/base-screen/base-screen.component.ts @@ -24,11 +24,11 @@ export class BaseScreenComponent { } constructor( - public readonly appStateService: AppStateService, - public readonly permissionsService: PermissionsService, - public readonly userPreferenceService: UserPreferenceService, - public readonly titleService: Title, - public readonly fileDownloadService: FileDownloadService, + readonly appStateService: AppStateService, + readonly permissionsService: PermissionsService, + readonly userPreferenceService: UserPreferenceService, + readonly titleService: Title, + readonly fileDownloadService: FileDownloadService, private readonly _statusOverlayService: StatusOverlayService, private readonly _appConfigService: AppConfigService, private readonly _router: Router, diff --git a/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.ts b/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.ts index 0be3707d2..f3ade2a31 100644 --- a/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.ts +++ b/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.ts @@ -9,17 +9,17 @@ import { DownloadControllerService } from '@redaction/red-ui-http'; styleUrls: ['./downloads-list-screen.component.scss'] }) export class DownloadsListScreenComponent implements OnInit { - constructor(public readonly fileDownloadService: FileDownloadService, private readonly _downloadControllerService: DownloadControllerService) {} + constructor(readonly fileDownloadService: FileDownloadService, private readonly _downloadControllerService: DownloadControllerService) {} ngOnInit(): void { this.fileDownloadService.getDownloadStatus().subscribe(); } - public get noData(): boolean { + get noData(): boolean { return this.fileDownloadService.downloads.length === 0; } - public async downloadItem(download: DownloadStatusWrapper) { + async downloadItem(download: DownloadStatusWrapper) { await this.fileDownloadService.performDownload(download); } diff --git a/apps/red-ui/src/app/components/logo/logo.component.ts b/apps/red-ui/src/app/components/logo/logo.component.ts index 0bc7217c9..fa4f478b7 100644 --- a/apps/red-ui/src/app/components/logo/logo.component.ts +++ b/apps/red-ui/src/app/components/logo/logo.component.ts @@ -1,12 +1,8 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; @Component({ selector: 'redaction-logo', templateUrl: './logo.component.html', styleUrls: ['./logo.component.scss'] }) -export class LogoComponent implements OnInit { - constructor() {} - - ngOnInit(): void {} -} +export class LogoComponent {} 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 d6c4b04bb..ec720d1eb 100644 --- a/apps/red-ui/src/app/components/notifications/notifications.component.ts +++ b/apps/red-ui/src/app/components/notifications/notifications.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import * as moment from 'moment'; import { TranslateService } from '@ngx-translate/core'; @@ -13,23 +13,21 @@ interface Notification { templateUrl: './notifications.component.html', styleUrls: ['./notifications.component.scss'] }) -export class NotificationsComponent implements OnInit { - public notifications: Notification[] = [ +export class NotificationsComponent { + notifications: Notification[] = [ { message: 'This is a notification with longer text wrapping on multiple lines', eventTime: 1607340971000, read: false }, { message: 'This is a link', eventTime: 1607254981000, read: true }, { message: 'This is a notification 1', eventTime: 1607254571000, read: false }, { message: 'Notification', eventTime: 1607385727000, read: true }, { message: 'Another notification', eventTime: 1606829412000, read: false } ]; - public groupedNotifications: { dateString: string; notifications: Notification[] }[] = []; + groupedNotifications: { dateString: string; notifications: Notification[] }[] = []; constructor(private _translateService: TranslateService) { this._groupNotifications(); } - ngOnInit(): void {} - - public get hasUnread() { + get hasUnread() { return this.notifications.filter((notification) => !notification.read).length > 0; } @@ -45,7 +43,7 @@ export class NotificationsComponent implements OnInit { } } - public day(group: { dateString: string; notifications: Notification[] }): string { + day(group: { dateString: string; notifications: Notification[] }): string { moment.locale(this._translateService.currentLang); return moment(group.notifications[0].eventTime).calendar({ sameDay: `[${this._translateService.instant('notifications.today')}]`, @@ -57,7 +55,7 @@ export class NotificationsComponent implements OnInit { }); } - public eventTime(eventTime: number): string { + eventTime(eventTime: number): string { moment.locale(this._translateService.currentLang); if (moment().isSame(eventTime, 'day')) { return moment(eventTime).fromNow(); @@ -66,7 +64,7 @@ export class NotificationsComponent implements OnInit { } } - public toggleRead(notification: Notification, $event) { + toggleRead(notification: Notification, $event) { $event.stopPropagation(); notification.read = !notification.read; } diff --git a/apps/red-ui/src/app/components/toast/toast.component.ts b/apps/red-ui/src/app/components/toast/toast.component.ts index 66f5412fb..e434030cb 100644 --- a/apps/red-ui/src/app/components/toast/toast.component.ts +++ b/apps/red-ui/src/app/components/toast/toast.component.ts @@ -7,16 +7,17 @@ import { Toast, ToastPackage, ToastrService } from 'ngx-toastr'; styleUrls: ['./toast.component.scss'] }) export class ToastComponent extends Toast { - constructor(protected toastrService: ToastrService, public toastPackage: ToastPackage) { - super(toastrService, toastPackage); + constructor(protected readonly _toastrService: ToastrService, readonly toastPackage: ToastPackage) { + super(_toastrService, toastPackage); } - public get actions() { + get actions() { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore return this.options.actions; } - public callAction($event: MouseEvent, action: Function) { + callAction($event: MouseEvent, action: Function) { $event.stopPropagation(); if (action) { action(); diff --git a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts index e9887aec7..e84937260 100644 --- a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts +++ b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts @@ -19,12 +19,12 @@ interface ProfileModel { styleUrls: ['./user-profile-screen.component.scss'] }) export class UserProfileScreenComponent implements OnInit { - public viewReady = false; - public formGroup: FormGroup; + viewReady = false; + formGroup: FormGroup; private _profileModel: ProfileModel; constructor( - public readonly permissionsService: PermissionsService, + readonly permissionsService: PermissionsService, private readonly _formBuilder: FormBuilder, private readonly _userService: UserService, private readonly _userControllerService: UserControllerService, diff --git a/apps/red-ui/src/app/guards/can-deactivate.guard.ts b/apps/red-ui/src/app/guards/can-deactivate.guard.ts index 001e23f87..401591a4e 100644 --- a/apps/red-ui/src/app/guards/can-deactivate.guard.ts +++ b/apps/red-ui/src/app/guards/can-deactivate.guard.ts @@ -24,7 +24,7 @@ export abstract class ComponentHasChanges implements ComponentCanDeactivate { @Injectable({ providedIn: 'root' }) export class PendingChangesGuard implements CanDeactivate { - constructor(private readonly translateService: TranslateService) {} + constructor(private readonly _translateService: TranslateService) {} canDeactivate(component: ComponentCanDeactivate): boolean | Observable { // if there are no pending changes, just allow deactivation; else confirm first @@ -33,6 +33,6 @@ export class PendingChangesGuard implements CanDeactivate {}); + this._translateService.setDefaultLang(defaultLang); + this._translateService.use(defaultLang).subscribe(() => {}); } changeLanguage(language: string) { localStorage.setItem('redaction.language', language); document.documentElement.lang = language; - this.translateService.use(language).subscribe(() => {}); + this._translateService.use(language).subscribe(() => {}); } } diff --git a/apps/red-ui/src/app/models/file/annotation.permissions.ts b/apps/red-ui/src/app/models/file/annotation.permissions.ts index 64e311f94..64a7f005a 100644 --- a/apps/red-ui/src/app/models/file/annotation.permissions.ts +++ b/apps/red-ui/src/app/models/file/annotation.permissions.ts @@ -16,7 +16,7 @@ export class AnnotationPermissions { canForceRedaction: boolean; - public static forUser(isManagerAndOwner: boolean, user: UserWrapper, annotation: AnnotationWrapper) { + static forUser(isManagerAndOwner: boolean, user: UserWrapper, annotation: AnnotationWrapper) { const permissions: AnnotationPermissions = new AnnotationPermissions(); permissions.canUndo = @@ -41,7 +41,7 @@ export class AnnotationPermissions { return permissions; } - public get canPerformMultipleRemoveActions() { + get canPerformMultipleRemoveActions() { return ( this.canMarkTextOnlyAsFalsePositive + this.canMarkAsFalsePositive + diff --git a/apps/red-ui/src/app/models/file/file-data.model.ts b/apps/red-ui/src/app/models/file/file-data.model.ts index a021afdb2..348bbb32e 100644 --- a/apps/red-ui/src/app/models/file/file-data.model.ts +++ b/apps/red-ui/src/app/models/file/file-data.model.ts @@ -38,9 +38,7 @@ export class FileDataModel { let allAnnotations = entries.map((entry) => AnnotationWrapper.fromData(entry)); if (!areDevFeaturesEnabled) { - allAnnotations = allAnnotations.filter((annotation) => { - return !annotation.isFalsePositive; - }); + allAnnotations = allAnnotations.filter((annotation) => !annotation.isFalsePositive); } const visibleAnnotations = allAnnotations.filter((annotation) => { @@ -113,7 +111,7 @@ export class FileDataModel { } // an entry for this request already exists in the redactionLog - if (!!relevantRedactionLogEntry) { + if (relevantRedactionLogEntry) { relevantRedactionLogEntry.userId = forceRedaction.user; relevantRedactionLogEntry.dictionaryEntry = false; relevantRedactionLogEntry.force = true; @@ -132,14 +130,14 @@ export class FileDataModel { const relevantRedactionLogEntry = result.find((r) => r.id === manual.id); // a redaction-log entry is marked as a reason for another entry - hide it - if (!!markedAsReasonRedactionLogEntry) { + if (markedAsReasonRedactionLogEntry) { if (!(this._hasAlreadyBeenProcessed(manual) && manual.status === 'APPROVED')) { markedAsReasonRedactionLogEntry.hidden = true; } } // an entry for this request already exists in the redactionLog - if (!!relevantRedactionLogEntry) { + if (relevantRedactionLogEntry) { if (relevantRedactionLogEntry.status === 'DECLINED') { relevantRedactionLogEntry.hidden = true; return; @@ -178,7 +176,7 @@ export class FileDataModel { redactionLogEntryWrapper.manualRedactionType = 'ADD'; redactionLogEntryWrapper.manual = true; redactionLogEntryWrapper.comments = this.manualRedactions.comments[redactionLogEntryWrapper.id]; - if (!!markedAsReasonRedactionLogEntry) { + if (markedAsReasonRedactionLogEntry) { // cleanup reason if the reason is another annotationId - it is not needed for drawing redactionLogEntryWrapper.reason = null; } diff --git a/apps/red-ui/src/app/models/file/file-status.wrapper.ts b/apps/red-ui/src/app/models/file/file-status.wrapper.ts index 5ceac440c..198083885 100644 --- a/apps/red-ui/src/app/models/file/file-status.wrapper.ts +++ b/apps/red-ui/src/app/models/file/file-status.wrapper.ts @@ -1,4 +1,4 @@ -import { FileAttributeConfig, FileAttributesConfig, FileStatus } from '@redaction/red-ui-http'; +import { FileAttributesConfig, FileStatus } from '@redaction/red-ui-http'; import { StatusSorter } from '../../utils/sorters/status-sorter'; export class FileStatusWrapper { diff --git a/apps/red-ui/src/app/models/file/manual-redaction-entry.wrapper.ts b/apps/red-ui/src/app/models/file/manual-redaction-entry.wrapper.ts index 83fc278be..6dc92c3ee 100644 --- a/apps/red-ui/src/app/models/file/manual-redaction-entry.wrapper.ts +++ b/apps/red-ui/src/app/models/file/manual-redaction-entry.wrapper.ts @@ -2,10 +2,10 @@ import { ManualRedactionEntry } from '@redaction/red-ui-http'; export class ManualRedactionEntryWrapper { constructor( - public readonly quads: any, - public readonly manualRedactionEntry: ManualRedactionEntry, - public readonly type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE', - public readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT', - public readonly rectId?: string + readonly quads: any, + readonly manualRedactionEntry: ManualRedactionEntry, + readonly type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE', + readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT', + readonly rectId?: string ) {} } diff --git a/apps/red-ui/src/app/modules/admin/components/breadcrumbs/admin-breadcrumbs.component.ts b/apps/red-ui/src/app/modules/admin/components/breadcrumbs/admin-breadcrumbs.component.ts index ed49c74a6..54f2c75ba 100644 --- a/apps/red-ui/src/app/modules/admin/components/breadcrumbs/admin-breadcrumbs.component.ts +++ b/apps/red-ui/src/app/modules/admin/components/breadcrumbs/admin-breadcrumbs.component.ts @@ -9,11 +9,11 @@ import { PermissionsService } from '../../../../services/permissions.service'; styleUrls: ['./admin-breadcrumbs.component.scss'] }) export class AdminBreadcrumbsComponent { - @Input() public root = false; + @Input() root = false; constructor( - public readonly userPreferenceService: UserPreferenceService, - public readonly permissionService: PermissionsService, - public readonly appStateService: AppStateService + readonly userPreferenceService: UserPreferenceService, + readonly permissionService: PermissionsService, + readonly appStateService: AppStateService ) {} } 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 70fceb08a..14ad69d13 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 @@ -364,9 +364,7 @@ export class ComboChartComponent extends BaseChartComponent { } onActivate(item) { - const idx = this.activeEntries.findIndex((d) => { - return d.name === item.name && d.value === item.value && d.series === item.series; - }); + const idx = this.activeEntries.findIndex((d) => d.name === item.name && d.value === item.value && d.series === item.series); if (idx > -1) { return; } @@ -376,9 +374,7 @@ export class ComboChartComponent extends BaseChartComponent { } onDeactivate(item) { - const idx = this.activeEntries.findIndex((d) => { - return d.name === item.name && d.value === item.value && d.series === item.series; - }); + const idx = this.activeEntries.findIndex((d) => d.name === item.name && d.value === item.value && d.series === item.series); this.activeEntries.splice(idx, 1); this.activeEntries = [...this.activeEntries]; 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 f0a69f3f2..3e0dcdb64 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 @@ -1,5 +1,5 @@ -import { Component, Input, Output, EventEmitter, OnChanges, ChangeDetectionStrategy } from '@angular/core'; -import { trigger, style, animate, transition } from '@angular/animations'; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core'; +import { animate, style, transition, trigger } from '@angular/animations'; import { formatLabel } from '@swimlane/ngx-charts'; @Component({ @@ -68,7 +68,7 @@ export class ComboSeriesVerticalComponent implements OnChanges { x: any; y: any; - ngOnChanges(changes): void { + ngOnChanges(): void { this.update(); } @@ -163,23 +163,21 @@ export class ComboSeriesVerticalComponent implements OnChanges { this.getSeriesTooltips(this.seriesLine, index); const lineValue = this.seriesLine[0].series[index].value; bar.tooltipText = ` - ${tooltipLabel} - Y1 - ${value.toLocaleString()} • Y2 - ${lineValue.toLocaleString()}% + ${tooltipLabel} + Y1 - ${value.toLocaleString()} • Y2 - ${lineValue.toLocaleString()}% `; return bar; }); } + getSeriesTooltips(seriesLine, index) { - return seriesLine.map((d) => { - return d.series[index]; - }); + return seriesLine.map((d) => d.series[index]); } + isActive(entry): boolean { if (!this.activeEntries) return false; - const item = this.activeEntries.find((d) => { - return entry.name === d.name && entry.series === d.series; - }); + 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/components/rule-set-actions/rule-set-actions.component.ts b/apps/red-ui/src/app/modules/admin/components/rule-set-actions/rule-set-actions.component.ts index c7c8f8419..4247c69ec 100644 --- a/apps/red-ui/src/app/modules/admin/components/rule-set-actions/rule-set-actions.component.ts +++ b/apps/red-ui/src/app/modules/admin/components/rule-set-actions/rule-set-actions.component.ts @@ -17,14 +17,14 @@ export class RuleSetActionsComponent { private readonly _dialogService: AdminDialogService, private readonly _appStateService: AppStateService, private readonly _router: Router, - public readonly permissionsService: PermissionsService + readonly permissionsService: PermissionsService ) { if (!this.ruleSetId) { this.ruleSetId = this._appStateService.activeRuleSetId; } } - public get ruleSet() { + get ruleSet() { return this._appStateService.getRuleSetById(this.ruleSetId); } diff --git a/apps/red-ui/src/app/modules/admin/components/side-nav/side-nav.component.ts b/apps/red-ui/src/app/modules/admin/components/side-nav/side-nav.component.ts index e48b76b56..115c6fe83 100644 --- a/apps/red-ui/src/app/modules/admin/components/side-nav/side-nav.component.ts +++ b/apps/red-ui/src/app/modules/admin/components/side-nav/side-nav.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { PermissionsService } from '../../../../services/permissions.service'; import { UserPreferenceService } from '../../../../services/user-preference.service'; import { AppStateService } from '../../../../state/app-state.service'; @@ -8,10 +8,10 @@ import { AppStateService } from '../../../../state/app-state.service'; templateUrl: './side-nav.component.html', styleUrls: ['./side-nav.component.scss'] }) -export class SideNavComponent implements OnInit { +export class SideNavComponent { @Input() type: 'settings' | 'project-templates'; - public items: { [key: string]: { screen: string; onlyDevMode?: boolean; onlyAdmin?: boolean; userManagerOnly?: boolean; label?: string }[] } = { + items: { [key: string]: { screen: string; onlyDevMode?: boolean; onlyAdmin?: boolean; userManagerOnly?: boolean; label?: string }[] } = { settings: [ { screen: 'project-templates', onlyAdmin: true }, { screen: 'digital-signature', onlyAdmin: true }, @@ -31,14 +31,12 @@ export class SideNavComponent implements OnInit { constructor( private readonly _appStateService: AppStateService, - public readonly userPreferenceService: UserPreferenceService, - public readonly permissionsService: PermissionsService + readonly userPreferenceService: UserPreferenceService, + readonly permissionsService: PermissionsService ) {} - ngOnInit(): void {} - - public get prefix() { - if (!!this._appStateService.activeDictionaryType) { + get prefix() { + if (this._appStateService.activeDictionaryType) { return '../../'; } diff --git a/apps/red-ui/src/app/modules/admin/components/users-stats/users-stats.component.ts b/apps/red-ui/src/app/modules/admin/components/users-stats/users-stats.component.ts index 79a35e9ed..2d890d907 100644 --- a/apps/red-ui/src/app/modules/admin/components/users-stats/users-stats.component.ts +++ b/apps/red-ui/src/app/modules/admin/components/users-stats/users-stats.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-chart/simple-doughnut-chart.component'; @Component({ @@ -6,11 +6,7 @@ import { DoughnutChartConfig } from '../../../shared/components/simple-doughnut- templateUrl: './users-stats.component.html', styleUrls: ['./users-stats.component.scss'] }) -export class UsersStatsComponent implements OnInit { - @Output() public toggleCollapse = new EventEmitter(); +export class UsersStatsComponent { + @Output() toggleCollapse = new EventEmitter(); @Input() chartData: DoughnutChartConfig[]; - - constructor() {} - - ngOnInit(): void {} } 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 7ad52be92..524250d31 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 @@ -14,7 +14,7 @@ import { TranslateService } from '@ngx-translate/core'; }) export class AddEditDictionaryDialogComponent { dictionaryForm: FormGroup; - public readonly dictionary: TypeValue; + readonly dictionary: TypeValue; private readonly _ruleSetId: string; constructor( @@ -39,11 +39,11 @@ export class AddEditDictionaryDialogComponent { }); } - public get dictCaseSensitive() { + get dictCaseSensitive() { return this.dictionary ? !this.dictionary.caseInsensitive : false; } - public get changed(): boolean { + get changed(): boolean { if (!this.dictionary) return true; for (const key of Object.keys(this.dictionaryForm.getRawValue())) { 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 56afda115..4c5f4e298 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 @@ -10,10 +10,10 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; styleUrls: ['./add-edit-file-attribute-dialog.component.scss'] }) export class AddEditFileAttributeDialogComponent { - public fileAttributeForm: FormGroup; - public fileAttribute: FileAttributeConfig; - public ruleSetId: string; - public readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE]; + fileAttributeForm: FormGroup; + fileAttribute: FileAttributeConfig; + ruleSetId: string; + readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE]; constructor( private readonly _appStateService: AppStateService, @@ -33,7 +33,7 @@ export class AddEditFileAttributeDialogComponent { }); } - public get changed(): boolean { + get changed(): boolean { if (!this.fileAttribute) return true; for (const key of Object.keys(this.fileAttributeForm.getRawValue())) { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-rule-set-dialog/add-edit-rule-set-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-rule-set-dialog/add-edit-rule-set-dialog.component.ts index 7fa9359d9..65402e65e 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-rule-set-dialog/add-edit-rule-set-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-rule-set-dialog/add-edit-rule-set-dialog.component.ts @@ -13,11 +13,11 @@ import { applyIntervalConstraints } from '../../../../utils/date-inputs-utils'; styleUrls: ['./add-edit-rule-set-dialog.component.scss'] }) export class AddEditRuleSetDialogComponent { - public ruleSetForm: FormGroup; - public hasValidFrom: boolean; - public hasValidTo: boolean; - public downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED']; - public reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum); + ruleSetForm: FormGroup; + hasValidFrom: boolean; + hasValidTo: boolean; + downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED']; + reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum); private _previousValidFrom: Moment; private _previousValidTo: Moment; @@ -75,7 +75,7 @@ export class AddEditRuleSetDialogComponent { }; } - public get changed(): boolean { + get changed(): boolean { if (!this.ruleSet) return true; for (const key of Object.keys(this.ruleSetForm.getRawValue())) { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/add-edit-user-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/add-edit-user-dialog.component.ts index 1a849a645..de168e68b 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/add-edit-user-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/add-edit-user-dialog.component.ts @@ -10,9 +10,9 @@ import { UserService } from '../../../../services/user.service'; styleUrls: ['./add-edit-user-dialog.component.scss'] }) export class AddEditUserDialogComponent { - public userForm: FormGroup; - public ROLES = ['RED_USER', 'RED_MANAGER', 'RED_USER_ADMIN', 'RED_ADMIN']; - private ROLE_REQUIREMENTS = { RED_MANAGER: 'RED_USER', RED_ADMIN: 'RED_USER_ADMIN' }; + userForm: FormGroup; + readonly ROLES = ['RED_USER', 'RED_MANAGER', 'RED_USER_ADMIN', 'RED_ADMIN']; + private readonly _ROLE_REQUIREMENTS = { RED_MANAGER: 'RED_USER', RED_ADMIN: 'RED_USER_ADMIN' }; constructor( private readonly _formBuilder: FormBuilder, @@ -28,9 +28,10 @@ export class AddEditUserDialogComponent { value: this.user && this.user.roles.indexOf(role) !== -1, disabled: this.user && - Object.keys(this.ROLE_REQUIREMENTS).reduce((value, key) => { - return value || (role === this.ROLE_REQUIREMENTS[key] && this.user.roles.indexOf(key) !== -1); - }, false) + Object.keys(this._ROLE_REQUIREMENTS).reduce( + (value, key) => value || (role === this._ROLE_REQUIREMENTS[key] && this.user.roles.indexOf(key) !== -1), + false + ) } ] }), @@ -47,19 +48,19 @@ export class AddEditUserDialogComponent { } private _setRolesRequirements() { - for (const key of Object.keys(this.ROLE_REQUIREMENTS)) { + for (const key of Object.keys(this._ROLE_REQUIREMENTS)) { this.userForm.controls[key].valueChanges.subscribe((checked) => { if (checked) { - this.userForm.patchValue({ [this.ROLE_REQUIREMENTS[key]]: true }); - this.userForm.controls[this.ROLE_REQUIREMENTS[key]].disable(); + this.userForm.patchValue({ [this._ROLE_REQUIREMENTS[key]]: true }); + this.userForm.controls[this._ROLE_REQUIREMENTS[key]].disable(); } else { - this.userForm.controls[this.ROLE_REQUIREMENTS[key]].enable(); + this.userForm.controls[this._ROLE_REQUIREMENTS[key]].enable(); } }); } } - public get changed(): boolean { + get changed(): boolean { if (!this.user) return true; for (const key of Object.keys(this.userForm.getRawValue())) { @@ -71,18 +72,18 @@ export class AddEditUserDialogComponent { return false; } - public async save() { + async save() { this.dialogRef.close({ action: this.user ? 'UPDATE' : 'CREATE', user: { ...this.userForm.getRawValue(), roles: this.activeRoles } }); } - public async delete() { + async delete() { this.dialogRef.close('DELETE'); } - public get activeRoles(): string[] { + get activeRoles(): string[] { return this.ROLES.reduce((acc, role) => { if (this.userForm.get(role).value) { acc.push(role); diff --git a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-file-attribute-dialog/confirm-delete-file-attribute-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-file-attribute-dialog/confirm-delete-file-attribute-dialog.component.ts index ddcf589ce..3ca2443ac 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-file-attribute-dialog/confirm-delete-file-attribute-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-file-attribute-dialog/confirm-delete-file-attribute-dialog.component.ts @@ -9,12 +9,12 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; styleUrls: ['./confirm-delete-file-attribute-dialog.component.scss'] }) export class ConfirmDeleteFileAttributeDialogComponent { - public fileAttribute: FileAttributeConfig; - public checkboxes = [ + fileAttribute: FileAttributeConfig; + checkboxes = [ { value: false, label: 'impacted-documents.' + this.type }, { value: false, label: 'lost-details' } ]; - public showToast = false; + showToast = false; constructor( private readonly _appStateService: AppStateService, @@ -24,11 +24,11 @@ export class ConfirmDeleteFileAttributeDialogComponent { this.fileAttribute = data; } - public get valid() { + get valid() { return this.checkboxes[0].value && this.checkboxes[1].value; } - public deleteFileAttribute() { + deleteFileAttribute() { if (this.valid) { this.dialogRef.close(true); } else { @@ -36,11 +36,11 @@ export class ConfirmDeleteFileAttributeDialogComponent { } } - public get type(): 'bulk' | 'single' { + get type(): 'bulk' | 'single' { return !this.fileAttribute ? 'bulk' : 'single'; } - public cancel() { + cancel() { this.dialogRef.close(); } } diff --git a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-users-dialog/confirm-delete-users-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-users-dialog/confirm-delete-users-dialog.component.ts index ffe134598..dc04b30f3 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-users-dialog/confirm-delete-users-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-users-dialog/confirm-delete-users-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, Inject } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { User } from '@redaction/red-ui-http'; import { AppStateService } from '../../../../state/app-state.service'; @@ -8,13 +8,13 @@ import { AppStateService } from '../../../../state/app-state.service'; templateUrl: './confirm-delete-users-dialog.component.html', styleUrls: ['./confirm-delete-users-dialog.component.scss'] }) -export class ConfirmDeleteUsersDialogComponent implements OnInit { - public checkboxes = [ +export class ConfirmDeleteUsersDialogComponent { + checkboxes = [ { value: false, label: 'impacted-projects' }, { value: false, label: 'impacted-documents.' + this.type } ]; - public showToast = false; - public projectsCount: number; + showToast = false; + projectsCount: number; constructor( @Inject(MAT_DIALOG_DATA) public users: User[], @@ -31,8 +31,6 @@ export class ConfirmDeleteUsersDialogComponent implements OnInit { }).length; } - ngOnInit(): void {} - async deleteUser() { if (this.valid) { this.dialogRef.close(true); @@ -41,15 +39,15 @@ export class ConfirmDeleteUsersDialogComponent implements OnInit { } } - public get valid() { + get valid() { return this.checkboxes[0].value && this.checkboxes[1].value; } - public cancel() { + cancel() { this.dialogRef.close(); } - public get type(): 'bulk' | 'single' { + get type(): 'bulk' | 'single' { return this.users.length > 1 ? 'bulk' : 'single'; } } diff --git a/apps/red-ui/src/app/modules/admin/dialogs/edit-color-dialog/edit-color-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/edit-color-dialog/edit-color-dialog.component.ts index 8cfc88482..ecc3fdfab 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/edit-color-dialog/edit-color-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/edit-color-dialog/edit-color-dialog.component.ts @@ -11,11 +11,11 @@ import { TranslateService } from '@ngx-translate/core'; styleUrls: ['./edit-color-dialog.component.scss'] }) export class EditColorDialogComponent { - public readonly colors: Colors; - public readonly colorKey: string; + readonly colors: Colors; + readonly colorKey: string; private readonly _initialColor: string; private readonly _ruleSetId: string; - public colorForm: FormGroup; + colorForm: FormGroup; constructor( private readonly _formBuilder: FormBuilder, @@ -35,7 +35,7 @@ export class EditColorDialogComponent { }); } - public get changed(): boolean { + get changed(): boolean { return this.colorForm.get('color').value !== this._initialColor; } 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 9fb18a78a..6e3474b2e 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 @@ -9,12 +9,12 @@ import { FileAttributeConfig } from '@redaction/red-ui-http'; styleUrls: ['./active-fields-listing.component.scss'] }) export class ActiveFieldsListingComponent extends BaseListingComponent implements OnChanges { - @Input() public allEntities: Field[]; - @Output() public allEntitiesChange = new EventEmitter(); - @Output() public setHoveredColumn = new EventEmitter(); - @Output() public toggleFieldActive = new EventEmitter(); + @Input() allEntities: Field[]; + @Output() allEntitiesChange = new EventEmitter(); + @Output() setHoveredColumn = new EventEmitter(); + @Output() toggleFieldActive = new EventEmitter(); - public readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE]; + readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE]; protected readonly _selectionKey = 'csvColumn'; @@ -29,20 +29,20 @@ export class ActiveFieldsListingComponent extends BaseListingComponent im } } - public deactivateSelection() { + deactivateSelection() { this.allEntities.filter((field) => this.isEntitySelected(field)).forEach((field) => (field.primaryAttribute = false)); this.allEntities = [...this.allEntities.filter((field) => !this.isEntitySelected(field))]; this.allEntitiesChange.emit(this.allEntities); this.selectedEntitiesIds = []; } - public setAttributeForSelection(attribute: string, value: any) { + setAttributeForSelection(attribute: string, value: any) { for (const csvColumn of this.selectedEntitiesIds) { this.allEntities.find((f) => f.csvColumn === csvColumn)[attribute] = value; } } - public togglePrimary(field: Field) { + togglePrimary(field: Field) { if (field.primaryAttribute) { field.primaryAttribute = false; } else { 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 4baa14973..823e05ba0 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 @@ -30,18 +30,18 @@ export interface Field { export class FileAttributesCsvImportDialogComponent extends BaseListingComponent { protected readonly _searchKey = 'csvColumn'; - public csvFile: File; - public ruleSetId: string; - public parseResult: { data: any[]; errors: any[]; meta: any; fields: Field[] }; - public hoveredColumn: string; - public activeFields: Field[] = []; - public baseConfigForm: FormGroup; - public isSearchOpen = false; - public previewExpanded = true; - public filteredKeyOptions: Observable; - public keepPreview = false; - public columnSample = []; - public initialParseConfig: { delimiter?: string; encoding?: string } = {}; + csvFile: File; + ruleSetId: string; + parseResult: { data: any[]; errors: any[]; meta: any; fields: Field[] }; + hoveredColumn: string; + activeFields: Field[] = []; + baseConfigForm: FormGroup; + isSearchOpen = false; + previewExpanded = true; + filteredKeyOptions: Observable; + keepPreview = false; + columnSample = []; + initialParseConfig: { delimiter?: string; encoding?: string } = {}; @ViewChild(CdkVirtualScrollViewport, { static: false }) cdkVirtualScrollViewport: CdkVirtualScrollViewport; @@ -76,7 +76,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent }; } - public readFile() { + readFile() { const reader = new FileReader(); reader.addEventListener('load', async (event) => { const parsedCsv = event.target.result; @@ -97,7 +97,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent for (const entity of this.allEntities) { const existing = this.data.existingConfiguration.fileAttributeConfigs.find((a) => a.csvColumnHeader === entity.csvColumn); - if (!!existing) { + if (existing) { entity.id = existing.id; entity.name = existing.label; entity.temporaryName = existing.label; @@ -130,11 +130,11 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent reader.readAsText(this.csvFile, this.baseConfigForm.get('encoding').value); } - public getSample(csvColumn: string) { + getSample(csvColumn: string) { return this.parseResult?.data?.length ? this.parseResult?.data[0][csvColumn] : ''; } - public getEntries(csvColumn: string) { + getEntries(csvColumn: string) { if (this.parseResult?.data) { let count = 0; for (const entry of this.parseResult.data) { @@ -148,11 +148,11 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent } } - public isActive(field: Field): boolean { + isActive(field: Field): boolean { return this.activeFields.indexOf(field) !== -1; } - public toggleFieldActive(field: Field) { + toggleFieldActive(field: Field) { if (!this.isActive(field)) { this.activeFields = [...this.activeFields, field]; } else { @@ -174,15 +174,15 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent }; } - public activateAll() { + activateAll() { this.activeFields = [...this.allEntities]; } - public deactivateAll() { + deactivateAll() { this.activeFields = []; } - public async save() { + async save() { const newPrimary = !!this.activeFields.find((attr) => attr.primaryAttribute); if (newPrimary) { @@ -195,16 +195,14 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent ...this.data.existingConfiguration.fileAttributeConfigs.filter( (a) => !this.allEntities.find((entity) => entity.csvColumn === a.csvColumnHeader) ), - ...this.activeFields.map((field) => { - return { - id: field.id, - csvColumnHeader: field.csvColumn, - editable: !field.readonly, - label: field.name, - type: field.type, - primaryAttribute: field.primaryAttribute - }; - }) + ...this.activeFields.map((field) => ({ + id: field.id, + csvColumnHeader: field.csvColumn, + editable: !field.readonly, + label: field.name, + type: field.type, + primaryAttribute: field.primaryAttribute + })) ] }; @@ -226,7 +224,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent this.dialogRef.close(true); } - public setHoveredColumn(column?: string) { + setHoveredColumn(column?: string) { setTimeout(() => { if (this.keepPreview && !column) { return; @@ -241,7 +239,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent }, 0); } - public get changedParseConfig(): boolean { + get changedParseConfig(): boolean { return ( this.initialParseConfig.delimiter !== this.baseConfigForm.get('delimiter').value || this.initialParseConfig.encoding !== this.baseConfigForm.get('encoding').value diff --git a/apps/red-ui/src/app/modules/admin/dialogs/smtp-auth-dialog/smtp-auth-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/smtp-auth-dialog/smtp-auth-dialog.component.ts index f6a2c4e95..f123463d2 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/smtp-auth-dialog/smtp-auth-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/smtp-auth-dialog/smtp-auth-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { UserService } from '../../../../services/user.service'; @@ -9,8 +9,8 @@ import { SMTPConfigurationModel } from '@redaction/red-ui-http'; templateUrl: './smtp-auth-dialog.component.html', styleUrls: ['./smtp-auth-dialog.component.scss'] }) -export class SmtpAuthDialogComponent implements OnInit { - public authForm: FormGroup; +export class SmtpAuthDialogComponent { + authForm: FormGroup; constructor( private readonly _formBuilder: FormBuilder, @@ -24,9 +24,7 @@ export class SmtpAuthDialogComponent implements OnInit { }); } - ngOnInit(): void {} - - public save() { + save() { this.dialogRef.close(this.authForm.getRawValue()); } } diff --git a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.ts index 651877e0f..972f51c19 100644 --- a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.ts @@ -14,21 +14,21 @@ const PAGE_SIZE = 50; styleUrls: ['./audit-screen.component.scss'] }) export class AuditScreenComponent { - public filterForm: FormGroup; - public viewReady = false; - public categories: string[] = []; - public userIds: Set; - public logs: AuditResponse; - public currentPage = 1; + readonly ALL_CATEGORIES = 'audit-screen.all-categories'; + readonly ALL_USERS = 'audit-screen.all-users'; - public ALL_CATEGORIES = 'audit-screen.all-categories'; - public ALL_USERS = 'audit-screen.all-users'; + filterForm: FormGroup; + viewReady = false; + categories: string[] = []; + userIds: Set; + logs: AuditResponse; + currentPage = 1; private _previousFrom: Moment; private _previousTo: Moment; constructor( - public readonly permissionsService: PermissionsService, + readonly permissionsService: PermissionsService, private readonly _formBuilder: FormBuilder, private readonly _auditControllerService: AuditControllerService, private readonly _translateService: TranslateService @@ -66,7 +66,7 @@ export class AuditScreenComponent { const userId = this.filterForm.get('userId').value; const from = this.filterForm.get('from').value; let to = this.filterForm.get('to').value; - if (!!to) { + if (to) { to = to.clone().add(1, 'd'); } const logsRequestBody: AuditSearchRequest = { @@ -94,14 +94,14 @@ export class AuditScreenComponent { }); } - public get totalPages(): number { + get totalPages(): number { if (!this.logs) { return 0; } return Math.ceil(this.logs.totalHits / PAGE_SIZE); } - public pageChanged(page: number) { + pageChanged(page: number) { this._fetchData(page); } } diff --git a/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts index b34fa75cf..b02ed44b1 100644 --- a/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts @@ -14,7 +14,7 @@ import { BaseListingComponent } from '../../../shared/base/base-listing.componen export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: string; value: string }> { protected readonly _sortKey = 'default-colors'; - public viewReady = false; + viewReady = false; private _colorsObj: Colors; constructor( @@ -22,7 +22,7 @@ export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: st private readonly _activatedRoute: ActivatedRoute, private readonly _dictionaryControllerService: DictionaryControllerService, private readonly _dialogService: AdminDialogService, - public readonly permissionsService: PermissionsService, + readonly permissionsService: PermissionsService, protected readonly _injector: Injector ) { super(_injector); @@ -30,7 +30,7 @@ export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: st this._loadColors(); } - public async loadRuleSetsData(): Promise { + async loadRuleSetsData(): Promise { await this._appStateService.loadAllRuleSets(); } diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts index a7deb42d2..20645a519 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts @@ -19,15 +19,15 @@ export class DictionaryListingScreenComponent extends BaseListingComponent - {{ ruleSet === SELECT_RULESET ? (ruleSet.name | translate) : ruleSet.name }} + {{ ruleSet === selectRuleSet ? (ruleSet.name | translate) : ruleSet.name }}
- {{ dictionary === SELECT_DICTIONARY ? (dictionary.label | translate) : dictionary.label }} + {{ dictionary === selectDictionary ? (dictionary.label | translate) : dictionary.label }}
@@ -114,13 +114,13 @@ class="ace-redaction" > -
+
{ this._setFieldStatus('ruleSet', value.active); - this._setFieldStatus('dictionary', value.active && this.compareForm.get('ruleSet').value !== this.SELECT_RULESET); + this._setFieldStatus('dictionary', value.active && this.compareForm.get('ruleSet').value !== this.selectRuleSet); this._loadDictionaries(); }); - this.ruleSets = [this.SELECT_RULESET, ...this._appStateService.ruleSets]; + this.ruleSets = [this.selectRuleSet, ...this._appStateService.ruleSets]; this._initializeEditor(); @@ -84,11 +83,11 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple }); } - public get dictionary(): TypeValue { + get dictionary(): TypeValue { return this._appStateService.activeDictionary; } - public get hasChanges() { + get hasChanges() { return ( this.currentDictionaryEntries.length && (this.activeEditMarkers.length > 0 || @@ -112,14 +111,14 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple }); } - public openEditDictionaryDialog($event: any) { + openEditDictionaryDialog($event: any) { $event.stopPropagation(); this._dialogService.openAddEditDictionaryDialog(this.dictionary, this.dictionary.ruleSetId, async () => { await this._appStateService.loadDictionaryData(); }); } - public openDeleteDictionaryDialog($event: any) { + openDeleteDictionaryDialog($event: any) { this._dialogService.openDeleteDictionaryDialog($event, this.dictionary, this.dictionary.ruleSetId, async () => { await this._appStateService.loadDictionaryData(); this._router.navigate(['..']); @@ -127,7 +126,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple } @debounce() - public searchChanged(text: string) { + searchChanged(text: string) { this.searchText = text.toLowerCase(); this._applySearchMarkers(); this.currentMatch = 0; @@ -135,7 +134,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple } @debounce(500) - public textChanged($event: any) { + textChanged($event: any) { this._applySearchMarkers(); this.currentDictionaryEntries = $event.split('\n'); this.changedLines = []; @@ -151,28 +150,28 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple } } - const Range = ace.require('ace/range').Range; + const range = ace.require('ace/range').Range; for (const i of this.changedLines) { const entry = this.currentDictionaryEntries[i]; if (entry?.trim().length > 0) { // only mark non-empty lines - this.activeEditMarkers.push(this._editorComponent.getEditor().getSession().addMarker(new Range(i, 0, i, 1), 'changed-row-marker', 'fullLine')); + this.activeEditMarkers.push(this._editorComponent.getEditor().getSession().addMarker(new range(i, 0, i, 1), 'changed-row-marker', 'fullLine')); } - if (entry?.trim().length > 0 && entry.trim().length < DictionaryOverviewScreenComponent.MIN_WORD_LENGTH) { + if (entry?.trim().length > 0 && entry.trim().length < MIN_WORD_LENGTH) { // show lines that are too short - this.activeEditMarkers.push(this._editorComponent.getEditor().getSession().addMarker(new Range(i, 0, i, 1), 'too-short-marker', 'fullLine')); + this.activeEditMarkers.push(this._editorComponent.getEditor().getSession().addMarker(new range(i, 0, i, 1), 'too-short-marker', 'fullLine')); } } } - public async saveEntries() { + async saveEntries() { let entriesToAdd = []; this.currentDictionaryEntries.forEach((currentEntry) => { entriesToAdd.push(currentEntry); }); // remove empty lines entriesToAdd = entriesToAdd.filter((e) => e && e.trim().length > 0).map((e) => e.trim()); - const invalidRowsExist = entriesToAdd.filter((e) => e.length < DictionaryOverviewScreenComponent.MIN_WORD_LENGTH); + const invalidRowsExist = entriesToAdd.filter((e) => e.length < MIN_WORD_LENGTH); if (invalidRowsExist.length === 0) { // can add at least 1 - block UI this.processing = true; @@ -210,13 +209,13 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple } } - public revert() { + revert() { DictionaryOverviewScreenComponent._setEditorValue(this._editorComponent, this.initialDictionaryEntries); this.searchChanged(''); this.processing = false; } - public nextSearchMatch() { + nextSearchMatch() { // length = 3 if (this.searchPositions.length > 0) { this.currentMatch = this.currentMatch < this.searchPositions.length ? this.currentMatch + 1 : 1; @@ -224,14 +223,14 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple } } - public previousSearchMatch() { + previousSearchMatch() { if (this.searchPositions.length > 0) { this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.searchPositions.length; this._gotoLine(); } } - public download(): void { + download(): void { const content = this._editorComponent.getEditor().getValue(); const blob = new Blob([content], { type: 'text/plain;charset=utf-8' @@ -239,7 +238,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple saveAs(blob, `${this.dictionary.label}.txt`); } - public upload($event): void { + upload($event): void { const file = $event.target.files[0]; const fileReader = new FileReader(); @@ -253,18 +252,18 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple } private _syncActiveLines() { - if (!!this._compareEditorComponent) { + if (this._compareEditorComponent) { this._compareEditorComponent.getEditor().gotoLine(this._activeRow); } } private _onRuleSetChanged() { this._loadDictionaries(); - this.compareForm.patchValue({ dictionary: this.SELECT_DICTIONARY }); + this.compareForm.patchValue({ dictionary: this.selectDictionary }); } private _onDictionaryChanged(dictionary: TypeValue) { - if (dictionary !== this.SELECT_DICTIONARY) { + if (dictionary !== this.selectDictionary) { this._dictionaryControllerService.getDictionaryForType(dictionary.type, dictionary.ruleSetId).subscribe( (data) => { this.compareDictionaryEntries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' })); @@ -285,12 +284,12 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple private _loadDictionaries() { const ruleSetId = this.compareForm.get('ruleSet').value.ruleSetId; if (!ruleSetId) { - this.dictionaries = [this.SELECT_DICTIONARY]; + this.dictionaries = [this.selectDictionary]; return; } const appStateDictionaryData = this._appStateService.dictionaryData[ruleSetId]; this.dictionaries = [ - this.SELECT_DICTIONARY, + this.selectDictionary, ...Object.keys(appStateDictionaryData) .map((key) => appStateDictionaryData[key]) .filter((d) => !d.virtual || d.type === 'false_positive') @@ -317,13 +316,13 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple }); this.activeSearchMarkers = []; - const Range = ace.require('ace/range').Range; + const range = ace.require('ace/range').Range; for (const position of this.searchPositions) { this.activeSearchMarkers.push( this._editorComponent .getEditor() .getSession() - .addMarker(new Range(position.row, position.column, position.row, position.column + position.length), 'search-marker', 'text') + .addMarker(new range(position.row, position.column, position.row, position.column + position.length), 'search-marker', 'text') ); } } diff --git a/apps/red-ui/src/app/modules/admin/screens/digital-signature/digital-signature-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/digital-signature/digital-signature-screen.component.ts index 367030168..08061e82a 100644 --- a/apps/red-ui/src/app/modules/admin/screens/digital-signature/digital-signature-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/digital-signature/digital-signature-screen.component.ts @@ -12,18 +12,18 @@ import { lastIndexOfEnd } from '../../../../utils/functions'; styleUrls: ['./digital-signature-screen.component.scss'] }) export class DigitalSignatureScreenComponent { - public digitalSignature: DigitalSignature; - public digitalSignatureForm: FormGroup; + digitalSignature: DigitalSignature; + digitalSignatureForm: FormGroup; - public viewReady = false; - public digitalSignatureExists = false; + viewReady = false; + digitalSignatureExists = false; constructor( private readonly _digitalSignatureControllerService: DigitalSignatureControllerService, private readonly _notificationService: NotificationService, private readonly _formBuilder: FormBuilder, private readonly _translateService: TranslateService, - public readonly permissionsService: PermissionsService + readonly permissionsService: PermissionsService ) { this.loadDigitalSignatureAndInitializeForm(); } diff --git a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts index 49faa6c4a..31482843e 100644 --- a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts @@ -16,15 +16,15 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent { this.loading = true; @@ -61,11 +61,11 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent { this.loading = true; - if (!!fileAttribute) { + if (fileAttribute) { await this._fileAttributesService.deleteFileAttribute(this._appStateService.activeRuleSetId, fileAttribute.id).toPromise(); } else { await this._fileAttributesService.deleteFileAttributes(this.selectedEntitiesIds, this._appStateService.activeRuleSetId).toPromise(); @@ -74,7 +74,7 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent { if (newRuleSet) { this.loadRuleSetsData(); diff --git a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen.component.ts index 1c66e3089..01436cf43 100644 --- a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen.component.ts @@ -9,7 +9,7 @@ import { ComponentHasChanges } from '../../../../guards/can-deactivate.guard'; import { ActivatedRoute } from '@angular/router'; import { AppStateService } from '../../../../state/app-state.service'; -declare var ace; +declare let ace; @Component({ selector: 'redaction-rules-screen', @@ -17,14 +17,14 @@ declare var ace; styleUrls: ['./rules-screen.component.scss'] }) export class RulesScreenComponent extends ComponentHasChanges { - public aceOptions = { showPrintMargin: false }; - public rules: string; - public processing = true; + aceOptions = { showPrintMargin: false }; + rules: string; + processing = true; - public initialLines: string[] = []; - public currentLines: string[] = []; - public changedLines: number[] = []; - public activeEditMarkers: any[] = []; + initialLines: string[] = []; + currentLines: string[] = []; + changedLines: number[] = []; + activeEditMarkers: any[] = []; @ViewChild('editorComponent', { static: true }) editorComponent: AceEditorComponent; @@ -33,7 +33,7 @@ export class RulesScreenComponent extends ComponentHasChanges { private _fileInput: ElementRef; constructor( - public readonly permissionsService: PermissionsService, + readonly permissionsService: PermissionsService, private readonly _rulesControllerService: RulesControllerService, private readonly _appStateService: AppStateService, private readonly _notificationService: NotificationService, @@ -57,7 +57,7 @@ export class RulesScreenComponent extends ComponentHasChanges { ); } - public textChanged($event: any) { + textChanged($event: any) { this.currentLines = $event.split('\n'); this.changedLines = []; this.activeEditMarkers.forEach((am) => { @@ -72,21 +72,21 @@ export class RulesScreenComponent extends ComponentHasChanges { } } - const Range = ace.require('ace/range').Range; + const range = ace.require('ace/range').Range; for (const i of this.changedLines) { const entry = this.currentLines[i]; if (entry?.trim().length > 0) { // only mark non-empty lines - this.activeEditMarkers.push(this.editorComponent.getEditor().getSession().addMarker(new Range(i, 0, i, 1), 'changed-row-marker', 'fullLine')); + this.activeEditMarkers.push(this.editorComponent.getEditor().getSession().addMarker(new range(i, 0, i, 1), 'changed-row-marker', 'fullLine')); } } } - public get hasChanges(): boolean { + get hasChanges(): boolean { return this.activeEditMarkers.length > 0; } - public async save(): Promise { + async save(): Promise { this.processing = true; this._rulesControllerService .uploadRules({ @@ -109,14 +109,14 @@ export class RulesScreenComponent extends ComponentHasChanges { ); } - public revert(): void { + revert(): void { this.initialLines = this.rules.split('\n'); this.editorComponent.getEditor().setValue(this.rules); this.editorComponent.getEditor().clearSelection(); this.processing = false; } - public download(): void { + download(): void { const content = this.editorComponent.getEditor().getValue(); const blob = new Blob([content], { type: 'text/plain;charset=utf-8' @@ -124,7 +124,7 @@ export class RulesScreenComponent extends ComponentHasChanges { saveAs(blob, 'rules.txt'); } - public upload($event): void { + upload($event): void { const file = $event.target.files[0]; const fileReader = new FileReader(); diff --git a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.ts index 9b0d0b027..e1e188d3f 100644 --- a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.ts @@ -12,13 +12,13 @@ import { TranslateService } from '@ngx-translate/core'; styleUrls: ['./smtp-config-screen.component.scss'] }) export class SmtpConfigScreenComponent implements OnInit { - public viewReady = false; - public configForm: FormGroup; + viewReady = false; + configForm: FormGroup; private _initialValue: SMTPConfigurationModel; constructor( - public readonly permissionsService: PermissionsService, + readonly permissionsService: PermissionsService, private readonly _smtpConfigService: SmtpConfigurationControllerService, private readonly _formBuilder: FormBuilder, private readonly _dialogService: AdminDialogService, @@ -60,7 +60,7 @@ export class SmtpConfigScreenComponent implements OnInit { } } - public get changed(): boolean { + get changed(): boolean { if (!this._initialValue) return true; for (const key of Object.keys(this.configForm.getRawValue())) { @@ -72,14 +72,14 @@ export class SmtpConfigScreenComponent implements OnInit { return false; } - public async save() { + async save() { this.viewReady = false; await this._smtpConfigService.updateSMTPConfiguration(this.configForm.getRawValue()).toPromise(); this._initialValue = this.configForm.getRawValue(); this.viewReady = true; } - public openAuthConfigDialog(skipDisableOnCancel?: boolean) { + openAuthConfigDialog(skipDisableOnCancel?: boolean) { this._dialogService.openSMTPAuthConfigDialog(this.configForm.getRawValue(), (authConfig) => { if (authConfig) { this.configForm.patchValue(authConfig); @@ -89,10 +89,10 @@ export class SmtpConfigScreenComponent implements OnInit { }); } - public async testConnection() { + async testConnection() { this.viewReady = false; try { - const res = await this._smtpConfigService.testSMTPConfiguration(this.configForm.getRawValue()).toPromise(); + await this._smtpConfigService.testSMTPConfiguration(this.configForm.getRawValue()).toPromise(); this._notificationService.showToastNotification( this._translateService.instant('smtp-config-screen.test.success'), undefined, diff --git a/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.ts index 487a127be..519687e72 100644 --- a/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.ts @@ -16,14 +16,14 @@ import { BaseListingComponent } from '../../../shared/base/base-listing.componen export class UserListingScreenComponent extends BaseListingComponent implements OnInit { protected readonly _selectionKey = 'userId'; - public viewReady = false; - public loading = false; - public collapsedDetails = false; - public chartData: DoughnutChartConfig[] = []; + viewReady = false; + loading = false; + collapsedDetails = false; + chartData: DoughnutChartConfig[] = []; constructor( - public readonly permissionsService: PermissionsService, - public readonly userService: UserService, + readonly permissionsService: PermissionsService, + readonly userService: UserService, private readonly _translateService: TranslateService, private readonly _adminDialogService: AdminDialogService, private readonly _userControllerService: UserControllerService, @@ -33,7 +33,7 @@ export class UserListingScreenComponent extends BaseListingComponent imple super(_injector); } - public async ngOnInit() { + async ngOnInit() { await this._loadData(); } @@ -41,7 +41,7 @@ export class UserListingScreenComponent extends BaseListingComponent imple return this.userService.getName(user); } - public openAddEditUserDialog($event: MouseEvent, user?: User) { + openAddEditUserDialog($event: MouseEvent, user?: User) { $event.stopPropagation(); this._adminDialogService.openAddEditUserDialog(user, async (result) => { if (result === 'DELETE') { @@ -58,7 +58,7 @@ export class UserListingScreenComponent extends BaseListingComponent imple }); } - public openDeleteUserDialog(users: User[], $event?: MouseEvent) { + openDeleteUserDialog(users: User[], $event?: MouseEvent) { $event?.stopPropagation(); this._adminDialogService.openConfirmDeleteUsersDialog(users, async () => { this.loading = true; @@ -112,26 +112,26 @@ export class UserListingScreenComponent extends BaseListingComponent imple ); } - public getDisplayRoles(user: User) { + getDisplayRoles(user: User) { return user.roles.map((role) => this._translateService.instant('roles.' + role)).join(', ') || this._translateService.instant('roles.NO_ROLE'); } - public async toggleActive(user: User) { + async toggleActive(user: User) { this.loading = true; user.roles = this.userService.isActive(user) ? [] : ['RED_USER']; await this._userControllerService.addRoleToUsers(user.roles, user.userId).toPromise(); await this._loadData(); } - public toggleCollapsedDetails() { + toggleCollapsedDetails() { this.collapsedDetails = !this.collapsedDetails; } - public async bulkDelete() { + async bulkDelete() { this.openDeleteUserDialog(this.allEntities.filter((u) => this.isEntitySelected(u))); } - public get canDeleteSelected(): boolean { + get canDeleteSelected(): boolean { return this.selectedEntitiesIds.indexOf(this.userService.userId) === -1; } } diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts index c78919b79..cfdacdf4a 100644 --- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts @@ -34,8 +34,8 @@ export class WatermarkScreenComponent implements OnInit { @ViewChild('viewer', { static: true }) private _viewer: ElementRef; - public viewReady = false; - public configForm: FormGroup; + viewReady = false; + configForm: FormGroup; get changed(): boolean { if (this._watermark === DEFAULT_WATERMARK) { @@ -50,8 +50,8 @@ export class WatermarkScreenComponent implements OnInit { } constructor( - public readonly permissionsService: PermissionsService, - public readonly appStateService: AppStateService, + readonly permissionsService: PermissionsService, + readonly appStateService: AppStateService, @Inject(BASE_HREF) private readonly _baseHref: string, private readonly _translateService: TranslateService, private readonly _watermarkControllerService: WatermarkControllerService, @@ -85,11 +85,11 @@ export class WatermarkScreenComponent implements OnInit { } @debounce() - public configChanged() { + configChanged() { this._drawWatermark(); } - public save() { + save() { const watermark = { ...this.configForm.getRawValue() }; @@ -113,12 +113,12 @@ export class WatermarkScreenComponent implements OnInit { ); } - public revert() { + revert() { this.configForm.setValue({ ...this._watermark }); this.configChanged(); } - public triggerChanges() {} + triggerChanges() {} private _loadViewer() { if (!this._instance) { @@ -158,16 +158,16 @@ export class WatermarkScreenComponent implements OnInit { } private async _drawWatermark() { - const PDFNet = this._instance.PDFNet; + const pdfNet = this._instance.PDFNet; const document = await this._instance.docViewer.getDocument().getPDFDoc(); - await PDFNet.runWithCleanup( + await pdfNet.runWithCleanup( async () => { await document.lock(); - const pageSet = await PDFNet.PageSet.createSinglePage(1); + const pageSet = await pdfNet.PageSet.createSinglePage(1); - await PDFNet.Stamper.deleteStamps(document, pageSet); + await pdfNet.Stamper.deleteStamps(document, pageSet); const text = this.configForm.get('text').value || ''; const fontSize = this.configForm.get('fontSize').value; @@ -178,8 +178,8 @@ export class WatermarkScreenComponent implements OnInit { const rgbColor = hexToRgb(color); - const stamper = await PDFNet.Stamper.create(3, fontSize, 0); - await stamper.setFontColor(await PDFNet.ColorPt.init(rgbColor.r / 255, rgbColor.g / 255, rgbColor.b / 255)); + const stamper = await pdfNet.Stamper.create(3, fontSize, 0); + await stamper.setFontColor(await pdfNet.ColorPt.init(rgbColor.r / 255, rgbColor.g / 255, rgbColor.b / 255)); await stamper.setOpacity(opacity / 100); switch (orientation) { @@ -195,7 +195,7 @@ export class WatermarkScreenComponent implements OnInit { await stamper.setRotation(-45); } - const font = await PDFNet.Font.createAndEmbed(document, this._convertFont(fontType)); + const font = await pdfNet.Font.createAndEmbed(document, this._convertFont(fontType)); await stamper.setFont(font); await stamper.setTextAlignment(0); await stamper.stampText(document, text, pageSet); @@ -219,7 +219,7 @@ export class WatermarkScreenComponent implements OnInit { }); } - public setValue(type: 'fontType' | 'orientation' | 'hexColor', value: any) { + setValue(type: 'fontType' | 'orientation' | 'hexColor', value: any) { if (!this.configForm.get(type).disabled) { this.configForm.get(type).setValue(value); this.configChanged(); diff --git a/apps/red-ui/src/app/modules/admin/services/admin-dialog.service.ts b/apps/red-ui/src/app/modules/admin/services/admin-dialog.service.ts index beae60667..321651d30 100644 --- a/apps/red-ui/src/app/modules/admin/services/admin-dialog.service.ts +++ b/apps/red-ui/src/app/modules/admin/services/admin-dialog.service.ts @@ -53,7 +53,7 @@ export class AdminDialogService { private readonly _manualRedactionControllerService: ManualRedactionControllerService ) {} - public openDeleteDictionaryDialog($event: MouseEvent, dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef { + openDeleteDictionaryDialog($event: MouseEvent, dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef { $event.stopPropagation(); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); ref.afterClosed().subscribe(async (result) => { @@ -65,7 +65,7 @@ export class AdminDialogService { return ref; } - public openDeleteRuleSetDialog($event: MouseEvent, ruleSet: RuleSetModel, cb?: Function): MatDialogRef { + openDeleteRuleSetDialog($event: MouseEvent, ruleSet: RuleSetModel, cb?: Function): MatDialogRef { $event.stopPropagation(); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); ref.afterClosed().subscribe(async (result) => { @@ -77,7 +77,7 @@ export class AdminDialogService { return ref; } - public openAddEditDictionaryDialog(dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef { + openAddEditDictionaryDialog(dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef { const ref = this._dialog.open(AddEditDictionaryDialogComponent, { ...dialogConfig, data: { dictionary, ruleSetId }, @@ -93,7 +93,7 @@ export class AdminDialogService { return ref; } - public openEditColorsDialog(colors: Colors, colorKey: string, ruleSetId: string, cb?: Function): MatDialogRef { + openEditColorsDialog(colors: Colors, colorKey: string, ruleSetId: string, cb?: Function): MatDialogRef { const ref = this._dialog.open(EditColorDialogComponent, { ...dialogConfig, data: { colors, colorKey, ruleSetId }, @@ -109,7 +109,7 @@ export class AdminDialogService { return ref; } - public openAddEditRuleSetDialog(ruleSet: RuleSetModel, cb?: Function): MatDialogRef { + openAddEditRuleSetDialog(ruleSet: RuleSetModel, cb?: Function): MatDialogRef { const ref = this._dialog.open(AddEditRuleSetDialogComponent, { ...dialogConfig, width: '900px', @@ -126,7 +126,7 @@ export class AdminDialogService { return ref; } - public openImportFileAttributeCSVDialog( + openImportFileAttributeCSVDialog( csv: File, ruleSetId: string, existingConfiguration: FileAttributesConfig, @@ -146,11 +146,7 @@ export class AdminDialogService { return ref; } - public openAddEditFileAttributeDialog( - fileAttribute: FileAttributeConfig, - ruleSetId: string, - cb?: Function - ): MatDialogRef { + openAddEditFileAttributeDialog(fileAttribute: FileAttributeConfig, ruleSetId: string, cb?: Function): MatDialogRef { const ref = this._dialog.open(AddEditFileAttributeDialogComponent, { ...dialogConfig, data: { fileAttribute, ruleSetId }, @@ -166,7 +162,7 @@ export class AdminDialogService { return ref; } - public openConfirmDeleteFileAttributeDialog( + openConfirmDeleteFileAttributeDialog( fileAttribute: FileAttributeConfig, ruleSetId: string, cb?: Function @@ -186,7 +182,7 @@ export class AdminDialogService { return ref; } - public openSMTPAuthConfigDialog(smtpConfig: SMTPConfigurationModel, cb?: Function): MatDialogRef { + openSMTPAuthConfigDialog(smtpConfig: SMTPConfigurationModel, cb?: Function): MatDialogRef { const ref = this._dialog.open(SmtpAuthDialogComponent, { ...dialogConfig, data: smtpConfig, @@ -202,7 +198,7 @@ export class AdminDialogService { return ref; } - public openAddEditUserDialog(user?: User, cb?: Function): MatDialogRef { + openAddEditUserDialog(user?: User, cb?: Function): MatDialogRef { const ref = this._dialog.open(AddEditUserDialogComponent, { ...dialogConfig, data: user, @@ -218,7 +214,7 @@ export class AdminDialogService { return ref; } - public openConfirmDeleteUsersDialog(users: User[], cb?: Function): MatDialogRef { + openConfirmDeleteUsersDialog(users: User[], cb?: Function): MatDialogRef { const ref = this._dialog.open(ConfirmDeleteUsersDialogComponent, { ...dialogConfig, data: users, diff --git a/apps/red-ui/src/app/modules/auth/auth.guard.ts b/apps/red-ui/src/app/modules/auth/auth.guard.ts index e318231b3..1a08305f8 100644 --- a/apps/red-ui/src/app/modules/auth/auth.guard.ts +++ b/apps/red-ui/src/app/modules/auth/auth.guard.ts @@ -21,7 +21,7 @@ export class AuthGuard extends KeycloakAuthGuard { super(_router, _keycloak); } - public async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if (!this.authenticated) { await this._keycloak.login({ idpHint: this._appConfigService.getConfig(AppConfigKey.OAUTH_IDP_HINT, null), diff --git a/apps/red-ui/src/app/modules/auth/auth.module.ts b/apps/red-ui/src/app/modules/auth/auth.module.ts index 2e60056dd..695b4e874 100644 --- a/apps/red-ui/src/app/modules/auth/auth.module.ts +++ b/apps/red-ui/src/app/modules/auth/auth.module.ts @@ -8,8 +8,7 @@ import { AppConfigKey, AppConfigService } from '../app-config/app-config.service import { BASE_HREF } from '../../tokens'; export function keycloakInitializer(keycloak: KeycloakService, appConfigService: AppConfigService, baseUrl) { - return () => { - return appConfigService + return () => appConfigService .loadAppConfig() .toPromise() .then(() => { @@ -33,7 +32,6 @@ export function keycloakInitializer(keycloak: KeycloakService, appConfigService: }; return keycloak.init(options).then(() => configureAutomaticRedirectToLoginScreen(keycloak)); }); - }; } function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakService) { diff --git a/apps/red-ui/src/app/modules/icons/icons.module.ts b/apps/red-ui/src/app/modules/icons/icons.module.ts index 2de3b6f24..4a388f7ef 100644 --- a/apps/red-ui/src/app/modules/icons/icons.module.ts +++ b/apps/red-ui/src/app/modules/icons/icons.module.ts @@ -9,7 +9,7 @@ import { DomSanitizer } from '@angular/platform-browser'; exports: [MatIconModule] }) export class IconsModule { - constructor(private iconRegistry: MatIconRegistry, private sanitizer: DomSanitizer) { + constructor(private readonly _iconRegistry: MatIconRegistry, private readonly _sanitizer: DomSanitizer) { const icons = [ 'add', 'analyse', @@ -84,7 +84,7 @@ export class IconsModule { ]; for (const icon of icons) { - iconRegistry.addSvgIconInNamespace('red', icon, sanitizer.bypassSecurityTrustResourceUrl(`/assets/icons/general/${icon}.svg`)); + _iconRegistry.addSvgIconInNamespace('red', icon, _sanitizer.bypassSecurityTrustResourceUrl(`/assets/icons/general/${icon}.svg`)); } } } diff --git a/apps/red-ui/src/app/modules/projects/components/annotation-actions/annotation-actions.component.ts b/apps/red-ui/src/app/modules/projects/components/annotation-actions/annotation-actions.component.ts index e552ca4d6..a2d926125 100644 --- a/apps/red-ui/src/app/modules/projects/components/annotation-actions/annotation-actions.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/annotation-actions/annotation-actions.component.ts @@ -35,17 +35,17 @@ export class AnnotationActionsComponent implements OnInit { ); } - public get viewerAnnotation(): Annotations.Annotation { + get viewerAnnotation(): Annotations.Annotation { return this.viewer.annotManager.getAnnotationById(this.annotation.id); } - public hideAnnotation($event: MouseEvent) { + hideAnnotation($event: MouseEvent) { $event.stopPropagation(); this.viewer.annotManager.hideAnnotations([this.viewerAnnotation]); this.viewer.annotManager.deselectAllAnnotations(); } - public showAnnotation($event: MouseEvent) { + showAnnotation($event: MouseEvent) { $event.stopPropagation(); this.viewer.annotManager.showAnnotations([this.viewerAnnotation]); this.viewer.annotManager.deselectAllAnnotations(); diff --git a/apps/red-ui/src/app/modules/projects/components/annotation-remove-actions/annotation-remove-actions.component.ts b/apps/red-ui/src/app/modules/projects/components/annotation-remove-actions/annotation-remove-actions.component.ts index d35c30b10..886b51e7a 100644 --- a/apps/red-ui/src/app/modules/projects/components/annotation-remove-actions/annotation-remove-actions.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/annotation-remove-actions/annotation-remove-actions.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { AppStateService } from '../../../../state/app-state.service'; import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper'; import { AnnotationActionsService } from '../../services/annotation-actions.service'; @@ -11,7 +11,7 @@ import { MatMenuTrigger } from '@angular/material/menu'; templateUrl: './annotation-remove-actions.component.html', styleUrls: ['./annotation-remove-actions.component.scss'] }) -export class AnnotationRemoveActionsComponent implements OnInit { +export class AnnotationRemoveActionsComponent { @Output() menuOpenChange = new EventEmitter(); @Input() annotationsChanged: EventEmitter; @Input() menuOpen: boolean; @@ -19,7 +19,7 @@ export class AnnotationRemoveActionsComponent implements OnInit { @Input() tooltipPosition: 'before' | 'above' = 'before'; @ViewChild(MatMenuTrigger) matMenuTrigger: MatMenuTrigger; - public permissions: { + permissions: { canRemoveOrSuggestToRemoveOnlyHere: boolean; canPerformMultipleRemoveActions: boolean; canNotPerformMultipleRemoveActions: boolean; @@ -28,49 +28,47 @@ export class AnnotationRemoveActionsComponent implements OnInit { }; constructor( - public readonly appStateService: AppStateService, + readonly appStateService: AppStateService, private readonly _annotationActionsService: AnnotationActionsService, private readonly _permissionsService: PermissionsService ) {} private _annotations: AnnotationWrapper[]; - public get annotations(): AnnotationWrapper[] { + get annotations(): AnnotationWrapper[] { return this._annotations; } @Input() - public set annotations(value: AnnotationWrapper[]) { + set annotations(value: AnnotationWrapper[]) { this._annotations = value.filter((a) => a !== undefined); this._setPermissions(); } - public get dictionaryColor() { + get dictionaryColor() { return this.appStateService.getDictionaryColor('suggestion-add-dictionary'); } - public get suggestionColor() { + get suggestionColor() { return this.appStateService.getDictionaryColor('suggestion'); } - ngOnInit(): void {} - - public openMenu($event: MouseEvent) { + openMenu($event: MouseEvent) { $event.stopPropagation(); this.matMenuTrigger.openMenu(); this.menuOpenChange.emit(true); } - public onMenuClosed() { + onMenuClosed() { this.menuOpenChange.emit(false); } - public suggestRemoveAnnotations($event, removeFromDict: boolean) { + suggestRemoveAnnotations($event, removeFromDict: boolean) { $event.stopPropagation(); this._annotationActionsService.suggestRemoveAnnotation($event, this.annotations, removeFromDict, this.annotationsChanged); } - public markAsFalsePositive($event) { + markAsFalsePositive($event) { this._annotationActionsService.markAsFalsePositive($event, this.annotations, this.annotationsChanged); } diff --git a/apps/red-ui/src/app/modules/projects/components/bulk-actions/project-overview-bulk-actions.component.ts b/apps/red-ui/src/app/modules/projects/components/bulk-actions/project-overview-bulk-actions.component.ts index 082a30904..531ae3ce9 100644 --- a/apps/red-ui/src/app/modules/projects/components/bulk-actions/project-overview-bulk-actions.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/bulk-actions/project-overview-bulk-actions.component.ts @@ -16,8 +16,8 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service'; }) export class ProjectOverviewBulkActionsComponent { @Input() selectedFileIds: string[]; - @Output() private reload = new EventEmitter(); - public loading = false; + @Output() private _reload = new EventEmitter(); + loading = false; constructor( private readonly _appStateService: AppStateService, @@ -39,52 +39,52 @@ export class ProjectOverviewBulkActionsComponent { return this.selectedFileIds.map((fileId) => this._appStateService.getFileById(this._appStateService.activeProject.project.projectId, fileId)); } - public get areAllFilesSelected() { + get areAllFilesSelected() { return this._appStateService.activeProject.files.length !== 0 && this.selectedFileIds.length === this._appStateService.activeProject.files.length; } - public get areSomeFilesSelected() { + get areSomeFilesSelected() { return this.selectedFileIds.length > 0; } - public get canDelete() { + get canDelete() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canDeleteFile(file), true); } - public get canAssign() { + get canAssign() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canAssignReviewer(file), true); } - public get canReanalyse() { + get canReanalyse() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canReanalyseFile(file), true); } - public get canOcr() { + get canOcr() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canOcrFile(file), true); } - public get fileStatuses() { + get fileStatuses() { return this.selectedFiles.map((file) => file.fileStatus.status); } - public delete() { + delete() { this.loading = true; this._dialogService.openDeleteFilesDialog(null, this._appStateService.activeProject.project.projectId, this.selectedFileIds, () => { - this.reload.emit(); + this._reload.emit(); this.loading = false; this.selectedFileIds.splice(0, this.selectedFileIds.length); }); } - public assign() { + assign() { this.loading = true; this._dialogService.openBulkAssignFileReviewerDialog(this.selectedFileIds, () => { - this.reload.emit(); + this._reload.emit(); this.loading = false; }); } - public async reanalyse() { + async reanalyse() { const fileIds = this.selectedFiles.filter((file) => this._permissionsService.fileRequiresReanalysis(file)).map((file) => file.fileId); this._performBulkAction(this._reanalysisControllerService.reanalyzeFilesForProject(fileIds, this._appStateService.activeProject.projectId)); } @@ -94,45 +94,45 @@ export class ProjectOverviewBulkActionsComponent { } // Under review - public get canSetToUnderReview() { + get canSetToUnderReview() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canSetUnderReview(file), true); } - public setToUnderReview() { + setToUnderReview() { this._performBulkAction(this._fileActionService.setFileUnderReview(this.selectedFiles)); } // Under approval - public get canSetToUnderApproval() { + get canSetToUnderApproval() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canSetUnderApproval(file), true); } - public setToUnderApproval() { + setToUnderApproval() { this._performBulkAction(this._fileActionService.setFileUnderApproval(this.selectedFiles)); } // Approve - public get isReadyForApproval() { + get isReadyForApproval() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.isReadyForApproval(file), true); } - public get canApprove() { + get canApprove() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canApprove(file), true); } - public approveDocuments() { + approveDocuments() { this._performBulkAction(this._fileActionService.setFileApproved(this.selectedFiles)); } // Undo approval - public get canUndoApproval() { + get canUndoApproval() { return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canUndoApproval(file), true); } private _performBulkAction(obs: Observable) { this.loading = true; obs.subscribe().add(() => { - this.reload.emit(); + this._reload.emit(); this.loading = false; }); } diff --git a/apps/red-ui/src/app/modules/projects/components/comments/comments.component.ts b/apps/red-ui/src/app/modules/projects/components/comments/comments.component.ts index d8a0d5147..42c78ef49 100644 --- a/apps/red-ui/src/app/modules/projects/components/comments/comments.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/comments/comments.component.ts @@ -14,14 +14,14 @@ import { PermissionsService } from '../../../../services/permissions.service'; styleUrls: ['./comments.component.scss'] }) export class CommentsComponent { - @Input() public annotation: AnnotationWrapper; - public expanded = false; - public commentForm: FormGroup; - public addingComment = false; + @Input() annotation: AnnotationWrapper; + expanded = false; + commentForm: FormGroup; + addingComment = false; constructor( - public readonly translateService: TranslateService, - public readonly permissionsService: PermissionsService, + readonly translateService: TranslateService, + readonly permissionsService: PermissionsService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _appStateService: AppStateService, private readonly _formBuilder: FormBuilder, @@ -37,7 +37,7 @@ export class CommentsComponent { return !this.annotation.isChangeLogRemoved; } - public toggleExpandComments($event: MouseEvent): void { + toggleExpandComments($event: MouseEvent): void { $event.stopPropagation(); if (!this.annotation.comments.length) { return; @@ -46,7 +46,7 @@ export class CommentsComponent { this._changeDetectorRef.detectChanges(); } - public toggleAddingComment($event?: MouseEvent): void { + toggleAddingComment($event?: MouseEvent): void { $event?.stopPropagation(); this.addingComment = !this.addingComment; if (this.addingComment) { @@ -55,7 +55,7 @@ export class CommentsComponent { this._changeDetectorRef.detectChanges(); } - public addComment(): void { + addComment(): void { const value = this.commentForm.value.comment; if (value) { this._manualAnnotationService.addComment(value, this.annotation.id).subscribe((commentResponse) => { @@ -70,7 +70,7 @@ export class CommentsComponent { } } - public deleteComment(comment: Comment): void { + deleteComment(comment: Comment): void { this._manualAnnotationService.deleteComment(comment.id, this.annotation.id).subscribe(() => { this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1); if (!this.annotation.comments.length) { @@ -79,11 +79,11 @@ export class CommentsComponent { }); } - public isCommentOwner(comment: Comment): boolean { + isCommentOwner(comment: Comment): boolean { return comment.user === this._userService.userId; } - public getOwnerName(comment: Comment): string { + getOwnerName(comment: Comment): string { return this._userService.getNameForId(comment.user); } } diff --git a/apps/red-ui/src/app/modules/projects/components/document-info/document-info.component.ts b/apps/red-ui/src/app/modules/projects/components/document-info/document-info.component.ts index 8c330fa8d..7f187b24a 100644 --- a/apps/red-ui/src/app/modules/projects/components/document-info/document-info.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/document-info/document-info.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { FileAttributesConfig, FileStatus } from '@redaction/red-ui-http'; import { AppStateService } from '../../../../state/app-state.service'; import { ProjectsDialogService } from '../../services/projects-dialog.service'; @@ -8,27 +8,25 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service'; templateUrl: './document-info.component.html', styleUrls: ['./document-info.component.scss'] }) -export class DocumentInfoComponent implements OnInit { +export class DocumentInfoComponent { @Input() file: FileStatus; @Output() closeDocumentInfoView = new EventEmitter(); - public fileAttributesConfig: FileAttributesConfig; + fileAttributesConfig: FileAttributesConfig; constructor(private readonly _appStateService: AppStateService, private readonly _dialogService: ProjectsDialogService) { this.fileAttributesConfig = this._appStateService.activeFileAttributesConfig; } - ngOnInit(): void {} - - public get project() { + get project() { return this._appStateService.getProjectById(this.file.projectId); } - public edit() { + edit() { this._dialogService.openDocumentInfoDialog(this.file); } - public get ruleSetName(): string { + get ruleSetName(): string { return this._appStateService.getRuleSetById(this.project.ruleSetId).name; } } diff --git a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts index 029dee8b5..70ecca38e 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts @@ -19,8 +19,8 @@ export class FileActionsComponent implements OnInit { screen: 'file-preview' | 'project-overview'; constructor( - public readonly permissionsService: PermissionsService, - public readonly appStateService: AppStateService, + readonly permissionsService: PermissionsService, + readonly appStateService: AppStateService, private readonly _dialogService: ProjectsDialogService, private readonly _fileActionService: FileActionService ) {} @@ -39,15 +39,15 @@ export class FileActionsComponent implements OnInit { } } - public toggleViewDocumentInfo() { + toggleViewDocumentInfo() { this.actionPerformed.emit('view-document-info'); } - public get tooltipPosition() { + get tooltipPosition() { return this.screen === 'file-preview' ? 'below' : 'above'; } - public get buttonType() { + get buttonType() { return this.screen === 'file-preview' ? 'default' : 'dark-bg'; } diff --git a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts index 336a87ca1..96cefa40b 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts @@ -16,7 +16,7 @@ const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']; styleUrls: ['./file-workload.component.scss'] }) export class FileWorkloadComponent { - public displayedAnnotations: { [key: number]: { annotations: AnnotationWrapper[] } } = {}; + displayedAnnotations: { [key: number]: { annotations: AnnotationWrapper[] } } = {}; private _annotations: AnnotationWrapper[]; @Input() @@ -41,21 +41,21 @@ export class FileWorkloadComponent { @Output() toggleSkipped = new EventEmitter(); @Output() annotationsChanged = new EventEmitter(); - public quickScrollFirstEnabled = false; - public quickScrollLastEnabled = false; - public displayedPages: number[] = []; - public pagesPanelActive = true; + quickScrollFirstEnabled = false; + quickScrollLastEnabled = false; + displayedPages: number[] = []; + pagesPanelActive = true; @ViewChild('annotationsElement') private _annotationsElement: ElementRef; @ViewChild('quickNavigation') private _quickNavigationElement: ElementRef; private _multiSelectActive = false; - public get multiSelectActive(): boolean { + get multiSelectActive(): boolean { return this._multiSelectActive; } - public set multiSelectActive(value: boolean) { + set multiSelectActive(value: boolean) { this._multiSelectActive = value; if (!value) { this.selectAnnotations.emit(); @@ -67,7 +67,7 @@ export class FileWorkloadComponent { constructor(private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _annotationProcessingService: AnnotationProcessingService) {} - private get firstSelectedAnnotation() { + private get _firstSelectedAnnotation() { return this.selectedAnnotations?.length ? this.selectedAnnotations[0] : null; } @@ -82,37 +82,37 @@ export class FileWorkloadComponent { } } - public annotationIsSelected(annotation: AnnotationWrapper) { + annotationIsSelected(annotation: AnnotationWrapper) { return this.selectedAnnotations?.find((a) => a?.id === annotation.id); } - public logAnnotation(annotation: AnnotationWrapper) { + logAnnotation(annotation: AnnotationWrapper) { console.log(annotation); } - public pageHasSelection(page: number) { + pageHasSelection(page: number) { return this.multiSelectActive && !!this.selectedAnnotations?.find((a) => a.pageNumber === page); } - public selectAllOnActivePage() { + selectAllOnActivePage() { this.selectAnnotations.emit(this.displayedAnnotations[this.activeViewerPage].annotations); this._changeDetectorRef.detectChanges(); } - public deselectAllOnActivePage() { + deselectAllOnActivePage() { this.deselectAnnotations.emit(this.displayedAnnotations[this.activeViewerPage].annotations); this._changeDetectorRef.detectChanges(); } @debounce(0) - public filtersChanged(filters: { primary: FilterModel[]; secondary?: FilterModel[] }) { + filtersChanged(filters: { primary: FilterModel[]; secondary?: FilterModel[] }) { this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(this._annotations, filters.primary, filters.secondary); this.displayedPages = Object.keys(this.displayedAnnotations).map((key) => Number(key)); this.computeQuickNavButtonsState(); this._changeDetectorRef.markForCheck(); } - public computeQuickNavButtonsState() { + computeQuickNavButtonsState() { setTimeout(() => { const element: HTMLElement = this._quickNavigationElement.nativeElement.querySelector(`#pages`); const { scrollTop, scrollHeight, clientHeight } = element; @@ -121,7 +121,7 @@ export class FileWorkloadComponent { }, 0); } - public annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) { + annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) { this.pagesPanelActive = false; if (this.annotationIsSelected(annotation)) { this.deselectAnnotations.emit([annotation]); @@ -166,28 +166,28 @@ export class FileWorkloadComponent { this._changeDetectorRef.detectChanges(); } - public scrollAnnotations() { - if (this.firstSelectedAnnotation?.pageNumber === this.activeViewerPage) { + scrollAnnotations() { + if (this._firstSelectedAnnotation?.pageNumber === this.activeViewerPage) { return; } this.scrollAnnotationsToPage(this.activeViewerPage, 'always'); } - public scrollAnnotationsToPage(page: number, mode: 'always' | 'if-needed' = 'if-needed') { + scrollAnnotationsToPage(page: number, mode: 'always' | 'if-needed' = 'if-needed') { const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[anotation-page-header="${page}"]`); FileWorkloadComponent._scrollToFirstElement(elements, mode); } @debounce() - public scrollToSelectedAnnotation() { + scrollToSelectedAnnotation() { if (!this.selectedAnnotations || this.selectedAnnotations.length === 0) { return; } - const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[annotation-id="${this.firstSelectedAnnotation?.id}"].active`); + const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[annotation-id="${this._firstSelectedAnnotation?.id}"].active`); FileWorkloadComponent._scrollToFirstElement(elements); } - public scrollQuickNavigation() { + scrollQuickNavigation() { let quickNavPageIndex = this.displayedPages.findIndex((p) => p >= this.activeViewerPage); if (quickNavPageIndex === -1 || this.displayedPages[quickNavPageIndex] !== this.activeViewerPage) { quickNavPageIndex = Math.max(0, quickNavPageIndex - 1); @@ -195,24 +195,24 @@ export class FileWorkloadComponent { this._scrollQuickNavigationToPage(this.displayedPages[quickNavPageIndex]); } - public scrollQuickNavFirst() { + scrollQuickNavFirst() { if (this.displayedPages.length > 0) { this._scrollQuickNavigationToPage(this.displayedPages[0]); } } - public scrollQuickNavLast() { + scrollQuickNavLast() { if (this.displayedPages.length > 0) { this._scrollQuickNavigationToPage(this.displayedPages[this.displayedPages.length - 1]); } } - public pageSelectedByClick($event: number) { + pageSelectedByClick($event: number) { this.pagesPanelActive = true; this.selectPage.emit($event); } - public preventKeyDefault($event: KeyboardEvent) { + preventKeyDefault($event: KeyboardEvent) { if (COMMAND_KEY_ARRAY.includes($event.key) && !(($event.target as any).localName === 'input')) { $event.preventDefault(); } @@ -220,23 +220,23 @@ export class FileWorkloadComponent { private _selectFirstAnnotationOnCurrentPageIfNecessary() { if ( - (!this.firstSelectedAnnotation || this.activeViewerPage !== this.firstSelectedAnnotation.pageNumber) && + (!this._firstSelectedAnnotation || this.activeViewerPage !== this._firstSelectedAnnotation.pageNumber) && this.displayedPages.indexOf(this.activeViewerPage) >= 0 ) { this.selectAnnotations.emit([this.displayedAnnotations[this.activeViewerPage].annotations[0]]); } } - public jumpToPreviousWithAnnotations() { + jumpToPreviousWithAnnotations() { this.selectPage.emit(this._prevPageWithAnnotations()); } - public jumpToNextWithAnnotations() { + jumpToNextWithAnnotations() { this.selectPage.emit(this._nextPageWithAnnotations()); } private _navigateAnnotations($event: KeyboardEvent) { - if (!this.firstSelectedAnnotation || this.activeViewerPage !== this.firstSelectedAnnotation.pageNumber) { + if (!this._firstSelectedAnnotation || this.activeViewerPage !== this._firstSelectedAnnotation.pageNumber) { const pageIdx = this.displayedPages.indexOf(this.activeViewerPage); if (pageIdx !== -1) { // Displayed page has annotations @@ -257,10 +257,10 @@ export class FileWorkloadComponent { } } } else { - const page = this.firstSelectedAnnotation.pageNumber; + const page = this._firstSelectedAnnotation.pageNumber; const pageIdx = this.displayedPages.indexOf(page); const annotationsOnPage = this.displayedAnnotations[page].annotations; - const idx = annotationsOnPage.findIndex((a) => a.id === this.firstSelectedAnnotation.id); + const idx = annotationsOnPage.findIndex((a) => a.id === this._firstSelectedAnnotation.id); if ($event.key === 'ArrowDown') { if (idx + 1 !== annotationsOnPage.length) { diff --git a/apps/red-ui/src/app/modules/projects/components/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/modules/projects/components/pdf-viewer/pdf-viewer.component.ts index 2128e0673..ce8c0de0c 100644 --- a/apps/red-ui/src/app/modules/projects/components/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/pdf-viewer/pdf-viewer.component.ts @@ -394,11 +394,11 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { }; } - public deselectAllAnnotations() { + deselectAllAnnotations() { this.instance.annotManager.deselectAllAnnotations(); } - public selectAnnotations($event: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) { + selectAnnotations($event: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) { let annotations: AnnotationWrapper[]; let multiSelect: boolean; if ($event instanceof Array) { @@ -419,11 +419,11 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { this.instance.annotManager.jumpToAnnotation(annotationsFromViewer[0]); } - public deselectAnnotations(annotations: AnnotationWrapper[]) { + deselectAnnotations(annotations: AnnotationWrapper[]) { this.instance.annotManager.deselectAnnotations(annotations.map((ann) => this.instance.annotManager.getAnnotationById(ann.id))); } - public navigateToPage(pageNumber: number) { + navigateToPage(pageNumber: number) { const activePage = this.instance.docViewer.getCurrentPage(); if (activePage !== pageNumber) { this.instance.docViewer.displayPageLocation(pageNumber, 0, 0); diff --git a/apps/red-ui/src/app/modules/projects/components/project-details/project-details.component.ts b/apps/red-ui/src/app/modules/projects/components/project-details/project-details.component.ts index 5dc948b26..d6b283b99 100644 --- a/apps/red-ui/src/app/modules/projects/components/project-details/project-details.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/project-details/project-details.component.ts @@ -15,16 +15,16 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service'; styleUrls: ['./project-details.component.scss'] }) export class ProjectDetailsComponent implements OnInit { - public documentsChartData: DoughnutChartConfig[] = []; - @Input() public filters: { needsWorkFilters: FilterModel[]; statusFilters: FilterModel[] }; - @Output() public filtersChanged = new EventEmitter(); - @Output() public openAssignProjectMembersDialog = new EventEmitter(); - @Output() public toggleCollapse = new EventEmitter(); + documentsChartData: DoughnutChartConfig[] = []; + @Input() filters: { needsWorkFilters: FilterModel[]; statusFilters: FilterModel[] }; + @Output() filtersChanged = new EventEmitter(); + @Output() openAssignProjectMembersDialog = new EventEmitter(); + @Output() toggleCollapse = new EventEmitter(); constructor( - public readonly appStateService: AppStateService, - public readonly translateChartService: TranslateChartService, - public readonly permissionsService: PermissionsService, + readonly appStateService: AppStateService, + readonly translateChartService: TranslateChartService, + readonly permissionsService: PermissionsService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _dialogService: ProjectsDialogService, private readonly _router: Router @@ -37,11 +37,11 @@ export class ProjectDetailsComponent implements OnInit { }); } - public get memberIds(): string[] { + get memberIds(): string[] { return this.appStateService.activeProject.project.memberIds; } - public calculateChartConfig(): void { + calculateChartConfig(): void { if (this.appStateService.activeProject) { const groups = groupBy(this.appStateService.activeProject?.files, 'status'); this.documentsChartData = []; @@ -58,7 +58,7 @@ export class ProjectDetailsComponent implements OnInit { return this.appStateService.activeProject.hasFiles; } - public toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void { + toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void { const filter = this.filters[filterType].find((f) => f.key === key); filter.checked = !filter.checked; this.filtersChanged.emit(this.filters); diff --git a/apps/red-ui/src/app/modules/projects/components/project-listing-actions/project-listing-actions.component.ts b/apps/red-ui/src/app/modules/projects/components/project-listing-actions/project-listing-actions.component.ts index 2cdd569bc..d4df0c857 100644 --- a/apps/red-ui/src/app/modules/projects/components/project-listing-actions/project-listing-actions.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/project-listing-actions/project-listing-actions.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { PermissionsService } from '../../../../services/permissions.service'; import { ProjectWrapper } from '../../../../state/model/project.wrapper'; import { StatusSorter } from '../../../../utils/sorters/status-sorter'; @@ -13,27 +13,25 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service'; templateUrl: './project-listing-actions.component.html', styleUrls: ['./project-listing-actions.component.scss'] }) -export class ProjectListingActionsComponent implements OnInit { +export class ProjectListingActionsComponent { @Input() project: ProjectWrapper; @Output() actionPerformed = new EventEmitter(); actionMenuOpen = false; constructor( - public readonly permissionsService: PermissionsService, - public readonly appStateService: AppStateService, + readonly permissionsService: PermissionsService, + readonly appStateService: AppStateService, private readonly _dialogService: ProjectsDialogService, private readonly _fileManagementControllerService: FileManagementControllerService ) {} - ngOnInit(): void {} - - public openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) { + openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) { this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project, (pw: ProjectWrapper) => { this.actionPerformed.emit(pw); }); } - public openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper) { + openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper) { this._dialogService.openDeleteProjectDialog($event, project, () => { this.actionPerformed.emit(); }); @@ -53,7 +51,7 @@ export class ProjectListingActionsComponent implements OnInit { } // Download Files - public downloadRedactedFiles($event: MouseEvent, project: ProjectWrapper) { + downloadRedactedFiles($event: MouseEvent, project: ProjectWrapper) { $event.stopPropagation(); this._fileManagementControllerService .downloadRedactedFiles({ fileIds: project.files.map((file) => file.fileId) }, project.projectId, false, 'response') @@ -62,11 +60,11 @@ export class ProjectListingActionsComponent implements OnInit { }); } - public canDownloadRedactedFiles(project: ProjectWrapper) { + canDownloadRedactedFiles(project: ProjectWrapper) { return project.files.length > 0 && project.files.reduce((acc, file) => acc && this.permissionsService.canDownloadRedactedFile(file), true); } - public getProjectStatusConfig(pw: ProjectWrapper) { + getProjectStatusConfig(pw: ProjectWrapper) { const obj = pw.files.reduce((acc, file) => { const status = file.status; if (!acc[status]) { diff --git a/apps/red-ui/src/app/modules/projects/components/project-listing-details/project-listing-details.component.ts b/apps/red-ui/src/app/modules/projects/components/project-listing-details/project-listing-details.component.ts index fd0204bf6..145e02594 100644 --- a/apps/red-ui/src/app/modules/projects/components/project-listing-details/project-listing-details.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/project-listing-details/project-listing-details.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-chart/simple-doughnut-chart.component'; import { AppStateService } from '../../../../state/app-state.service'; import { FilterModel } from '../../../shared/components/filter/model/filter.model'; @@ -8,25 +8,23 @@ import { FilterModel } from '../../../shared/components/filter/model/filter.mode templateUrl: './project-listing-details.component.html', styleUrls: ['./project-listing-details.component.scss'] }) -export class ProjectListingDetailsComponent implements OnInit { - @Input() public projectsChartData: DoughnutChartConfig[]; - @Input() public documentsChartData: DoughnutChartConfig[]; - @Input() public filters: { statusFilters: FilterModel[] }; - @Output() public filtersChanged = new EventEmitter(); +export class ProjectListingDetailsComponent { + @Input() projectsChartData: DoughnutChartConfig[]; + @Input() documentsChartData: DoughnutChartConfig[]; + @Input() filters: { statusFilters: FilterModel[] }; + @Output() filtersChanged = new EventEmitter(); constructor(private readonly _appStateService: AppStateService) {} - ngOnInit(): void {} - - public get totalPages() { + get totalPages() { return this._appStateService.totalAnalysedPages; } - public get totalPeople() { + get totalPeople() { return this._appStateService.totalPeople; } - public toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void { + toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void { const filter = this.filters[filterType].find((f) => f.key === key); filter.checked = !filter.checked; this.filtersChanged.emit(this.filters); diff --git a/apps/red-ui/src/app/modules/projects/components/team-members/team-members.component.ts b/apps/red-ui/src/app/modules/projects/components/team-members/team-members.component.ts index ed1a49f2d..4fc9a8cbe 100644 --- a/apps/red-ui/src/app/modules/projects/components/team-members/team-members.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/team-members/team-members.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { PermissionsService } from '../../../../services/permissions.service'; @Component({ @@ -6,41 +6,39 @@ import { PermissionsService } from '../../../../services/permissions.service'; templateUrl: './team-members.component.html', styleUrls: ['./team-members.component.scss'] }) -export class TeamMembersComponent implements OnInit { - @Input() public memberIds: string[]; - @Input() public perLine: number; - @Input() public canAdd = true; - @Input() public largeSpacing = false; - @Input() public canRemove = false; - @Input() public unremovableMembers: string[] = []; - @Output() public openAssignProjectMembersDialog = new EventEmitter(); - @Output() public remove = new EventEmitter(); +export class TeamMembersComponent { + @Input() memberIds: string[]; + @Input() perLine: number; + @Input() canAdd = true; + @Input() largeSpacing = false; + @Input() canRemove = false; + @Input() unremovableMembers: string[] = []; + @Output() openAssignProjectMembersDialog = new EventEmitter(); + @Output() remove = new EventEmitter(); @ViewChild('container', { static: true }) container: ElementRef; - public expandedTeam = false; + expandedTeam = false; constructor(public permissionsService: PermissionsService) {} - ngOnInit(): void {} - - public get maxTeamMembersBeforeExpand(): number { + get maxTeamMembersBeforeExpand(): number { return this.perLine - (this.canAdd ? 1 : 0); } - public get displayedMembers(): string[] { + get displayedMembers(): string[] { return this.expandedTeam || !this.overflowCount ? this.memberIds : this.memberIds.slice(0, this.maxTeamMembersBeforeExpand - 1); } - public toggleExpandedTeam() { + toggleExpandedTeam() { this.expandedTeam = !this.expandedTeam; } - public get overflowCount() { + get overflowCount() { return this.memberIds.length > this.maxTeamMembersBeforeExpand ? this.memberIds.length - (this.maxTeamMembersBeforeExpand - 1) : 0; } - public canRemoveMember(userId: string) { + canRemoveMember(userId: string) { return this.canRemove && this.unremovableMembers.indexOf(userId) === -1; } } diff --git a/apps/red-ui/src/app/modules/projects/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.ts b/apps/red-ui/src/app/modules/projects/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.ts index e4704e8e8..56a7552ca 100644 --- a/apps/red-ui/src/app/modules/projects/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.ts +++ b/apps/red-ui/src/app/modules/projects/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.ts @@ -12,11 +12,11 @@ import * as moment from 'moment'; styleUrls: ['./add-edit-project-dialog.component.scss'] }) export class AddEditProjectDialogComponent { - public projectForm: FormGroup; - public hasDueDate: boolean; - public downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED']; - public reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum); - public ruleSets: RuleSetModel[]; + projectForm: FormGroup; + hasDueDate: boolean; + downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED']; + reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum); + ruleSets: RuleSetModel[]; constructor( private readonly _appStateService: AppStateService, @@ -55,7 +55,7 @@ export class AddEditProjectDialogComponent { }); } - public get changed() { + get changed() { if (!this.project) { return true; } @@ -80,7 +80,7 @@ export class AddEditProjectDialogComponent { return false; } - public get disabled() { + get disabled() { if (this.hasDueDate && this.projectForm.get('dueDate').value === null) { return true; } diff --git a/apps/red-ui/src/app/modules/projects/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts b/apps/red-ui/src/app/modules/projects/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts index a3fbff6ae..f5540b17c 100644 --- a/apps/red-ui/src/app/modules/projects/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts +++ b/apps/red-ui/src/app/modules/projects/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts @@ -21,11 +21,11 @@ class DialogData { styleUrls: ['./assign-owner-dialog.component.scss'] }) export class AssignOwnerDialogComponent { - public usersForm: FormGroup; - public searchForm: FormGroup; + usersForm: FormGroup; + searchForm: FormGroup; constructor( - public readonly userService: UserService, + readonly userService: UserService, private readonly _projectControllerService: ProjectControllerService, private readonly _notificationService: NotificationService, private readonly _formBuilder: FormBuilder, @@ -70,23 +70,23 @@ export class AssignOwnerDialogComponent { } } - public get selectedSingleUser(): string { + get selectedSingleUser(): string { return this.usersForm.get('singleUser').value; } - public get selectedApproversList(): string[] { + get selectedApproversList(): string[] { return this.usersForm.get('approvers').value; } - public get selectedReviewersList(): string[] { + get selectedReviewersList(): string[] { return this.selectedUsersList.filter((m) => this.selectedApproversList.indexOf(m) === -1); } - public get selectedUsersList(): string[] { + get selectedUsersList(): string[] { return this.usersForm.get('members').value; } - public isOwner(userId: string): boolean { + isOwner(userId: string): boolean { return userId === this.selectedSingleUser; } @@ -138,15 +138,15 @@ export class AssignOwnerDialogComponent { .map((user) => user.userId); } - public isMemberSelected(userId: string): boolean { + isMemberSelected(userId: string): boolean { return this.selectedUsersList.indexOf(userId) !== -1; } - public isApprover(userId: string): boolean { + isApprover(userId: string): boolean { return this.selectedApproversList.indexOf(userId) !== -1; } - public toggleApprover(userId: string, $event?: MouseEvent) { + toggleApprover(userId: string, $event?: MouseEvent) { $event?.stopPropagation(); if (this.isOwner(userId) && this.isApprover(userId)) { @@ -163,7 +163,7 @@ export class AssignOwnerDialogComponent { } } - public toggleSelected(userId: string) { + toggleSelected(userId: string) { if (this.isMemberSelected(userId)) { this.selectedUsersList.splice(this.selectedUsersList.indexOf(userId), 1); @@ -189,7 +189,7 @@ export class AssignOwnerDialogComponent { return false; } - public get changed(): boolean { + get changed(): boolean { if (this.data.ignoreChanged) { return true; } diff --git a/apps/red-ui/src/app/modules/projects/dialogs/document-info-dialog/document-info-dialog.component.ts b/apps/red-ui/src/app/modules/projects/dialogs/document-info-dialog/document-info-dialog.component.ts index 522b1ee17..1bb4b16f1 100644 --- a/apps/red-ui/src/app/modules/projects/dialogs/document-info-dialog/document-info-dialog.component.ts +++ b/apps/red-ui/src/app/modules/projects/dialogs/document-info-dialog/document-info-dialog.component.ts @@ -11,9 +11,9 @@ import { ProjectWrapper } from '../../../../state/model/project.wrapper'; styleUrls: ['./document-info-dialog.component.scss'] }) export class DocumentInfoDialogComponent implements OnInit { - public documentInfoForm: FormGroup; - public file: FileStatus; - public attributes: FileAttributeConfig[]; + documentInfoForm: FormGroup; + file: FileStatus; + attributes: FileAttributeConfig[]; private _project: ProjectWrapper; @@ -36,7 +36,7 @@ export class DocumentInfoDialogComponent implements OnInit { this.documentInfoForm = this._formBuilder.group(formConfig); } - public async saveDocumentInfo() { + async saveDocumentInfo() { const attributeIdToValue = { ...this.file.fileAttributes?.attributeIdToValue, ...this.documentInfoForm.getRawValue() }; await this._fileAttributesService.setFileAttributes({ attributeIdToValue }, this.file.projectId, this.file.fileId).toPromise(); this.file.fileAttributes = { attributeIdToValue }; diff --git a/apps/red-ui/src/app/modules/projects/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/projects/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts index 4ede91b17..b9864c2f2 100644 --- a/apps/red-ui/src/app/modules/projects/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/projects/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts @@ -84,7 +84,7 @@ export class ManualAnnotationDialogComponent implements OnInit { this.redactionDictionaries.sort((a, b) => a.label.localeCompare(b.label)); } - public get displayedDictionaryLabel() { + get displayedDictionaryLabel() { const dictType = this.redactionForm.get('dictionary').value; if (dictType) { return this.redactionDictionaries.find((d) => d.type === dictType).label; diff --git a/apps/red-ui/src/app/modules/projects/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.ts b/apps/red-ui/src/app/modules/projects/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.ts index 507936a7c..ed996a11f 100644 --- a/apps/red-ui/src/app/modules/projects/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.ts +++ b/apps/red-ui/src/app/modules/projects/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.ts @@ -1,8 +1,7 @@ -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, Inject } from '@angular/core'; import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper'; import { TranslateService } from '@ngx-translate/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { ConfirmationDialogInput } from '../../../shared/dialogs/confirmation-dialog/confirmation-dialog.component'; export interface RemoveAnnotationsDialogInput { annotationsToRemove: AnnotationWrapper[]; @@ -14,15 +13,13 @@ export interface RemoveAnnotationsDialogInput { templateUrl: './remove-annotations-dialog.component.html', styleUrls: ['./remove-annotations-dialog.component.scss'] }) -export class RemoveAnnotationsDialogComponent implements OnInit { +export class RemoveAnnotationsDialogComponent { constructor( private readonly _translateService: TranslateService, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: RemoveAnnotationsDialogInput ) {} - ngOnInit(): void {} - deny() { this.dialogRef.close(); } diff --git a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts index e8baa44f4..df81cd6ce 100644 --- a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts @@ -38,15 +38,15 @@ const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f']; styleUrls: ['./file-preview-screen.component.scss'] }) export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, OnDetach { - public dialogRef: MatDialogRef; - public viewMode: ViewMode = 'STANDARD'; - public fullScreen = false; - public editingReviewer = false; - public reviewerForm: FormGroup; - public shouldDeselectAnnotationsOnPageChange = true; - public analysisProgressInSeconds = 0; - public analysisProgress: number; - public analysisInterval: number; + dialogRef: MatDialogRef; + viewMode: ViewMode = 'STANDARD'; + fullScreen = false; + editingReviewer = false; + reviewerForm: FormGroup; + shouldDeselectAnnotationsOnPageChange = true; + analysisProgressInSeconds = 0; + analysisProgress: number; + analysisInterval: number; fileData: FileDataModel; annotationData: AnnotationData; selectedAnnotations: AnnotationWrapper[]; @@ -59,19 +59,19 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, fileReanalysedSubscription: Subscription; hideSkipped = false; displayPDFViewer = false; - public viewDocumentInfo = false; + viewDocumentInfo = false; private _instance: WebViewerInstance; private _lastPage: string; @ViewChild('fileWorkloadComponent') private _workloadComponent: FileWorkloadComponent; @ViewChild(PdfViewerComponent) private _viewerComponent: PdfViewerComponent; - @ViewChild(FileWorkloadComponent) public fileWorkloadComponent: FileWorkloadComponent; + @ViewChild(FileWorkloadComponent) fileWorkloadComponent: FileWorkloadComponent; constructor( - public readonly appStateService: AppStateService, - public readonly permissionsService: PermissionsService, - public readonly userPreferenceService: UserPreferenceService, - public readonly userService: UserService, + readonly appStateService: AppStateService, + readonly permissionsService: PermissionsService, + readonly userPreferenceService: UserPreferenceService, + readonly userService: UserService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _activatedRoute: ActivatedRoute, private readonly _dialogService: ProjectsDialogService, @@ -135,7 +135,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, const redactions = allAnnotations.filter((a) => a.getCustomData('redaction')); switch (this.viewMode) { - case 'STANDARD': + case 'STANDARD': { const standardEntries = allAnnotations.filter((a) => !a.getCustomData('changeLogRemoved')); const nonStandardEntries = allAnnotations.filter((a) => a.getCustomData('changeLogRemoved')); redactions.forEach((redaction) => { @@ -144,7 +144,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, this._instance.annotManager.showAnnotations(standardEntries); this._instance.annotManager.hideAnnotations(nonStandardEntries); break; - case 'DELTA': + } + case 'DELTA': { const changeLogEntries = allAnnotations.filter((a) => a.getCustomData('changeLog')); const nonChangeLogEntries = allAnnotations.filter((a) => !a.getCustomData('changeLog')); redactions.forEach((redaction) => { @@ -153,7 +154,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, this._instance.annotManager.showAnnotations(changeLogEntries); this._instance.annotManager.hideAnnotations(nonChangeLogEntries); break; - case 'REDACTED': + } + case 'REDACTED': { const redactionEntries = allAnnotations.filter((a) => a.getCustomData('redaction')); const nonRedactionEntries = allAnnotations.filter((a) => !a.getCustomData('redaction')); redactions.forEach((redaction) => { @@ -162,6 +164,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, this._instance.annotManager.showAnnotations(redactionEntries); this._instance.annotManager.hideAnnotations(nonRedactionEntries); break; + } } this.rebuildFilters(); @@ -184,7 +187,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, ngOnInit(): void { this.displayPDFViewer = true; - document.documentElement.addEventListener('fullscreenchange', (event) => { + document.documentElement.addEventListener('fullscreenchange', () => { if (!document.fullscreenElement) { this.fullScreen = false; } @@ -201,7 +204,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, this._unsubscribeFromFileUpdates(); } - public rebuildFilters(deletePreviousAnnotations: boolean = false) { + rebuildFilters(deletePreviousAnnotations: boolean = false) { const startTime = new Date().getTime(); if (deletePreviousAnnotations) { this.activeViewer.annotManager.deleteAnnotations(this.activeViewer.annotManager.getAnnotationsList(), { @@ -246,7 +249,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, } selectAnnotations(annotations?: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) { - if (!!annotations) { + if (annotations) { this._viewerComponent.selectAnnotations(annotations); } else { this._viewerComponent.deselectAllAnnotations(); @@ -278,7 +281,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, }); } - public toggleFullScreen() { + toggleFullScreen() { this.fullScreen = !this.fullScreen; if (this.fullScreen) { this._openFullScreen(); @@ -371,7 +374,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, } } - public async assignToMe() { + async assignToMe() { await this._fileActionService.assignToMe(this.fileData.fileStatus, async () => { await this.appStateService.reloadActiveFile(); this.resetReviewerForm(); @@ -379,7 +382,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, }); } - public assignReviewer() { + assignReviewer() { const reviewerId = this.reviewerForm.get('reviewer').value; this._statusControllerService.setFileReviewer(this.fileData.fileStatus.projectId, this.fileData.fileStatus.fileId, reviewerId).subscribe(async () => { @@ -392,7 +395,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, }); } - public resetReviewerForm() { + resetReviewerForm() { this.reviewerForm.setValue({ reviewer: this.appStateService.activeFile.currentReviewer }); } diff --git a/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.html b/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.html index 3bb397f0c..416e02ccf 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.html @@ -128,7 +128,7 @@
- +
diff --git a/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.ts b/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.ts index c3f38354d..eb1a9fc72 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.ts @@ -20,7 +20,7 @@ import { filter, tap } from 'rxjs/operators'; import { TranslateChartService } from '../../../../services/translate-chart.service'; import { RedactionFilterSorter } from '../../../../utils/sorters/redaction-filter-sorter'; import { StatusSorter } from '../../../../utils/sorters/status-sorter'; -import { ActivatedRouteSnapshot, NavigationEnd, NavigationStart, Router } from '@angular/router'; +import { NavigationEnd, NavigationStart, Router } from '@angular/router'; import { FilterComponent } from '../../../shared/components/filter/filter.component'; import { ProjectsDialogService } from '../../services/projects-dialog.service'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; @@ -36,15 +36,15 @@ export class ProjectListingScreenComponent extends BaseListingComponent p.project.status === Project.StatusEnum.ACTIVE).length; } - public get inactiveProjectsCount() { + get inactiveProjectsCount() { return this.allEntities.length - this.activeProjectsCount; } - public documentCount(project: ProjectWrapper) { + documentCount(project: ProjectWrapper) { return project.files.length; } - public userCount(project: ProjectWrapper) { + userCount(project: ProjectWrapper) { return project.numberOfMembers; } - public canOpenProject(pw: ProjectWrapper): boolean { - return true; + canOpenProject(pw: ProjectWrapper): boolean { + return !!pw; } - public getRuleSet(pw: ProjectWrapper): RuleSetModel { + getRuleSet(pw: ProjectWrapper): RuleSetModel { return this._appStateService.getRuleSetById(pw.project.ruleSetId); } - public openAddProjectDialog(): void { + openAddProjectDialog(): void { this._dialogService.openAddProjectDialog((addResponse) => { this._calculateData(); this._router.navigate([`/main/projects/${addResponse.project.projectId}`]); @@ -191,7 +191,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent ({ ...f })) }; } - public actionPerformed(pw: ProjectWrapper) { + actionPerformed() { this._calculateData(); } } diff --git a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts index 378fd2a5f..e11a02959 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts @@ -1,5 +1,5 @@ import { Component, HostListener, Injector, OnDestroy, OnInit, ViewChild } from '@angular/core'; -import { ActivatedRouteSnapshot, NavigationEnd, NavigationStart, Router } from '@angular/router'; +import { NavigationEnd, NavigationStart, Router } from '@angular/router'; import { NotificationService, NotificationType } from '../../../../services/notification.service'; import { AppStateService } from '../../../../state/app-state.service'; import { FileDropOverlayService } from '../../../upload-download/services/file-drop-overlay.service'; @@ -19,7 +19,6 @@ import { Subscription, timer } from 'rxjs'; import { filter, tap } from 'rxjs/operators'; import { RedactionFilterSorter } from '../../../../utils/sorters/redaction-filter-sorter'; import { StatusSorter } from '../../../../utils/sorters/status-sorter'; -import { FormGroup } from '@angular/forms'; import { convertFiles, handleFileDrop } from '../../../../utils/file-drop-utils'; import { FilterComponent } from '../../../shared/components/filter/filter.component'; import { ProjectsDialogService } from '../../services/projects-dialog.service'; @@ -38,10 +37,10 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent { @@ -146,19 +145,19 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent ({ ...f })), statusFilters: this.statusFilters.map((f) => ({ ...f })) @@ -308,23 +307,23 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent { this._router.navigate(['/main/projects']); }); } - public openAssignProjectMembersDialog(): void { + openAssignProjectMembersDialog(): void { this._dialogService.openAssignProjectMembersAndOwnerDialog(null, this.activeProject, () => { this.reloadProjects(); }); } - public toggleCollapsedDetails() { + toggleCollapsedDetails() { this.collapsedDetails = !this.collapsedDetails; } } diff --git a/apps/red-ui/src/app/modules/projects/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/projects/services/annotation-actions.service.ts index c61bff748..559dccea9 100644 --- a/apps/red-ui/src/app/modules/projects/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/annotation-actions.service.ts @@ -21,21 +21,21 @@ export class AnnotationActionsService { private readonly _dialogService: ProjectsDialogService ) {} - public acceptSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { + acceptSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { $event?.stopPropagation(); annotations.forEach((annotation) => { this._processObsAndEmit(this._manualAnnotationService.approveRequest(annotation.id, annotation.isModifyDictionary), annotation, annotationsChanged); }); } - public rejectSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { + rejectSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { $event?.stopPropagation(); annotations.forEach((annotation) => { this._processObsAndEmit(this._manualAnnotationService.declineOrRemoveRequest(annotation), annotation, annotationsChanged); }); } - public forceRedaction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { + forceRedaction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { $event?.stopPropagation(); this._dialogService.openForceRedactionDialog($event, (request) => { annotations.forEach((annotation) => { @@ -48,7 +48,7 @@ export class AnnotationActionsService { }); } - public suggestRemoveAnnotation( + suggestRemoveAnnotation( $event: MouseEvent, annotations: AnnotationWrapper[], removeFromDictionary: boolean, @@ -65,7 +65,7 @@ export class AnnotationActionsService { }); } - public markAsFalsePositive($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { + markAsFalsePositive($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { annotations.forEach((annotation) => { const permissions = AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, annotation); const value = permissions.canMarkTextOnlyAsFalsePositive ? annotation.value : this._getFalsePositiveText(annotation); @@ -74,7 +74,7 @@ export class AnnotationActionsService { }); } - public undoDirectAction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { + undoDirectAction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { $event?.stopPropagation(); annotations.forEach((annotation) => { @@ -82,7 +82,7 @@ export class AnnotationActionsService { }); } - public convertRecommendationToAnnotation($event: any, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { + convertRecommendationToAnnotation($event: any, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { $event?.stopPropagation(); annotations.forEach((annotation) => { @@ -101,15 +101,13 @@ export class AnnotationActionsService { ); } - public getViewerAvailableActions(annotations: AnnotationWrapper[], annotationsChanged: EventEmitter): {}[] { + getViewerAvailableActions(annotations: AnnotationWrapper[], annotationsChanged: EventEmitter): Record[] { const availableActions = []; - const annotationPermissions = annotations.map((a) => { - return { - annotation: a, - permissions: AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, a) - }; - }); + const annotationPermissions = annotations.map((a) => ({ + annotation: a, + permissions: AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, a) + })); const canForceRedaction = annotationPermissions.reduce((acc, next) => acc && next.permissions.canForceRedaction, true); if (canForceRedaction) { diff --git a/apps/red-ui/src/app/modules/projects/services/annotation-draw.service.ts b/apps/red-ui/src/app/modules/projects/services/annotation-draw.service.ts index 8fccb33fc..87c3b2215 100644 --- a/apps/red-ui/src/app/modules/projects/services/annotation-draw.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/annotation-draw.service.ts @@ -14,7 +14,7 @@ export class AnnotationDrawService { private readonly _userPreferenceService: UserPreferenceService ) {} - public drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[], hideSkipped: boolean = false) { + drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[], hideSkipped: boolean = false) { const annotations = []; annotationWrappers.forEach((annotation) => { annotations.push(this.computeAnnotation(activeViewer, annotation, hideSkipped)); @@ -33,7 +33,7 @@ export class AnnotationDrawService { } } - public drawSections(activeViewer: WebViewerInstance, sectionGrid: SectionGrid) { + drawSections(activeViewer: WebViewerInstance, sectionGrid: SectionGrid) { const sections = []; for (const page of Object.keys(sectionGrid.rectanglesPerPage)) { const sectionRectangles: SectionRectangle[] = sectionGrid.rectanglesPerPage[page]; @@ -49,7 +49,7 @@ export class AnnotationDrawService { annotationManager.drawAnnotationsFromList(sections); } - public computeSection(activeViewer: WebViewerInstance, pageNumber: number, sectionRectangle: SectionRectangle) { + computeSection(activeViewer: WebViewerInstance, pageNumber: number, sectionRectangle: SectionRectangle) { const rectangleAnnot = new activeViewer.Annotations.RectangleAnnotation(); const pageHeight = activeViewer.docViewer.getPageHeight(pageNumber); const rectangle = { @@ -70,7 +70,7 @@ export class AnnotationDrawService { return rectangleAnnot; } - public computeAnnotation(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper, hideSkipped: boolean = false) { + computeAnnotation(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper, hideSkipped: boolean = false) { const pageNumber = annotationWrapper.pageNumber; const highlight = new activeViewer.Annotations.TextHighlightAnnotation(); highlight.PageNumber = pageNumber; @@ -133,7 +133,7 @@ export class AnnotationDrawService { return new activeViewer.CoreControls.Math.Quad(x1, y1, x2, y2, x3, y3, x4, y4); } - public annotationToQuads(annotation: Annotations.Annotation, activeViewer: WebViewerInstance, pageNumber: number) { + annotationToQuads(annotation: Annotations.Annotation, activeViewer: WebViewerInstance) { const x1 = annotation.getRect().x1; const y1 = annotation.getRect().y1 + annotation.getRect().getHeight(); diff --git a/apps/red-ui/src/app/modules/projects/services/annotation-processing.service.ts b/apps/red-ui/src/app/modules/projects/services/annotation-processing.service.ts index 65c6cb98f..31583eef6 100644 --- a/apps/red-ui/src/app/modules/projects/services/annotation-processing.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/annotation-processing.service.ts @@ -114,7 +114,7 @@ export class AnnotationProcessingService { flatFilters.push(...filter.filters); }); - return !!filterBy ? flatFilters.filter((f) => filterBy(f)) : flatFilters; + return filterBy ? flatFilters.filter((f) => filterBy(f)) : flatFilters; } private _matchesOne = (filters: FilterModel[], condition: (filter: FilterModel) => boolean): boolean => { diff --git a/apps/red-ui/src/app/modules/projects/services/file-action.service.ts b/apps/red-ui/src/app/modules/projects/services/file-action.service.ts index f58f1452e..8009b2d57 100644 --- a/apps/red-ui/src/app/modules/projects/services/file-action.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/file-action.service.ts @@ -18,21 +18,21 @@ export class FileActionService { private readonly _appStateService: AppStateService ) {} - public reanalyseFile(fileStatusWrapper?: FileStatusWrapper, priority = -1) { + reanalyseFile(fileStatusWrapper?: FileStatusWrapper, priority = -1) { if (!fileStatusWrapper) { fileStatusWrapper = this._appStateService.activeFile; } return this._reanalysisControllerService.reanalyzeFile(this._appStateService.activeProject.project.projectId, fileStatusWrapper.fileId, priority); } - public toggleAnalysis(fileStatusWrapper?: FileStatusWrapper) { + toggleAnalysis(fileStatusWrapper?: FileStatusWrapper) { if (!fileStatusWrapper) { fileStatusWrapper = this._appStateService.activeFile; } return this._reanalysisControllerService.toggleAnalysis(fileStatusWrapper.projectId, fileStatusWrapper.fileId, fileStatusWrapper.isExcluded); } - public async assignProjectReviewerFromOverview(file?: FileStatusWrapper, callback?: Function) { + async assignProjectReviewerFromOverview(file?: FileStatusWrapper, callback?: Function) { if (this._permissionsService.isManagerAndOwner()) { this._openAssignReviewerDialog(file, callback); } else { @@ -49,7 +49,7 @@ export class FileActionService { }); } - public assignProjectReviewer(file?: FileStatus, callback?: Function, ignoreDialogChanges = false) { + assignProjectReviewer(file?: FileStatus, callback?: Function, ignoreDialogChanges = false) { this._dialogService.openAssignFileReviewerDialog( file ? file : this._appStateService.activeFile, async () => { @@ -62,7 +62,7 @@ export class FileActionService { ); } - public async assignToMe(file?: FileStatus, callback?: Function) { + async assignToMe(file?: FileStatus, callback?: Function) { if (!file.currentReviewer) { await this._assignReviewerToCurrentUser(file, callback); } else { diff --git a/apps/red-ui/src/app/modules/projects/services/manual-annotation.service.ts b/apps/red-ui/src/app/modules/projects/services/manual-annotation.service.ts index df3d89031..59f9f921b 100644 --- a/apps/red-ui/src/app/modules/projects/services/manual-annotation.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/manual-annotation.service.ts @@ -66,7 +66,7 @@ export class ManualAnnotationService { // this wraps // /manualRedaction/redaction/force // /manualRedaction/request/force - public forceRedaction(request: ForceRedactionRequest) { + forceRedaction(request: ForceRedactionRequest) { if (this._permissionsService.isManagerAndOwner()) { return this._makeForceRedaction(request); } else { @@ -76,7 +76,7 @@ export class ManualAnnotationService { // this wraps // /manualRedaction/approve - public approveRequest(annotationId: string, addToDictionary: boolean = false) { + approveRequest(annotationId: string, addToDictionary: boolean = false) { // for only here - approve the request return this._manualRedactionControllerService .approveRequest( diff --git a/apps/red-ui/src/app/modules/projects/services/pdf-viewer-data.service.ts b/apps/red-ui/src/app/modules/projects/services/pdf-viewer-data.service.ts index e8e56661e..2e8485ce1 100644 --- a/apps/red-ui/src/app/modules/projects/services/pdf-viewer-data.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/pdf-viewer-data.service.ts @@ -41,9 +41,7 @@ export class PdfViewerDataService { const viewedPagesObs = this.getViewedPagesForActiveFile(); return forkJoin([fileObs, reactionLogObs, redactionChangeLogObs, manualRedactionsObs, viewedPagesObs]).pipe( - map((data) => { - return new FileDataModel(this._appStateService.activeFile, ...data); - }) + map((data) => new FileDataModel(this._appStateService.activeFile, ...data)) ); } diff --git a/apps/red-ui/src/app/modules/projects/services/projects-dialog.service.ts b/apps/red-ui/src/app/modules/projects/services/projects-dialog.service.ts index 382bcb687..7055d7d6b 100644 --- a/apps/red-ui/src/app/modules/projects/services/projects-dialog.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/projects-dialog.service.ts @@ -5,9 +5,7 @@ import { FileManagementControllerService, FileStatus, ManualRedactionControllerService, - RuleSetControllerService, - RuleSetModel, - TypeValue + RuleSetControllerService } from '@redaction/red-ui-http'; import { AddEditProjectDialogComponent } from '../dialogs/add-edit-project-dialog/add-edit-project-dialog.component'; import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component'; @@ -44,7 +42,7 @@ export class ProjectsDialogService { private readonly _manualRedactionControllerService: ManualRedactionControllerService ) {} - public openDeleteFilesDialog($event: MouseEvent, projectId: string, fileIds: string[], cb?: Function): MatDialogRef { + openDeleteFilesDialog($event: MouseEvent, projectId: string, fileIds: string[], cb?: Function): MatDialogRef { $event?.stopPropagation(); const ref = this._dialog.open(ConfirmationDialogComponent, { @@ -70,7 +68,7 @@ export class ProjectsDialogService { return ref; } - public openManualAnnotationDialog($event: ManualRedactionEntryWrapper, cb?: Function): MatDialogRef { + openManualAnnotationDialog($event: ManualRedactionEntryWrapper, cb?: Function): MatDialogRef { const ref = this._dialog.open(ManualAnnotationDialogComponent, { ...dialogConfig, autoFocus: true, @@ -86,7 +84,7 @@ export class ProjectsDialogService { return ref; } - public openAcceptSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, callback?: Function): MatDialogRef { + openAcceptSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, callback?: Function): MatDialogRef { $event?.stopPropagation(); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); @@ -103,7 +101,7 @@ export class ProjectsDialogService { return ref; } - public openRejectSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, rejectCallback: () => void): MatDialogRef { + openRejectSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, rejectCallback: () => void): MatDialogRef { $event?.stopPropagation(); const ref = this._dialog.open(ConfirmationDialogComponent, { @@ -122,7 +120,7 @@ export class ProjectsDialogService { return ref; } - public openEditProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef { + openEditProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef { $event.stopPropagation(); const ref = this._dialog.open(AddEditProjectDialogComponent, { ...dialogConfig, @@ -138,7 +136,7 @@ export class ProjectsDialogService { return ref; } - public openForceRedactionDialog($event: MouseEvent, cb?: Function): MatDialogRef { + openForceRedactionDialog($event: MouseEvent, cb?: Function): MatDialogRef { $event?.stopPropagation(); const ref = this._dialog.open(ForceRedactionDialogComponent, { ...dialogConfig @@ -151,7 +149,7 @@ export class ProjectsDialogService { return ref; } - public openRemoveFromDictionaryDialog( + openRemoveFromDictionaryDialog( $event: MouseEvent, annotations: AnnotationWrapper[], removeFromDictionary: boolean, @@ -170,7 +168,7 @@ export class ProjectsDialogService { return ref; } - public openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef { + openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef { $event.stopPropagation(); const ref = this._dialog.open(ConfirmationDialogComponent, { ...dialogConfig, @@ -189,7 +187,7 @@ export class ProjectsDialogService { return ref; } - public openAssignProjectMembersAndOwnerDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef { + openAssignProjectMembersAndOwnerDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef { $event?.stopPropagation(); const ref = this._dialog.open(AssignOwnerDialogComponent, { ...dialogConfig, @@ -203,7 +201,7 @@ export class ProjectsDialogService { return ref; } - public openAssignFileReviewerDialog(file: FileStatus, cb?: Function, ignoreDialogChanges = false): MatDialogRef { + openAssignFileReviewerDialog(file: FileStatus, cb?: Function, ignoreDialogChanges = false): MatDialogRef { const ref = this._dialog.open(AssignOwnerDialogComponent, { ...dialogConfig, data: { type: 'file', files: [file], ignoreChanged: ignoreDialogChanges } @@ -216,7 +214,7 @@ export class ProjectsDialogService { return ref; } - public openAssignFileToMeDialog(file: FileStatus, cb?: Function) { + openAssignFileToMeDialog(file: FileStatus, cb?: Function) { const ref = this._dialog.open(ConfirmationDialogComponent, { ...dialogConfig, data: new ConfirmationDialogInput({ @@ -229,7 +227,7 @@ export class ProjectsDialogService { }); } - public openBulkAssignFileReviewerDialog(fileIds: string[], cb?: Function): MatDialogRef { + openBulkAssignFileReviewerDialog(fileIds: string[], cb?: Function): MatDialogRef { const projectId = this._appStateService.activeProject.project.projectId; const ref = this._dialog.open(AssignOwnerDialogComponent, { ...dialogConfig, @@ -246,7 +244,7 @@ export class ProjectsDialogService { return ref; } - public openAddProjectDialog(cb?: Function): MatDialogRef { + openAddProjectDialog(cb?: Function): MatDialogRef { const ref = this._dialog.open(AddEditProjectDialogComponent, { ...dialogConfig, autoFocus: true @@ -259,7 +257,7 @@ export class ProjectsDialogService { return ref; } - public openDocumentInfoDialog(file: FileStatus, cb?: Function): MatDialogRef { + openDocumentInfoDialog(file: FileStatus, cb?: Function): MatDialogRef { const ref = this._dialog.open(DocumentInfoDialogComponent, { ...dialogConfig, data: file, diff --git a/apps/red-ui/src/app/modules/shared/base/base-listing.component.ts b/apps/red-ui/src/app/modules/shared/base/base-listing.component.ts index 5a91a608e..3407e66c7 100644 --- a/apps/red-ui/src/app/modules/shared/base/base-listing.component.ts +++ b/apps/red-ui/src/app/modules/shared/base/base-listing.component.ts @@ -11,12 +11,12 @@ import { ScreenName, SortingOption, SortingService } from '../../../services/sor // Usage: overwrite necessary methods/members in your component @Component({ template: '' }) -export class BaseListingComponent { - public allEntities: T[] = []; - public filteredEntities: T[] = []; - public displayedEntities: T[] = []; - public selectedEntitiesIds: string[] = []; - public searchForm: FormGroup; +export abstract class BaseListingComponent { + allEntities: T[] = []; + filteredEntities: T[] = []; + displayedEntities: T[] = []; + selectedEntitiesIds: string[] = []; + searchForm: FormGroup; protected readonly _formBuilder: FormBuilder; protected readonly _changeDetectorRef: ChangeDetectorRef; @@ -24,55 +24,34 @@ export class BaseListingComponent { // ---- // Overwrite in child class: - protected readonly _searchKey: string; - protected readonly _selectionKey: string; - protected readonly _sortKey: ScreenName; + protected abstract readonly _searchKey: string; + protected abstract readonly _selectionKey: string; + protected abstract readonly _sortKey: ScreenName; - protected get filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] { + protected get _filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] { return []; } - protected preFilter() { + protected _preFilter() { return; } - protected get filterComponents(): FilterComponent[] { + protected get _filterComponents(): FilterComponent[] { return []; } protected _searchField(entity: T): string { - return entity[this.searchKey]; + return entity[this._searchKey]; } // ---- - constructor(protected readonly _injector: Injector) { + protected constructor(protected readonly _injector: Injector) { this._formBuilder = this._injector.get(FormBuilder); this._changeDetectorRef = this._injector.get(ChangeDetectorRef); this._sortingService = this._injector.get(SortingService); this._initSearch(); } - private get searchKey(): string { - if (!this._searchKey) { - throw new Error('Not implemented.'); - } - return this._searchKey; - } - - private get selectionKey(): string { - if (!this._selectionKey) { - throw new Error('Not implemented.'); - } - return this._selectionKey; - } - - private get sortKey(): ScreenName { - if (!this._sortKey) { - throw new Error('Not implemented.'); - } - return this._sortKey; - } - // Search private _initSearch() { @@ -89,7 +68,7 @@ export class BaseListingComponent { } protected _executeSearchImmediately() { - this.displayedEntities = (this.filters.length ? this.filteredEntities : this.allEntities).filter((entity) => + this.displayedEntities = (this._filters.length ? this.filteredEntities : this.allEntities).filter((entity) => this._searchField(entity).toLowerCase().includes(this.searchForm.get('query').value.toLowerCase()) ); this._updateSelection(); @@ -97,13 +76,13 @@ export class BaseListingComponent { protected _updateSelection() { if (this._selectionKey) { - this.selectedEntitiesIds = this.displayedEntities.map((entity) => entity[this.selectionKey]).filter((id) => this.selectedEntitiesIds.includes(id)); + this.selectedEntitiesIds = this.displayedEntities.map((entity) => entity[this._selectionKey]).filter((id) => this.selectedEntitiesIds.includes(id)); } } // Filter - public filtersChanged(filters?: { [key: string]: FilterModel[] }): void { + filtersChanged(filters?: { [key: string]: FilterModel[] }): void { if (filters) { for (const key of Object.keys(filters)) { for (let idx = 0; idx < this[key].length; ++idx) { @@ -115,23 +94,23 @@ export class BaseListingComponent { } protected _filterEntities() { - this.preFilter(); - this.filteredEntities = getFilteredEntities(this.allEntities, this.filters); + this._preFilter(); + this.filteredEntities = getFilteredEntities(this.allEntities, this._filters); this._executeSearch(); this._changeDetectorRef.detectChanges(); } - public resetFilters() { - for (const filterComponent of this.filterComponents.filter((f) => !!f)) { + resetFilters() { + for (const filterComponent of this._filterComponents.filter((f) => !!f)) { filterComponent.deactivateAllFilters(); } this.filtersChanged(); this.searchForm.reset({ query: '' }); } - public get hasActiveFilters() { + get hasActiveFilters() { return ( - this.filterComponents.filter((f) => !!f).reduce((prev, component) => prev || component?.hasActiveFilters, false) || + this._filterComponents.filter((f) => !!f).reduce((prev, component) => prev || component?.hasActiveFilters, false) || this.searchForm.get('query').value ); } @@ -140,41 +119,41 @@ export class BaseListingComponent { toggleEntitySelected($event: MouseEvent, entity: T) { $event.stopPropagation(); - const idx = this.selectedEntitiesIds.indexOf(entity[this.selectionKey]); + const idx = this.selectedEntitiesIds.indexOf(entity[this._selectionKey]); if (idx === -1) { - this.selectedEntitiesIds.push(entity[this.selectionKey]); + this.selectedEntitiesIds.push(entity[this._selectionKey]); } else { this.selectedEntitiesIds.splice(idx, 1); } } - public toggleSelectAll() { + toggleSelectAll() { if (this.areSomeEntitiesSelected) { this.selectedEntitiesIds = []; } else { - this.selectedEntitiesIds = this.displayedEntities.map((entity) => entity[this.selectionKey]); + this.selectedEntitiesIds = this.displayedEntities.map((entity) => entity[this._selectionKey]); } } - public get areAllEntitiesSelected() { + get areAllEntitiesSelected() { return this.displayedEntities.length !== 0 && this.selectedEntitiesIds.length === this.displayedEntities.length; } - public get areSomeEntitiesSelected() { + get areSomeEntitiesSelected() { return this.selectedEntitiesIds.length > 0; } - public isEntitySelected(entity: T) { - return this.selectedEntitiesIds.indexOf(entity[this.selectionKey]) !== -1; + isEntitySelected(entity: T) { + return this.selectedEntitiesIds.indexOf(entity[this._selectionKey]) !== -1; } // Sort - public get sortingOption(): SortingOption { - return this._sortingService.getSortingOption(this.sortKey); + get sortingOption(): SortingOption { + return this._sortingService.getSortingOption(this._sortKey); } - public toggleSort($event) { - this._sortingService.toggleSort(this.sortKey, $event); + toggleSort($event) { + this._sortingService.toggleSort(this._sortKey, $event); } } diff --git a/apps/red-ui/src/app/modules/shared/components/annotation-icon/annotation-icon.component.ts b/apps/red-ui/src/app/modules/shared/components/annotation-icon/annotation-icon.component.ts index 244e29d04..29d7534ea 100644 --- a/apps/red-ui/src/app/modules/shared/components/annotation-icon/annotation-icon.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/annotation-icon/annotation-icon.component.ts @@ -20,19 +20,19 @@ export class AnnotationIconComponent implements OnInit { this.icon.nativeElement.style.setProperty('--color', this.backgroundColor); } - public get isHint() { + get isHint() { return this.type === 'circle' || this.dictType?.type === 'hint'; } - public get isRequest() { + get isRequest() { return this.type === 'rhombus' || this.dictType?.type === 'redaction'; } - public get isRecommendation() { + get isRecommendation() { return this.type === 'hexagon' || this.dictType?.type === 'recommendation'; } - public get backgroundColor() { + get backgroundColor() { return this.color || this.dictType?.hexColor; } } diff --git a/apps/red-ui/src/app/modules/shared/components/buttons/chevron-button/chevron-button.component.ts b/apps/red-ui/src/app/modules/shared/components/buttons/chevron-button/chevron-button.component.ts index 93c4758b6..d42452785 100644 --- a/apps/red-ui/src/app/modules/shared/components/buttons/chevron-button/chevron-button.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/buttons/chevron-button/chevron-button.component.ts @@ -1,16 +1,12 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, Input } from '@angular/core'; @Component({ selector: 'redaction-chevron-button', templateUrl: './chevron-button.component.html', styleUrls: ['./chevron-button.component.scss'] }) -export class ChevronButtonComponent implements OnInit { +export class ChevronButtonComponent { @Input() text: string; @Input() showDot = false; @Input() primary = false; - - constructor() {} - - ngOnInit(): void {} } diff --git a/apps/red-ui/src/app/modules/shared/components/buttons/circle-button/circle-button.component.ts b/apps/red-ui/src/app/modules/shared/components/buttons/circle-button/circle-button.component.ts index b0f115a46..8dbb7eb97 100644 --- a/apps/red-ui/src/app/modules/shared/components/buttons/circle-button/circle-button.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/buttons/circle-button/circle-button.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { MatTooltip } from '@angular/material/tooltip'; @Component({ @@ -6,7 +6,7 @@ import { MatTooltip } from '@angular/material/tooltip'; templateUrl: './circle-button.component.html', styleUrls: ['./circle-button.component.scss'] }) -export class CircleButtonComponent implements OnInit { +export class CircleButtonComponent { @Input() icon: string; @Input() tooltip: string; @Input() showDot = false; @@ -20,10 +20,6 @@ export class CircleButtonComponent implements OnInit { @ViewChild(MatTooltip) matTooltip: MatTooltip; - constructor() {} - - ngOnInit(): void {} - performAction($event: any) { if (!this.disabled) { if (this.removeTooltip) { diff --git a/apps/red-ui/src/app/modules/shared/components/buttons/icon-button/icon-button.component.ts b/apps/red-ui/src/app/modules/shared/components/buttons/icon-button/icon-button.component.ts index 3dd79bc13..e9684fa0b 100644 --- a/apps/red-ui/src/app/modules/shared/components/buttons/icon-button/icon-button.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/buttons/icon-button/icon-button.component.ts @@ -1,19 +1,15 @@ -import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; +import { Component, Input, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'redaction-icon-button', templateUrl: './icon-button.component.html', styleUrls: ['./icon-button.component.scss'] }) -export class IconButtonComponent implements OnInit { +export class IconButtonComponent { @Input() icon: string; @Input() text: string; @Input() showDot = false; @Input() disabled = false; @Input() type: 'default' | 'show-bg' | 'primary' = 'default'; @Output() action = new EventEmitter(); - - constructor() {} - - ngOnInit(): void {} } diff --git a/apps/red-ui/src/app/modules/shared/components/buttons/user-button/user-button.component.ts b/apps/red-ui/src/app/modules/shared/components/buttons/user-button/user-button.component.ts index 607f60830..9d8f23387 100644 --- a/apps/red-ui/src/app/modules/shared/components/buttons/user-button/user-button.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/buttons/user-button/user-button.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { UserWrapper } from '../../../../../services/user.service'; @Component({ @@ -6,11 +6,7 @@ import { UserWrapper } from '../../../../../services/user.service'; templateUrl: './user-button.component.html', styleUrls: ['./user-button.component.scss'] }) -export class UserButtonComponent implements OnInit { +export class UserButtonComponent { @Input() user: UserWrapper; @Input() showDot = false; - - constructor() {} - - ngOnInit(): void {} } diff --git a/apps/red-ui/src/app/modules/shared/components/checkbox/round-checkbox.component.ts b/apps/red-ui/src/app/modules/shared/components/checkbox/round-checkbox.component.ts index 3a96398eb..e39cb4c0f 100644 --- a/apps/red-ui/src/app/modules/shared/components/checkbox/round-checkbox.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/checkbox/round-checkbox.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, HostBinding, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core'; +import { Component, ElementRef, HostBinding, Input, OnChanges, OnInit, ViewChild } from '@angular/core'; @Component({ selector: 'redaction-round-checkbox', @@ -23,7 +23,7 @@ export class RoundCheckboxComponent implements OnInit, OnChanges { this._wrapper.nativeElement.style.setProperty('--size', this.size + 'px'); } - ngOnChanges(changes: SimpleChanges): void { + ngOnChanges(): void { this._activeClass = this.active && !this.indeterminate; this._inactiveClass = !this.active && !this.indeterminate; this._indeterminateClass = this.indeterminate; diff --git a/apps/red-ui/src/app/modules/shared/components/filter/filter.component.ts b/apps/red-ui/src/app/modules/shared/components/filter/filter.component.ts index d8e05b13e..b26c479b5 100644 --- a/apps/red-ui/src/app/modules/shared/components/filter/filter.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/filter/filter.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, TemplateRef } from '@angular/core'; +import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, Output, TemplateRef } from '@angular/core'; import { FilterModel } from './model/filter.model'; import { handleCheckedValue } from './utils/filter-utils'; import { MAT_CHECKBOX_DEFAULT_OPTIONS } from '@angular/material/checkbox'; @@ -35,7 +35,7 @@ export class FilterComponent implements OnChanges { constructor(private readonly _changeDetectorRef: ChangeDetectorRef) {} - ngOnChanges(changes: SimpleChanges): void { + ngOnChanges(): void { this.atLeastOneFilterIsExpandable = false; this.atLeastOneSecondaryFilterIsExpandable = false; this.primaryFilters?.forEach((f) => { diff --git a/apps/red-ui/src/app/modules/shared/components/filter/utils/filter-utils.ts b/apps/red-ui/src/app/modules/shared/components/filter/utils/filter-utils.ts index a865bb31d..c3f5a8251 100644 --- a/apps/red-ui/src/app/modules/shared/components/filter/utils/filter-utils.ts +++ b/apps/red-ui/src/app/modules/shared/components/filter/utils/filter-utils.ts @@ -144,13 +144,9 @@ export const annotationFilterChecker = (input: FileStatusWrapper | ProjectWrappe export const projectStatusChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.hasStatus(filter.key); -export const projectMemberChecker = (pw: ProjectWrapper, filter: FilterModel) => { - return pw.hasMember(filter.key); -}; +export const projectMemberChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.hasMember(filter.key); -export const ruleSetChecker = (pw: ProjectWrapper, filter: FilterModel) => { - return pw.ruleSetId === filter.key; -}; +export const ruleSetChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.ruleSetId === filter.key; export const dueDateChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.dueDateMatches(filter.key); 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 5b307c5b6..ceedfc18c 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 @@ -9,17 +9,19 @@ import { TranslateService } from '@ngx-translate/core'; styleUrls: ['./initials-avatar.component.scss'] }) export class InitialsAvatarComponent implements OnChanges { - @Input() public userId: string; - @Input() public user: User; - @Input() public color = 'lightgray'; - @Input() public size: 'small' | 'large' = 'small'; - @Input() public withName = false; - @Input() public showYou = false; - @Input() public tooltipPosition: 'below' | 'above' = 'above'; + @Input() userId: string; + @Input() user: User; + @Input() color = 'lightgray'; + @Input() size: 'small' | 'large' = 'small'; + @Input() withName = false; + @Input() showYou = false; + @Input() tooltipPosition: 'below' | 'above' = 'above'; - public displayName: string; - public initials: string; - public colorClass: string; + displayName: string; + + initials: string; + + colorClass: string; constructor(private readonly _userService: UserService, private readonly _translateService: TranslateService) {} @@ -71,11 +73,11 @@ export class InitialsAvatarComponent implements OnChanges { return this.user && this._userService.userId === this.user.userId; } - public get hasBorder(): boolean { - return !!this.user && !this._isCurrentUser && this._userService.isManager(this.user); + get hasBorder(): boolean { + return !!this.user && this._userService.userId !== this.userId && this._userService.isManager(this.user); } - public get disabled(): boolean { + get disabled(): boolean { return !this._userService.isActive(this.user); } } diff --git a/apps/red-ui/src/app/modules/shared/components/pagination/pagination.component.ts b/apps/red-ui/src/app/modules/shared/components/pagination/pagination.component.ts index e4472a8c0..d72bf41e7 100644 --- a/apps/red-ui/src/app/modules/shared/components/pagination/pagination.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/pagination/pagination.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; const DISPLAYED_ITEMS = 5; @@ -7,34 +7,30 @@ const DISPLAYED_ITEMS = 5; templateUrl: './pagination.component.html', styleUrls: ['./pagination.component.scss'] }) -export class PaginationComponent implements OnInit { +export class PaginationComponent { private _currentPage: number; private _totalPages: number; - public displayedPages: (number | string)[]; + displayedPages: (number | string)[]; @Input() - public set settings(value: { currentPage: number; totalPages: number }) { + set settings(value: { currentPage: number; totalPages: number }) { this._currentPage = value.currentPage; this._totalPages = value.totalPages; this._updatePagesArray(); } - public get currentPage() { + get currentPage() { return this._currentPage; } - public get totalPages() { + get totalPages() { return this._totalPages; } @Output() pageChanged = new EventEmitter(); - public displayed; - - constructor() {} - - ngOnInit(): void {} + displayed; private _updatePagesArray() { this.displayedPages = [0]; @@ -52,17 +48,17 @@ export class PaginationComponent implements OnInit { } } - public get allDisplayed(): boolean { + get allDisplayed(): boolean { return this.totalPages > DISPLAYED_ITEMS; } - public selectPage(page: number | string) { + selectPage(page: number | string) { if (page !== '...') { this.pageChanged.emit(page as number); } } - public displayValue(page: number | string) { + displayValue(page: number | string) { return page === '...' ? page : (page as number) + 1; } } diff --git a/apps/red-ui/src/app/modules/shared/components/search-input/search-input.component.ts b/apps/red-ui/src/app/modules/shared/components/search-input/search-input.component.ts index ac1a00683..8b121e247 100644 --- a/apps/red-ui/src/app/modules/shared/components/search-input/search-input.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/search-input/search-input.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; @Component({ @@ -6,24 +6,20 @@ import { FormGroup } from '@angular/forms'; templateUrl: './search-input.component.html', styleUrls: ['./search-input.component.scss'] }) -export class SearchInputComponent implements OnInit { +export class SearchInputComponent { @Input() form: FormGroup; @Input() placeholder: string; @Input() width: number | 'full' = 250; - constructor() {} - - ngOnInit(): void {} - - public get hasContent() { + get hasContent() { return !!this.form.get('query').value.length; } - public clearContent() { + clearContent() { this.form.patchValue({ query: '' }); } - public get computedWidth() { + get computedWidth() { return this.width === 'full' ? '100%' : `${this.width}px`; } } 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 187325716..91d699fbe 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 @@ -47,6 +47,7 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor { this._onChange = fn; } + // eslint-disable-next-line @typescript-eslint/no-unused-vars registerOnTouched(fn: any): void {} writeValue(value: string[]): void { 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 a070c76b5..383f024fa 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 @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core'; import { Color } from '../../../../utils/types'; import { FilterModel } from '../filter/model/filter.model'; @@ -25,18 +25,18 @@ export class SimpleDoughnutChartComponent implements OnChanges { @Input() totalType: 'sum' | 'count' = 'sum'; @Input() counterText: string; @Output() - public toggleFilter = new EventEmitter(); + toggleFilter = new EventEmitter(); - public chartData: any[] = []; - public perimeter: number; - public cx = 0; - public cy = 0; - public size = 0; - public parsedConfig: { color: Color; active?: boolean; checked: boolean; label: string; value: number; key?: string }[]; + chartData: any[] = []; + perimeter: number; + cx = 0; + cy = 0; + size = 0; + parsedConfig: { color: Color; active?: boolean; checked: boolean; label: string; value: number; key?: string }[]; constructor() {} - ngOnChanges(changes: SimpleChanges): void { + ngOnChanges(): void { this.calculateChartData(); this.cx = this.radius + this.strokeWidth / 2; this.cy = this.radius + this.strokeWidth / 2; @@ -89,7 +89,7 @@ export class SimpleDoughnutChartComponent implements OnChanges { return `rotate(${this.chartData[index].degrees}, ${this.cx}, ${this.cy})`; } - public getLabel(config: DoughnutChartConfig): string { + getLabel(config: DoughnutChartConfig): string { return this.totalType === 'sum' ? `${config.value} ${config.label}` : `${config.label} (${config.value} ${this.counterText})`; } diff --git a/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.ts b/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.ts index c2cbaa8f0..1e4a964d5 100644 --- a/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; +import { Component, Input, ViewEncapsulation } from '@angular/core'; import { Color } from '../../../../utils/types'; @Component({ @@ -9,7 +9,7 @@ import { Color } from '../../../../utils/types'; }) export class StatusBarComponent { @Input() - public config: { + config: { length: number; color: Color; label?: string; @@ -17,7 +17,7 @@ export class StatusBarComponent { }[] = []; @Input() - public small = false; + small = false; constructor() {} } diff --git a/apps/red-ui/src/app/modules/shared/components/table-col-name/table-col-name.component.ts b/apps/red-ui/src/app/modules/shared/components/table-col-name/table-col-name.component.ts index 425f8f218..b3cda5121 100644 --- a/apps/red-ui/src/app/modules/shared/components/table-col-name/table-col-name.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/table-col-name/table-col-name.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { SortingOption } from '../../../../services/sorting.service'; @Component({ @@ -6,19 +6,15 @@ import { SortingOption } from '../../../../services/sorting.service'; templateUrl: './table-col-name.component.html', styleUrls: ['./table-col-name.component.scss'] }) -export class TableColNameComponent implements OnInit { - @Input() public activeSortingOption: SortingOption; - @Input() public column: string; - @Input() public label: string; - @Input() public withSort = false; - @Input() public class: string; - @Input() public leftIcon: string; - @Input() public rightIcon: string; - @Input() public rightIconTooltip: string; +export class TableColNameComponent { + @Input() activeSortingOption: SortingOption; + @Input() column: string; + @Input() label: string; + @Input() withSort = false; + @Input() class: string; + @Input() leftIcon: string; + @Input() rightIcon: string; + @Input() rightIconTooltip: string; - @Output() public toggleSort = new EventEmitter(); - - constructor() {} - - ngOnInit(): void {} + @Output() toggleSort = new EventEmitter(); } 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 90a243adc..7f578339e 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 @@ -1,13 +1,13 @@ -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, Inject } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; export class ConfirmationDialogInput { - public title?: string; - public question?: string; - public confirmationText?: string; - public denyText?: string; - public translateParams?: {}; + title?: string; + question?: string; + confirmationText?: string; + denyText?: string; + translateParams?: Record; constructor(options: ConfirmationDialogInput) { this.title = options.title || ConfirmationDialogInput.default().title; @@ -33,7 +33,7 @@ export class ConfirmationDialogInput { templateUrl: './confirmation-dialog.component.html', styleUrls: ['./confirmation-dialog.component.scss'] }) -export class ConfirmationDialogComponent implements OnInit { +export class ConfirmationDialogComponent { constructor( private readonly _translateService: TranslateService, public dialogRef: MatDialogRef, @@ -44,8 +44,6 @@ export class ConfirmationDialogComponent implements OnInit { } } - ngOnInit(): void {} - deny() { this.dialogRef.close(); } diff --git a/apps/red-ui/src/app/modules/shared/directives/has-scrollbar.directive.ts b/apps/red-ui/src/app/modules/shared/directives/has-scrollbar.directive.ts index a3409afe2..c9d8cb664 100644 --- a/apps/red-ui/src/app/modules/shared/directives/has-scrollbar.directive.ts +++ b/apps/red-ui/src/app/modules/shared/directives/has-scrollbar.directive.ts @@ -5,7 +5,7 @@ import { AfterContentChecked, Directive, ElementRef, HostBinding } from '@angula exportAs: 'redactionHasScrollbar' }) export class HasScrollbarDirective implements AfterContentChecked { - constructor(private el: ElementRef) {} + constructor(private readonly _elementRef: ElementRef) {} @HostBinding('class') class = ''; @@ -20,7 +20,7 @@ export class HasScrollbarDirective implements AfterContentChecked { } } - public get hasScrollbar() { - return this.el?.nativeElement.clientHeight < this.el?.nativeElement.scrollHeight; + get hasScrollbar() { + return this._elementRef?.nativeElement.clientHeight < this._elementRef?.nativeElement.scrollHeight; } } diff --git a/apps/red-ui/src/app/modules/shared/directives/sync-width.directive.ts b/apps/red-ui/src/app/modules/shared/directives/sync-width.directive.ts index bbcc3db1b..3cf86d846 100644 --- a/apps/red-ui/src/app/modules/shared/directives/sync-width.directive.ts +++ b/apps/red-ui/src/app/modules/shared/directives/sync-width.directive.ts @@ -10,7 +10,7 @@ export class SyncWidthDirective implements AfterViewInit, OnDestroy { redactionSyncWidth: string; private _interval: number; - constructor(private el: ElementRef) {} + constructor(private readonly _elementRef: ElementRef) {} ngAfterViewInit(): void { this._interval = setInterval(() => { @@ -24,14 +24,14 @@ export class SyncWidthDirective implements AfterViewInit, OnDestroy { @debounce(10) matchWidth() { - const headerItems = this.el.nativeElement.children; - const tableRows = this.el.nativeElement.parentElement.getElementsByClassName(this.redactionSyncWidth); + const headerItems = this._elementRef.nativeElement.children; + const tableRows = this._elementRef.nativeElement.parentElement.getElementsByClassName(this.redactionSyncWidth); if (!tableRows || !tableRows.length) { return; } - this.el.nativeElement.setAttribute('synced', true); + this._elementRef.nativeElement.setAttribute('synced', true); const { tableRow, length } = this._sampleRow(tableRows); diff --git a/apps/red-ui/src/app/modules/upload-download/dialogs/overwrite-files-dialog/overwrite-files-dialog.component.ts b/apps/red-ui/src/app/modules/upload-download/dialogs/overwrite-files-dialog/overwrite-files-dialog.component.ts index 5349af659..be41c881c 100644 --- a/apps/red-ui/src/app/modules/upload-download/dialogs/overwrite-files-dialog/overwrite-files-dialog.component.ts +++ b/apps/red-ui/src/app/modules/upload-download/dialogs/overwrite-files-dialog/overwrite-files-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, Inject } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @@ -7,8 +7,8 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; templateUrl: './overwrite-files-dialog.component.html', styleUrls: ['./overwrite-files-dialog.component.scss'] }) -export class OverwriteFilesDialogComponent implements OnInit { - public remember = false; +export class OverwriteFilesDialogComponent { + remember = false; constructor( private readonly _translateService: TranslateService, @@ -16,8 +16,6 @@ export class OverwriteFilesDialogComponent implements OnInit { @Inject(MAT_DIALOG_DATA) public filename: string ) {} - ngOnInit(): void {} - cancel() { this.dialogRef.close(); } diff --git a/apps/red-ui/src/app/modules/upload-download/file-drop/file-drop.component.ts b/apps/red-ui/src/app/modules/upload-download/file-drop/file-drop.component.ts index 9768d5788..4749518b8 100644 --- a/apps/red-ui/src/app/modules/upload-download/file-drop/file-drop.component.ts +++ b/apps/red-ui/src/app/modules/upload-download/file-drop/file-drop.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, HostListener, OnInit } from '@angular/core'; +import { ChangeDetectorRef, Component, HostListener } from '@angular/core'; import { FileUploadService } from '../services/file-upload.service'; import { FileUploadModel } from '../model/file-upload.model'; import { OverlayRef } from '@angular/cdk/overlay'; @@ -11,7 +11,7 @@ import { AppStateService } from '../../../state/app-state.service'; templateUrl: './file-drop.component.html', styleUrls: ['./file-drop.component.scss'] }) -export class FileDropComponent implements OnInit { +export class FileDropComponent { constructor( private readonly _dialogRef: OverlayRef, private readonly _fileUploadService: FileUploadService, @@ -20,8 +20,6 @@ export class FileDropComponent implements OnInit { private readonly _statusOverlayService: StatusOverlayService ) {} - ngOnInit() {} - close() { setTimeout(() => { this._dialogRef.detach(); diff --git a/apps/red-ui/src/app/modules/upload-download/file-upload-download.module.ts b/apps/red-ui/src/app/modules/upload-download/file-upload-download.module.ts index b507078f1..9d7ccce07 100644 --- a/apps/red-ui/src/app/modules/upload-download/file-upload-download.module.ts +++ b/apps/red-ui/src/app/modules/upload-download/file-upload-download.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FileDropComponent } from './file-drop/file-drop.component'; import { OverlayModule } from '@angular/cdk/overlay'; -import { UploadStatusOverlay } from './upload-status-overlay/upload-status-overlay.component'; +import { UploadStatusOverlayComponent } from './upload-status-overlay/upload-status-overlay.component'; import { SharedModule } from '../shared/shared.module'; import { UploadDownloadDialogService } from './services/upload-download-dialog.service'; import { OverwriteFilesDialogComponent } from './dialogs/overwrite-files-dialog/overwrite-files-dialog.component'; @@ -13,9 +13,9 @@ import { FileDropOverlayService } from './services/file-drop-overlay.service'; @NgModule({ imports: [CommonModule, SharedModule, OverlayModule], - declarations: [FileDropComponent, UploadStatusOverlay, OverwriteFilesDialogComponent], - entryComponents: [FileDropComponent, UploadStatusOverlay], + declarations: [FileDropComponent, UploadStatusOverlayComponent, OverwriteFilesDialogComponent], + entryComponents: [FileDropComponent, UploadStatusOverlayComponent], providers: [UploadDownloadDialogService, FileUploadService, FileDownloadService, StatusOverlayService, FileDropOverlayService], - exports: [FileDropComponent, UploadStatusOverlay] + exports: [FileDropComponent, UploadStatusOverlayComponent] }) export class FileUploadDownloadModule {} diff --git a/apps/red-ui/src/app/modules/upload-download/services/file-download.service.ts b/apps/red-ui/src/app/modules/upload-download/services/file-download.service.ts index 518473261..722b618c9 100644 --- a/apps/red-ui/src/app/modules/upload-download/services/file-download.service.ts +++ b/apps/red-ui/src/app/modules/upload-download/services/file-download.service.ts @@ -13,9 +13,9 @@ import { KeycloakService } from 'keycloak-angular'; @Injectable() export class FileDownloadService { - public downloads: DownloadStatusWrapper[] = []; + downloads: DownloadStatusWrapper[] = []; - public hasPendingDownloads; + hasPendingDownloads; constructor( private readonly _applicationRef: ApplicationRef, @@ -27,7 +27,7 @@ export class FileDownloadService { private readonly _keycloakService: KeycloakService, private readonly _fileManagementControllerService: FileManagementControllerService ) { - interval(5000).subscribe((val) => { + interval(5000).subscribe(() => { if (_permissionsService.isUser()) { this.getDownloadStatus().subscribe(() => {}); } @@ -42,14 +42,10 @@ export class FileDownloadService { reportTypes: ['WORD_SINGLE_FILE_EFSA_TEMPLATE', 'WORD_SINGLE_FILE_SYNGENTA_TEMPLATE', 'EXCEL_MULTI_FILE'], downloadFileTypes: ['PREVIEW', 'REDACTED'] }) - .pipe( - mergeMap(() => { - return this.getDownloadStatus(); - }) - ); + .pipe(mergeMap(() => this.getDownloadStatus())); } - public getDownloadStatus() { + getDownloadStatus() { return this._downloadControllerService.getDownloadStatus().pipe( tap((statusResponse) => { this.downloads = statusResponse.downloadStatus.map((d) => new DownloadStatusWrapper(d)); @@ -58,7 +54,7 @@ export class FileDownloadService { ); } - public async performDownload(status: DownloadStatusWrapper) { + async performDownload(status: DownloadStatusWrapper) { const token = await this._keycloakService.getToken(); const anchor = document.createElement('a'); anchor.href = diff --git a/apps/red-ui/src/app/modules/upload-download/services/file-drop-overlay.service.ts b/apps/red-ui/src/app/modules/upload-download/services/file-drop-overlay.service.ts index 29016a076..4ff2115af 100644 --- a/apps/red-ui/src/app/modules/upload-download/services/file-drop-overlay.service.ts +++ b/apps/red-ui/src/app/modules/upload-download/services/file-drop-overlay.service.ts @@ -8,8 +8,8 @@ export class FileDropOverlayService { private _mouseIn = false; private readonly _dropOverlayRef: OverlayRef; - constructor(private overlay: Overlay, private readonly _injector: Injector) { - this._dropOverlayRef = this.overlay.create({ + constructor(private readonly _overlay: Overlay, private readonly _injector: Injector) { + this._dropOverlayRef = this._overlay.create({ height: '100vh', width: '100vw' }); diff --git a/apps/red-ui/src/app/modules/upload-download/services/file-upload.service.ts b/apps/red-ui/src/app/modules/upload-download/services/file-upload.service.ts index f92b45879..23053921a 100644 --- a/apps/red-ui/src/app/modules/upload-download/services/file-upload.service.ts +++ b/apps/red-ui/src/app/modules/upload-download/services/file-upload.service.ts @@ -32,7 +32,7 @@ export class FileUploadService { private readonly _fileManagementControllerService: FileManagementControllerService, private readonly _dialogService: UploadDownloadDialogService ) { - interval(2500).subscribe((val) => { + interval(2500).subscribe(() => { this._handleUploads(); }); } @@ -54,7 +54,7 @@ export class FileUploadService { for (let idx = 0; idx < files.length; ++idx) { const file = files[idx]; let currentOption = option; - if (!!projectFiles.find((pf) => pf.filename === file.file.name)) { + if (projectFiles.find((pf) => pf.filename === file.file.name)) { if (!option) { const res = await this._dialogService.openOverwriteFileDialog(file.file.name); if (res.cancel) { @@ -91,7 +91,7 @@ export class FileUploadService { this.groupedFiles[file.projectId].push(file); } - public filterFiles() { + filterFiles() { for (const file of this.files) { if (file.completed && !file.error) { this.removeFile(file); @@ -104,7 +104,7 @@ export class FileUploadService { this.groupedFiles[file.projectId].splice(index, 1); } - public get activeProjectKeys() { + get activeProjectKeys() { return Object.keys(this.groupedFiles).filter((projectId) => this.groupedFiles[projectId].length > 0); } diff --git a/apps/red-ui/src/app/modules/upload-download/services/status-overlay.service.ts b/apps/red-ui/src/app/modules/upload-download/services/status-overlay.service.ts index e5b2259a9..fe47689ff 100644 --- a/apps/red-ui/src/app/modules/upload-download/services/status-overlay.service.ts +++ b/apps/red-ui/src/app/modules/upload-download/services/status-overlay.service.ts @@ -1,14 +1,14 @@ import { Injectable, Injector } from '@angular/core'; import { Overlay, OverlayRef } from '@angular/cdk/overlay'; import { ComponentPortal } from '@angular/cdk/portal'; -import { UploadStatusOverlay } from '../upload-status-overlay/upload-status-overlay.component'; +import { UploadStatusOverlayComponent } from '../upload-status-overlay/upload-status-overlay.component'; @Injectable() export class StatusOverlayService { private readonly _uploadStatusOverlayRef: OverlayRef; - constructor(private overlay: Overlay, private readonly _injector: Injector) { - this._uploadStatusOverlayRef = this.overlay.create(); + constructor(private readonly _overlay: Overlay, private readonly _injector: Injector) { + this._uploadStatusOverlayRef = this._overlay.create(); } private _createUploadInjector() { @@ -19,7 +19,7 @@ export class StatusOverlayService { } openUploadStatusOverlay() { - const component = new ComponentPortal(UploadStatusOverlay, null, this._createUploadInjector()); + const component = new ComponentPortal(UploadStatusOverlayComponent, null, this._createUploadInjector()); if (!this._uploadStatusOverlayRef.hasAttached()) { this._uploadStatusOverlayRef.attach(component); } diff --git a/apps/red-ui/src/app/modules/upload-download/services/upload-download-dialog.service.ts b/apps/red-ui/src/app/modules/upload-download/services/upload-download-dialog.service.ts index 9f555f611..686f04943 100644 --- a/apps/red-ui/src/app/modules/upload-download/services/upload-download-dialog.service.ts +++ b/apps/red-ui/src/app/modules/upload-download/services/upload-download-dialog.service.ts @@ -21,8 +21,6 @@ export class UploadDownloadDialogService { return ref .afterClosed() .toPromise() - .then((res) => { - return res || { cancel: true }; - }); + .then((res) => res || { cancel: true }); } } diff --git a/apps/red-ui/src/app/modules/upload-download/upload-status-overlay/upload-status-overlay.component.ts b/apps/red-ui/src/app/modules/upload-download/upload-status-overlay/upload-status-overlay.component.ts index ae18c664e..5abe451b6 100644 --- a/apps/red-ui/src/app/modules/upload-download/upload-status-overlay/upload-status-overlay.component.ts +++ b/apps/red-ui/src/app/modules/upload-download/upload-status-overlay/upload-status-overlay.component.ts @@ -8,16 +8,12 @@ import { OverlayRef } from '@angular/cdk/overlay'; templateUrl: './upload-status-overlay.component.html', styleUrls: ['./upload-status-overlay.component.scss'] }) -export class UploadStatusOverlay implements OnInit { +export class UploadStatusOverlayComponent implements OnInit { collapsed = true; uploadStatusInterval: number; - constructor( - public readonly uploadService: FileUploadService, - private readonly _overlayRef: OverlayRef, - private readonly _changeDetectorRef: ChangeDetectorRef - ) {} + constructor(readonly uploadService: FileUploadService, private readonly _overlayRef: OverlayRef, private readonly _changeDetectorRef: ChangeDetectorRef) {} ngOnInit() { this.uploadStatusInterval = setInterval(() => { diff --git a/apps/red-ui/src/app/services/notification.service.ts b/apps/red-ui/src/app/services/notification.service.ts index 71e6453f8..b5f1fffe4 100644 --- a/apps/red-ui/src/app/services/notification.service.ts +++ b/apps/red-ui/src/app/services/notification.service.ts @@ -12,7 +12,7 @@ export enum NotificationType { export class ToastAction { title: string; - action?: Function; + action?: () => any; } @Injectable({ @@ -27,10 +27,10 @@ export class NotificationService { }); } - public showToastNotification( + showToastNotification( message: string, title?: string, - notificationType: NotificationType = NotificationType.INFO, + notificationType = NotificationType.INFO, options?: Partial & { actions?: ToastAction[] } ): ActiveToast { switch (notificationType) { diff --git a/apps/red-ui/src/app/services/permissions.service.ts b/apps/red-ui/src/app/services/permissions.service.ts index a431ba7b6..441aff79e 100644 --- a/apps/red-ui/src/app/services/permissions.service.ts +++ b/apps/red-ui/src/app/services/permissions.service.ts @@ -19,11 +19,11 @@ export class PermissionsService { return this._userService.userId; } - public isManager(user?: User) { + isManager(user?: User) { return this._userService.isManager(user); } - isReviewerOrOwner(fileStatus?: FileStatusWrapper, user?: User) { + isReviewerOrOwner(fileStatus?: FileStatusWrapper) { return this.isFileReviewer(fileStatus) || this.isManagerAndOwner(); } @@ -186,7 +186,7 @@ export class PermissionsService { return (fileStatus.status === 'UNDER_APPROVAL' || fileStatus.status === 'UNDER_REVIEW') && this.isFileReviewer(fileStatus); } - public canOpenFile(fileStatus: FileStatusWrapper) { + canOpenFile(fileStatus: FileStatusWrapper) { if (!fileStatus) { fileStatus = this._appStateService.activeFile; } diff --git a/apps/red-ui/src/app/services/router-history.service.ts b/apps/red-ui/src/app/services/router-history.service.ts index 0c3a47c4e..8eee3e7ff 100644 --- a/apps/red-ui/src/app/services/router-history.service.ts +++ b/apps/red-ui/src/app/services/router-history.service.ts @@ -16,7 +16,7 @@ export class RouterHistoryService { }); } - public navigateToLastProjectsScreen() { + navigateToLastProjectsScreen() { this._router.navigate([this._lastProjectsScreen]); } } diff --git a/apps/red-ui/src/app/services/sorting.service.ts b/apps/red-ui/src/app/services/sorting.service.ts index 66ab9fb99..cccd17686 100644 --- a/apps/red-ui/src/app/services/sorting.service.ts +++ b/apps/red-ui/src/app/services/sorting.service.ts @@ -22,7 +22,7 @@ export class SortingService { constructor() {} - public toggleSort(screen: ScreenName, column: string) { + toggleSort(screen: ScreenName, column: string) { if (this._options[screen].column === column) { const currentOrder = this._options[screen].order; this._options[screen].order = currentOrder === 'asc' ? 'desc' : 'asc'; @@ -31,7 +31,7 @@ export class SortingService { } } - public getSortingOption(screen: ScreenName) { + getSortingOption(screen: ScreenName) { return this._options[screen]; } } diff --git a/apps/red-ui/src/app/services/translate-chart.service.ts b/apps/red-ui/src/app/services/translate-chart.service.ts index d1ea1582f..b4a7e0235 100644 --- a/apps/red-ui/src/app/services/translate-chart.service.ts +++ b/apps/red-ui/src/app/services/translate-chart.service.ts @@ -8,11 +8,11 @@ import { TranslateService } from '@ngx-translate/core'; export class TranslateChartService { constructor(private readonly _translateService: TranslateService) {} - public translateStatus(config: DoughnutChartConfig[]): DoughnutChartConfig[] { + translateStatus(config: DoughnutChartConfig[]): DoughnutChartConfig[] { return config.map((val) => ({ ...val, label: this._translateService.instant(val.label) })); } - public translateRoles(config: DoughnutChartConfig[]): DoughnutChartConfig[] { + translateRoles(config: DoughnutChartConfig[]): DoughnutChartConfig[] { return config.map((val) => ({ ...val, label: this._translateService.instant(`roles.${val.label}`).toLowerCase() })); } } diff --git a/apps/red-ui/src/app/services/user-preference.service.ts b/apps/red-ui/src/app/services/user-preference.service.ts index a81b85893..b77e13d58 100644 --- a/apps/red-ui/src/app/services/user-preference.service.ts +++ b/apps/red-ui/src/app/services/user-preference.service.ts @@ -12,7 +12,7 @@ export class UserPreferenceService { return false; } - public toggleDevFeatures() { + toggleDevFeatures() { sessionStorage.setItem('redaction.enable-dev-features', `${!this.areDevFeaturesEnabled}`); window.location.reload(); } diff --git a/apps/red-ui/src/app/services/user.service.ts b/apps/red-ui/src/app/services/user.service.ts index 8fab39dd3..de98f24ad 100644 --- a/apps/red-ui/src/app/services/user.service.ts +++ b/apps/red-ui/src/app/services/user.service.ts @@ -56,7 +56,7 @@ export class UserService { private _allUsers: User[]; constructor( - @Inject(BASE_HREF) public readonly baseHref: string, + @Inject(BASE_HREF) readonly baseHref: string, private readonly _keycloakService: KeycloakService, private readonly _userControllerService: UserControllerService ) {} diff --git a/apps/red-ui/src/app/state/app-state.guard.ts b/apps/red-ui/src/app/state/app-state.guard.ts index 3c59af301..60df77836 100644 --- a/apps/red-ui/src/app/state/app-state.guard.ts +++ b/apps/red-ui/src/app/state/app-state.guard.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router'; +import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router'; import { AppStateService } from './app-state.service'; import { UserService } from '../services/user.service'; @@ -9,7 +9,7 @@ import { UserService } from '../services/user.service'; export class AppStateGuard implements CanActivate { constructor(private readonly _appStateService: AppStateService, private readonly _userService: UserService, private readonly _router: Router) {} - async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise { + async canActivate(route: ActivatedRouteSnapshot): Promise { if (this._userService.user.isUserAdmin) { await this._userService.loadAllUsersIfNecessary(); } 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 b20209c81..c1d4ab192 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -43,8 +43,8 @@ export interface AppState { export class AppStateService { private _appState: AppState; private _dictionaryData: { [key: string]: { [key: string]: TypeValue } } = null; - public fileChanged = new EventEmitter(); - public fileReanalysed = new EventEmitter(); + fileChanged = new EventEmitter(); + fileReanalysed = new EventEmitter(); constructor( private readonly _router: Router, @@ -112,14 +112,14 @@ export class AppStateService { return fileStatus.dictionaryVersion === this.dictionaryVersion() && fileStatus.rulesVersion === this.rulesVersion(); } - public dictionaryVersion(ruleSetId?: string) { + dictionaryVersion(ruleSetId?: string) { if (!ruleSetId) { ruleSetId = this.activeProject.ruleSetId; } return this._appState.versions[ruleSetId].dictionaryVersion; } - public rulesVersion(ruleSetId?: string) { + rulesVersion(ruleSetId?: string) { if (!ruleSetId) { ruleSetId = this.activeProject.ruleSetId; } @@ -173,15 +173,15 @@ export class AppStateService { return this.getRuleSetById(this.activeRuleSetId); } - public get ruleSets(): RuleSetModel[] { + get ruleSets(): RuleSetModel[] { return this._appState.ruleSets; } - public getRuleSetById(id: string): RuleSetModel { + getRuleSetById(id: string): RuleSetModel { return this.ruleSets.find((rs) => rs.ruleSetId === id); } - public get activeFileAttributesConfig(): FileAttributesConfig { + get activeFileAttributesConfig(): FileAttributesConfig { if (this.activeProject) { return this._appState.fileAttributesConfig[this.activeProject.ruleSetId]; } @@ -247,20 +247,18 @@ export class AppStateService { return this._appState.totalDocuments; } - public getProjectById(id: string) { + getProjectById(id: string) { return this.allProjects.find((project) => project.project.projectId === id); } - public getFileById(projectId: string, fileId: string) { + getFileById(projectId: string, fileId: string) { return this.getProjectById(projectId).files.find((file) => file.fileId === fileId); } async loadAllProjects(emitEvents: boolean = true) { const projects = await this._projectControllerService.getProjects().toPromise(); if (projects) { - const mappedProjects = projects.map((p) => { - return new ProjectWrapper(p, this._getExistingFiles(p.projectId)); - }); + const mappedProjects = projects.map((p) => new ProjectWrapper(p, this._getExistingFiles(p.projectId))); const fileData = await this._statusControllerService.getFileStatusForProjects(mappedProjects.map((p) => p.projectId)).toPromise(); @@ -532,7 +530,7 @@ export class AppStateService { } } - getDictionaryDataForRuleSetObservables(ruleSetId: string, dictionaryData: {}): Observable[] { + getDictionaryDataForRuleSetObservables(ruleSetId: string, dictionaryData: { [key: string]: any }): Observable[] { const typeObs = this._dictionaryControllerService.getAllTypes(ruleSetId).pipe( tap((typesResponse) => { for (const type of typesResponse.types) { diff --git a/apps/red-ui/src/app/state/model/project.wrapper.ts b/apps/red-ui/src/app/state/model/project.wrapper.ts index de4798f62..3a09114fe 100644 --- a/apps/red-ui/src/app/state/model/project.wrapper.ts +++ b/apps/red-ui/src/app/state/model/project.wrapper.ts @@ -45,6 +45,10 @@ export class ProjectWrapper { this._recomputeFileStatus(); } + get files() { + return this._files; + } + get memberIds() { return this.project.memberIds; } @@ -53,10 +57,6 @@ export class ProjectWrapper { return this.project.approverIds; } - get files() { - return this._files; - } - get projectDate() { return this.project.date; } diff --git a/apps/red-ui/src/app/utils/dialog-helper.ts b/apps/red-ui/src/app/utils/dialog-helper.ts index 8b3025220..653b86897 100644 --- a/apps/red-ui/src/app/utils/dialog-helper.ts +++ b/apps/red-ui/src/app/utils/dialog-helper.ts @@ -2,9 +2,9 @@ import { MatDialogConfig } from '@angular/material/dialog'; import { Overlay, OverlayConfig } from '@angular/cdk/overlay'; export class DialogHelper { - public static _MARGIN = '16px'; + static _MARGIN = '16px'; - public static generateDialogConfig(injectionData?: any | null): MatDialogConfig { + static generateDialogConfig(injectionData?: any | null): MatDialogConfig { const viewPortWidth = window.innerWidth; if (viewPortWidth < 600) { return DialogHelper.generateFullScreenDialogConfig(injectionData); @@ -20,7 +20,7 @@ export class DialogHelper { return conf; } - public static generateMediumDialogConfig(injectionData?: any | null): MatDialogConfig { + static generateMediumDialogConfig(injectionData?: any | null): MatDialogConfig { const conf = new MatDialogConfig(); conf.width = '60vw'; conf.maxHeight = '88vh'; @@ -31,7 +31,7 @@ export class DialogHelper { return conf; } - public static generateLargeDialogConfig(injectionData?: any | null): MatDialogConfig { + static generateLargeDialogConfig(injectionData?: any | null): MatDialogConfig { const conf = new MatDialogConfig(); conf.height = '90vh'; conf.width = '90vw'; @@ -42,7 +42,7 @@ export class DialogHelper { return conf; } - public static generateFullScreenDialogConfig(injectionData?: any | null): MatDialogConfig { + static generateFullScreenDialogConfig(injectionData?: any | null): MatDialogConfig { const conf = new MatDialogConfig(); conf.height = '100vh'; conf.width = '100vw'; @@ -53,28 +53,20 @@ export class DialogHelper { return conf; } - public static generateFileDropConfig(overlay: Overlay): OverlayConfig { + static generateFileDropConfig(overlay: Overlay): OverlayConfig { const config = new OverlayConfig(); config.hasBackdrop = true; config.backdropClass = 'dark-backdrop'; config.panelClass = 'gin-file-upload-dialog-panel'; config.scrollStrategy = overlay.scrollStrategies.block(); - config.positionStrategy = overlay - .position() - .global() - .centerHorizontally() - .centerVertically(); + config.positionStrategy = overlay.position().global().centerHorizontally().centerVertically(); return config; } - public static generateUploadStatusConfig(overlay: Overlay): OverlayConfig { + static generateUploadStatusConfig(overlay: Overlay): OverlayConfig { const config = new OverlayConfig(); config.hasBackdrop = false; - config.positionStrategy = overlay - .position() - .global() - .bottom(DialogHelper._MARGIN) - .right(DialogHelper._MARGIN); + config.positionStrategy = overlay.position().global().bottom(DialogHelper._MARGIN).right(DialogHelper._MARGIN); return config; } } diff --git a/apps/red-ui/tsconfig.app.json b/apps/red-ui/tsconfig.app.json index 8289972bc..a8d67e989 100644 --- a/apps/red-ui/tsconfig.app.json +++ b/apps/red-ui/tsconfig.app.json @@ -4,5 +4,6 @@ "outDir": "../../dist/out-tsc", "types": [] }, + "include": ["src/**/*.ts"], "files": ["src/main.ts", "src/polyfills.ts"] } diff --git a/package.json b/package.json index b4ef5560b..493c0a394 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "help": "nx help", "postinstall": "ngcc --properties es2015 browser module main", "lint": "nx workspace-lint && nx lint", + "lint-fix": "nx workspace-lint --fix && nx lint --fix", "nx": "nx", "start": "nx serve", "test": "nx test",