fix eslint errors

This commit is contained in:
Dan Percic 2021-05-08 01:07:48 +03:00
parent 0464eb3789
commit 369b890e69
116 changed files with 834 additions and 927 deletions

View File

@ -62,14 +62,45 @@
"@angular-eslint/use-pipe-transform-interface": "error", "@angular-eslint/use-pipe-transform-interface": "error",
"@typescript-eslint/consistent-type-definitions": "error", "@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off", "@typescript-eslint/dot-notation": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-member-accessibility": [ "@typescript-eslint/explicit-member-accessibility": [
"off", "warn",
{ {
"accessibility": "explicit" "accessibility": "no-public"
} }
], ],
"@typescript-eslint/member-ordering": "error", "@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-function": "off",
"@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-inferrable-types": [ "@typescript-eslint/no-inferrable-types": [

View File

@ -29,9 +29,9 @@ import { UserProfileScreenComponent } from './components/user-profile/user-profi
import { PlatformLocation } from '@angular/common'; import { PlatformLocation } from '@angular/common';
import { BASE_HREF } from './tokens'; 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'); return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json');
} }
@ -68,7 +68,7 @@ const components = [AppComponent, LogoComponent, AuthErrorComponent, ToastCompon
TranslateModule.forRoot({ TranslateModule.forRoot({
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,
useFactory: HttpLoaderFactory, useFactory: httpLoaderFactory,
deps: [HttpClient] deps: [HttpClient]
} }
}), }),

View File

@ -24,11 +24,11 @@ export class BaseScreenComponent {
} }
constructor( constructor(
public readonly appStateService: AppStateService, readonly appStateService: AppStateService,
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
public readonly userPreferenceService: UserPreferenceService, readonly userPreferenceService: UserPreferenceService,
public readonly titleService: Title, readonly titleService: Title,
public readonly fileDownloadService: FileDownloadService, readonly fileDownloadService: FileDownloadService,
private readonly _statusOverlayService: StatusOverlayService, private readonly _statusOverlayService: StatusOverlayService,
private readonly _appConfigService: AppConfigService, private readonly _appConfigService: AppConfigService,
private readonly _router: Router, private readonly _router: Router,

View File

@ -9,17 +9,17 @@ import { DownloadControllerService } from '@redaction/red-ui-http';
styleUrls: ['./downloads-list-screen.component.scss'] styleUrls: ['./downloads-list-screen.component.scss']
}) })
export class DownloadsListScreenComponent implements OnInit { export class DownloadsListScreenComponent implements OnInit {
constructor(public readonly fileDownloadService: FileDownloadService, private readonly _downloadControllerService: DownloadControllerService) {} constructor(readonly fileDownloadService: FileDownloadService, private readonly _downloadControllerService: DownloadControllerService) {}
ngOnInit(): void { ngOnInit(): void {
this.fileDownloadService.getDownloadStatus().subscribe(); this.fileDownloadService.getDownloadStatus().subscribe();
} }
public get noData(): boolean { get noData(): boolean {
return this.fileDownloadService.downloads.length === 0; return this.fileDownloadService.downloads.length === 0;
} }
public async downloadItem(download: DownloadStatusWrapper) { async downloadItem(download: DownloadStatusWrapper) {
await this.fileDownloadService.performDownload(download); await this.fileDownloadService.performDownload(download);
} }

View File

@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'redaction-logo', selector: 'redaction-logo',
templateUrl: './logo.component.html', templateUrl: './logo.component.html',
styleUrls: ['./logo.component.scss'] styleUrls: ['./logo.component.scss']
}) })
export class LogoComponent implements OnInit { export class LogoComponent {}
constructor() {}
ngOnInit(): void {}
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component } from '@angular/core';
import * as moment from 'moment'; import * as moment from 'moment';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
@ -13,23 +13,21 @@ interface Notification {
templateUrl: './notifications.component.html', templateUrl: './notifications.component.html',
styleUrls: ['./notifications.component.scss'] styleUrls: ['./notifications.component.scss']
}) })
export class NotificationsComponent implements OnInit { export class NotificationsComponent {
public notifications: Notification[] = [ notifications: Notification[] = [
{ message: 'This is a notification with longer text wrapping on multiple lines', eventTime: 1607340971000, read: false }, { message: 'This is a notification with longer text wrapping on multiple lines', eventTime: 1607340971000, read: false },
{ message: 'This is a <a>link</a>', eventTime: 1607254981000, read: true }, { message: 'This is a <a>link</a>', eventTime: 1607254981000, read: true },
{ message: 'This is a <b>notification 1</b>', eventTime: 1607254571000, read: false }, { message: 'This is a <b>notification 1</b>', eventTime: 1607254571000, read: false },
{ message: 'Notification', eventTime: 1607385727000, read: true }, { message: 'Notification', eventTime: 1607385727000, read: true },
{ message: 'Another notification', eventTime: 1606829412000, read: false } { message: 'Another notification', eventTime: 1606829412000, read: false }
]; ];
public groupedNotifications: { dateString: string; notifications: Notification[] }[] = []; groupedNotifications: { dateString: string; notifications: Notification[] }[] = [];
constructor(private _translateService: TranslateService) { constructor(private _translateService: TranslateService) {
this._groupNotifications(); this._groupNotifications();
} }
ngOnInit(): void {} get hasUnread() {
public get hasUnread() {
return this.notifications.filter((notification) => !notification.read).length > 0; 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); moment.locale(this._translateService.currentLang);
return moment(group.notifications[0].eventTime).calendar({ return moment(group.notifications[0].eventTime).calendar({
sameDay: `[${this._translateService.instant('notifications.today')}]`, 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); moment.locale(this._translateService.currentLang);
if (moment().isSame(eventTime, 'day')) { if (moment().isSame(eventTime, 'day')) {
return moment(eventTime).fromNow(); return moment(eventTime).fromNow();
@ -66,7 +64,7 @@ export class NotificationsComponent implements OnInit {
} }
} }
public toggleRead(notification: Notification, $event) { toggleRead(notification: Notification, $event) {
$event.stopPropagation(); $event.stopPropagation();
notification.read = !notification.read; notification.read = !notification.read;
} }

View File

@ -7,16 +7,17 @@ import { Toast, ToastPackage, ToastrService } from 'ngx-toastr';
styleUrls: ['./toast.component.scss'] styleUrls: ['./toast.component.scss']
}) })
export class ToastComponent extends Toast { export class ToastComponent extends Toast {
constructor(protected toastrService: ToastrService, public toastPackage: ToastPackage) { constructor(protected readonly _toastrService: ToastrService, readonly toastPackage: ToastPackage) {
super(toastrService, toastPackage); super(_toastrService, toastPackage);
} }
public get actions() { get actions() {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
return this.options.actions; return this.options.actions;
} }
public callAction($event: MouseEvent, action: Function) { callAction($event: MouseEvent, action: Function) {
$event.stopPropagation(); $event.stopPropagation();
if (action) { if (action) {
action(); action();

View File

@ -19,12 +19,12 @@ interface ProfileModel {
styleUrls: ['./user-profile-screen.component.scss'] styleUrls: ['./user-profile-screen.component.scss']
}) })
export class UserProfileScreenComponent implements OnInit { export class UserProfileScreenComponent implements OnInit {
public viewReady = false; viewReady = false;
public formGroup: FormGroup; formGroup: FormGroup;
private _profileModel: ProfileModel; private _profileModel: ProfileModel;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
private readonly _userService: UserService, private readonly _userService: UserService,
private readonly _userControllerService: UserControllerService, private readonly _userControllerService: UserControllerService,

View File

@ -24,7 +24,7 @@ export abstract class ComponentHasChanges implements ComponentCanDeactivate {
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class PendingChangesGuard implements CanDeactivate<ComponentCanDeactivate> { export class PendingChangesGuard implements CanDeactivate<ComponentCanDeactivate> {
constructor(private readonly translateService: TranslateService) {} constructor(private readonly _translateService: TranslateService) {}
canDeactivate(component: ComponentCanDeactivate): boolean | Observable<boolean> { canDeactivate(component: ComponentCanDeactivate): boolean | Observable<boolean> {
// if there are no pending changes, just allow deactivation; else confirm first // if there are no pending changes, just allow deactivation; else confirm first
@ -33,6 +33,6 @@ export class PendingChangesGuard implements CanDeactivate<ComponentCanDeactivate
: // NOTE: this warning message will only be shown when navigating elsewhere within your angular app; : // NOTE: this warning message will only be shown when navigating elsewhere within your angular app;
// when navigating away from your angular app, the browser will show a generic warning message // when navigating away from your angular app, the browser will show a generic warning message
// see http://stackoverflow.com/a/42207299/7307355 // see http://stackoverflow.com/a/42207299/7307355
confirm(this.translateService.instant('pending-changes-guard')); confirm(this._translateService.instant('pending-changes-guard'));
} }
} }

View File

@ -5,36 +5,34 @@ import { TranslateService } from '@ngx-translate/core';
providedIn: 'root' providedIn: 'root'
}) })
export class LanguageService { export class LanguageService {
constructor(private translateService: TranslateService) { constructor(private readonly _translateService: TranslateService) {
translateService.addLangs(['en', 'de']); _translateService.addLangs(['en', 'de']);
} }
get currentLanguage() { get currentLanguage() {
return this.translateService.currentLang; return this._translateService.currentLang;
} }
chooseAndSetInitialLanguage() { chooseAndSetInitialLanguage() {
let defaultLang: string; let defaultLang: string;
const localStorageLang = localStorage.getItem('redaction.language'); const localStorageLang = localStorage.getItem('redaction.language');
// const browserLang = this.translateService.getBrowserLang(); // const browserLang = this._translateService.getBrowserLang();
const browserLang = 'en'; // Force language to english until translations are ready const browserLang = 'en'; // Force language to english until translations are ready
// @ts-ignore if (this._translateService.getLangs().includes(localStorageLang)) {
if (this.translateService.getLangs().includes(localStorageLang)) {
defaultLang = localStorageLang; defaultLang = localStorageLang;
// @ts-ignore } else if (this._translateService.getLangs().includes(browserLang)) {
} else if (this.translateService.getLangs().includes(browserLang)) {
defaultLang = browserLang; defaultLang = browserLang;
} else { } else {
defaultLang = 'en'; defaultLang = 'en';
} }
document.documentElement.lang = defaultLang; document.documentElement.lang = defaultLang;
this.translateService.setDefaultLang(defaultLang); this._translateService.setDefaultLang(defaultLang);
this.translateService.use(defaultLang).subscribe(() => {}); this._translateService.use(defaultLang).subscribe(() => {});
} }
changeLanguage(language: string) { changeLanguage(language: string) {
localStorage.setItem('redaction.language', language); localStorage.setItem('redaction.language', language);
document.documentElement.lang = language; document.documentElement.lang = language;
this.translateService.use(language).subscribe(() => {}); this._translateService.use(language).subscribe(() => {});
} }
} }

View File

@ -16,7 +16,7 @@ export class AnnotationPermissions {
canForceRedaction: boolean; canForceRedaction: boolean;
public static forUser(isManagerAndOwner: boolean, user: UserWrapper, annotation: AnnotationWrapper) { static forUser(isManagerAndOwner: boolean, user: UserWrapper, annotation: AnnotationWrapper) {
const permissions: AnnotationPermissions = new AnnotationPermissions(); const permissions: AnnotationPermissions = new AnnotationPermissions();
permissions.canUndo = permissions.canUndo =
@ -41,7 +41,7 @@ export class AnnotationPermissions {
return permissions; return permissions;
} }
public get canPerformMultipleRemoveActions() { get canPerformMultipleRemoveActions() {
return ( return (
<any>this.canMarkTextOnlyAsFalsePositive + <any>this.canMarkTextOnlyAsFalsePositive +
<any>this.canMarkAsFalsePositive + <any>this.canMarkAsFalsePositive +

View File

@ -38,9 +38,7 @@ export class FileDataModel {
let allAnnotations = entries.map((entry) => AnnotationWrapper.fromData(entry)); let allAnnotations = entries.map((entry) => AnnotationWrapper.fromData(entry));
if (!areDevFeaturesEnabled) { if (!areDevFeaturesEnabled) {
allAnnotations = allAnnotations.filter((annotation) => { allAnnotations = allAnnotations.filter((annotation) => !annotation.isFalsePositive);
return !annotation.isFalsePositive;
});
} }
const visibleAnnotations = allAnnotations.filter((annotation) => { const visibleAnnotations = allAnnotations.filter((annotation) => {
@ -113,7 +111,7 @@ export class FileDataModel {
} }
// an entry for this request already exists in the redactionLog // an entry for this request already exists in the redactionLog
if (!!relevantRedactionLogEntry) { if (relevantRedactionLogEntry) {
relevantRedactionLogEntry.userId = forceRedaction.user; relevantRedactionLogEntry.userId = forceRedaction.user;
relevantRedactionLogEntry.dictionaryEntry = false; relevantRedactionLogEntry.dictionaryEntry = false;
relevantRedactionLogEntry.force = true; relevantRedactionLogEntry.force = true;
@ -132,14 +130,14 @@ export class FileDataModel {
const relevantRedactionLogEntry = result.find((r) => r.id === manual.id); const relevantRedactionLogEntry = result.find((r) => r.id === manual.id);
// a redaction-log entry is marked as a reason for another entry - hide it // 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')) { if (!(this._hasAlreadyBeenProcessed(manual) && manual.status === 'APPROVED')) {
markedAsReasonRedactionLogEntry.hidden = true; markedAsReasonRedactionLogEntry.hidden = true;
} }
} }
// an entry for this request already exists in the redactionLog // an entry for this request already exists in the redactionLog
if (!!relevantRedactionLogEntry) { if (relevantRedactionLogEntry) {
if (relevantRedactionLogEntry.status === 'DECLINED') { if (relevantRedactionLogEntry.status === 'DECLINED') {
relevantRedactionLogEntry.hidden = true; relevantRedactionLogEntry.hidden = true;
return; return;
@ -178,7 +176,7 @@ export class FileDataModel {
redactionLogEntryWrapper.manualRedactionType = 'ADD'; redactionLogEntryWrapper.manualRedactionType = 'ADD';
redactionLogEntryWrapper.manual = true; redactionLogEntryWrapper.manual = true;
redactionLogEntryWrapper.comments = this.manualRedactions.comments[redactionLogEntryWrapper.id]; 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 // cleanup reason if the reason is another annotationId - it is not needed for drawing
redactionLogEntryWrapper.reason = null; redactionLogEntryWrapper.reason = null;
} }

View File

@ -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'; import { StatusSorter } from '../../utils/sorters/status-sorter';
export class FileStatusWrapper { export class FileStatusWrapper {

View File

@ -2,10 +2,10 @@ import { ManualRedactionEntry } from '@redaction/red-ui-http';
export class ManualRedactionEntryWrapper { export class ManualRedactionEntryWrapper {
constructor( constructor(
public readonly quads: any, readonly quads: any,
public readonly manualRedactionEntry: ManualRedactionEntry, readonly manualRedactionEntry: ManualRedactionEntry,
public readonly type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE', readonly type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE',
public readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT', readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT',
public readonly rectId?: string readonly rectId?: string
) {} ) {}
} }

View File

@ -9,11 +9,11 @@ import { PermissionsService } from '../../../../services/permissions.service';
styleUrls: ['./admin-breadcrumbs.component.scss'] styleUrls: ['./admin-breadcrumbs.component.scss']
}) })
export class AdminBreadcrumbsComponent { export class AdminBreadcrumbsComponent {
@Input() public root = false; @Input() root = false;
constructor( constructor(
public readonly userPreferenceService: UserPreferenceService, readonly userPreferenceService: UserPreferenceService,
public readonly permissionService: PermissionsService, readonly permissionService: PermissionsService,
public readonly appStateService: AppStateService readonly appStateService: AppStateService
) {} ) {}
} }

View File

@ -364,9 +364,7 @@ export class ComboChartComponent extends BaseChartComponent {
} }
onActivate(item) { onActivate(item) {
const idx = this.activeEntries.findIndex((d) => { const idx = this.activeEntries.findIndex((d) => d.name === item.name && d.value === item.value && d.series === item.series);
return d.name === item.name && d.value === item.value && d.series === item.series;
});
if (idx > -1) { if (idx > -1) {
return; return;
} }
@ -376,9 +374,7 @@ export class ComboChartComponent extends BaseChartComponent {
} }
onDeactivate(item) { onDeactivate(item) {
const idx = this.activeEntries.findIndex((d) => { const idx = this.activeEntries.findIndex((d) => d.name === item.name && d.value === item.value && d.series === item.series);
return d.name === item.name && d.value === item.value && d.series === item.series;
});
this.activeEntries.splice(idx, 1); this.activeEntries.splice(idx, 1);
this.activeEntries = [...this.activeEntries]; this.activeEntries = [...this.activeEntries];

View File

@ -1,5 +1,5 @@
import { Component, Input, Output, EventEmitter, OnChanges, ChangeDetectionStrategy } from '@angular/core'; import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { trigger, style, animate, transition } from '@angular/animations'; import { animate, style, transition, trigger } from '@angular/animations';
import { formatLabel } from '@swimlane/ngx-charts'; import { formatLabel } from '@swimlane/ngx-charts';
@Component({ @Component({
@ -68,7 +68,7 @@ export class ComboSeriesVerticalComponent implements OnChanges {
x: any; x: any;
y: any; y: any;
ngOnChanges(changes): void { ngOnChanges(): void {
this.update(); this.update();
} }
@ -163,23 +163,21 @@ export class ComboSeriesVerticalComponent implements OnChanges {
this.getSeriesTooltips(this.seriesLine, index); this.getSeriesTooltips(this.seriesLine, index);
const lineValue = this.seriesLine[0].series[index].value; const lineValue = this.seriesLine[0].series[index].value;
bar.tooltipText = ` bar.tooltipText = `
<span class="tooltip-label">${tooltipLabel}</span> <span class='tooltip-label'>${tooltipLabel}</span>
<span class="tooltip-val"> Y1 - ${value.toLocaleString()} Y2 - ${lineValue.toLocaleString()}%</span> <span class='tooltip-val'> Y1 - ${value.toLocaleString()} Y2 - ${lineValue.toLocaleString()}%</span>
`; `;
return bar; return bar;
}); });
} }
getSeriesTooltips(seriesLine, index) { getSeriesTooltips(seriesLine, index) {
return seriesLine.map((d) => { return seriesLine.map((d) => d.series[index]);
return d.series[index];
});
} }
isActive(entry): boolean { isActive(entry): boolean {
if (!this.activeEntries) return false; if (!this.activeEntries) return false;
const item = this.activeEntries.find((d) => { const item = this.activeEntries.find((d) => entry.name === d.name && entry.series === d.series);
return entry.name === d.name && entry.series === d.series;
});
return item !== undefined; return item !== undefined;
} }

View File

@ -17,14 +17,14 @@ export class RuleSetActionsComponent {
private readonly _dialogService: AdminDialogService, private readonly _dialogService: AdminDialogService,
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
private readonly _router: Router, private readonly _router: Router,
public readonly permissionsService: PermissionsService readonly permissionsService: PermissionsService
) { ) {
if (!this.ruleSetId) { if (!this.ruleSetId) {
this.ruleSetId = this._appStateService.activeRuleSetId; this.ruleSetId = this._appStateService.activeRuleSetId;
} }
} }
public get ruleSet() { get ruleSet() {
return this._appStateService.getRuleSetById(this.ruleSetId); return this._appStateService.getRuleSetById(this.ruleSetId);
} }

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input } from '@angular/core';
import { PermissionsService } from '../../../../services/permissions.service'; import { PermissionsService } from '../../../../services/permissions.service';
import { UserPreferenceService } from '../../../../services/user-preference.service'; import { UserPreferenceService } from '../../../../services/user-preference.service';
import { AppStateService } from '../../../../state/app-state.service'; import { AppStateService } from '../../../../state/app-state.service';
@ -8,10 +8,10 @@ import { AppStateService } from '../../../../state/app-state.service';
templateUrl: './side-nav.component.html', templateUrl: './side-nav.component.html',
styleUrls: ['./side-nav.component.scss'] styleUrls: ['./side-nav.component.scss']
}) })
export class SideNavComponent implements OnInit { export class SideNavComponent {
@Input() type: 'settings' | 'project-templates'; @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: [ settings: [
{ screen: 'project-templates', onlyAdmin: true }, { screen: 'project-templates', onlyAdmin: true },
{ screen: 'digital-signature', onlyAdmin: true }, { screen: 'digital-signature', onlyAdmin: true },
@ -31,14 +31,12 @@ export class SideNavComponent implements OnInit {
constructor( constructor(
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
public readonly userPreferenceService: UserPreferenceService, readonly userPreferenceService: UserPreferenceService,
public readonly permissionsService: PermissionsService readonly permissionsService: PermissionsService
) {} ) {}
ngOnInit(): void {} get prefix() {
if (this._appStateService.activeDictionaryType) {
public get prefix() {
if (!!this._appStateService.activeDictionaryType) {
return '../../'; return '../../';
} }

View File

@ -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 { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
@Component({ @Component({
@ -6,11 +6,7 @@ import { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-
templateUrl: './users-stats.component.html', templateUrl: './users-stats.component.html',
styleUrls: ['./users-stats.component.scss'] styleUrls: ['./users-stats.component.scss']
}) })
export class UsersStatsComponent implements OnInit { export class UsersStatsComponent {
@Output() public toggleCollapse = new EventEmitter(); @Output() toggleCollapse = new EventEmitter();
@Input() chartData: DoughnutChartConfig[]; @Input() chartData: DoughnutChartConfig[];
constructor() {}
ngOnInit(): void {}
} }

View File

@ -14,7 +14,7 @@ import { TranslateService } from '@ngx-translate/core';
}) })
export class AddEditDictionaryDialogComponent { export class AddEditDictionaryDialogComponent {
dictionaryForm: FormGroup; dictionaryForm: FormGroup;
public readonly dictionary: TypeValue; readonly dictionary: TypeValue;
private readonly _ruleSetId: string; private readonly _ruleSetId: string;
constructor( constructor(
@ -39,11 +39,11 @@ export class AddEditDictionaryDialogComponent {
}); });
} }
public get dictCaseSensitive() { get dictCaseSensitive() {
return this.dictionary ? !this.dictionary.caseInsensitive : false; return this.dictionary ? !this.dictionary.caseInsensitive : false;
} }
public get changed(): boolean { get changed(): boolean {
if (!this.dictionary) return true; if (!this.dictionary) return true;
for (const key of Object.keys(this.dictionaryForm.getRawValue())) { for (const key of Object.keys(this.dictionaryForm.getRawValue())) {

View File

@ -10,10 +10,10 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./add-edit-file-attribute-dialog.component.scss'] styleUrls: ['./add-edit-file-attribute-dialog.component.scss']
}) })
export class AddEditFileAttributeDialogComponent { export class AddEditFileAttributeDialogComponent {
public fileAttributeForm: FormGroup; fileAttributeForm: FormGroup;
public fileAttribute: FileAttributeConfig; fileAttribute: FileAttributeConfig;
public ruleSetId: string; ruleSetId: string;
public readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE]; readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE];
constructor( constructor(
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
@ -33,7 +33,7 @@ export class AddEditFileAttributeDialogComponent {
}); });
} }
public get changed(): boolean { get changed(): boolean {
if (!this.fileAttribute) return true; if (!this.fileAttribute) return true;
for (const key of Object.keys(this.fileAttributeForm.getRawValue())) { for (const key of Object.keys(this.fileAttributeForm.getRawValue())) {

View File

@ -13,11 +13,11 @@ import { applyIntervalConstraints } from '../../../../utils/date-inputs-utils';
styleUrls: ['./add-edit-rule-set-dialog.component.scss'] styleUrls: ['./add-edit-rule-set-dialog.component.scss']
}) })
export class AddEditRuleSetDialogComponent { export class AddEditRuleSetDialogComponent {
public ruleSetForm: FormGroup; ruleSetForm: FormGroup;
public hasValidFrom: boolean; hasValidFrom: boolean;
public hasValidTo: boolean; hasValidTo: boolean;
public downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED']; downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED'];
public reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum); reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum);
private _previousValidFrom: Moment; private _previousValidFrom: Moment;
private _previousValidTo: Moment; private _previousValidTo: Moment;
@ -75,7 +75,7 @@ export class AddEditRuleSetDialogComponent {
}; };
} }
public get changed(): boolean { get changed(): boolean {
if (!this.ruleSet) return true; if (!this.ruleSet) return true;
for (const key of Object.keys(this.ruleSetForm.getRawValue())) { for (const key of Object.keys(this.ruleSetForm.getRawValue())) {

View File

@ -10,9 +10,9 @@ import { UserService } from '../../../../services/user.service';
styleUrls: ['./add-edit-user-dialog.component.scss'] styleUrls: ['./add-edit-user-dialog.component.scss']
}) })
export class AddEditUserDialogComponent { export class AddEditUserDialogComponent {
public userForm: FormGroup; userForm: FormGroup;
public ROLES = ['RED_USER', 'RED_MANAGER', 'RED_USER_ADMIN', 'RED_ADMIN']; readonly ROLES = ['RED_USER', 'RED_MANAGER', 'RED_USER_ADMIN', 'RED_ADMIN'];
private ROLE_REQUIREMENTS = { RED_MANAGER: 'RED_USER', RED_ADMIN: 'RED_USER_ADMIN' }; private readonly _ROLE_REQUIREMENTS = { RED_MANAGER: 'RED_USER', RED_ADMIN: 'RED_USER_ADMIN' };
constructor( constructor(
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
@ -28,9 +28,10 @@ export class AddEditUserDialogComponent {
value: this.user && this.user.roles.indexOf(role) !== -1, value: this.user && this.user.roles.indexOf(role) !== -1,
disabled: disabled:
this.user && this.user &&
Object.keys(this.ROLE_REQUIREMENTS).reduce((value, key) => { Object.keys(this._ROLE_REQUIREMENTS).reduce(
return value || (role === this.ROLE_REQUIREMENTS[key] && this.user.roles.indexOf(key) !== -1); (value, key) => value || (role === this._ROLE_REQUIREMENTS[key] && this.user.roles.indexOf(key) !== -1),
}, false) false
)
} }
] ]
}), }),
@ -47,19 +48,19 @@ export class AddEditUserDialogComponent {
} }
private _setRolesRequirements() { 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) => { this.userForm.controls[key].valueChanges.subscribe((checked) => {
if (checked) { if (checked) {
this.userForm.patchValue({ [this.ROLE_REQUIREMENTS[key]]: true }); this.userForm.patchValue({ [this._ROLE_REQUIREMENTS[key]]: true });
this.userForm.controls[this.ROLE_REQUIREMENTS[key]].disable(); this.userForm.controls[this._ROLE_REQUIREMENTS[key]].disable();
} else { } 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; if (!this.user) return true;
for (const key of Object.keys(this.userForm.getRawValue())) { for (const key of Object.keys(this.userForm.getRawValue())) {
@ -71,18 +72,18 @@ export class AddEditUserDialogComponent {
return false; return false;
} }
public async save() { async save() {
this.dialogRef.close({ this.dialogRef.close({
action: this.user ? 'UPDATE' : 'CREATE', action: this.user ? 'UPDATE' : 'CREATE',
user: { ...this.userForm.getRawValue(), roles: this.activeRoles } user: { ...this.userForm.getRawValue(), roles: this.activeRoles }
}); });
} }
public async delete() { async delete() {
this.dialogRef.close('DELETE'); this.dialogRef.close('DELETE');
} }
public get activeRoles(): string[] { get activeRoles(): string[] {
return this.ROLES.reduce((acc, role) => { return this.ROLES.reduce((acc, role) => {
if (this.userForm.get(role).value) { if (this.userForm.get(role).value) {
acc.push(role); acc.push(role);

View File

@ -9,12 +9,12 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./confirm-delete-file-attribute-dialog.component.scss'] styleUrls: ['./confirm-delete-file-attribute-dialog.component.scss']
}) })
export class ConfirmDeleteFileAttributeDialogComponent { export class ConfirmDeleteFileAttributeDialogComponent {
public fileAttribute: FileAttributeConfig; fileAttribute: FileAttributeConfig;
public checkboxes = [ checkboxes = [
{ value: false, label: 'impacted-documents.' + this.type }, { value: false, label: 'impacted-documents.' + this.type },
{ value: false, label: 'lost-details' } { value: false, label: 'lost-details' }
]; ];
public showToast = false; showToast = false;
constructor( constructor(
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
@ -24,11 +24,11 @@ export class ConfirmDeleteFileAttributeDialogComponent {
this.fileAttribute = data; this.fileAttribute = data;
} }
public get valid() { get valid() {
return this.checkboxes[0].value && this.checkboxes[1].value; return this.checkboxes[0].value && this.checkboxes[1].value;
} }
public deleteFileAttribute() { deleteFileAttribute() {
if (this.valid) { if (this.valid) {
this.dialogRef.close(true); this.dialogRef.close(true);
} else { } else {
@ -36,11 +36,11 @@ export class ConfirmDeleteFileAttributeDialogComponent {
} }
} }
public get type(): 'bulk' | 'single' { get type(): 'bulk' | 'single' {
return !this.fileAttribute ? 'bulk' : 'single'; return !this.fileAttribute ? 'bulk' : 'single';
} }
public cancel() { cancel() {
this.dialogRef.close(); this.dialogRef.close();
} }
} }

View File

@ -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 { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { User } from '@redaction/red-ui-http'; import { User } from '@redaction/red-ui-http';
import { AppStateService } from '../../../../state/app-state.service'; 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', templateUrl: './confirm-delete-users-dialog.component.html',
styleUrls: ['./confirm-delete-users-dialog.component.scss'] styleUrls: ['./confirm-delete-users-dialog.component.scss']
}) })
export class ConfirmDeleteUsersDialogComponent implements OnInit { export class ConfirmDeleteUsersDialogComponent {
public checkboxes = [ checkboxes = [
{ value: false, label: 'impacted-projects' }, { value: false, label: 'impacted-projects' },
{ value: false, label: 'impacted-documents.' + this.type } { value: false, label: 'impacted-documents.' + this.type }
]; ];
public showToast = false; showToast = false;
public projectsCount: number; projectsCount: number;
constructor( constructor(
@Inject(MAT_DIALOG_DATA) public users: User[], @Inject(MAT_DIALOG_DATA) public users: User[],
@ -31,8 +31,6 @@ export class ConfirmDeleteUsersDialogComponent implements OnInit {
}).length; }).length;
} }
ngOnInit(): void {}
async deleteUser() { async deleteUser() {
if (this.valid) { if (this.valid) {
this.dialogRef.close(true); 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; return this.checkboxes[0].value && this.checkboxes[1].value;
} }
public cancel() { cancel() {
this.dialogRef.close(); this.dialogRef.close();
} }
public get type(): 'bulk' | 'single' { get type(): 'bulk' | 'single' {
return this.users.length > 1 ? 'bulk' : 'single'; return this.users.length > 1 ? 'bulk' : 'single';
} }
} }

View File

@ -11,11 +11,11 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./edit-color-dialog.component.scss'] styleUrls: ['./edit-color-dialog.component.scss']
}) })
export class EditColorDialogComponent { export class EditColorDialogComponent {
public readonly colors: Colors; readonly colors: Colors;
public readonly colorKey: string; readonly colorKey: string;
private readonly _initialColor: string; private readonly _initialColor: string;
private readonly _ruleSetId: string; private readonly _ruleSetId: string;
public colorForm: FormGroup; colorForm: FormGroup;
constructor( constructor(
private readonly _formBuilder: FormBuilder, 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; return this.colorForm.get('color').value !== this._initialColor;
} }

View File

@ -9,12 +9,12 @@ import { FileAttributeConfig } from '@redaction/red-ui-http';
styleUrls: ['./active-fields-listing.component.scss'] styleUrls: ['./active-fields-listing.component.scss']
}) })
export class ActiveFieldsListingComponent extends BaseListingComponent<Field> implements OnChanges { export class ActiveFieldsListingComponent extends BaseListingComponent<Field> implements OnChanges {
@Input() public allEntities: Field[]; @Input() allEntities: Field[];
@Output() public allEntitiesChange = new EventEmitter<Field[]>(); @Output() allEntitiesChange = new EventEmitter<Field[]>();
@Output() public setHoveredColumn = new EventEmitter<string>(); @Output() setHoveredColumn = new EventEmitter<string>();
@Output() public toggleFieldActive = new EventEmitter<Field>(); @Output() toggleFieldActive = new EventEmitter<Field>();
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'; protected readonly _selectionKey = 'csvColumn';
@ -29,20 +29,20 @@ export class ActiveFieldsListingComponent extends BaseListingComponent<Field> im
} }
} }
public deactivateSelection() { deactivateSelection() {
this.allEntities.filter((field) => this.isEntitySelected(field)).forEach((field) => (field.primaryAttribute = false)); this.allEntities.filter((field) => this.isEntitySelected(field)).forEach((field) => (field.primaryAttribute = false));
this.allEntities = [...this.allEntities.filter((field) => !this.isEntitySelected(field))]; this.allEntities = [...this.allEntities.filter((field) => !this.isEntitySelected(field))];
this.allEntitiesChange.emit(this.allEntities); this.allEntitiesChange.emit(this.allEntities);
this.selectedEntitiesIds = []; this.selectedEntitiesIds = [];
} }
public setAttributeForSelection(attribute: string, value: any) { setAttributeForSelection(attribute: string, value: any) {
for (const csvColumn of this.selectedEntitiesIds) { for (const csvColumn of this.selectedEntitiesIds) {
this.allEntities.find((f) => f.csvColumn === csvColumn)[attribute] = value; this.allEntities.find((f) => f.csvColumn === csvColumn)[attribute] = value;
} }
} }
public togglePrimary(field: Field) { togglePrimary(field: Field) {
if (field.primaryAttribute) { if (field.primaryAttribute) {
field.primaryAttribute = false; field.primaryAttribute = false;
} else { } else {

View File

@ -30,18 +30,18 @@ export interface Field {
export class FileAttributesCsvImportDialogComponent extends BaseListingComponent<Field> { export class FileAttributesCsvImportDialogComponent extends BaseListingComponent<Field> {
protected readonly _searchKey = 'csvColumn'; protected readonly _searchKey = 'csvColumn';
public csvFile: File; csvFile: File;
public ruleSetId: string; ruleSetId: string;
public parseResult: { data: any[]; errors: any[]; meta: any; fields: Field[] }; parseResult: { data: any[]; errors: any[]; meta: any; fields: Field[] };
public hoveredColumn: string; hoveredColumn: string;
public activeFields: Field[] = []; activeFields: Field[] = [];
public baseConfigForm: FormGroup; baseConfigForm: FormGroup;
public isSearchOpen = false; isSearchOpen = false;
public previewExpanded = true; previewExpanded = true;
public filteredKeyOptions: Observable<string[]>; filteredKeyOptions: Observable<string[]>;
public keepPreview = false; keepPreview = false;
public columnSample = []; columnSample = [];
public initialParseConfig: { delimiter?: string; encoding?: string } = {}; initialParseConfig: { delimiter?: string; encoding?: string } = {};
@ViewChild(CdkVirtualScrollViewport, { static: false }) cdkVirtualScrollViewport: CdkVirtualScrollViewport; @ViewChild(CdkVirtualScrollViewport, { static: false }) cdkVirtualScrollViewport: CdkVirtualScrollViewport;
@ -76,7 +76,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
}; };
} }
public readFile() { readFile() {
const reader = new FileReader(); const reader = new FileReader();
reader.addEventListener('load', async (event) => { reader.addEventListener('load', async (event) => {
const parsedCsv = <any>event.target.result; const parsedCsv = <any>event.target.result;
@ -97,7 +97,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
for (const entity of this.allEntities) { for (const entity of this.allEntities) {
const existing = this.data.existingConfiguration.fileAttributeConfigs.find((a) => a.csvColumnHeader === entity.csvColumn); const existing = this.data.existingConfiguration.fileAttributeConfigs.find((a) => a.csvColumnHeader === entity.csvColumn);
if (!!existing) { if (existing) {
entity.id = existing.id; entity.id = existing.id;
entity.name = existing.label; entity.name = existing.label;
entity.temporaryName = existing.label; entity.temporaryName = existing.label;
@ -130,11 +130,11 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
reader.readAsText(this.csvFile, this.baseConfigForm.get('encoding').value); 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] : ''; return this.parseResult?.data?.length ? this.parseResult?.data[0][csvColumn] : '';
} }
public getEntries(csvColumn: string) { getEntries(csvColumn: string) {
if (this.parseResult?.data) { if (this.parseResult?.data) {
let count = 0; let count = 0;
for (const entry of this.parseResult.data) { 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; return this.activeFields.indexOf(field) !== -1;
} }
public toggleFieldActive(field: Field) { toggleFieldActive(field: Field) {
if (!this.isActive(field)) { if (!this.isActive(field)) {
this.activeFields = [...this.activeFields, field]; this.activeFields = [...this.activeFields, field];
} else { } else {
@ -174,15 +174,15 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
}; };
} }
public activateAll() { activateAll() {
this.activeFields = [...this.allEntities]; this.activeFields = [...this.allEntities];
} }
public deactivateAll() { deactivateAll() {
this.activeFields = []; this.activeFields = [];
} }
public async save() { async save() {
const newPrimary = !!this.activeFields.find((attr) => attr.primaryAttribute); const newPrimary = !!this.activeFields.find((attr) => attr.primaryAttribute);
if (newPrimary) { if (newPrimary) {
@ -195,16 +195,14 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
...this.data.existingConfiguration.fileAttributeConfigs.filter( ...this.data.existingConfiguration.fileAttributeConfigs.filter(
(a) => !this.allEntities.find((entity) => entity.csvColumn === a.csvColumnHeader) (a) => !this.allEntities.find((entity) => entity.csvColumn === a.csvColumnHeader)
), ),
...this.activeFields.map((field) => { ...this.activeFields.map((field) => ({
return { id: field.id,
id: field.id, csvColumnHeader: field.csvColumn,
csvColumnHeader: field.csvColumn, editable: !field.readonly,
editable: !field.readonly, label: field.name,
label: field.name, type: field.type,
type: field.type, primaryAttribute: field.primaryAttribute
primaryAttribute: field.primaryAttribute }))
};
})
] ]
}; };
@ -226,7 +224,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
this.dialogRef.close(true); this.dialogRef.close(true);
} }
public setHoveredColumn(column?: string) { setHoveredColumn(column?: string) {
setTimeout(() => { setTimeout(() => {
if (this.keepPreview && !column) { if (this.keepPreview && !column) {
return; return;
@ -241,7 +239,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
}, 0); }, 0);
} }
public get changedParseConfig(): boolean { get changedParseConfig(): boolean {
return ( return (
this.initialParseConfig.delimiter !== this.baseConfigForm.get('delimiter').value || this.initialParseConfig.delimiter !== this.baseConfigForm.get('delimiter').value ||
this.initialParseConfig.encoding !== this.baseConfigForm.get('encoding').value this.initialParseConfig.encoding !== this.baseConfigForm.get('encoding').value

View File

@ -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 { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { UserService } from '../../../../services/user.service'; import { UserService } from '../../../../services/user.service';
@ -9,8 +9,8 @@ import { SMTPConfigurationModel } from '@redaction/red-ui-http';
templateUrl: './smtp-auth-dialog.component.html', templateUrl: './smtp-auth-dialog.component.html',
styleUrls: ['./smtp-auth-dialog.component.scss'] styleUrls: ['./smtp-auth-dialog.component.scss']
}) })
export class SmtpAuthDialogComponent implements OnInit { export class SmtpAuthDialogComponent {
public authForm: FormGroup; authForm: FormGroup;
constructor( constructor(
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
@ -24,9 +24,7 @@ export class SmtpAuthDialogComponent implements OnInit {
}); });
} }
ngOnInit(): void {} save() {
public save() {
this.dialogRef.close(this.authForm.getRawValue()); this.dialogRef.close(this.authForm.getRawValue());
} }
} }

View File

@ -14,21 +14,21 @@ const PAGE_SIZE = 50;
styleUrls: ['./audit-screen.component.scss'] styleUrls: ['./audit-screen.component.scss']
}) })
export class AuditScreenComponent { export class AuditScreenComponent {
public filterForm: FormGroup; readonly ALL_CATEGORIES = 'audit-screen.all-categories';
public viewReady = false; readonly ALL_USERS = 'audit-screen.all-users';
public categories: string[] = [];
public userIds: Set<string>;
public logs: AuditResponse;
public currentPage = 1;
public ALL_CATEGORIES = 'audit-screen.all-categories'; filterForm: FormGroup;
public ALL_USERS = 'audit-screen.all-users'; viewReady = false;
categories: string[] = [];
userIds: Set<string>;
logs: AuditResponse;
currentPage = 1;
private _previousFrom: Moment; private _previousFrom: Moment;
private _previousTo: Moment; private _previousTo: Moment;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
private readonly _auditControllerService: AuditControllerService, private readonly _auditControllerService: AuditControllerService,
private readonly _translateService: TranslateService private readonly _translateService: TranslateService
@ -66,7 +66,7 @@ export class AuditScreenComponent {
const userId = this.filterForm.get('userId').value; const userId = this.filterForm.get('userId').value;
const from = this.filterForm.get('from').value; const from = this.filterForm.get('from').value;
let to = this.filterForm.get('to').value; let to = this.filterForm.get('to').value;
if (!!to) { if (to) {
to = to.clone().add(1, 'd'); to = to.clone().add(1, 'd');
} }
const logsRequestBody: AuditSearchRequest = { const logsRequestBody: AuditSearchRequest = {
@ -94,14 +94,14 @@ export class AuditScreenComponent {
}); });
} }
public get totalPages(): number { get totalPages(): number {
if (!this.logs) { if (!this.logs) {
return 0; return 0;
} }
return Math.ceil(this.logs.totalHits / PAGE_SIZE); return Math.ceil(this.logs.totalHits / PAGE_SIZE);
} }
public pageChanged(page: number) { pageChanged(page: number) {
this._fetchData(page); this._fetchData(page);
} }
} }

View File

@ -14,7 +14,7 @@ import { BaseListingComponent } from '../../../shared/base/base-listing.componen
export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: string; value: string }> { export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: string; value: string }> {
protected readonly _sortKey = 'default-colors'; protected readonly _sortKey = 'default-colors';
public viewReady = false; viewReady = false;
private _colorsObj: Colors; private _colorsObj: Colors;
constructor( constructor(
@ -22,7 +22,7 @@ export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: st
private readonly _activatedRoute: ActivatedRoute, private readonly _activatedRoute: ActivatedRoute,
private readonly _dictionaryControllerService: DictionaryControllerService, private readonly _dictionaryControllerService: DictionaryControllerService,
private readonly _dialogService: AdminDialogService, private readonly _dialogService: AdminDialogService,
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
protected readonly _injector: Injector protected readonly _injector: Injector
) { ) {
super(_injector); super(_injector);
@ -30,7 +30,7 @@ export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: st
this._loadColors(); this._loadColors();
} }
public async loadRuleSetsData(): Promise<void> { async loadRuleSetsData(): Promise<void> {
await this._appStateService.loadAllRuleSets(); await this._appStateService.loadAllRuleSets();
} }

View File

@ -19,15 +19,15 @@ export class DictionaryListingScreenComponent extends BaseListingComponent<TypeV
protected readonly _selectionKey = 'type'; protected readonly _selectionKey = 'type';
protected readonly _sortKey = 'dictionary-listing'; protected readonly _sortKey = 'dictionary-listing';
public viewReady = false; viewReady = false;
public chartData: DoughnutChartConfig[] = []; chartData: DoughnutChartConfig[] = [];
constructor( constructor(
private readonly _dialogService: AdminDialogService, private readonly _dialogService: AdminDialogService,
private readonly _dictionaryControllerService: DictionaryControllerService, private readonly _dictionaryControllerService: DictionaryControllerService,
private readonly _activatedRoute: ActivatedRoute, private readonly _activatedRoute: ActivatedRoute,
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
protected readonly _injector: Injector protected readonly _injector: Injector
) { ) {
super(_injector); super(_injector);

View File

@ -88,14 +88,14 @@
<div class="red-input-group w-200 mr-8"> <div class="red-input-group w-200 mr-8">
<mat-select formControlName="ruleSet"> <mat-select formControlName="ruleSet">
<mat-option *ngFor="let ruleSet of ruleSets" [value]="ruleSet"> <mat-option *ngFor="let ruleSet of ruleSets" [value]="ruleSet">
{{ ruleSet === SELECT_RULESET ? (ruleSet.name | translate) : ruleSet.name }} {{ ruleSet === selectRuleSet ? (ruleSet.name | translate) : ruleSet.name }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</div> </div>
<div class="red-input-group w-200"> <div class="red-input-group w-200">
<mat-select formControlName="dictionary"> <mat-select formControlName="dictionary">
<mat-option *ngFor="let dictionary of dictionaries" [value]="dictionary"> <mat-option *ngFor="let dictionary of dictionaries" [value]="dictionary">
{{ dictionary === SELECT_DICTIONARY ? (dictionary.label | translate) : dictionary.label }} {{ dictionary === selectDictionary ? (dictionary.label | translate) : dictionary.label }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</div> </div>
@ -114,13 +114,13 @@
class="ace-redaction" class="ace-redaction"
> >
</ace-editor> </ace-editor>
<div class="no-dictionary-selected" *ngIf="compareForm.get('active').value && compareForm.get('dictionary').value === SELECT_DICTIONARY"> <div class="no-dictionary-selected" *ngIf="compareForm.get('active').value && compareForm.get('dictionary').value === selectDictionary">
<mat-icon svgIcon="red:dictionary"></mat-icon> <mat-icon svgIcon="red:dictionary"></mat-icon>
<span class="heading-l" translate="dictionary-overview.select-dictionary"></span> <span class="heading-l" translate="dictionary-overview.select-dictionary"></span>
</div> </div>
<ace-editor <ace-editor
#compareEditorComponent #compareEditorComponent
*ngIf="compareForm.get('active').value && compareForm.get('dictionary').value !== SELECT_DICTIONARY" *ngIf="compareForm.get('active').value && compareForm.get('dictionary').value !== selectDictionary"
[mode]="'text'" [mode]="'text'"
[theme]="'eclipse'" [theme]="'eclipse'"
[options]="aceOptions" [options]="aceOptions"

View File

@ -13,7 +13,8 @@ import { ComponentHasChanges } from '../../../../guards/can-deactivate.guard';
import { FormBuilder, FormGroup } from '@angular/forms'; import { FormBuilder, FormGroup } from '@angular/forms';
import { AdminDialogService } from '../../services/admin-dialog.service'; import { AdminDialogService } from '../../services/admin-dialog.service';
declare var ace; declare let ace;
const MIN_WORD_LENGTH = 2;
@Component({ @Component({
selector: 'redaction-dictionary-overview-screen', selector: 'redaction-dictionary-overview-screen',
@ -21,8 +22,6 @@ declare var ace;
styleUrls: ['./dictionary-overview-screen.component.scss'] styleUrls: ['./dictionary-overview-screen.component.scss']
}) })
export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit { export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit {
static readonly MIN_WORD_LENGTH: number = 2;
activeEditMarkers: any[] = []; activeEditMarkers: any[] = [];
activeSearchMarkers: any[] = []; activeSearchMarkers: any[] = [];
searchPositions: any[] = []; searchPositions: any[] = [];
@ -35,18 +34,18 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
searchText = ''; searchText = '';
processing = true; processing = true;
public SELECT_RULESET = { name: 'dictionary-overview.compare.select-ruleset' }; selectRuleSet = { name: 'dictionary-overview.compare.select-ruleset' };
public SELECT_DICTIONARY = { label: 'dictionary-overview.compare.select-dictionary' }; selectDictionary = { label: 'dictionary-overview.compare.select-dictionary' };
public ruleSets: RuleSetModel[]; ruleSets: RuleSetModel[];
public dictionaries: TypeValue[] = [this.SELECT_DICTIONARY]; dictionaries: TypeValue[] = [this.selectDictionary];
public compareForm: FormGroup; compareForm: FormGroup;
@ViewChild('editorComponent', { static: true }) private _editorComponent: AceEditorComponent; @ViewChild('editorComponent', { static: true }) private _editorComponent: AceEditorComponent;
@ViewChild('compareEditorComponent') private _compareEditorComponent: AceEditorComponent; @ViewChild('compareEditorComponent') private _compareEditorComponent: AceEditorComponent;
@ViewChild('fileInput') private _fileInput: ElementRef; @ViewChild('fileInput') private _fileInput: ElementRef;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _notificationService: NotificationService, private readonly _notificationService: NotificationService,
protected readonly _translateService: TranslateService, protected readonly _translateService: TranslateService,
private readonly _dictionaryControllerService: DictionaryControllerService, private readonly _dictionaryControllerService: DictionaryControllerService,
@ -61,17 +60,17 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
this.compareForm = this._formBuilder.group({ this.compareForm = this._formBuilder.group({
active: [false], active: [false],
ruleSet: [{ value: this.SELECT_RULESET, disabled: true }], ruleSet: [{ value: this.selectRuleSet, disabled: true }],
dictionary: [{ value: this.SELECT_DICTIONARY, disabled: true }] dictionary: [{ value: this.selectDictionary, disabled: true }]
}); });
this.compareForm.valueChanges.subscribe((value) => { this.compareForm.valueChanges.subscribe((value) => {
this._setFieldStatus('ruleSet', value.active); 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._loadDictionaries();
}); });
this.ruleSets = [this.SELECT_RULESET, ...this._appStateService.ruleSets]; this.ruleSets = [this.selectRuleSet, ...this._appStateService.ruleSets];
this._initializeEditor(); this._initializeEditor();
@ -84,11 +83,11 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
}); });
} }
public get dictionary(): TypeValue { get dictionary(): TypeValue {
return this._appStateService.activeDictionary; return this._appStateService.activeDictionary;
} }
public get hasChanges() { get hasChanges() {
return ( return (
this.currentDictionaryEntries.length && this.currentDictionaryEntries.length &&
(this.activeEditMarkers.length > 0 || (this.activeEditMarkers.length > 0 ||
@ -112,14 +111,14 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
}); });
} }
public openEditDictionaryDialog($event: any) { openEditDictionaryDialog($event: any) {
$event.stopPropagation(); $event.stopPropagation();
this._dialogService.openAddEditDictionaryDialog(this.dictionary, this.dictionary.ruleSetId, async () => { this._dialogService.openAddEditDictionaryDialog(this.dictionary, this.dictionary.ruleSetId, async () => {
await this._appStateService.loadDictionaryData(); await this._appStateService.loadDictionaryData();
}); });
} }
public openDeleteDictionaryDialog($event: any) { openDeleteDictionaryDialog($event: any) {
this._dialogService.openDeleteDictionaryDialog($event, this.dictionary, this.dictionary.ruleSetId, async () => { this._dialogService.openDeleteDictionaryDialog($event, this.dictionary, this.dictionary.ruleSetId, async () => {
await this._appStateService.loadDictionaryData(); await this._appStateService.loadDictionaryData();
this._router.navigate(['..']); this._router.navigate(['..']);
@ -127,7 +126,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
} }
@debounce() @debounce()
public searchChanged(text: string) { searchChanged(text: string) {
this.searchText = text.toLowerCase(); this.searchText = text.toLowerCase();
this._applySearchMarkers(); this._applySearchMarkers();
this.currentMatch = 0; this.currentMatch = 0;
@ -135,7 +134,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
} }
@debounce(500) @debounce(500)
public textChanged($event: any) { textChanged($event: any) {
this._applySearchMarkers(); this._applySearchMarkers();
this.currentDictionaryEntries = $event.split('\n'); this.currentDictionaryEntries = $event.split('\n');
this.changedLines = []; 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) { for (const i of this.changedLines) {
const entry = this.currentDictionaryEntries[i]; const entry = this.currentDictionaryEntries[i];
if (entry?.trim().length > 0) { if (entry?.trim().length > 0) {
// only mark non-empty lines // 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 // 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 = []; let entriesToAdd = [];
this.currentDictionaryEntries.forEach((currentEntry) => { this.currentDictionaryEntries.forEach((currentEntry) => {
entriesToAdd.push(currentEntry); entriesToAdd.push(currentEntry);
}); });
// remove empty lines // remove empty lines
entriesToAdd = entriesToAdd.filter((e) => e && e.trim().length > 0).map((e) => e.trim()); 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) { if (invalidRowsExist.length === 0) {
// can add at least 1 - block UI // can add at least 1 - block UI
this.processing = true; this.processing = true;
@ -210,13 +209,13 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
} }
} }
public revert() { revert() {
DictionaryOverviewScreenComponent._setEditorValue(this._editorComponent, this.initialDictionaryEntries); DictionaryOverviewScreenComponent._setEditorValue(this._editorComponent, this.initialDictionaryEntries);
this.searchChanged(''); this.searchChanged('');
this.processing = false; this.processing = false;
} }
public nextSearchMatch() { nextSearchMatch() {
// length = 3 // length = 3
if (this.searchPositions.length > 0) { if (this.searchPositions.length > 0) {
this.currentMatch = this.currentMatch < this.searchPositions.length ? this.currentMatch + 1 : 1; 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) { if (this.searchPositions.length > 0) {
this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.searchPositions.length; this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.searchPositions.length;
this._gotoLine(); this._gotoLine();
} }
} }
public download(): void { download(): void {
const content = this._editorComponent.getEditor().getValue(); const content = this._editorComponent.getEditor().getValue();
const blob = new Blob([content], { const blob = new Blob([content], {
type: 'text/plain;charset=utf-8' type: 'text/plain;charset=utf-8'
@ -239,7 +238,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
saveAs(blob, `${this.dictionary.label}.txt`); saveAs(blob, `${this.dictionary.label}.txt`);
} }
public upload($event): void { upload($event): void {
const file = $event.target.files[0]; const file = $event.target.files[0];
const fileReader = new FileReader(); const fileReader = new FileReader();
@ -253,18 +252,18 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
} }
private _syncActiveLines() { private _syncActiveLines() {
if (!!this._compareEditorComponent) { if (this._compareEditorComponent) {
this._compareEditorComponent.getEditor().gotoLine(this._activeRow); this._compareEditorComponent.getEditor().gotoLine(this._activeRow);
} }
} }
private _onRuleSetChanged() { private _onRuleSetChanged() {
this._loadDictionaries(); this._loadDictionaries();
this.compareForm.patchValue({ dictionary: this.SELECT_DICTIONARY }); this.compareForm.patchValue({ dictionary: this.selectDictionary });
} }
private _onDictionaryChanged(dictionary: TypeValue) { private _onDictionaryChanged(dictionary: TypeValue) {
if (dictionary !== this.SELECT_DICTIONARY) { if (dictionary !== this.selectDictionary) {
this._dictionaryControllerService.getDictionaryForType(dictionary.type, dictionary.ruleSetId).subscribe( this._dictionaryControllerService.getDictionaryForType(dictionary.type, dictionary.ruleSetId).subscribe(
(data) => { (data) => {
this.compareDictionaryEntries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' })); 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() { private _loadDictionaries() {
const ruleSetId = this.compareForm.get('ruleSet').value.ruleSetId; const ruleSetId = this.compareForm.get('ruleSet').value.ruleSetId;
if (!ruleSetId) { if (!ruleSetId) {
this.dictionaries = [this.SELECT_DICTIONARY]; this.dictionaries = [this.selectDictionary];
return; return;
} }
const appStateDictionaryData = this._appStateService.dictionaryData[ruleSetId]; const appStateDictionaryData = this._appStateService.dictionaryData[ruleSetId];
this.dictionaries = [ this.dictionaries = [
this.SELECT_DICTIONARY, this.selectDictionary,
...Object.keys(appStateDictionaryData) ...Object.keys(appStateDictionaryData)
.map((key) => appStateDictionaryData[key]) .map((key) => appStateDictionaryData[key])
.filter((d) => !d.virtual || d.type === 'false_positive') .filter((d) => !d.virtual || d.type === 'false_positive')
@ -317,13 +316,13 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
}); });
this.activeSearchMarkers = []; this.activeSearchMarkers = [];
const Range = ace.require('ace/range').Range; const range = ace.require('ace/range').Range;
for (const position of this.searchPositions) { for (const position of this.searchPositions) {
this.activeSearchMarkers.push( this.activeSearchMarkers.push(
this._editorComponent this._editorComponent
.getEditor() .getEditor()
.getSession() .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')
); );
} }
} }

View File

@ -12,18 +12,18 @@ import { lastIndexOfEnd } from '../../../../utils/functions';
styleUrls: ['./digital-signature-screen.component.scss'] styleUrls: ['./digital-signature-screen.component.scss']
}) })
export class DigitalSignatureScreenComponent { export class DigitalSignatureScreenComponent {
public digitalSignature: DigitalSignature; digitalSignature: DigitalSignature;
public digitalSignatureForm: FormGroup; digitalSignatureForm: FormGroup;
public viewReady = false; viewReady = false;
public digitalSignatureExists = false; digitalSignatureExists = false;
constructor( constructor(
private readonly _digitalSignatureControllerService: DigitalSignatureControllerService, private readonly _digitalSignatureControllerService: DigitalSignatureControllerService,
private readonly _notificationService: NotificationService, private readonly _notificationService: NotificationService,
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
private readonly _translateService: TranslateService, private readonly _translateService: TranslateService,
public readonly permissionsService: PermissionsService readonly permissionsService: PermissionsService
) { ) {
this.loadDigitalSignatureAndInitializeForm(); this.loadDigitalSignatureAndInitializeForm();
} }

View File

@ -16,15 +16,15 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent<F
protected readonly _selectionKey = 'id'; protected readonly _selectionKey = 'id';
protected readonly _sortKey = 'file-attributes-listing'; protected readonly _sortKey = 'file-attributes-listing';
public viewReady = false; viewReady = false;
public loading = false; loading = false;
private _existingConfiguration: FileAttributesConfig; private _existingConfiguration: FileAttributesConfig;
@ViewChild('fileInput') private _fileInput: ElementRef; @ViewChild('fileInput') private _fileInput: ElementRef;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _fileAttributesService: FileAttributesControllerService, private readonly _fileAttributesService: FileAttributesControllerService,
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
private readonly _activatedRoute: ActivatedRoute, private readonly _activatedRoute: ActivatedRoute,
@ -52,7 +52,7 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent<F
} }
} }
public openAddEditAttributeDialog($event: MouseEvent, fileAttribute?: FileAttributeConfig) { openAddEditAttributeDialog($event: MouseEvent, fileAttribute?: FileAttributeConfig) {
$event.stopPropagation(); $event.stopPropagation();
this._dialogService.openAddEditFileAttributeDialog(fileAttribute, this._appStateService.activeRuleSetId, async (newValue: FileAttributeConfig) => { this._dialogService.openAddEditFileAttributeDialog(fileAttribute, this._appStateService.activeRuleSetId, async (newValue: FileAttributeConfig) => {
this.loading = true; this.loading = true;
@ -61,11 +61,11 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent<F
}); });
} }
public openConfirmDeleteAttributeDialog($event: MouseEvent, fileAttribute?: FileAttributeConfig) { openConfirmDeleteAttributeDialog($event: MouseEvent, fileAttribute?: FileAttributeConfig) {
$event.stopPropagation(); $event.stopPropagation();
this._dialogService.openConfirmDeleteFileAttributeDialog(fileAttribute, this._appStateService.activeRuleSetId, async () => { this._dialogService.openConfirmDeleteFileAttributeDialog(fileAttribute, this._appStateService.activeRuleSetId, async () => {
this.loading = true; this.loading = true;
if (!!fileAttribute) { if (fileAttribute) {
await this._fileAttributesService.deleteFileAttribute(this._appStateService.activeRuleSetId, fileAttribute.id).toPromise(); await this._fileAttributesService.deleteFileAttribute(this._appStateService.activeRuleSetId, fileAttribute.id).toPromise();
} else { } else {
await this._fileAttributesService.deleteFileAttributes(this.selectedEntitiesIds, this._appStateService.activeRuleSetId).toPromise(); await this._fileAttributesService.deleteFileAttributes(this.selectedEntitiesIds, this._appStateService.activeRuleSetId).toPromise();
@ -74,7 +74,7 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent<F
}); });
} }
public importCSV(files: FileList | File[]) { importCSV(files: FileList | File[]) {
const csvFile = files[0]; const csvFile = files[0];
this._fileInput.nativeElement.value = null; this._fileInput.nativeElement.value = null;

View File

@ -12,8 +12,8 @@ import { TranslateService } from '@ngx-translate/core';
}) })
export class LicenseInformationScreenComponent implements OnInit { export class LicenseInformationScreenComponent implements OnInit {
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
public readonly appConfigService: AppConfigService, readonly appConfigService: AppConfigService,
private readonly _licenseReportController: LicenseReportControllerService, private readonly _licenseReportController: LicenseReportControllerService,
private readonly _translateService: TranslateService private readonly _translateService: TranslateService
) {} ) {}
@ -21,12 +21,12 @@ export class LicenseInformationScreenComponent implements OnInit {
get currentYear(): number { get currentYear(): number {
return new Date().getFullYear(); return new Date().getFullYear();
} }
public currentInfo: LicenseReport = {}; currentInfo: LicenseReport = {};
public totalInfo: LicenseReport = {}; totalInfo: LicenseReport = {};
public unlicensedInfo: LicenseReport = {}; unlicensedInfo: LicenseReport = {};
public totalLicensedNumberOfPages = 0; totalLicensedNumberOfPages = 0;
public analysisPercentageOfLicense = 100; analysisPercentageOfLicense = 100;
public viewReady = false; viewReady = false;
barChart: any[] = []; barChart: any[] = [];
lineChartSeries: any[] = []; lineChartSeries: any[] = [];
@ -46,7 +46,7 @@ export class LicenseInformationScreenComponent implements OnInit {
domain: ['#0389ec'] domain: ['#0389ec']
}; };
public async ngOnInit() { async ngOnInit() {
this.totalLicensedNumberOfPages = this.appConfigService.getConfig('LICENSE_PAGE_COUNT', 0); this.totalLicensedNumberOfPages = this.appConfigService.getConfig('LICENSE_PAGE_COUNT', 0);
const startDate = moment(this.appConfigService.getConfig('LICENSE_START'), 'DD-MM-YYYY'); const startDate = moment(this.appConfigService.getConfig('LICENSE_START'), 'DD-MM-YYYY');
const endDate = moment(this.appConfigService.getConfig('LICENSE_END'), 'DD-MM-YYYY'); const endDate = moment(this.appConfigService.getConfig('LICENSE_END'), 'DD-MM-YYYY');

View File

@ -19,8 +19,8 @@ export class RuleSetsListingScreenComponent extends BaseListingComponent<RuleSet
constructor( constructor(
private readonly _dialogService: AdminDialogService, private readonly _dialogService: AdminDialogService,
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
public readonly userPreferenceService: UserPreferenceService, readonly userPreferenceService: UserPreferenceService,
protected readonly _injector: Injector protected readonly _injector: Injector
) { ) {
super(_injector); super(_injector);
@ -30,7 +30,7 @@ export class RuleSetsListingScreenComponent extends BaseListingComponent<RuleSet
this.loadRuleSetsData(); this.loadRuleSetsData();
} }
public loadRuleSetsData() { loadRuleSetsData() {
this._appStateService.reset(); this._appStateService.reset();
this.allEntities = this._appStateService.ruleSets; this.allEntities = this._appStateService.ruleSets;
this._executeSearchImmediately(); this._executeSearchImmediately();
@ -51,7 +51,7 @@ export class RuleSetsListingScreenComponent extends BaseListingComponent<RuleSet
}); });
} }
public openAddRuleSetDialog() { openAddRuleSetDialog() {
this._dialogService.openAddEditRuleSetDialog(null, async (newRuleSet) => { this._dialogService.openAddEditRuleSetDialog(null, async (newRuleSet) => {
if (newRuleSet) { if (newRuleSet) {
this.loadRuleSetsData(); this.loadRuleSetsData();

View File

@ -9,7 +9,7 @@ import { ComponentHasChanges } from '../../../../guards/can-deactivate.guard';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { AppStateService } from '../../../../state/app-state.service'; import { AppStateService } from '../../../../state/app-state.service';
declare var ace; declare let ace;
@Component({ @Component({
selector: 'redaction-rules-screen', selector: 'redaction-rules-screen',
@ -17,14 +17,14 @@ declare var ace;
styleUrls: ['./rules-screen.component.scss'] styleUrls: ['./rules-screen.component.scss']
}) })
export class RulesScreenComponent extends ComponentHasChanges { export class RulesScreenComponent extends ComponentHasChanges {
public aceOptions = { showPrintMargin: false }; aceOptions = { showPrintMargin: false };
public rules: string; rules: string;
public processing = true; processing = true;
public initialLines: string[] = []; initialLines: string[] = [];
public currentLines: string[] = []; currentLines: string[] = [];
public changedLines: number[] = []; changedLines: number[] = [];
public activeEditMarkers: any[] = []; activeEditMarkers: any[] = [];
@ViewChild('editorComponent', { static: true }) @ViewChild('editorComponent', { static: true })
editorComponent: AceEditorComponent; editorComponent: AceEditorComponent;
@ -33,7 +33,7 @@ export class RulesScreenComponent extends ComponentHasChanges {
private _fileInput: ElementRef; private _fileInput: ElementRef;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _rulesControllerService: RulesControllerService, private readonly _rulesControllerService: RulesControllerService,
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
private readonly _notificationService: NotificationService, 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.currentLines = $event.split('\n');
this.changedLines = []; this.changedLines = [];
this.activeEditMarkers.forEach((am) => { 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) { for (const i of this.changedLines) {
const entry = this.currentLines[i]; const entry = this.currentLines[i];
if (entry?.trim().length > 0) { if (entry?.trim().length > 0) {
// only mark non-empty lines // 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; return this.activeEditMarkers.length > 0;
} }
public async save(): Promise<void> { async save(): Promise<void> {
this.processing = true; this.processing = true;
this._rulesControllerService this._rulesControllerService
.uploadRules({ .uploadRules({
@ -109,14 +109,14 @@ export class RulesScreenComponent extends ComponentHasChanges {
); );
} }
public revert(): void { revert(): void {
this.initialLines = this.rules.split('\n'); this.initialLines = this.rules.split('\n');
this.editorComponent.getEditor().setValue(this.rules); this.editorComponent.getEditor().setValue(this.rules);
this.editorComponent.getEditor().clearSelection(); this.editorComponent.getEditor().clearSelection();
this.processing = false; this.processing = false;
} }
public download(): void { download(): void {
const content = this.editorComponent.getEditor().getValue(); const content = this.editorComponent.getEditor().getValue();
const blob = new Blob([content], { const blob = new Blob([content], {
type: 'text/plain;charset=utf-8' type: 'text/plain;charset=utf-8'
@ -124,7 +124,7 @@ export class RulesScreenComponent extends ComponentHasChanges {
saveAs(blob, 'rules.txt'); saveAs(blob, 'rules.txt');
} }
public upload($event): void { upload($event): void {
const file = $event.target.files[0]; const file = $event.target.files[0];
const fileReader = new FileReader(); const fileReader = new FileReader();

View File

@ -12,13 +12,13 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./smtp-config-screen.component.scss'] styleUrls: ['./smtp-config-screen.component.scss']
}) })
export class SmtpConfigScreenComponent implements OnInit { export class SmtpConfigScreenComponent implements OnInit {
public viewReady = false; viewReady = false;
public configForm: FormGroup; configForm: FormGroup;
private _initialValue: SMTPConfigurationModel; private _initialValue: SMTPConfigurationModel;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _smtpConfigService: SmtpConfigurationControllerService, private readonly _smtpConfigService: SmtpConfigurationControllerService,
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
private readonly _dialogService: AdminDialogService, 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; if (!this._initialValue) return true;
for (const key of Object.keys(this.configForm.getRawValue())) { for (const key of Object.keys(this.configForm.getRawValue())) {
@ -72,14 +72,14 @@ export class SmtpConfigScreenComponent implements OnInit {
return false; return false;
} }
public async save() { async save() {
this.viewReady = false; this.viewReady = false;
await this._smtpConfigService.updateSMTPConfiguration(this.configForm.getRawValue()).toPromise(); await this._smtpConfigService.updateSMTPConfiguration(this.configForm.getRawValue()).toPromise();
this._initialValue = this.configForm.getRawValue(); this._initialValue = this.configForm.getRawValue();
this.viewReady = true; this.viewReady = true;
} }
public openAuthConfigDialog(skipDisableOnCancel?: boolean) { openAuthConfigDialog(skipDisableOnCancel?: boolean) {
this._dialogService.openSMTPAuthConfigDialog(this.configForm.getRawValue(), (authConfig) => { this._dialogService.openSMTPAuthConfigDialog(this.configForm.getRawValue(), (authConfig) => {
if (authConfig) { if (authConfig) {
this.configForm.patchValue(authConfig); this.configForm.patchValue(authConfig);
@ -89,10 +89,10 @@ export class SmtpConfigScreenComponent implements OnInit {
}); });
} }
public async testConnection() { async testConnection() {
this.viewReady = false; this.viewReady = false;
try { try {
const res = await this._smtpConfigService.testSMTPConfiguration(this.configForm.getRawValue()).toPromise(); await this._smtpConfigService.testSMTPConfiguration(this.configForm.getRawValue()).toPromise();
this._notificationService.showToastNotification( this._notificationService.showToastNotification(
this._translateService.instant('smtp-config-screen.test.success'), this._translateService.instant('smtp-config-screen.test.success'),
undefined, undefined,

View File

@ -16,14 +16,14 @@ import { BaseListingComponent } from '../../../shared/base/base-listing.componen
export class UserListingScreenComponent extends BaseListingComponent<User> implements OnInit { export class UserListingScreenComponent extends BaseListingComponent<User> implements OnInit {
protected readonly _selectionKey = 'userId'; protected readonly _selectionKey = 'userId';
public viewReady = false; viewReady = false;
public loading = false; loading = false;
public collapsedDetails = false; collapsedDetails = false;
public chartData: DoughnutChartConfig[] = []; chartData: DoughnutChartConfig[] = [];
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
public readonly userService: UserService, readonly userService: UserService,
private readonly _translateService: TranslateService, private readonly _translateService: TranslateService,
private readonly _adminDialogService: AdminDialogService, private readonly _adminDialogService: AdminDialogService,
private readonly _userControllerService: UserControllerService, private readonly _userControllerService: UserControllerService,
@ -33,7 +33,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
super(_injector); super(_injector);
} }
public async ngOnInit() { async ngOnInit() {
await this._loadData(); await this._loadData();
} }
@ -41,7 +41,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
return this.userService.getName(user); return this.userService.getName(user);
} }
public openAddEditUserDialog($event: MouseEvent, user?: User) { openAddEditUserDialog($event: MouseEvent, user?: User) {
$event.stopPropagation(); $event.stopPropagation();
this._adminDialogService.openAddEditUserDialog(user, async (result) => { this._adminDialogService.openAddEditUserDialog(user, async (result) => {
if (result === 'DELETE') { if (result === 'DELETE') {
@ -58,7 +58,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
}); });
} }
public openDeleteUserDialog(users: User[], $event?: MouseEvent) { openDeleteUserDialog(users: User[], $event?: MouseEvent) {
$event?.stopPropagation(); $event?.stopPropagation();
this._adminDialogService.openConfirmDeleteUsersDialog(users, async () => { this._adminDialogService.openConfirmDeleteUsersDialog(users, async () => {
this.loading = true; this.loading = true;
@ -112,26 +112,26 @@ export class UserListingScreenComponent extends BaseListingComponent<User> 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'); 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; this.loading = true;
user.roles = this.userService.isActive(user) ? [] : ['RED_USER']; user.roles = this.userService.isActive(user) ? [] : ['RED_USER'];
await this._userControllerService.addRoleToUsers(user.roles, user.userId).toPromise(); await this._userControllerService.addRoleToUsers(user.roles, user.userId).toPromise();
await this._loadData(); await this._loadData();
} }
public toggleCollapsedDetails() { toggleCollapsedDetails() {
this.collapsedDetails = !this.collapsedDetails; this.collapsedDetails = !this.collapsedDetails;
} }
public async bulkDelete() { async bulkDelete() {
this.openDeleteUserDialog(this.allEntities.filter((u) => this.isEntitySelected(u))); this.openDeleteUserDialog(this.allEntities.filter((u) => this.isEntitySelected(u)));
} }
public get canDeleteSelected(): boolean { get canDeleteSelected(): boolean {
return this.selectedEntitiesIds.indexOf(this.userService.userId) === -1; return this.selectedEntitiesIds.indexOf(this.userService.userId) === -1;
} }
} }

View File

@ -34,8 +34,8 @@ export class WatermarkScreenComponent implements OnInit {
@ViewChild('viewer', { static: true }) @ViewChild('viewer', { static: true })
private _viewer: ElementRef; private _viewer: ElementRef;
public viewReady = false; viewReady = false;
public configForm: FormGroup; configForm: FormGroup;
get changed(): boolean { get changed(): boolean {
if (this._watermark === DEFAULT_WATERMARK) { if (this._watermark === DEFAULT_WATERMARK) {
@ -50,8 +50,8 @@ export class WatermarkScreenComponent implements OnInit {
} }
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
public readonly appStateService: AppStateService, readonly appStateService: AppStateService,
@Inject(BASE_HREF) private readonly _baseHref: string, @Inject(BASE_HREF) private readonly _baseHref: string,
private readonly _translateService: TranslateService, private readonly _translateService: TranslateService,
private readonly _watermarkControllerService: WatermarkControllerService, private readonly _watermarkControllerService: WatermarkControllerService,
@ -85,11 +85,11 @@ export class WatermarkScreenComponent implements OnInit {
} }
@debounce() @debounce()
public configChanged() { configChanged() {
this._drawWatermark(); this._drawWatermark();
} }
public save() { save() {
const watermark = { const watermark = {
...this.configForm.getRawValue() ...this.configForm.getRawValue()
}; };
@ -113,12 +113,12 @@ export class WatermarkScreenComponent implements OnInit {
); );
} }
public revert() { revert() {
this.configForm.setValue({ ...this._watermark }); this.configForm.setValue({ ...this._watermark });
this.configChanged(); this.configChanged();
} }
public triggerChanges() {} triggerChanges() {}
private _loadViewer() { private _loadViewer() {
if (!this._instance) { if (!this._instance) {
@ -158,16 +158,16 @@ export class WatermarkScreenComponent implements OnInit {
} }
private async _drawWatermark() { private async _drawWatermark() {
const PDFNet = this._instance.PDFNet; const pdfNet = this._instance.PDFNet;
const document = await this._instance.docViewer.getDocument().getPDFDoc(); const document = await this._instance.docViewer.getDocument().getPDFDoc();
await PDFNet.runWithCleanup( await pdfNet.runWithCleanup(
async () => { async () => {
await document.lock(); 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 text = this.configForm.get('text').value || '';
const fontSize = this.configForm.get('fontSize').value; const fontSize = this.configForm.get('fontSize').value;
@ -178,8 +178,8 @@ export class WatermarkScreenComponent implements OnInit {
const rgbColor = hexToRgb(color); const rgbColor = hexToRgb(color);
const stamper = await PDFNet.Stamper.create(3, fontSize, 0); 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.setFontColor(await pdfNet.ColorPt.init(rgbColor.r / 255, rgbColor.g / 255, rgbColor.b / 255));
await stamper.setOpacity(opacity / 100); await stamper.setOpacity(opacity / 100);
switch (orientation) { switch (orientation) {
@ -195,7 +195,7 @@ export class WatermarkScreenComponent implements OnInit {
await stamper.setRotation(-45); 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.setFont(font);
await stamper.setTextAlignment(0); await stamper.setTextAlignment(0);
await stamper.stampText(document, text, pageSet); 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) { if (!this.configForm.get(type).disabled) {
this.configForm.get(type).setValue(value); this.configForm.get(type).setValue(value);
this.configChanged(); this.configChanged();

View File

@ -53,7 +53,7 @@ export class AdminDialogService {
private readonly _manualRedactionControllerService: ManualRedactionControllerService private readonly _manualRedactionControllerService: ManualRedactionControllerService
) {} ) {}
public openDeleteDictionaryDialog($event: MouseEvent, dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef<ConfirmationDialogComponent> { openDeleteDictionaryDialog($event: MouseEvent, dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
$event.stopPropagation(); $event.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
ref.afterClosed().subscribe(async (result) => { ref.afterClosed().subscribe(async (result) => {
@ -65,7 +65,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openDeleteRuleSetDialog($event: MouseEvent, ruleSet: RuleSetModel, cb?: Function): MatDialogRef<ConfirmationDialogComponent> { openDeleteRuleSetDialog($event: MouseEvent, ruleSet: RuleSetModel, cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
$event.stopPropagation(); $event.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
ref.afterClosed().subscribe(async (result) => { ref.afterClosed().subscribe(async (result) => {
@ -77,7 +77,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openAddEditDictionaryDialog(dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef<AddEditDictionaryDialogComponent> { openAddEditDictionaryDialog(dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef<AddEditDictionaryDialogComponent> {
const ref = this._dialog.open(AddEditDictionaryDialogComponent, { const ref = this._dialog.open(AddEditDictionaryDialogComponent, {
...dialogConfig, ...dialogConfig,
data: { dictionary, ruleSetId }, data: { dictionary, ruleSetId },
@ -93,7 +93,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openEditColorsDialog(colors: Colors, colorKey: string, ruleSetId: string, cb?: Function): MatDialogRef<EditColorDialogComponent> { openEditColorsDialog(colors: Colors, colorKey: string, ruleSetId: string, cb?: Function): MatDialogRef<EditColorDialogComponent> {
const ref = this._dialog.open(EditColorDialogComponent, { const ref = this._dialog.open(EditColorDialogComponent, {
...dialogConfig, ...dialogConfig,
data: { colors, colorKey, ruleSetId }, data: { colors, colorKey, ruleSetId },
@ -109,7 +109,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openAddEditRuleSetDialog(ruleSet: RuleSetModel, cb?: Function): MatDialogRef<AddEditRuleSetDialogComponent> { openAddEditRuleSetDialog(ruleSet: RuleSetModel, cb?: Function): MatDialogRef<AddEditRuleSetDialogComponent> {
const ref = this._dialog.open(AddEditRuleSetDialogComponent, { const ref = this._dialog.open(AddEditRuleSetDialogComponent, {
...dialogConfig, ...dialogConfig,
width: '900px', width: '900px',
@ -126,7 +126,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openImportFileAttributeCSVDialog( openImportFileAttributeCSVDialog(
csv: File, csv: File,
ruleSetId: string, ruleSetId: string,
existingConfiguration: FileAttributesConfig, existingConfiguration: FileAttributesConfig,
@ -146,11 +146,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openAddEditFileAttributeDialog( openAddEditFileAttributeDialog(fileAttribute: FileAttributeConfig, ruleSetId: string, cb?: Function): MatDialogRef<AddEditFileAttributeDialogComponent> {
fileAttribute: FileAttributeConfig,
ruleSetId: string,
cb?: Function
): MatDialogRef<AddEditFileAttributeDialogComponent> {
const ref = this._dialog.open(AddEditFileAttributeDialogComponent, { const ref = this._dialog.open(AddEditFileAttributeDialogComponent, {
...dialogConfig, ...dialogConfig,
data: { fileAttribute, ruleSetId }, data: { fileAttribute, ruleSetId },
@ -166,7 +162,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openConfirmDeleteFileAttributeDialog( openConfirmDeleteFileAttributeDialog(
fileAttribute: FileAttributeConfig, fileAttribute: FileAttributeConfig,
ruleSetId: string, ruleSetId: string,
cb?: Function cb?: Function
@ -186,7 +182,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openSMTPAuthConfigDialog(smtpConfig: SMTPConfigurationModel, cb?: Function): MatDialogRef<SmtpAuthDialogComponent> { openSMTPAuthConfigDialog(smtpConfig: SMTPConfigurationModel, cb?: Function): MatDialogRef<SmtpAuthDialogComponent> {
const ref = this._dialog.open(SmtpAuthDialogComponent, { const ref = this._dialog.open(SmtpAuthDialogComponent, {
...dialogConfig, ...dialogConfig,
data: smtpConfig, data: smtpConfig,
@ -202,7 +198,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openAddEditUserDialog(user?: User, cb?: Function): MatDialogRef<AddEditUserDialogComponent> { openAddEditUserDialog(user?: User, cb?: Function): MatDialogRef<AddEditUserDialogComponent> {
const ref = this._dialog.open(AddEditUserDialogComponent, { const ref = this._dialog.open(AddEditUserDialogComponent, {
...dialogConfig, ...dialogConfig,
data: user, data: user,
@ -218,7 +214,7 @@ export class AdminDialogService {
return ref; return ref;
} }
public openConfirmDeleteUsersDialog(users: User[], cb?: Function): MatDialogRef<ConfirmDeleteUsersDialogComponent> { openConfirmDeleteUsersDialog(users: User[], cb?: Function): MatDialogRef<ConfirmDeleteUsersDialogComponent> {
const ref = this._dialog.open(ConfirmDeleteUsersDialogComponent, { const ref = this._dialog.open(ConfirmDeleteUsersDialogComponent, {
...dialogConfig, ...dialogConfig,
data: users, data: users,

View File

@ -21,7 +21,7 @@ export class AuthGuard extends KeycloakAuthGuard {
super(_router, _keycloak); super(_router, _keycloak);
} }
public async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (!this.authenticated) { if (!this.authenticated) {
await this._keycloak.login({ await this._keycloak.login({
idpHint: this._appConfigService.getConfig(AppConfigKey.OAUTH_IDP_HINT, null), idpHint: this._appConfigService.getConfig(AppConfigKey.OAUTH_IDP_HINT, null),

View File

@ -8,8 +8,7 @@ import { AppConfigKey, AppConfigService } from '../app-config/app-config.service
import { BASE_HREF } from '../../tokens'; import { BASE_HREF } from '../../tokens';
export function keycloakInitializer(keycloak: KeycloakService, appConfigService: AppConfigService, baseUrl) { export function keycloakInitializer(keycloak: KeycloakService, appConfigService: AppConfigService, baseUrl) {
return () => { return () => appConfigService
return appConfigService
.loadAppConfig() .loadAppConfig()
.toPromise() .toPromise()
.then(() => { .then(() => {
@ -33,7 +32,6 @@ export function keycloakInitializer(keycloak: KeycloakService, appConfigService:
}; };
return keycloak.init(options).then(() => configureAutomaticRedirectToLoginScreen(keycloak)); return keycloak.init(options).then(() => configureAutomaticRedirectToLoginScreen(keycloak));
}); });
};
} }
function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakService) { function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakService) {

View File

@ -9,7 +9,7 @@ import { DomSanitizer } from '@angular/platform-browser';
exports: [MatIconModule] exports: [MatIconModule]
}) })
export class IconsModule { export class IconsModule {
constructor(private iconRegistry: MatIconRegistry, private sanitizer: DomSanitizer) { constructor(private readonly _iconRegistry: MatIconRegistry, private readonly _sanitizer: DomSanitizer) {
const icons = [ const icons = [
'add', 'add',
'analyse', 'analyse',
@ -84,7 +84,7 @@ export class IconsModule {
]; ];
for (const icon of icons) { 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`));
} }
} }
} }

View File

@ -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); return this.viewer.annotManager.getAnnotationById(this.annotation.id);
} }
public hideAnnotation($event: MouseEvent) { hideAnnotation($event: MouseEvent) {
$event.stopPropagation(); $event.stopPropagation();
this.viewer.annotManager.hideAnnotations([this.viewerAnnotation]); this.viewer.annotManager.hideAnnotations([this.viewerAnnotation]);
this.viewer.annotManager.deselectAllAnnotations(); this.viewer.annotManager.deselectAllAnnotations();
} }
public showAnnotation($event: MouseEvent) { showAnnotation($event: MouseEvent) {
$event.stopPropagation(); $event.stopPropagation();
this.viewer.annotManager.showAnnotations([this.viewerAnnotation]); this.viewer.annotManager.showAnnotations([this.viewerAnnotation]);
this.viewer.annotManager.deselectAllAnnotations(); this.viewer.annotManager.deselectAllAnnotations();

View File

@ -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 { AppStateService } from '../../../../state/app-state.service';
import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper'; import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper';
import { AnnotationActionsService } from '../../services/annotation-actions.service'; import { AnnotationActionsService } from '../../services/annotation-actions.service';
@ -11,7 +11,7 @@ import { MatMenuTrigger } from '@angular/material/menu';
templateUrl: './annotation-remove-actions.component.html', templateUrl: './annotation-remove-actions.component.html',
styleUrls: ['./annotation-remove-actions.component.scss'] styleUrls: ['./annotation-remove-actions.component.scss']
}) })
export class AnnotationRemoveActionsComponent implements OnInit { export class AnnotationRemoveActionsComponent {
@Output() menuOpenChange = new EventEmitter<boolean>(); @Output() menuOpenChange = new EventEmitter<boolean>();
@Input() annotationsChanged: EventEmitter<AnnotationWrapper>; @Input() annotationsChanged: EventEmitter<AnnotationWrapper>;
@Input() menuOpen: boolean; @Input() menuOpen: boolean;
@ -19,7 +19,7 @@ export class AnnotationRemoveActionsComponent implements OnInit {
@Input() tooltipPosition: 'before' | 'above' = 'before'; @Input() tooltipPosition: 'before' | 'above' = 'before';
@ViewChild(MatMenuTrigger) matMenuTrigger: MatMenuTrigger; @ViewChild(MatMenuTrigger) matMenuTrigger: MatMenuTrigger;
public permissions: { permissions: {
canRemoveOrSuggestToRemoveOnlyHere: boolean; canRemoveOrSuggestToRemoveOnlyHere: boolean;
canPerformMultipleRemoveActions: boolean; canPerformMultipleRemoveActions: boolean;
canNotPerformMultipleRemoveActions: boolean; canNotPerformMultipleRemoveActions: boolean;
@ -28,49 +28,47 @@ export class AnnotationRemoveActionsComponent implements OnInit {
}; };
constructor( constructor(
public readonly appStateService: AppStateService, readonly appStateService: AppStateService,
private readonly _annotationActionsService: AnnotationActionsService, private readonly _annotationActionsService: AnnotationActionsService,
private readonly _permissionsService: PermissionsService private readonly _permissionsService: PermissionsService
) {} ) {}
private _annotations: AnnotationWrapper[]; private _annotations: AnnotationWrapper[];
public get annotations(): AnnotationWrapper[] { get annotations(): AnnotationWrapper[] {
return this._annotations; return this._annotations;
} }
@Input() @Input()
public set annotations(value: AnnotationWrapper[]) { set annotations(value: AnnotationWrapper[]) {
this._annotations = value.filter((a) => a !== undefined); this._annotations = value.filter((a) => a !== undefined);
this._setPermissions(); this._setPermissions();
} }
public get dictionaryColor() { get dictionaryColor() {
return this.appStateService.getDictionaryColor('suggestion-add-dictionary'); return this.appStateService.getDictionaryColor('suggestion-add-dictionary');
} }
public get suggestionColor() { get suggestionColor() {
return this.appStateService.getDictionaryColor('suggestion'); return this.appStateService.getDictionaryColor('suggestion');
} }
ngOnInit(): void {} openMenu($event: MouseEvent) {
public openMenu($event: MouseEvent) {
$event.stopPropagation(); $event.stopPropagation();
this.matMenuTrigger.openMenu(); this.matMenuTrigger.openMenu();
this.menuOpenChange.emit(true); this.menuOpenChange.emit(true);
} }
public onMenuClosed() { onMenuClosed() {
this.menuOpenChange.emit(false); this.menuOpenChange.emit(false);
} }
public suggestRemoveAnnotations($event, removeFromDict: boolean) { suggestRemoveAnnotations($event, removeFromDict: boolean) {
$event.stopPropagation(); $event.stopPropagation();
this._annotationActionsService.suggestRemoveAnnotation($event, this.annotations, removeFromDict, this.annotationsChanged); this._annotationActionsService.suggestRemoveAnnotation($event, this.annotations, removeFromDict, this.annotationsChanged);
} }
public markAsFalsePositive($event) { markAsFalsePositive($event) {
this._annotationActionsService.markAsFalsePositive($event, this.annotations, this.annotationsChanged); this._annotationActionsService.markAsFalsePositive($event, this.annotations, this.annotationsChanged);
} }

View File

@ -16,8 +16,8 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service';
}) })
export class ProjectOverviewBulkActionsComponent { export class ProjectOverviewBulkActionsComponent {
@Input() selectedFileIds: string[]; @Input() selectedFileIds: string[];
@Output() private reload = new EventEmitter(); @Output() private _reload = new EventEmitter();
public loading = false; loading = false;
constructor( constructor(
private readonly _appStateService: AppStateService, 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)); 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; 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; return this.selectedFileIds.length > 0;
} }
public get canDelete() { get canDelete() {
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canDeleteFile(file), true); 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); 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); 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); 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); return this.selectedFiles.map((file) => file.fileStatus.status);
} }
public delete() { delete() {
this.loading = true; this.loading = true;
this._dialogService.openDeleteFilesDialog(null, this._appStateService.activeProject.project.projectId, this.selectedFileIds, () => { this._dialogService.openDeleteFilesDialog(null, this._appStateService.activeProject.project.projectId, this.selectedFileIds, () => {
this.reload.emit(); this._reload.emit();
this.loading = false; this.loading = false;
this.selectedFileIds.splice(0, this.selectedFileIds.length); this.selectedFileIds.splice(0, this.selectedFileIds.length);
}); });
} }
public assign() { assign() {
this.loading = true; this.loading = true;
this._dialogService.openBulkAssignFileReviewerDialog(this.selectedFileIds, () => { this._dialogService.openBulkAssignFileReviewerDialog(this.selectedFileIds, () => {
this.reload.emit(); this._reload.emit();
this.loading = false; this.loading = false;
}); });
} }
public async reanalyse() { async reanalyse() {
const fileIds = this.selectedFiles.filter((file) => this._permissionsService.fileRequiresReanalysis(file)).map((file) => file.fileId); const fileIds = this.selectedFiles.filter((file) => this._permissionsService.fileRequiresReanalysis(file)).map((file) => file.fileId);
this._performBulkAction(this._reanalysisControllerService.reanalyzeFilesForProject(fileIds, this._appStateService.activeProject.projectId)); this._performBulkAction(this._reanalysisControllerService.reanalyzeFilesForProject(fileIds, this._appStateService.activeProject.projectId));
} }
@ -94,45 +94,45 @@ export class ProjectOverviewBulkActionsComponent {
} }
// Under review // Under review
public get canSetToUnderReview() { get canSetToUnderReview() {
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canSetUnderReview(file), true); return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canSetUnderReview(file), true);
} }
public setToUnderReview() { setToUnderReview() {
this._performBulkAction(this._fileActionService.setFileUnderReview(this.selectedFiles)); this._performBulkAction(this._fileActionService.setFileUnderReview(this.selectedFiles));
} }
// Under approval // Under approval
public get canSetToUnderApproval() { get canSetToUnderApproval() {
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canSetUnderApproval(file), true); return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canSetUnderApproval(file), true);
} }
public setToUnderApproval() { setToUnderApproval() {
this._performBulkAction(this._fileActionService.setFileUnderApproval(this.selectedFiles)); this._performBulkAction(this._fileActionService.setFileUnderApproval(this.selectedFiles));
} }
// Approve // Approve
public get isReadyForApproval() { get isReadyForApproval() {
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.isReadyForApproval(file), true); 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); return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canApprove(file), true);
} }
public approveDocuments() { approveDocuments() {
this._performBulkAction(this._fileActionService.setFileApproved(this.selectedFiles)); this._performBulkAction(this._fileActionService.setFileApproved(this.selectedFiles));
} }
// Undo approval // Undo approval
public get canUndoApproval() { get canUndoApproval() {
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canUndoApproval(file), true); return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canUndoApproval(file), true);
} }
private _performBulkAction(obs: Observable<any>) { private _performBulkAction(obs: Observable<any>) {
this.loading = true; this.loading = true;
obs.subscribe().add(() => { obs.subscribe().add(() => {
this.reload.emit(); this._reload.emit();
this.loading = false; this.loading = false;
}); });
} }

View File

@ -14,14 +14,14 @@ import { PermissionsService } from '../../../../services/permissions.service';
styleUrls: ['./comments.component.scss'] styleUrls: ['./comments.component.scss']
}) })
export class CommentsComponent { export class CommentsComponent {
@Input() public annotation: AnnotationWrapper; @Input() annotation: AnnotationWrapper;
public expanded = false; expanded = false;
public commentForm: FormGroup; commentForm: FormGroup;
public addingComment = false; addingComment = false;
constructor( constructor(
public readonly translateService: TranslateService, readonly translateService: TranslateService,
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
@ -37,7 +37,7 @@ export class CommentsComponent {
return !this.annotation.isChangeLogRemoved; return !this.annotation.isChangeLogRemoved;
} }
public toggleExpandComments($event: MouseEvent): void { toggleExpandComments($event: MouseEvent): void {
$event.stopPropagation(); $event.stopPropagation();
if (!this.annotation.comments.length) { if (!this.annotation.comments.length) {
return; return;
@ -46,7 +46,7 @@ export class CommentsComponent {
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
} }
public toggleAddingComment($event?: MouseEvent): void { toggleAddingComment($event?: MouseEvent): void {
$event?.stopPropagation(); $event?.stopPropagation();
this.addingComment = !this.addingComment; this.addingComment = !this.addingComment;
if (this.addingComment) { if (this.addingComment) {
@ -55,7 +55,7 @@ export class CommentsComponent {
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
} }
public addComment(): void { addComment(): void {
const value = this.commentForm.value.comment; const value = this.commentForm.value.comment;
if (value) { if (value) {
this._manualAnnotationService.addComment(value, this.annotation.id).subscribe((commentResponse) => { 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._manualAnnotationService.deleteComment(comment.id, this.annotation.id).subscribe(() => {
this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1); this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1);
if (!this.annotation.comments.length) { 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; return comment.user === this._userService.userId;
} }
public getOwnerName(comment: Comment): string { getOwnerName(comment: Comment): string {
return this._userService.getNameForId(comment.user); return this._userService.getNameForId(comment.user);
} }
} }

View File

@ -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 { FileAttributesConfig, FileStatus } from '@redaction/red-ui-http';
import { AppStateService } from '../../../../state/app-state.service'; import { AppStateService } from '../../../../state/app-state.service';
import { ProjectsDialogService } from '../../services/projects-dialog.service'; import { ProjectsDialogService } from '../../services/projects-dialog.service';
@ -8,27 +8,25 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service';
templateUrl: './document-info.component.html', templateUrl: './document-info.component.html',
styleUrls: ['./document-info.component.scss'] styleUrls: ['./document-info.component.scss']
}) })
export class DocumentInfoComponent implements OnInit { export class DocumentInfoComponent {
@Input() file: FileStatus; @Input() file: FileStatus;
@Output() closeDocumentInfoView = new EventEmitter(); @Output() closeDocumentInfoView = new EventEmitter();
public fileAttributesConfig: FileAttributesConfig; fileAttributesConfig: FileAttributesConfig;
constructor(private readonly _appStateService: AppStateService, private readonly _dialogService: ProjectsDialogService) { constructor(private readonly _appStateService: AppStateService, private readonly _dialogService: ProjectsDialogService) {
this.fileAttributesConfig = this._appStateService.activeFileAttributesConfig; this.fileAttributesConfig = this._appStateService.activeFileAttributesConfig;
} }
ngOnInit(): void {} get project() {
public get project() {
return this._appStateService.getProjectById(this.file.projectId); return this._appStateService.getProjectById(this.file.projectId);
} }
public edit() { edit() {
this._dialogService.openDocumentInfoDialog(this.file); this._dialogService.openDocumentInfoDialog(this.file);
} }
public get ruleSetName(): string { get ruleSetName(): string {
return this._appStateService.getRuleSetById(this.project.ruleSetId).name; return this._appStateService.getRuleSetById(this.project.ruleSetId).name;
} }
} }

View File

@ -19,8 +19,8 @@ export class FileActionsComponent implements OnInit {
screen: 'file-preview' | 'project-overview'; screen: 'file-preview' | 'project-overview';
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
public readonly appStateService: AppStateService, readonly appStateService: AppStateService,
private readonly _dialogService: ProjectsDialogService, private readonly _dialogService: ProjectsDialogService,
private readonly _fileActionService: FileActionService private readonly _fileActionService: FileActionService
) {} ) {}
@ -39,15 +39,15 @@ export class FileActionsComponent implements OnInit {
} }
} }
public toggleViewDocumentInfo() { toggleViewDocumentInfo() {
this.actionPerformed.emit('view-document-info'); this.actionPerformed.emit('view-document-info');
} }
public get tooltipPosition() { get tooltipPosition() {
return this.screen === 'file-preview' ? 'below' : 'above'; return this.screen === 'file-preview' ? 'below' : 'above';
} }
public get buttonType() { get buttonType() {
return this.screen === 'file-preview' ? 'default' : 'dark-bg'; return this.screen === 'file-preview' ? 'default' : 'dark-bg';
} }

View File

@ -16,7 +16,7 @@ const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
styleUrls: ['./file-workload.component.scss'] styleUrls: ['./file-workload.component.scss']
}) })
export class FileWorkloadComponent { export class FileWorkloadComponent {
public displayedAnnotations: { [key: number]: { annotations: AnnotationWrapper[] } } = {}; displayedAnnotations: { [key: number]: { annotations: AnnotationWrapper[] } } = {};
private _annotations: AnnotationWrapper[]; private _annotations: AnnotationWrapper[];
@Input() @Input()
@ -41,21 +41,21 @@ export class FileWorkloadComponent {
@Output() toggleSkipped = new EventEmitter<any>(); @Output() toggleSkipped = new EventEmitter<any>();
@Output() annotationsChanged = new EventEmitter<AnnotationWrapper>(); @Output() annotationsChanged = new EventEmitter<AnnotationWrapper>();
public quickScrollFirstEnabled = false; quickScrollFirstEnabled = false;
public quickScrollLastEnabled = false; quickScrollLastEnabled = false;
public displayedPages: number[] = []; displayedPages: number[] = [];
public pagesPanelActive = true; pagesPanelActive = true;
@ViewChild('annotationsElement') private _annotationsElement: ElementRef; @ViewChild('annotationsElement') private _annotationsElement: ElementRef;
@ViewChild('quickNavigation') private _quickNavigationElement: ElementRef; @ViewChild('quickNavigation') private _quickNavigationElement: ElementRef;
private _multiSelectActive = false; private _multiSelectActive = false;
public get multiSelectActive(): boolean { get multiSelectActive(): boolean {
return this._multiSelectActive; return this._multiSelectActive;
} }
public set multiSelectActive(value: boolean) { set multiSelectActive(value: boolean) {
this._multiSelectActive = value; this._multiSelectActive = value;
if (!value) { if (!value) {
this.selectAnnotations.emit(); this.selectAnnotations.emit();
@ -67,7 +67,7 @@ export class FileWorkloadComponent {
constructor(private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _annotationProcessingService: AnnotationProcessingService) {} constructor(private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _annotationProcessingService: AnnotationProcessingService) {}
private get firstSelectedAnnotation() { private get _firstSelectedAnnotation() {
return this.selectedAnnotations?.length ? this.selectedAnnotations[0] : null; 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); return this.selectedAnnotations?.find((a) => a?.id === annotation.id);
} }
public logAnnotation(annotation: AnnotationWrapper) { logAnnotation(annotation: AnnotationWrapper) {
console.log(annotation); console.log(annotation);
} }
public pageHasSelection(page: number) { pageHasSelection(page: number) {
return this.multiSelectActive && !!this.selectedAnnotations?.find((a) => a.pageNumber === page); return this.multiSelectActive && !!this.selectedAnnotations?.find((a) => a.pageNumber === page);
} }
public selectAllOnActivePage() { selectAllOnActivePage() {
this.selectAnnotations.emit(this.displayedAnnotations[this.activeViewerPage].annotations); this.selectAnnotations.emit(this.displayedAnnotations[this.activeViewerPage].annotations);
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
} }
public deselectAllOnActivePage() { deselectAllOnActivePage() {
this.deselectAnnotations.emit(this.displayedAnnotations[this.activeViewerPage].annotations); this.deselectAnnotations.emit(this.displayedAnnotations[this.activeViewerPage].annotations);
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
} }
@debounce(0) @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.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(this._annotations, filters.primary, filters.secondary);
this.displayedPages = Object.keys(this.displayedAnnotations).map((key) => Number(key)); this.displayedPages = Object.keys(this.displayedAnnotations).map((key) => Number(key));
this.computeQuickNavButtonsState(); this.computeQuickNavButtonsState();
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
} }
public computeQuickNavButtonsState() { computeQuickNavButtonsState() {
setTimeout(() => { setTimeout(() => {
const element: HTMLElement = this._quickNavigationElement.nativeElement.querySelector(`#pages`); const element: HTMLElement = this._quickNavigationElement.nativeElement.querySelector(`#pages`);
const { scrollTop, scrollHeight, clientHeight } = element; const { scrollTop, scrollHeight, clientHeight } = element;
@ -121,7 +121,7 @@ export class FileWorkloadComponent {
}, 0); }, 0);
} }
public annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) { annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) {
this.pagesPanelActive = false; this.pagesPanelActive = false;
if (this.annotationIsSelected(annotation)) { if (this.annotationIsSelected(annotation)) {
this.deselectAnnotations.emit([annotation]); this.deselectAnnotations.emit([annotation]);
@ -166,28 +166,28 @@ export class FileWorkloadComponent {
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
} }
public scrollAnnotations() { scrollAnnotations() {
if (this.firstSelectedAnnotation?.pageNumber === this.activeViewerPage) { if (this._firstSelectedAnnotation?.pageNumber === this.activeViewerPage) {
return; return;
} }
this.scrollAnnotationsToPage(this.activeViewerPage, 'always'); 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}"]`); const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[anotation-page-header="${page}"]`);
FileWorkloadComponent._scrollToFirstElement(elements, mode); FileWorkloadComponent._scrollToFirstElement(elements, mode);
} }
@debounce() @debounce()
public scrollToSelectedAnnotation() { scrollToSelectedAnnotation() {
if (!this.selectedAnnotations || this.selectedAnnotations.length === 0) { if (!this.selectedAnnotations || this.selectedAnnotations.length === 0) {
return; 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); FileWorkloadComponent._scrollToFirstElement(elements);
} }
public scrollQuickNavigation() { scrollQuickNavigation() {
let quickNavPageIndex = this.displayedPages.findIndex((p) => p >= this.activeViewerPage); let quickNavPageIndex = this.displayedPages.findIndex((p) => p >= this.activeViewerPage);
if (quickNavPageIndex === -1 || this.displayedPages[quickNavPageIndex] !== this.activeViewerPage) { if (quickNavPageIndex === -1 || this.displayedPages[quickNavPageIndex] !== this.activeViewerPage) {
quickNavPageIndex = Math.max(0, quickNavPageIndex - 1); quickNavPageIndex = Math.max(0, quickNavPageIndex - 1);
@ -195,24 +195,24 @@ export class FileWorkloadComponent {
this._scrollQuickNavigationToPage(this.displayedPages[quickNavPageIndex]); this._scrollQuickNavigationToPage(this.displayedPages[quickNavPageIndex]);
} }
public scrollQuickNavFirst() { scrollQuickNavFirst() {
if (this.displayedPages.length > 0) { if (this.displayedPages.length > 0) {
this._scrollQuickNavigationToPage(this.displayedPages[0]); this._scrollQuickNavigationToPage(this.displayedPages[0]);
} }
} }
public scrollQuickNavLast() { scrollQuickNavLast() {
if (this.displayedPages.length > 0) { if (this.displayedPages.length > 0) {
this._scrollQuickNavigationToPage(this.displayedPages[this.displayedPages.length - 1]); this._scrollQuickNavigationToPage(this.displayedPages[this.displayedPages.length - 1]);
} }
} }
public pageSelectedByClick($event: number) { pageSelectedByClick($event: number) {
this.pagesPanelActive = true; this.pagesPanelActive = true;
this.selectPage.emit($event); this.selectPage.emit($event);
} }
public preventKeyDefault($event: KeyboardEvent) { preventKeyDefault($event: KeyboardEvent) {
if (COMMAND_KEY_ARRAY.includes($event.key) && !(($event.target as any).localName === 'input')) { if (COMMAND_KEY_ARRAY.includes($event.key) && !(($event.target as any).localName === 'input')) {
$event.preventDefault(); $event.preventDefault();
} }
@ -220,23 +220,23 @@ export class FileWorkloadComponent {
private _selectFirstAnnotationOnCurrentPageIfNecessary() { private _selectFirstAnnotationOnCurrentPageIfNecessary() {
if ( if (
(!this.firstSelectedAnnotation || this.activeViewerPage !== this.firstSelectedAnnotation.pageNumber) && (!this._firstSelectedAnnotation || this.activeViewerPage !== this._firstSelectedAnnotation.pageNumber) &&
this.displayedPages.indexOf(this.activeViewerPage) >= 0 this.displayedPages.indexOf(this.activeViewerPage) >= 0
) { ) {
this.selectAnnotations.emit([this.displayedAnnotations[this.activeViewerPage].annotations[0]]); this.selectAnnotations.emit([this.displayedAnnotations[this.activeViewerPage].annotations[0]]);
} }
} }
public jumpToPreviousWithAnnotations() { jumpToPreviousWithAnnotations() {
this.selectPage.emit(this._prevPageWithAnnotations()); this.selectPage.emit(this._prevPageWithAnnotations());
} }
public jumpToNextWithAnnotations() { jumpToNextWithAnnotations() {
this.selectPage.emit(this._nextPageWithAnnotations()); this.selectPage.emit(this._nextPageWithAnnotations());
} }
private _navigateAnnotations($event: KeyboardEvent) { 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); const pageIdx = this.displayedPages.indexOf(this.activeViewerPage);
if (pageIdx !== -1) { if (pageIdx !== -1) {
// Displayed page has annotations // Displayed page has annotations
@ -257,10 +257,10 @@ export class FileWorkloadComponent {
} }
} }
} else { } else {
const page = this.firstSelectedAnnotation.pageNumber; const page = this._firstSelectedAnnotation.pageNumber;
const pageIdx = this.displayedPages.indexOf(page); const pageIdx = this.displayedPages.indexOf(page);
const annotationsOnPage = this.displayedAnnotations[page].annotations; 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 ($event.key === 'ArrowDown') {
if (idx + 1 !== annotationsOnPage.length) { if (idx + 1 !== annotationsOnPage.length) {

View File

@ -394,11 +394,11 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
}; };
} }
public deselectAllAnnotations() { deselectAllAnnotations() {
this.instance.annotManager.deselectAllAnnotations(); this.instance.annotManager.deselectAllAnnotations();
} }
public selectAnnotations($event: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) { selectAnnotations($event: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) {
let annotations: AnnotationWrapper[]; let annotations: AnnotationWrapper[];
let multiSelect: boolean; let multiSelect: boolean;
if ($event instanceof Array) { if ($event instanceof Array) {
@ -419,11 +419,11 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
this.instance.annotManager.jumpToAnnotation(annotationsFromViewer[0]); 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))); 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(); const activePage = this.instance.docViewer.getCurrentPage();
if (activePage !== pageNumber) { if (activePage !== pageNumber) {
this.instance.docViewer.displayPageLocation(pageNumber, 0, 0); this.instance.docViewer.displayPageLocation(pageNumber, 0, 0);

View File

@ -15,16 +15,16 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service';
styleUrls: ['./project-details.component.scss'] styleUrls: ['./project-details.component.scss']
}) })
export class ProjectDetailsComponent implements OnInit { export class ProjectDetailsComponent implements OnInit {
public documentsChartData: DoughnutChartConfig[] = []; documentsChartData: DoughnutChartConfig[] = [];
@Input() public filters: { needsWorkFilters: FilterModel[]; statusFilters: FilterModel[] }; @Input() filters: { needsWorkFilters: FilterModel[]; statusFilters: FilterModel[] };
@Output() public filtersChanged = new EventEmitter(); @Output() filtersChanged = new EventEmitter();
@Output() public openAssignProjectMembersDialog = new EventEmitter(); @Output() openAssignProjectMembersDialog = new EventEmitter();
@Output() public toggleCollapse = new EventEmitter(); @Output() toggleCollapse = new EventEmitter();
constructor( constructor(
public readonly appStateService: AppStateService, readonly appStateService: AppStateService,
public readonly translateChartService: TranslateChartService, readonly translateChartService: TranslateChartService,
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _dialogService: ProjectsDialogService, private readonly _dialogService: ProjectsDialogService,
private readonly _router: Router 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; return this.appStateService.activeProject.project.memberIds;
} }
public calculateChartConfig(): void { calculateChartConfig(): void {
if (this.appStateService.activeProject) { if (this.appStateService.activeProject) {
const groups = groupBy(this.appStateService.activeProject?.files, 'status'); const groups = groupBy(this.appStateService.activeProject?.files, 'status');
this.documentsChartData = []; this.documentsChartData = [];
@ -58,7 +58,7 @@ export class ProjectDetailsComponent implements OnInit {
return this.appStateService.activeProject.hasFiles; 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); const filter = this.filters[filterType].find((f) => f.key === key);
filter.checked = !filter.checked; filter.checked = !filter.checked;
this.filtersChanged.emit(this.filters); this.filtersChanged.emit(this.filters);

View File

@ -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 { PermissionsService } from '../../../../services/permissions.service';
import { ProjectWrapper } from '../../../../state/model/project.wrapper'; import { ProjectWrapper } from '../../../../state/model/project.wrapper';
import { StatusSorter } from '../../../../utils/sorters/status-sorter'; import { StatusSorter } from '../../../../utils/sorters/status-sorter';
@ -13,27 +13,25 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service';
templateUrl: './project-listing-actions.component.html', templateUrl: './project-listing-actions.component.html',
styleUrls: ['./project-listing-actions.component.scss'] styleUrls: ['./project-listing-actions.component.scss']
}) })
export class ProjectListingActionsComponent implements OnInit { export class ProjectListingActionsComponent {
@Input() project: ProjectWrapper; @Input() project: ProjectWrapper;
@Output() actionPerformed = new EventEmitter<ProjectWrapper | undefined>(); @Output() actionPerformed = new EventEmitter<ProjectWrapper | undefined>();
actionMenuOpen = false; actionMenuOpen = false;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
public readonly appStateService: AppStateService, readonly appStateService: AppStateService,
private readonly _dialogService: ProjectsDialogService, private readonly _dialogService: ProjectsDialogService,
private readonly _fileManagementControllerService: FileManagementControllerService private readonly _fileManagementControllerService: FileManagementControllerService
) {} ) {}
ngOnInit(): void {} openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) {
public openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) {
this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project, (pw: ProjectWrapper) => { this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project, (pw: ProjectWrapper) => {
this.actionPerformed.emit(pw); this.actionPerformed.emit(pw);
}); });
} }
public openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper) { openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper) {
this._dialogService.openDeleteProjectDialog($event, project, () => { this._dialogService.openDeleteProjectDialog($event, project, () => {
this.actionPerformed.emit(); this.actionPerformed.emit();
}); });
@ -53,7 +51,7 @@ export class ProjectListingActionsComponent implements OnInit {
} }
// Download Files // Download Files
public downloadRedactedFiles($event: MouseEvent, project: ProjectWrapper) { downloadRedactedFiles($event: MouseEvent, project: ProjectWrapper) {
$event.stopPropagation(); $event.stopPropagation();
this._fileManagementControllerService this._fileManagementControllerService
.downloadRedactedFiles({ fileIds: project.files.map((file) => file.fileId) }, project.projectId, false, 'response') .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); 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 obj = pw.files.reduce((acc, file) => {
const status = file.status; const status = file.status;
if (!acc[status]) { if (!acc[status]) {

View File

@ -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 { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
import { AppStateService } from '../../../../state/app-state.service'; import { AppStateService } from '../../../../state/app-state.service';
import { FilterModel } from '../../../shared/components/filter/model/filter.model'; 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', templateUrl: './project-listing-details.component.html',
styleUrls: ['./project-listing-details.component.scss'] styleUrls: ['./project-listing-details.component.scss']
}) })
export class ProjectListingDetailsComponent implements OnInit { export class ProjectListingDetailsComponent {
@Input() public projectsChartData: DoughnutChartConfig[]; @Input() projectsChartData: DoughnutChartConfig[];
@Input() public documentsChartData: DoughnutChartConfig[]; @Input() documentsChartData: DoughnutChartConfig[];
@Input() public filters: { statusFilters: FilterModel[] }; @Input() filters: { statusFilters: FilterModel[] };
@Output() public filtersChanged = new EventEmitter(); @Output() filtersChanged = new EventEmitter();
constructor(private readonly _appStateService: AppStateService) {} constructor(private readonly _appStateService: AppStateService) {}
ngOnInit(): void {} get totalPages() {
public get totalPages() {
return this._appStateService.totalAnalysedPages; return this._appStateService.totalAnalysedPages;
} }
public get totalPeople() { get totalPeople() {
return this._appStateService.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); const filter = this.filters[filterType].find((f) => f.key === key);
filter.checked = !filter.checked; filter.checked = !filter.checked;
this.filtersChanged.emit(this.filters); this.filtersChanged.emit(this.filters);

View File

@ -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'; import { PermissionsService } from '../../../../services/permissions.service';
@Component({ @Component({
@ -6,41 +6,39 @@ import { PermissionsService } from '../../../../services/permissions.service';
templateUrl: './team-members.component.html', templateUrl: './team-members.component.html',
styleUrls: ['./team-members.component.scss'] styleUrls: ['./team-members.component.scss']
}) })
export class TeamMembersComponent implements OnInit { export class TeamMembersComponent {
@Input() public memberIds: string[]; @Input() memberIds: string[];
@Input() public perLine: number; @Input() perLine: number;
@Input() public canAdd = true; @Input() canAdd = true;
@Input() public largeSpacing = false; @Input() largeSpacing = false;
@Input() public canRemove = false; @Input() canRemove = false;
@Input() public unremovableMembers: string[] = []; @Input() unremovableMembers: string[] = [];
@Output() public openAssignProjectMembersDialog = new EventEmitter(); @Output() openAssignProjectMembersDialog = new EventEmitter();
@Output() public remove = new EventEmitter<string>(); @Output() remove = new EventEmitter<string>();
@ViewChild('container', { static: true }) container: ElementRef; @ViewChild('container', { static: true }) container: ElementRef;
public expandedTeam = false; expandedTeam = false;
constructor(public permissionsService: PermissionsService) {} constructor(public permissionsService: PermissionsService) {}
ngOnInit(): void {} get maxTeamMembersBeforeExpand(): number {
public get maxTeamMembersBeforeExpand(): number {
return this.perLine - (this.canAdd ? 1 : 0); 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); return this.expandedTeam || !this.overflowCount ? this.memberIds : this.memberIds.slice(0, this.maxTeamMembersBeforeExpand - 1);
} }
public toggleExpandedTeam() { toggleExpandedTeam() {
this.expandedTeam = !this.expandedTeam; this.expandedTeam = !this.expandedTeam;
} }
public get overflowCount() { get overflowCount() {
return this.memberIds.length > this.maxTeamMembersBeforeExpand ? this.memberIds.length - (this.maxTeamMembersBeforeExpand - 1) : 0; 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; return this.canRemove && this.unremovableMembers.indexOf(userId) === -1;
} }
} }

View File

@ -12,11 +12,11 @@ import * as moment from 'moment';
styleUrls: ['./add-edit-project-dialog.component.scss'] styleUrls: ['./add-edit-project-dialog.component.scss']
}) })
export class AddEditProjectDialogComponent { export class AddEditProjectDialogComponent {
public projectForm: FormGroup; projectForm: FormGroup;
public hasDueDate: boolean; hasDueDate: boolean;
public downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED']; downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED'];
public reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum); reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum);
public ruleSets: RuleSetModel[]; ruleSets: RuleSetModel[];
constructor( constructor(
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
@ -55,7 +55,7 @@ export class AddEditProjectDialogComponent {
}); });
} }
public get changed() { get changed() {
if (!this.project) { if (!this.project) {
return true; return true;
} }
@ -80,7 +80,7 @@ export class AddEditProjectDialogComponent {
return false; return false;
} }
public get disabled() { get disabled() {
if (this.hasDueDate && this.projectForm.get('dueDate').value === null) { if (this.hasDueDate && this.projectForm.get('dueDate').value === null) {
return true; return true;
} }

View File

@ -21,11 +21,11 @@ class DialogData {
styleUrls: ['./assign-owner-dialog.component.scss'] styleUrls: ['./assign-owner-dialog.component.scss']
}) })
export class AssignOwnerDialogComponent { export class AssignOwnerDialogComponent {
public usersForm: FormGroup; usersForm: FormGroup;
public searchForm: FormGroup; searchForm: FormGroup;
constructor( constructor(
public readonly userService: UserService, readonly userService: UserService,
private readonly _projectControllerService: ProjectControllerService, private readonly _projectControllerService: ProjectControllerService,
private readonly _notificationService: NotificationService, private readonly _notificationService: NotificationService,
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
@ -70,23 +70,23 @@ export class AssignOwnerDialogComponent {
} }
} }
public get selectedSingleUser(): string { get selectedSingleUser(): string {
return this.usersForm.get('singleUser').value; return this.usersForm.get('singleUser').value;
} }
public get selectedApproversList(): string[] { get selectedApproversList(): string[] {
return this.usersForm.get('approvers').value; return this.usersForm.get('approvers').value;
} }
public get selectedReviewersList(): string[] { get selectedReviewersList(): string[] {
return this.selectedUsersList.filter((m) => this.selectedApproversList.indexOf(m) === -1); return this.selectedUsersList.filter((m) => this.selectedApproversList.indexOf(m) === -1);
} }
public get selectedUsersList(): string[] { get selectedUsersList(): string[] {
return this.usersForm.get('members').value; return this.usersForm.get('members').value;
} }
public isOwner(userId: string): boolean { isOwner(userId: string): boolean {
return userId === this.selectedSingleUser; return userId === this.selectedSingleUser;
} }
@ -138,15 +138,15 @@ export class AssignOwnerDialogComponent {
.map((user) => user.userId); .map((user) => user.userId);
} }
public isMemberSelected(userId: string): boolean { isMemberSelected(userId: string): boolean {
return this.selectedUsersList.indexOf(userId) !== -1; return this.selectedUsersList.indexOf(userId) !== -1;
} }
public isApprover(userId: string): boolean { isApprover(userId: string): boolean {
return this.selectedApproversList.indexOf(userId) !== -1; return this.selectedApproversList.indexOf(userId) !== -1;
} }
public toggleApprover(userId: string, $event?: MouseEvent) { toggleApprover(userId: string, $event?: MouseEvent) {
$event?.stopPropagation(); $event?.stopPropagation();
if (this.isOwner(userId) && this.isApprover(userId)) { 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)) { if (this.isMemberSelected(userId)) {
this.selectedUsersList.splice(this.selectedUsersList.indexOf(userId), 1); this.selectedUsersList.splice(this.selectedUsersList.indexOf(userId), 1);
@ -189,7 +189,7 @@ export class AssignOwnerDialogComponent {
return false; return false;
} }
public get changed(): boolean { get changed(): boolean {
if (this.data.ignoreChanged) { if (this.data.ignoreChanged) {
return true; return true;
} }

View File

@ -11,9 +11,9 @@ import { ProjectWrapper } from '../../../../state/model/project.wrapper';
styleUrls: ['./document-info-dialog.component.scss'] styleUrls: ['./document-info-dialog.component.scss']
}) })
export class DocumentInfoDialogComponent implements OnInit { export class DocumentInfoDialogComponent implements OnInit {
public documentInfoForm: FormGroup; documentInfoForm: FormGroup;
public file: FileStatus; file: FileStatus;
public attributes: FileAttributeConfig[]; attributes: FileAttributeConfig[];
private _project: ProjectWrapper; private _project: ProjectWrapper;
@ -36,7 +36,7 @@ export class DocumentInfoDialogComponent implements OnInit {
this.documentInfoForm = this._formBuilder.group(formConfig); this.documentInfoForm = this._formBuilder.group(formConfig);
} }
public async saveDocumentInfo() { async saveDocumentInfo() {
const attributeIdToValue = { ...this.file.fileAttributes?.attributeIdToValue, ...this.documentInfoForm.getRawValue() }; const attributeIdToValue = { ...this.file.fileAttributes?.attributeIdToValue, ...this.documentInfoForm.getRawValue() };
await this._fileAttributesService.setFileAttributes({ attributeIdToValue }, this.file.projectId, this.file.fileId).toPromise(); await this._fileAttributesService.setFileAttributes({ attributeIdToValue }, this.file.projectId, this.file.fileId).toPromise();
this.file.fileAttributes = { attributeIdToValue }; this.file.fileAttributes = { attributeIdToValue };

View File

@ -84,7 +84,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
this.redactionDictionaries.sort((a, b) => a.label.localeCompare(b.label)); this.redactionDictionaries.sort((a, b) => a.label.localeCompare(b.label));
} }
public get displayedDictionaryLabel() { get displayedDictionaryLabel() {
const dictType = this.redactionForm.get('dictionary').value; const dictType = this.redactionForm.get('dictionary').value;
if (dictType) { if (dictType) {
return this.redactionDictionaries.find((d) => d.type === dictType).label; return this.redactionDictionaries.find((d) => d.type === dictType).label;

View File

@ -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 { AnnotationWrapper } from '../../../../models/file/annotation.wrapper';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { ConfirmationDialogInput } from '../../../shared/dialogs/confirmation-dialog/confirmation-dialog.component';
export interface RemoveAnnotationsDialogInput { export interface RemoveAnnotationsDialogInput {
annotationsToRemove: AnnotationWrapper[]; annotationsToRemove: AnnotationWrapper[];
@ -14,15 +13,13 @@ export interface RemoveAnnotationsDialogInput {
templateUrl: './remove-annotations-dialog.component.html', templateUrl: './remove-annotations-dialog.component.html',
styleUrls: ['./remove-annotations-dialog.component.scss'] styleUrls: ['./remove-annotations-dialog.component.scss']
}) })
export class RemoveAnnotationsDialogComponent implements OnInit { export class RemoveAnnotationsDialogComponent {
constructor( constructor(
private readonly _translateService: TranslateService, private readonly _translateService: TranslateService,
public dialogRef: MatDialogRef<RemoveAnnotationsDialogComponent>, public dialogRef: MatDialogRef<RemoveAnnotationsDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: RemoveAnnotationsDialogInput @Inject(MAT_DIALOG_DATA) public data: RemoveAnnotationsDialogInput
) {} ) {}
ngOnInit(): void {}
deny() { deny() {
this.dialogRef.close(); this.dialogRef.close();
} }

View File

@ -38,15 +38,15 @@ const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f'];
styleUrls: ['./file-preview-screen.component.scss'] styleUrls: ['./file-preview-screen.component.scss']
}) })
export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, OnDetach { export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, OnDetach {
public dialogRef: MatDialogRef<any>; dialogRef: MatDialogRef<any>;
public viewMode: ViewMode = 'STANDARD'; viewMode: ViewMode = 'STANDARD';
public fullScreen = false; fullScreen = false;
public editingReviewer = false; editingReviewer = false;
public reviewerForm: FormGroup; reviewerForm: FormGroup;
public shouldDeselectAnnotationsOnPageChange = true; shouldDeselectAnnotationsOnPageChange = true;
public analysisProgressInSeconds = 0; analysisProgressInSeconds = 0;
public analysisProgress: number; analysisProgress: number;
public analysisInterval: number; analysisInterval: number;
fileData: FileDataModel; fileData: FileDataModel;
annotationData: AnnotationData; annotationData: AnnotationData;
selectedAnnotations: AnnotationWrapper[]; selectedAnnotations: AnnotationWrapper[];
@ -59,19 +59,19 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
fileReanalysedSubscription: Subscription; fileReanalysedSubscription: Subscription;
hideSkipped = false; hideSkipped = false;
displayPDFViewer = false; displayPDFViewer = false;
public viewDocumentInfo = false; viewDocumentInfo = false;
private _instance: WebViewerInstance; private _instance: WebViewerInstance;
private _lastPage: string; private _lastPage: string;
@ViewChild('fileWorkloadComponent') private _workloadComponent: FileWorkloadComponent; @ViewChild('fileWorkloadComponent') private _workloadComponent: FileWorkloadComponent;
@ViewChild(PdfViewerComponent) private _viewerComponent: PdfViewerComponent; @ViewChild(PdfViewerComponent) private _viewerComponent: PdfViewerComponent;
@ViewChild(FileWorkloadComponent) public fileWorkloadComponent: FileWorkloadComponent; @ViewChild(FileWorkloadComponent) fileWorkloadComponent: FileWorkloadComponent;
constructor( constructor(
public readonly appStateService: AppStateService, readonly appStateService: AppStateService,
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
public readonly userPreferenceService: UserPreferenceService, readonly userPreferenceService: UserPreferenceService,
public readonly userService: UserService, readonly userService: UserService,
private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _activatedRoute: ActivatedRoute, private readonly _activatedRoute: ActivatedRoute,
private readonly _dialogService: ProjectsDialogService, private readonly _dialogService: ProjectsDialogService,
@ -135,7 +135,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
const redactions = allAnnotations.filter((a) => a.getCustomData('redaction')); const redactions = allAnnotations.filter((a) => a.getCustomData('redaction'));
switch (this.viewMode) { switch (this.viewMode) {
case 'STANDARD': case 'STANDARD': {
const standardEntries = allAnnotations.filter((a) => !a.getCustomData('changeLogRemoved')); const standardEntries = allAnnotations.filter((a) => !a.getCustomData('changeLogRemoved'));
const nonStandardEntries = allAnnotations.filter((a) => a.getCustomData('changeLogRemoved')); const nonStandardEntries = allAnnotations.filter((a) => a.getCustomData('changeLogRemoved'));
redactions.forEach((redaction) => { redactions.forEach((redaction) => {
@ -144,7 +144,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
this._instance.annotManager.showAnnotations(standardEntries); this._instance.annotManager.showAnnotations(standardEntries);
this._instance.annotManager.hideAnnotations(nonStandardEntries); this._instance.annotManager.hideAnnotations(nonStandardEntries);
break; break;
case 'DELTA': }
case 'DELTA': {
const changeLogEntries = allAnnotations.filter((a) => a.getCustomData('changeLog')); const changeLogEntries = allAnnotations.filter((a) => a.getCustomData('changeLog'));
const nonChangeLogEntries = allAnnotations.filter((a) => !a.getCustomData('changeLog')); const nonChangeLogEntries = allAnnotations.filter((a) => !a.getCustomData('changeLog'));
redactions.forEach((redaction) => { redactions.forEach((redaction) => {
@ -153,7 +154,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
this._instance.annotManager.showAnnotations(changeLogEntries); this._instance.annotManager.showAnnotations(changeLogEntries);
this._instance.annotManager.hideAnnotations(nonChangeLogEntries); this._instance.annotManager.hideAnnotations(nonChangeLogEntries);
break; break;
case 'REDACTED': }
case 'REDACTED': {
const redactionEntries = allAnnotations.filter((a) => a.getCustomData('redaction')); const redactionEntries = allAnnotations.filter((a) => a.getCustomData('redaction'));
const nonRedactionEntries = allAnnotations.filter((a) => !a.getCustomData('redaction')); const nonRedactionEntries = allAnnotations.filter((a) => !a.getCustomData('redaction'));
redactions.forEach((redaction) => { redactions.forEach((redaction) => {
@ -162,6 +164,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
this._instance.annotManager.showAnnotations(redactionEntries); this._instance.annotManager.showAnnotations(redactionEntries);
this._instance.annotManager.hideAnnotations(nonRedactionEntries); this._instance.annotManager.hideAnnotations(nonRedactionEntries);
break; break;
}
} }
this.rebuildFilters(); this.rebuildFilters();
@ -184,7 +187,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
ngOnInit(): void { ngOnInit(): void {
this.displayPDFViewer = true; this.displayPDFViewer = true;
document.documentElement.addEventListener('fullscreenchange', (event) => { document.documentElement.addEventListener('fullscreenchange', () => {
if (!document.fullscreenElement) { if (!document.fullscreenElement) {
this.fullScreen = false; this.fullScreen = false;
} }
@ -201,7 +204,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
this._unsubscribeFromFileUpdates(); this._unsubscribeFromFileUpdates();
} }
public rebuildFilters(deletePreviousAnnotations: boolean = false) { rebuildFilters(deletePreviousAnnotations: boolean = false) {
const startTime = new Date().getTime(); const startTime = new Date().getTime();
if (deletePreviousAnnotations) { if (deletePreviousAnnotations) {
this.activeViewer.annotManager.deleteAnnotations(this.activeViewer.annotManager.getAnnotationsList(), { 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 }) { selectAnnotations(annotations?: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) {
if (!!annotations) { if (annotations) {
this._viewerComponent.selectAnnotations(annotations); this._viewerComponent.selectAnnotations(annotations);
} else { } else {
this._viewerComponent.deselectAllAnnotations(); this._viewerComponent.deselectAllAnnotations();
@ -278,7 +281,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
}); });
} }
public toggleFullScreen() { toggleFullScreen() {
this.fullScreen = !this.fullScreen; this.fullScreen = !this.fullScreen;
if (this.fullScreen) { if (this.fullScreen) {
this._openFullScreen(); 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._fileActionService.assignToMe(this.fileData.fileStatus, async () => {
await this.appStateService.reloadActiveFile(); await this.appStateService.reloadActiveFile();
this.resetReviewerForm(); this.resetReviewerForm();
@ -379,7 +382,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
}); });
} }
public assignReviewer() { assignReviewer() {
const reviewerId = this.reviewerForm.get('reviewer').value; const reviewerId = this.reviewerForm.get('reviewer').value;
this._statusControllerService.setFileReviewer(this.fileData.fileStatus.projectId, this.fileData.fileStatus.fileId, reviewerId).subscribe(async () => { 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 }); this.reviewerForm.setValue({ reviewer: this.appStateService.activeFile.currentReviewer });
} }

View File

@ -128,7 +128,7 @@
<redaction-initials-avatar [userId]="pw.project.ownerId" [withName]="true"></redaction-initials-avatar> <redaction-initials-avatar [userId]="pw.project.ownerId" [withName]="true"></redaction-initials-avatar>
</div> </div>
<div class="status-container"> <div class="status-container">
<redaction-project-listing-actions (actionPerformed)="actionPerformed($event)" [project]="pw"></redaction-project-listing-actions> <redaction-project-listing-actions (actionPerformed)="actionPerformed()" [project]="pw"></redaction-project-listing-actions>
</div> </div>
<div class="scrollbar-placeholder"></div> <div class="scrollbar-placeholder"></div>
</div> </div>

View File

@ -20,7 +20,7 @@ import { filter, tap } from 'rxjs/operators';
import { TranslateChartService } from '../../../../services/translate-chart.service'; import { TranslateChartService } from '../../../../services/translate-chart.service';
import { RedactionFilterSorter } from '../../../../utils/sorters/redaction-filter-sorter'; import { RedactionFilterSorter } from '../../../../utils/sorters/redaction-filter-sorter';
import { StatusSorter } from '../../../../utils/sorters/status-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 { FilterComponent } from '../../../shared/components/filter/filter.component';
import { ProjectsDialogService } from '../../services/projects-dialog.service'; import { ProjectsDialogService } from '../../services/projects-dialog.service';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
@ -36,15 +36,15 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
protected readonly _searchKey = 'name'; protected readonly _searchKey = 'name';
protected readonly _sortKey = 'project-listing'; protected readonly _sortKey = 'project-listing';
public projectsChartData: DoughnutChartConfig[] = []; projectsChartData: DoughnutChartConfig[] = [];
public documentsChartData: DoughnutChartConfig[] = []; documentsChartData: DoughnutChartConfig[] = [];
public statusFilters: FilterModel[]; statusFilters: FilterModel[];
public peopleFilters: FilterModel[]; peopleFilters: FilterModel[];
public needsWorkFilters: FilterModel[]; needsWorkFilters: FilterModel[];
public ruleSetFilters: FilterModel[]; ruleSetFilters: FilterModel[];
public detailsContainerFilters: { detailsContainerFilters: {
statusFilters: FilterModel[]; statusFilters: FilterModel[];
} = { } = {
statusFilters: [] statusFilters: []
@ -64,7 +64,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
private _fileChangedSub: Subscription; private _fileChangedSub: Subscription;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _translateChartService: TranslateChartService, private readonly _translateChartService: TranslateChartService,
private readonly _userService: UserService, private readonly _userService: UserService,
private readonly _dialogService: ProjectsDialogService, private readonly _dialogService: ProjectsDialogService,
@ -78,7 +78,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
this._loadEntitiesFromState(); this._loadEntitiesFromState();
} }
public ngOnInit(): void { ngOnInit(): void {
this._calculateData(); this._calculateData();
this._projectAutoUpdateTimer = timer(0, 10000) this._projectAutoUpdateTimer = timer(0, 10000)
@ -103,7 +103,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
}); });
} }
ngOnAttach(previousRoute: ActivatedRouteSnapshot) { ngOnAttach() {
this._appStateService.reset(); this._appStateService.reset();
this._loadEntitiesFromState(); this._loadEntitiesFromState();
this.ngOnInit(); this.ngOnInit();
@ -124,11 +124,11 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
this.allEntities = this._appStateService.allProjects; this.allEntities = this._appStateService.allProjects;
} }
public get noData() { get noData() {
return this.allEntities.length === 0; return this.allEntities.length === 0;
} }
protected get filterComponents(): FilterComponent[] { protected get _filterComponents(): FilterComponent[] {
return [this._statusFilterComponent, this._peopleFilterComponent, this._needsWorkFilterComponent, this._ruleSetFilterComponent]; return [this._statusFilterComponent, this._peopleFilterComponent, this._needsWorkFilterComponent, this._ruleSetFilterComponent];
} }
@ -153,35 +153,35 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
this.documentsChartData = this._translateChartService.translateStatus(this.documentsChartData); this.documentsChartData = this._translateChartService.translateStatus(this.documentsChartData);
} }
public get user() { get user() {
return this._userService.user; return this._userService.user;
} }
public get activeProjectsCount() { get activeProjectsCount() {
return this.allEntities.filter((p) => p.project.status === Project.StatusEnum.ACTIVE).length; return this.allEntities.filter((p) => p.project.status === Project.StatusEnum.ACTIVE).length;
} }
public get inactiveProjectsCount() { get inactiveProjectsCount() {
return this.allEntities.length - this.activeProjectsCount; return this.allEntities.length - this.activeProjectsCount;
} }
public documentCount(project: ProjectWrapper) { documentCount(project: ProjectWrapper) {
return project.files.length; return project.files.length;
} }
public userCount(project: ProjectWrapper) { userCount(project: ProjectWrapper) {
return project.numberOfMembers; return project.numberOfMembers;
} }
public canOpenProject(pw: ProjectWrapper): boolean { canOpenProject(pw: ProjectWrapper): boolean {
return true; return !!pw;
} }
public getRuleSet(pw: ProjectWrapper): RuleSetModel { getRuleSet(pw: ProjectWrapper): RuleSetModel {
return this._appStateService.getRuleSetById(pw.project.ruleSetId); return this._appStateService.getRuleSetById(pw.project.ruleSetId);
} }
public openAddProjectDialog(): void { openAddProjectDialog(): void {
this._dialogService.openAddProjectDialog((addResponse) => { this._dialogService.openAddProjectDialog((addResponse) => {
this._calculateData(); this._calculateData();
this._router.navigate([`/main/projects/${addResponse.project.projectId}`]); this._router.navigate([`/main/projects/${addResponse.project.projectId}`]);
@ -191,7 +191,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
}); });
} }
public openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) { openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) {
this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project); this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project);
} }
@ -261,7 +261,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
this.ruleSetFilters = processFilters(this.ruleSetFilters, ruleSetFilters); this.ruleSetFilters = processFilters(this.ruleSetFilters, ruleSetFilters);
} }
protected get filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] { protected get _filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] {
return [ return [
{ values: this.statusFilters, checker: projectStatusChecker }, { values: this.statusFilters, checker: projectStatusChecker },
{ values: this.peopleFilters, checker: projectMemberChecker }, { values: this.peopleFilters, checker: projectMemberChecker },
@ -275,13 +275,13 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
]; ];
} }
protected preFilter() { protected _preFilter() {
this.detailsContainerFilters = { this.detailsContainerFilters = {
statusFilters: this.statusFilters.map((f) => ({ ...f })) statusFilters: this.statusFilters.map((f) => ({ ...f }))
}; };
} }
public actionPerformed(pw: ProjectWrapper) { actionPerformed() {
this._calculateData(); this._calculateData();
} }
} }

View File

@ -1,5 +1,5 @@
import { Component, HostListener, Injector, OnDestroy, OnInit, ViewChild } from '@angular/core'; 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 { NotificationService, NotificationType } from '../../../../services/notification.service';
import { AppStateService } from '../../../../state/app-state.service'; import { AppStateService } from '../../../../state/app-state.service';
import { FileDropOverlayService } from '../../../upload-download/services/file-drop-overlay.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 { filter, tap } from 'rxjs/operators';
import { RedactionFilterSorter } from '../../../../utils/sorters/redaction-filter-sorter'; import { RedactionFilterSorter } from '../../../../utils/sorters/redaction-filter-sorter';
import { StatusSorter } from '../../../../utils/sorters/status-sorter'; import { StatusSorter } from '../../../../utils/sorters/status-sorter';
import { FormGroup } from '@angular/forms';
import { convertFiles, handleFileDrop } from '../../../../utils/file-drop-utils'; import { convertFiles, handleFileDrop } from '../../../../utils/file-drop-utils';
import { FilterComponent } from '../../../shared/components/filter/filter.component'; import { FilterComponent } from '../../../shared/components/filter/filter.component';
import { ProjectsDialogService } from '../../services/projects-dialog.service'; import { ProjectsDialogService } from '../../services/projects-dialog.service';
@ -38,10 +37,10 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
protected readonly _selectionKey = 'fileId'; protected readonly _selectionKey = 'fileId';
protected readonly _sortKey = 'project-overview'; protected readonly _sortKey = 'project-overview';
public statusFilters: FilterModel[]; statusFilters: FilterModel[];
public peopleFilters: FilterModel[]; peopleFilters: FilterModel[];
public needsWorkFilters: FilterModel[]; needsWorkFilters: FilterModel[];
public collapsedDetails = false; collapsedDetails = false;
detailsContainerFilters: { detailsContainerFilters: {
needsWorkFilters: FilterModel[]; needsWorkFilters: FilterModel[];
@ -62,7 +61,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
@ViewChild('needsWorkFilter') private _needsWorkFilterComponent: FilterComponent; @ViewChild('needsWorkFilter') private _needsWorkFilterComponent: FilterComponent;
constructor( constructor(
public readonly permissionsService: PermissionsService, readonly permissionsService: PermissionsService,
private readonly _userService: UserService, private readonly _userService: UserService,
private readonly _notificationService: NotificationService, private readonly _notificationService: NotificationService,
private readonly _dialogService: ProjectsDialogService, private readonly _dialogService: ProjectsDialogService,
@ -112,7 +111,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
this._routerEventsScrollPositionSub.unsubscribe(); this._routerEventsScrollPositionSub.unsubscribe();
} }
ngOnAttach(previousRoute: ActivatedRouteSnapshot) { ngOnAttach() {
this._loadEntitiesFromState(); this._loadEntitiesFromState();
this.ngOnInit(); this.ngOnInit();
this._scrollBar.scrollTo({ top: this._lastScrollPosition }); this._scrollBar.scrollTo({ top: this._lastScrollPosition });
@ -122,11 +121,11 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
this.ngOnDestroy(); this.ngOnDestroy();
} }
public get activeProject(): ProjectWrapper { get activeProject(): ProjectWrapper {
return this._appStateService.activeProject; return this._appStateService.activeProject;
} }
public reanalyseProject() { reanalyseProject() {
return this._appStateService return this._appStateService
.reanalyzeProject() .reanalyzeProject()
.then(() => { .then(() => {
@ -146,19 +145,19 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
}); });
} }
public isPending(fileStatusWrapper: FileStatusWrapper) { isPending(fileStatusWrapper: FileStatusWrapper) {
return fileStatusWrapper.status === FileStatus.StatusEnum.UNPROCESSED; return fileStatusWrapper.status === FileStatus.StatusEnum.UNPROCESSED;
} }
public isError(fileStatusWrapper: FileStatusWrapper) { isError(fileStatusWrapper: FileStatusWrapper) {
return fileStatusWrapper.status === FileStatus.StatusEnum.ERROR; return fileStatusWrapper.status === FileStatus.StatusEnum.ERROR;
} }
public isProcessing(fileStatusWrapper: FileStatusWrapper) { isProcessing(fileStatusWrapper: FileStatusWrapper) {
return [FileStatus.StatusEnum.REPROCESS, FileStatus.StatusEnum.FULLREPROCESS, FileStatus.StatusEnum.PROCESSING].includes(fileStatusWrapper.status); return [FileStatus.StatusEnum.REPROCESS, FileStatus.StatusEnum.FULLREPROCESS, FileStatus.StatusEnum.PROCESSING].includes(fileStatusWrapper.status);
} }
protected get filterComponents(): FilterComponent[] { protected get _filterComponents(): FilterComponent[] {
return [this._statusFilterComponent, this._peopleFilterComponent, this._needsWorkFilterComponent]; return [this._statusFilterComponent, this._peopleFilterComponent, this._needsWorkFilterComponent];
} }
@ -183,7 +182,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
} }
public fileId(index, item) { fileId(index, item) {
return item.fileId; return item.fileId;
} }
@ -283,7 +282,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
return this.permissionsService.canOpenFile(fileStatus) ? ['/main/projects/' + this.activeProject.project.projectId + '/file/' + fileStatus.fileId] : []; return this.permissionsService.canOpenFile(fileStatus) ? ['/main/projects/' + this.activeProject.project.projectId + '/file/' + fileStatus.fileId] : [];
} }
protected get filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] { protected get _filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] {
return [ return [
{ values: this.statusFilters, checker: keyChecker('status') }, { values: this.statusFilters, checker: keyChecker('status') },
{ values: this.peopleFilters, checker: keyChecker('currentReviewer') }, { values: this.peopleFilters, checker: keyChecker('currentReviewer') },
@ -296,7 +295,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
]; ];
} }
protected preFilter() { protected _preFilter() {
this.detailsContainerFilters = { this.detailsContainerFilters = {
needsWorkFilters: this.needsWorkFilters.map((f) => ({ ...f })), needsWorkFilters: this.needsWorkFilters.map((f) => ({ ...f })),
statusFilters: this.statusFilters.map((f) => ({ ...f })) statusFilters: this.statusFilters.map((f) => ({ ...f }))
@ -308,23 +307,23 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
this.reloadProjects(); this.reloadProjects();
} }
public openEditProjectDialog($event: MouseEvent) { openEditProjectDialog($event: MouseEvent) {
this._dialogService.openEditProjectDialog($event, this.activeProject); this._dialogService.openEditProjectDialog($event, this.activeProject);
} }
public openDeleteProjectDialog($event: MouseEvent) { openDeleteProjectDialog($event: MouseEvent) {
this._dialogService.openDeleteProjectDialog($event, this.activeProject, () => { this._dialogService.openDeleteProjectDialog($event, this.activeProject, () => {
this._router.navigate(['/main/projects']); this._router.navigate(['/main/projects']);
}); });
} }
public openAssignProjectMembersDialog(): void { openAssignProjectMembersDialog(): void {
this._dialogService.openAssignProjectMembersAndOwnerDialog(null, this.activeProject, () => { this._dialogService.openAssignProjectMembersAndOwnerDialog(null, this.activeProject, () => {
this.reloadProjects(); this.reloadProjects();
}); });
} }
public toggleCollapsedDetails() { toggleCollapsedDetails() {
this.collapsedDetails = !this.collapsedDetails; this.collapsedDetails = !this.collapsedDetails;
} }
} }

View File

@ -21,21 +21,21 @@ export class AnnotationActionsService {
private readonly _dialogService: ProjectsDialogService private readonly _dialogService: ProjectsDialogService
) {} ) {}
public acceptSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) { acceptSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
$event?.stopPropagation(); $event?.stopPropagation();
annotations.forEach((annotation) => { annotations.forEach((annotation) => {
this._processObsAndEmit(this._manualAnnotationService.approveRequest(annotation.id, annotation.isModifyDictionary), annotation, annotationsChanged); this._processObsAndEmit(this._manualAnnotationService.approveRequest(annotation.id, annotation.isModifyDictionary), annotation, annotationsChanged);
}); });
} }
public rejectSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) { rejectSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
$event?.stopPropagation(); $event?.stopPropagation();
annotations.forEach((annotation) => { annotations.forEach((annotation) => {
this._processObsAndEmit(this._manualAnnotationService.declineOrRemoveRequest(annotation), annotation, annotationsChanged); this._processObsAndEmit(this._manualAnnotationService.declineOrRemoveRequest(annotation), annotation, annotationsChanged);
}); });
} }
public forceRedaction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) { forceRedaction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
$event?.stopPropagation(); $event?.stopPropagation();
this._dialogService.openForceRedactionDialog($event, (request) => { this._dialogService.openForceRedactionDialog($event, (request) => {
annotations.forEach((annotation) => { annotations.forEach((annotation) => {
@ -48,7 +48,7 @@ export class AnnotationActionsService {
}); });
} }
public suggestRemoveAnnotation( suggestRemoveAnnotation(
$event: MouseEvent, $event: MouseEvent,
annotations: AnnotationWrapper[], annotations: AnnotationWrapper[],
removeFromDictionary: boolean, removeFromDictionary: boolean,
@ -65,7 +65,7 @@ export class AnnotationActionsService {
}); });
} }
public markAsFalsePositive($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) { markAsFalsePositive($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
annotations.forEach((annotation) => { annotations.forEach((annotation) => {
const permissions = AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, annotation); const permissions = AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, annotation);
const value = permissions.canMarkTextOnlyAsFalsePositive ? annotation.value : this._getFalsePositiveText(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<AnnotationWrapper>) { undoDirectAction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
$event?.stopPropagation(); $event?.stopPropagation();
annotations.forEach((annotation) => { annotations.forEach((annotation) => {
@ -82,7 +82,7 @@ export class AnnotationActionsService {
}); });
} }
public convertRecommendationToAnnotation($event: any, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) { convertRecommendationToAnnotation($event: any, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
$event?.stopPropagation(); $event?.stopPropagation();
annotations.forEach((annotation) => { annotations.forEach((annotation) => {
@ -101,15 +101,13 @@ export class AnnotationActionsService {
); );
} }
public getViewerAvailableActions(annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>): {}[] { getViewerAvailableActions(annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>): Record<string, unknown>[] {
const availableActions = []; const availableActions = [];
const annotationPermissions = annotations.map((a) => { const annotationPermissions = annotations.map((a) => ({
return { annotation: a,
annotation: a, permissions: AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, a)
permissions: AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, a) }));
};
});
const canForceRedaction = annotationPermissions.reduce((acc, next) => acc && next.permissions.canForceRedaction, true); const canForceRedaction = annotationPermissions.reduce((acc, next) => acc && next.permissions.canForceRedaction, true);
if (canForceRedaction) { if (canForceRedaction) {

View File

@ -14,7 +14,7 @@ export class AnnotationDrawService {
private readonly _userPreferenceService: UserPreferenceService private readonly _userPreferenceService: UserPreferenceService
) {} ) {}
public drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[], hideSkipped: boolean = false) { drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[], hideSkipped: boolean = false) {
const annotations = []; const annotations = [];
annotationWrappers.forEach((annotation) => { annotationWrappers.forEach((annotation) => {
annotations.push(this.computeAnnotation(activeViewer, annotation, hideSkipped)); 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 = []; const sections = [];
for (const page of Object.keys(sectionGrid.rectanglesPerPage)) { for (const page of Object.keys(sectionGrid.rectanglesPerPage)) {
const sectionRectangles: SectionRectangle[] = sectionGrid.rectanglesPerPage[page]; const sectionRectangles: SectionRectangle[] = sectionGrid.rectanglesPerPage[page];
@ -49,7 +49,7 @@ export class AnnotationDrawService {
annotationManager.drawAnnotationsFromList(sections); 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 rectangleAnnot = new activeViewer.Annotations.RectangleAnnotation();
const pageHeight = activeViewer.docViewer.getPageHeight(pageNumber); const pageHeight = activeViewer.docViewer.getPageHeight(pageNumber);
const rectangle = { const rectangle = {
@ -70,7 +70,7 @@ export class AnnotationDrawService {
return rectangleAnnot; return rectangleAnnot;
} }
public computeAnnotation(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper, hideSkipped: boolean = false) { computeAnnotation(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper, hideSkipped: boolean = false) {
const pageNumber = annotationWrapper.pageNumber; const pageNumber = annotationWrapper.pageNumber;
const highlight = new activeViewer.Annotations.TextHighlightAnnotation(); const highlight = new activeViewer.Annotations.TextHighlightAnnotation();
highlight.PageNumber = pageNumber; highlight.PageNumber = pageNumber;
@ -133,7 +133,7 @@ export class AnnotationDrawService {
return new activeViewer.CoreControls.Math.Quad(x1, y1, x2, y2, x3, y3, x4, y4); 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 x1 = annotation.getRect().x1;
const y1 = annotation.getRect().y1 + annotation.getRect().getHeight(); const y1 = annotation.getRect().y1 + annotation.getRect().getHeight();

View File

@ -114,7 +114,7 @@ export class AnnotationProcessingService {
flatFilters.push(...filter.filters); 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 => { private _matchesOne = (filters: FilterModel[], condition: (filter: FilterModel) => boolean): boolean => {

View File

@ -18,21 +18,21 @@ export class FileActionService {
private readonly _appStateService: AppStateService private readonly _appStateService: AppStateService
) {} ) {}
public reanalyseFile(fileStatusWrapper?: FileStatusWrapper, priority = -1) { reanalyseFile(fileStatusWrapper?: FileStatusWrapper, priority = -1) {
if (!fileStatusWrapper) { if (!fileStatusWrapper) {
fileStatusWrapper = this._appStateService.activeFile; fileStatusWrapper = this._appStateService.activeFile;
} }
return this._reanalysisControllerService.reanalyzeFile(this._appStateService.activeProject.project.projectId, fileStatusWrapper.fileId, priority); return this._reanalysisControllerService.reanalyzeFile(this._appStateService.activeProject.project.projectId, fileStatusWrapper.fileId, priority);
} }
public toggleAnalysis(fileStatusWrapper?: FileStatusWrapper) { toggleAnalysis(fileStatusWrapper?: FileStatusWrapper) {
if (!fileStatusWrapper) { if (!fileStatusWrapper) {
fileStatusWrapper = this._appStateService.activeFile; fileStatusWrapper = this._appStateService.activeFile;
} }
return this._reanalysisControllerService.toggleAnalysis(fileStatusWrapper.projectId, fileStatusWrapper.fileId, fileStatusWrapper.isExcluded); 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()) { if (this._permissionsService.isManagerAndOwner()) {
this._openAssignReviewerDialog(file, callback); this._openAssignReviewerDialog(file, callback);
} else { } 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( this._dialogService.openAssignFileReviewerDialog(
file ? file : this._appStateService.activeFile, file ? file : this._appStateService.activeFile,
async () => { async () => {
@ -62,7 +62,7 @@ export class FileActionService {
); );
} }
public async assignToMe(file?: FileStatus, callback?: Function) { async assignToMe(file?: FileStatus, callback?: Function) {
if (!file.currentReviewer) { if (!file.currentReviewer) {
await this._assignReviewerToCurrentUser(file, callback); await this._assignReviewerToCurrentUser(file, callback);
} else { } else {

View File

@ -66,7 +66,7 @@ export class ManualAnnotationService {
// this wraps // this wraps
// /manualRedaction/redaction/force // /manualRedaction/redaction/force
// /manualRedaction/request/force // /manualRedaction/request/force
public forceRedaction(request: ForceRedactionRequest) { forceRedaction(request: ForceRedactionRequest) {
if (this._permissionsService.isManagerAndOwner()) { if (this._permissionsService.isManagerAndOwner()) {
return this._makeForceRedaction(request); return this._makeForceRedaction(request);
} else { } else {
@ -76,7 +76,7 @@ export class ManualAnnotationService {
// this wraps // this wraps
// /manualRedaction/approve // /manualRedaction/approve
public approveRequest(annotationId: string, addToDictionary: boolean = false) { approveRequest(annotationId: string, addToDictionary: boolean = false) {
// for only here - approve the request // for only here - approve the request
return this._manualRedactionControllerService return this._manualRedactionControllerService
.approveRequest( .approveRequest(

View File

@ -41,9 +41,7 @@ export class PdfViewerDataService {
const viewedPagesObs = this.getViewedPagesForActiveFile(); const viewedPagesObs = this.getViewedPagesForActiveFile();
return forkJoin([fileObs, reactionLogObs, redactionChangeLogObs, manualRedactionsObs, viewedPagesObs]).pipe( return forkJoin([fileObs, reactionLogObs, redactionChangeLogObs, manualRedactionsObs, viewedPagesObs]).pipe(
map((data) => { map((data) => new FileDataModel(this._appStateService.activeFile, ...data))
return new FileDataModel(this._appStateService.activeFile, ...data);
})
); );
} }

View File

@ -5,9 +5,7 @@ import {
FileManagementControllerService, FileManagementControllerService,
FileStatus, FileStatus,
ManualRedactionControllerService, ManualRedactionControllerService,
RuleSetControllerService, RuleSetControllerService
RuleSetModel,
TypeValue
} from '@redaction/red-ui-http'; } from '@redaction/red-ui-http';
import { AddEditProjectDialogComponent } from '../dialogs/add-edit-project-dialog/add-edit-project-dialog.component'; import { AddEditProjectDialogComponent } from '../dialogs/add-edit-project-dialog/add-edit-project-dialog.component';
import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component'; import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component';
@ -44,7 +42,7 @@ export class ProjectsDialogService {
private readonly _manualRedactionControllerService: ManualRedactionControllerService private readonly _manualRedactionControllerService: ManualRedactionControllerService
) {} ) {}
public openDeleteFilesDialog($event: MouseEvent, projectId: string, fileIds: string[], cb?: Function): MatDialogRef<ConfirmationDialogComponent> { openDeleteFilesDialog($event: MouseEvent, projectId: string, fileIds: string[], cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
$event?.stopPropagation(); $event?.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, { const ref = this._dialog.open(ConfirmationDialogComponent, {
@ -70,7 +68,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openManualAnnotationDialog($event: ManualRedactionEntryWrapper, cb?: Function): MatDialogRef<ManualAnnotationDialogComponent> { openManualAnnotationDialog($event: ManualRedactionEntryWrapper, cb?: Function): MatDialogRef<ManualAnnotationDialogComponent> {
const ref = this._dialog.open(ManualAnnotationDialogComponent, { const ref = this._dialog.open(ManualAnnotationDialogComponent, {
...dialogConfig, ...dialogConfig,
autoFocus: true, autoFocus: true,
@ -86,7 +84,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openAcceptSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, callback?: Function): MatDialogRef<ConfirmationDialogComponent> { openAcceptSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, callback?: Function): MatDialogRef<ConfirmationDialogComponent> {
$event?.stopPropagation(); $event?.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
@ -103,7 +101,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openRejectSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, rejectCallback: () => void): MatDialogRef<ConfirmationDialogComponent> { openRejectSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, rejectCallback: () => void): MatDialogRef<ConfirmationDialogComponent> {
$event?.stopPropagation(); $event?.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, { const ref = this._dialog.open(ConfirmationDialogComponent, {
@ -122,7 +120,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openEditProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<AddEditProjectDialogComponent> { openEditProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<AddEditProjectDialogComponent> {
$event.stopPropagation(); $event.stopPropagation();
const ref = this._dialog.open(AddEditProjectDialogComponent, { const ref = this._dialog.open(AddEditProjectDialogComponent, {
...dialogConfig, ...dialogConfig,
@ -138,7 +136,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openForceRedactionDialog($event: MouseEvent, cb?: Function): MatDialogRef<ForceRedactionDialogComponent> { openForceRedactionDialog($event: MouseEvent, cb?: Function): MatDialogRef<ForceRedactionDialogComponent> {
$event?.stopPropagation(); $event?.stopPropagation();
const ref = this._dialog.open(ForceRedactionDialogComponent, { const ref = this._dialog.open(ForceRedactionDialogComponent, {
...dialogConfig ...dialogConfig
@ -151,7 +149,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openRemoveFromDictionaryDialog( openRemoveFromDictionaryDialog(
$event: MouseEvent, $event: MouseEvent,
annotations: AnnotationWrapper[], annotations: AnnotationWrapper[],
removeFromDictionary: boolean, removeFromDictionary: boolean,
@ -170,7 +168,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<ConfirmationDialogComponent> { openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
$event.stopPropagation(); $event.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, { const ref = this._dialog.open(ConfirmationDialogComponent, {
...dialogConfig, ...dialogConfig,
@ -189,7 +187,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openAssignProjectMembersAndOwnerDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<AssignOwnerDialogComponent> { openAssignProjectMembersAndOwnerDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<AssignOwnerDialogComponent> {
$event?.stopPropagation(); $event?.stopPropagation();
const ref = this._dialog.open(AssignOwnerDialogComponent, { const ref = this._dialog.open(AssignOwnerDialogComponent, {
...dialogConfig, ...dialogConfig,
@ -203,7 +201,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openAssignFileReviewerDialog(file: FileStatus, cb?: Function, ignoreDialogChanges = false): MatDialogRef<AssignOwnerDialogComponent> { openAssignFileReviewerDialog(file: FileStatus, cb?: Function, ignoreDialogChanges = false): MatDialogRef<AssignOwnerDialogComponent> {
const ref = this._dialog.open(AssignOwnerDialogComponent, { const ref = this._dialog.open(AssignOwnerDialogComponent, {
...dialogConfig, ...dialogConfig,
data: { type: 'file', files: [file], ignoreChanged: ignoreDialogChanges } data: { type: 'file', files: [file], ignoreChanged: ignoreDialogChanges }
@ -216,7 +214,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openAssignFileToMeDialog(file: FileStatus, cb?: Function) { openAssignFileToMeDialog(file: FileStatus, cb?: Function) {
const ref = this._dialog.open(ConfirmationDialogComponent, { const ref = this._dialog.open(ConfirmationDialogComponent, {
...dialogConfig, ...dialogConfig,
data: new ConfirmationDialogInput({ data: new ConfirmationDialogInput({
@ -229,7 +227,7 @@ export class ProjectsDialogService {
}); });
} }
public openBulkAssignFileReviewerDialog(fileIds: string[], cb?: Function): MatDialogRef<AssignOwnerDialogComponent> { openBulkAssignFileReviewerDialog(fileIds: string[], cb?: Function): MatDialogRef<AssignOwnerDialogComponent> {
const projectId = this._appStateService.activeProject.project.projectId; const projectId = this._appStateService.activeProject.project.projectId;
const ref = this._dialog.open(AssignOwnerDialogComponent, { const ref = this._dialog.open(AssignOwnerDialogComponent, {
...dialogConfig, ...dialogConfig,
@ -246,7 +244,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openAddProjectDialog(cb?: Function): MatDialogRef<AddEditProjectDialogComponent> { openAddProjectDialog(cb?: Function): MatDialogRef<AddEditProjectDialogComponent> {
const ref = this._dialog.open(AddEditProjectDialogComponent, { const ref = this._dialog.open(AddEditProjectDialogComponent, {
...dialogConfig, ...dialogConfig,
autoFocus: true autoFocus: true
@ -259,7 +257,7 @@ export class ProjectsDialogService {
return ref; return ref;
} }
public openDocumentInfoDialog(file: FileStatus, cb?: Function): MatDialogRef<DocumentInfoDialogComponent> { openDocumentInfoDialog(file: FileStatus, cb?: Function): MatDialogRef<DocumentInfoDialogComponent> {
const ref = this._dialog.open(DocumentInfoDialogComponent, { const ref = this._dialog.open(DocumentInfoDialogComponent, {
...dialogConfig, ...dialogConfig,
data: file, data: file,

View File

@ -11,12 +11,12 @@ import { ScreenName, SortingOption, SortingService } from '../../../services/sor
// Usage: overwrite necessary methods/members in your component // Usage: overwrite necessary methods/members in your component
@Component({ template: '' }) @Component({ template: '' })
export class BaseListingComponent<T = any> { export abstract class BaseListingComponent<T = any> {
public allEntities: T[] = []; allEntities: T[] = [];
public filteredEntities: T[] = []; filteredEntities: T[] = [];
public displayedEntities: T[] = []; displayedEntities: T[] = [];
public selectedEntitiesIds: string[] = []; selectedEntitiesIds: string[] = [];
public searchForm: FormGroup; searchForm: FormGroup;
protected readonly _formBuilder: FormBuilder; protected readonly _formBuilder: FormBuilder;
protected readonly _changeDetectorRef: ChangeDetectorRef; protected readonly _changeDetectorRef: ChangeDetectorRef;
@ -24,55 +24,34 @@ export class BaseListingComponent<T = any> {
// ---- // ----
// Overwrite in child class: // Overwrite in child class:
protected readonly _searchKey: string; protected abstract readonly _searchKey: string;
protected readonly _selectionKey: string; protected abstract readonly _selectionKey: string;
protected readonly _sortKey: ScreenName; 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 []; return [];
} }
protected preFilter() { protected _preFilter() {
return; return;
} }
protected get filterComponents(): FilterComponent[] { protected get _filterComponents(): FilterComponent[] {
return []; return [];
} }
protected _searchField(entity: T): string { 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>(FormBuilder); this._formBuilder = this._injector.get<FormBuilder>(FormBuilder);
this._changeDetectorRef = this._injector.get<ChangeDetectorRef>(ChangeDetectorRef); this._changeDetectorRef = this._injector.get<ChangeDetectorRef>(ChangeDetectorRef);
this._sortingService = this._injector.get<SortingService>(SortingService); this._sortingService = this._injector.get<SortingService>(SortingService);
this._initSearch(); 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 // Search
private _initSearch() { private _initSearch() {
@ -89,7 +68,7 @@ export class BaseListingComponent<T = any> {
} }
protected _executeSearchImmediately() { 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._searchField(entity).toLowerCase().includes(this.searchForm.get('query').value.toLowerCase())
); );
this._updateSelection(); this._updateSelection();
@ -97,13 +76,13 @@ export class BaseListingComponent<T = any> {
protected _updateSelection() { protected _updateSelection() {
if (this._selectionKey) { 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 // Filter
public filtersChanged(filters?: { [key: string]: FilterModel[] }): void { filtersChanged(filters?: { [key: string]: FilterModel[] }): void {
if (filters) { if (filters) {
for (const key of Object.keys(filters)) { for (const key of Object.keys(filters)) {
for (let idx = 0; idx < this[key].length; ++idx) { for (let idx = 0; idx < this[key].length; ++idx) {
@ -115,23 +94,23 @@ export class BaseListingComponent<T = any> {
} }
protected _filterEntities() { protected _filterEntities() {
this.preFilter(); this._preFilter();
this.filteredEntities = getFilteredEntities(this.allEntities, this.filters); this.filteredEntities = getFilteredEntities(this.allEntities, this._filters);
this._executeSearch(); this._executeSearch();
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
} }
public resetFilters() { resetFilters() {
for (const filterComponent of this.filterComponents.filter((f) => !!f)) { for (const filterComponent of this._filterComponents.filter((f) => !!f)) {
filterComponent.deactivateAllFilters(); filterComponent.deactivateAllFilters();
} }
this.filtersChanged(); this.filtersChanged();
this.searchForm.reset({ query: '' }); this.searchForm.reset({ query: '' });
} }
public get hasActiveFilters() { get hasActiveFilters() {
return ( 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 this.searchForm.get('query').value
); );
} }
@ -140,41 +119,41 @@ export class BaseListingComponent<T = any> {
toggleEntitySelected($event: MouseEvent, entity: T) { toggleEntitySelected($event: MouseEvent, entity: T) {
$event.stopPropagation(); $event.stopPropagation();
const idx = this.selectedEntitiesIds.indexOf(entity[this.selectionKey]); const idx = this.selectedEntitiesIds.indexOf(entity[this._selectionKey]);
if (idx === -1) { if (idx === -1) {
this.selectedEntitiesIds.push(entity[this.selectionKey]); this.selectedEntitiesIds.push(entity[this._selectionKey]);
} else { } else {
this.selectedEntitiesIds.splice(idx, 1); this.selectedEntitiesIds.splice(idx, 1);
} }
} }
public toggleSelectAll() { toggleSelectAll() {
if (this.areSomeEntitiesSelected) { if (this.areSomeEntitiesSelected) {
this.selectedEntitiesIds = []; this.selectedEntitiesIds = [];
} else { } 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; return this.displayedEntities.length !== 0 && this.selectedEntitiesIds.length === this.displayedEntities.length;
} }
public get areSomeEntitiesSelected() { get areSomeEntitiesSelected() {
return this.selectedEntitiesIds.length > 0; return this.selectedEntitiesIds.length > 0;
} }
public isEntitySelected(entity: T) { isEntitySelected(entity: T) {
return this.selectedEntitiesIds.indexOf(entity[this.selectionKey]) !== -1; return this.selectedEntitiesIds.indexOf(entity[this._selectionKey]) !== -1;
} }
// Sort // Sort
public get sortingOption(): SortingOption { get sortingOption(): SortingOption {
return this._sortingService.getSortingOption(this.sortKey); return this._sortingService.getSortingOption(this._sortKey);
} }
public toggleSort($event) { toggleSort($event) {
this._sortingService.toggleSort(this.sortKey, $event); this._sortingService.toggleSort(this._sortKey, $event);
} }
} }

View File

@ -20,19 +20,19 @@ export class AnnotationIconComponent implements OnInit {
this.icon.nativeElement.style.setProperty('--color', this.backgroundColor); this.icon.nativeElement.style.setProperty('--color', this.backgroundColor);
} }
public get isHint() { get isHint() {
return this.type === 'circle' || this.dictType?.type === 'hint'; return this.type === 'circle' || this.dictType?.type === 'hint';
} }
public get isRequest() { get isRequest() {
return this.type === 'rhombus' || this.dictType?.type === 'redaction'; return this.type === 'rhombus' || this.dictType?.type === 'redaction';
} }
public get isRecommendation() { get isRecommendation() {
return this.type === 'hexagon' || this.dictType?.type === 'recommendation'; return this.type === 'hexagon' || this.dictType?.type === 'recommendation';
} }
public get backgroundColor() { get backgroundColor() {
return this.color || this.dictType?.hexColor; return this.color || this.dictType?.hexColor;
} }
} }

View File

@ -1,16 +1,12 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, Input } from '@angular/core';
@Component({ @Component({
selector: 'redaction-chevron-button', selector: 'redaction-chevron-button',
templateUrl: './chevron-button.component.html', templateUrl: './chevron-button.component.html',
styleUrls: ['./chevron-button.component.scss'] styleUrls: ['./chevron-button.component.scss']
}) })
export class ChevronButtonComponent implements OnInit { export class ChevronButtonComponent {
@Input() text: string; @Input() text: string;
@Input() showDot = false; @Input() showDot = false;
@Input() primary = false; @Input() primary = false;
constructor() {}
ngOnInit(): void {}
} }

View File

@ -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'; import { MatTooltip } from '@angular/material/tooltip';
@Component({ @Component({
@ -6,7 +6,7 @@ import { MatTooltip } from '@angular/material/tooltip';
templateUrl: './circle-button.component.html', templateUrl: './circle-button.component.html',
styleUrls: ['./circle-button.component.scss'] styleUrls: ['./circle-button.component.scss']
}) })
export class CircleButtonComponent implements OnInit { export class CircleButtonComponent {
@Input() icon: string; @Input() icon: string;
@Input() tooltip: string; @Input() tooltip: string;
@Input() showDot = false; @Input() showDot = false;
@ -20,10 +20,6 @@ export class CircleButtonComponent implements OnInit {
@ViewChild(MatTooltip) matTooltip: MatTooltip; @ViewChild(MatTooltip) matTooltip: MatTooltip;
constructor() {}
ngOnInit(): void {}
performAction($event: any) { performAction($event: any) {
if (!this.disabled) { if (!this.disabled) {
if (this.removeTooltip) { if (this.removeTooltip) {

View File

@ -1,19 +1,15 @@
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({ @Component({
selector: 'redaction-icon-button', selector: 'redaction-icon-button',
templateUrl: './icon-button.component.html', templateUrl: './icon-button.component.html',
styleUrls: ['./icon-button.component.scss'] styleUrls: ['./icon-button.component.scss']
}) })
export class IconButtonComponent implements OnInit { export class IconButtonComponent {
@Input() icon: string; @Input() icon: string;
@Input() text: string; @Input() text: string;
@Input() showDot = false; @Input() showDot = false;
@Input() disabled = false; @Input() disabled = false;
@Input() type: 'default' | 'show-bg' | 'primary' = 'default'; @Input() type: 'default' | 'show-bg' | 'primary' = 'default';
@Output() action = new EventEmitter<any>(); @Output() action = new EventEmitter<any>();
constructor() {}
ngOnInit(): void {}
} }

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input } from '@angular/core';
import { UserWrapper } from '../../../../../services/user.service'; import { UserWrapper } from '../../../../../services/user.service';
@Component({ @Component({
@ -6,11 +6,7 @@ import { UserWrapper } from '../../../../../services/user.service';
templateUrl: './user-button.component.html', templateUrl: './user-button.component.html',
styleUrls: ['./user-button.component.scss'] styleUrls: ['./user-button.component.scss']
}) })
export class UserButtonComponent implements OnInit { export class UserButtonComponent {
@Input() user: UserWrapper; @Input() user: UserWrapper;
@Input() showDot = false; @Input() showDot = false;
constructor() {}
ngOnInit(): void {}
} }

View File

@ -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({ @Component({
selector: 'redaction-round-checkbox', selector: 'redaction-round-checkbox',
@ -23,7 +23,7 @@ export class RoundCheckboxComponent implements OnInit, OnChanges {
this._wrapper.nativeElement.style.setProperty('--size', this.size + 'px'); this._wrapper.nativeElement.style.setProperty('--size', this.size + 'px');
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(): void {
this._activeClass = this.active && !this.indeterminate; this._activeClass = this.active && !this.indeterminate;
this._inactiveClass = !this.active && !this.indeterminate; this._inactiveClass = !this.active && !this.indeterminate;
this._indeterminateClass = this.indeterminate; this._indeterminateClass = this.indeterminate;

View File

@ -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 { FilterModel } from './model/filter.model';
import { handleCheckedValue } from './utils/filter-utils'; import { handleCheckedValue } from './utils/filter-utils';
import { MAT_CHECKBOX_DEFAULT_OPTIONS } from '@angular/material/checkbox'; import { MAT_CHECKBOX_DEFAULT_OPTIONS } from '@angular/material/checkbox';
@ -35,7 +35,7 @@ export class FilterComponent implements OnChanges {
constructor(private readonly _changeDetectorRef: ChangeDetectorRef) {} constructor(private readonly _changeDetectorRef: ChangeDetectorRef) {}
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(): void {
this.atLeastOneFilterIsExpandable = false; this.atLeastOneFilterIsExpandable = false;
this.atLeastOneSecondaryFilterIsExpandable = false; this.atLeastOneSecondaryFilterIsExpandable = false;
this.primaryFilters?.forEach((f) => { this.primaryFilters?.forEach((f) => {

View File

@ -144,13 +144,9 @@ export const annotationFilterChecker = (input: FileStatusWrapper | ProjectWrappe
export const projectStatusChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.hasStatus(filter.key); export const projectStatusChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.hasStatus(filter.key);
export const projectMemberChecker = (pw: ProjectWrapper, filter: FilterModel) => { export const projectMemberChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.hasMember(filter.key);
return pw.hasMember(filter.key);
};
export const ruleSetChecker = (pw: ProjectWrapper, filter: FilterModel) => { export const ruleSetChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.ruleSetId === filter.key;
return pw.ruleSetId === filter.key;
};
export const dueDateChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.dueDateMatches(filter.key); export const dueDateChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.dueDateMatches(filter.key);

View File

@ -9,17 +9,19 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./initials-avatar.component.scss'] styleUrls: ['./initials-avatar.component.scss']
}) })
export class InitialsAvatarComponent implements OnChanges { export class InitialsAvatarComponent implements OnChanges {
@Input() public userId: string; @Input() userId: string;
@Input() public user: User; @Input() user: User;
@Input() public color = 'lightgray'; @Input() color = 'lightgray';
@Input() public size: 'small' | 'large' = 'small'; @Input() size: 'small' | 'large' = 'small';
@Input() public withName = false; @Input() withName = false;
@Input() public showYou = false; @Input() showYou = false;
@Input() public tooltipPosition: 'below' | 'above' = 'above'; @Input() tooltipPosition: 'below' | 'above' = 'above';
public displayName: string; displayName: string;
public initials: string;
public colorClass: string; initials: string;
colorClass: string;
constructor(private readonly _userService: UserService, private readonly _translateService: TranslateService) {} 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; return this.user && this._userService.userId === this.user.userId;
} }
public get hasBorder(): boolean { get hasBorder(): boolean {
return !!this.user && !this._isCurrentUser && this._userService.isManager(this.user); 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); return !this._userService.isActive(this.user);
} }
} }

View File

@ -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; const DISPLAYED_ITEMS = 5;
@ -7,34 +7,30 @@ const DISPLAYED_ITEMS = 5;
templateUrl: './pagination.component.html', templateUrl: './pagination.component.html',
styleUrls: ['./pagination.component.scss'] styleUrls: ['./pagination.component.scss']
}) })
export class PaginationComponent implements OnInit { export class PaginationComponent {
private _currentPage: number; private _currentPage: number;
private _totalPages: number; private _totalPages: number;
public displayedPages: (number | string)[]; displayedPages: (number | string)[];
@Input() @Input()
public set settings(value: { currentPage: number; totalPages: number }) { set settings(value: { currentPage: number; totalPages: number }) {
this._currentPage = value.currentPage; this._currentPage = value.currentPage;
this._totalPages = value.totalPages; this._totalPages = value.totalPages;
this._updatePagesArray(); this._updatePagesArray();
} }
public get currentPage() { get currentPage() {
return this._currentPage; return this._currentPage;
} }
public get totalPages() { get totalPages() {
return this._totalPages; return this._totalPages;
} }
@Output() pageChanged = new EventEmitter<number>(); @Output() pageChanged = new EventEmitter<number>();
public displayed; displayed;
constructor() {}
ngOnInit(): void {}
private _updatePagesArray() { private _updatePagesArray() {
this.displayedPages = [0]; this.displayedPages = [0];
@ -52,17 +48,17 @@ export class PaginationComponent implements OnInit {
} }
} }
public get allDisplayed(): boolean { get allDisplayed(): boolean {
return this.totalPages > DISPLAYED_ITEMS; return this.totalPages > DISPLAYED_ITEMS;
} }
public selectPage(page: number | string) { selectPage(page: number | string) {
if (page !== '...') { if (page !== '...') {
this.pageChanged.emit(page as number); this.pageChanged.emit(page as number);
} }
} }
public displayValue(page: number | string) { displayValue(page: number | string) {
return page === '...' ? page : (page as number) + 1; return page === '...' ? page : (page as number) + 1;
} }
} }

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input } from '@angular/core';
import { FormGroup } from '@angular/forms'; import { FormGroup } from '@angular/forms';
@Component({ @Component({
@ -6,24 +6,20 @@ import { FormGroup } from '@angular/forms';
templateUrl: './search-input.component.html', templateUrl: './search-input.component.html',
styleUrls: ['./search-input.component.scss'] styleUrls: ['./search-input.component.scss']
}) })
export class SearchInputComponent implements OnInit { export class SearchInputComponent {
@Input() form: FormGroup; @Input() form: FormGroup;
@Input() placeholder: string; @Input() placeholder: string;
@Input() width: number | 'full' = 250; @Input() width: number | 'full' = 250;
constructor() {} get hasContent() {
ngOnInit(): void {}
public get hasContent() {
return !!this.form.get('query').value.length; return !!this.form.get('query').value.length;
} }
public clearContent() { clearContent() {
this.form.patchValue({ query: '' }); this.form.patchValue({ query: '' });
} }
public get computedWidth() { get computedWidth() {
return this.width === 'full' ? '100%' : `${this.width}px`; return this.width === 'full' ? '100%' : `${this.width}px`;
} }
} }

View File

@ -47,6 +47,7 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor {
this._onChange = fn; this._onChange = fn;
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
registerOnTouched(fn: any): void {} registerOnTouched(fn: any): void {}
writeValue(value: string[]): void { writeValue(value: string[]): void {

View File

@ -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 { Color } from '../../../../utils/types';
import { FilterModel } from '../filter/model/filter.model'; import { FilterModel } from '../filter/model/filter.model';
@ -25,18 +25,18 @@ export class SimpleDoughnutChartComponent implements OnChanges {
@Input() totalType: 'sum' | 'count' = 'sum'; @Input() totalType: 'sum' | 'count' = 'sum';
@Input() counterText: string; @Input() counterText: string;
@Output() @Output()
public toggleFilter = new EventEmitter<string>(); toggleFilter = new EventEmitter<string>();
public chartData: any[] = []; chartData: any[] = [];
public perimeter: number; perimeter: number;
public cx = 0; cx = 0;
public cy = 0; cy = 0;
public size = 0; size = 0;
public parsedConfig: { color: Color; active?: boolean; checked: boolean; label: string; value: number; key?: string }[]; parsedConfig: { color: Color; active?: boolean; checked: boolean; label: string; value: number; key?: string }[];
constructor() {} constructor() {}
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(): void {
this.calculateChartData(); this.calculateChartData();
this.cx = this.radius + this.strokeWidth / 2; this.cx = this.radius + this.strokeWidth / 2;
this.cy = 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})`; 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})`; return this.totalType === 'sum' ? `${config.value} ${config.label}` : `${config.label} (${config.value} ${this.counterText})`;
} }

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, Input, ViewEncapsulation } from '@angular/core';
import { Color } from '../../../../utils/types'; import { Color } from '../../../../utils/types';
@Component({ @Component({
@ -9,7 +9,7 @@ import { Color } from '../../../../utils/types';
}) })
export class StatusBarComponent { export class StatusBarComponent {
@Input() @Input()
public config: { config: {
length: number; length: number;
color: Color; color: Color;
label?: string; label?: string;
@ -17,7 +17,7 @@ export class StatusBarComponent {
}[] = []; }[] = [];
@Input() @Input()
public small = false; small = false;
constructor() {} constructor() {}
} }

View File

@ -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'; import { SortingOption } from '../../../../services/sorting.service';
@Component({ @Component({
@ -6,19 +6,15 @@ import { SortingOption } from '../../../../services/sorting.service';
templateUrl: './table-col-name.component.html', templateUrl: './table-col-name.component.html',
styleUrls: ['./table-col-name.component.scss'] styleUrls: ['./table-col-name.component.scss']
}) })
export class TableColNameComponent implements OnInit { export class TableColNameComponent {
@Input() public activeSortingOption: SortingOption; @Input() activeSortingOption: SortingOption;
@Input() public column: string; @Input() column: string;
@Input() public label: string; @Input() label: string;
@Input() public withSort = false; @Input() withSort = false;
@Input() public class: string; @Input() class: string;
@Input() public leftIcon: string; @Input() leftIcon: string;
@Input() public rightIcon: string; @Input() rightIcon: string;
@Input() public rightIconTooltip: string; @Input() rightIconTooltip: string;
@Output() public toggleSort = new EventEmitter<string>(); @Output() toggleSort = new EventEmitter<string>();
constructor() {}
ngOnInit(): void {}
} }

View File

@ -1,13 +1,13 @@
import { Component, Inject, OnInit } from '@angular/core'; import { Component, Inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
export class ConfirmationDialogInput { export class ConfirmationDialogInput {
public title?: string; title?: string;
public question?: string; question?: string;
public confirmationText?: string; confirmationText?: string;
public denyText?: string; denyText?: string;
public translateParams?: {}; translateParams?: Record<string, unknown>;
constructor(options: ConfirmationDialogInput) { constructor(options: ConfirmationDialogInput) {
this.title = options.title || ConfirmationDialogInput.default().title; this.title = options.title || ConfirmationDialogInput.default().title;
@ -33,7 +33,7 @@ export class ConfirmationDialogInput {
templateUrl: './confirmation-dialog.component.html', templateUrl: './confirmation-dialog.component.html',
styleUrls: ['./confirmation-dialog.component.scss'] styleUrls: ['./confirmation-dialog.component.scss']
}) })
export class ConfirmationDialogComponent implements OnInit { export class ConfirmationDialogComponent {
constructor( constructor(
private readonly _translateService: TranslateService, private readonly _translateService: TranslateService,
public dialogRef: MatDialogRef<ConfirmationDialogComponent>, public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
@ -44,8 +44,6 @@ export class ConfirmationDialogComponent implements OnInit {
} }
} }
ngOnInit(): void {}
deny() { deny() {
this.dialogRef.close(); this.dialogRef.close();
} }

View File

@ -5,7 +5,7 @@ import { AfterContentChecked, Directive, ElementRef, HostBinding } from '@angula
exportAs: 'redactionHasScrollbar' exportAs: 'redactionHasScrollbar'
}) })
export class HasScrollbarDirective implements AfterContentChecked { export class HasScrollbarDirective implements AfterContentChecked {
constructor(private el: ElementRef) {} constructor(private readonly _elementRef: ElementRef) {}
@HostBinding('class') class = ''; @HostBinding('class') class = '';
@ -20,7 +20,7 @@ export class HasScrollbarDirective implements AfterContentChecked {
} }
} }
public get hasScrollbar() { get hasScrollbar() {
return this.el?.nativeElement.clientHeight < this.el?.nativeElement.scrollHeight; return this._elementRef?.nativeElement.clientHeight < this._elementRef?.nativeElement.scrollHeight;
} }
} }

View File

@ -10,7 +10,7 @@ export class SyncWidthDirective implements AfterViewInit, OnDestroy {
redactionSyncWidth: string; redactionSyncWidth: string;
private _interval: number; private _interval: number;
constructor(private el: ElementRef) {} constructor(private readonly _elementRef: ElementRef) {}
ngAfterViewInit(): void { ngAfterViewInit(): void {
this._interval = setInterval(() => { this._interval = setInterval(() => {
@ -24,14 +24,14 @@ export class SyncWidthDirective implements AfterViewInit, OnDestroy {
@debounce(10) @debounce(10)
matchWidth() { matchWidth() {
const headerItems = this.el.nativeElement.children; const headerItems = this._elementRef.nativeElement.children;
const tableRows = this.el.nativeElement.parentElement.getElementsByClassName(this.redactionSyncWidth); const tableRows = this._elementRef.nativeElement.parentElement.getElementsByClassName(this.redactionSyncWidth);
if (!tableRows || !tableRows.length) { if (!tableRows || !tableRows.length) {
return; return;
} }
this.el.nativeElement.setAttribute('synced', true); this._elementRef.nativeElement.setAttribute('synced', true);
const { tableRow, length } = this._sampleRow(tableRows); const { tableRow, length } = this._sampleRow(tableRows);

View File

@ -1,4 +1,4 @@
import { Component, Inject, OnInit } from '@angular/core'; import { Component, Inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; 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', templateUrl: './overwrite-files-dialog.component.html',
styleUrls: ['./overwrite-files-dialog.component.scss'] styleUrls: ['./overwrite-files-dialog.component.scss']
}) })
export class OverwriteFilesDialogComponent implements OnInit { export class OverwriteFilesDialogComponent {
public remember = false; remember = false;
constructor( constructor(
private readonly _translateService: TranslateService, private readonly _translateService: TranslateService,
@ -16,8 +16,6 @@ export class OverwriteFilesDialogComponent implements OnInit {
@Inject(MAT_DIALOG_DATA) public filename: string @Inject(MAT_DIALOG_DATA) public filename: string
) {} ) {}
ngOnInit(): void {}
cancel() { cancel() {
this.dialogRef.close(); this.dialogRef.close();
} }

View File

@ -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 { FileUploadService } from '../services/file-upload.service';
import { FileUploadModel } from '../model/file-upload.model'; import { FileUploadModel } from '../model/file-upload.model';
import { OverlayRef } from '@angular/cdk/overlay'; import { OverlayRef } from '@angular/cdk/overlay';
@ -11,7 +11,7 @@ import { AppStateService } from '../../../state/app-state.service';
templateUrl: './file-drop.component.html', templateUrl: './file-drop.component.html',
styleUrls: ['./file-drop.component.scss'] styleUrls: ['./file-drop.component.scss']
}) })
export class FileDropComponent implements OnInit { export class FileDropComponent {
constructor( constructor(
private readonly _dialogRef: OverlayRef, private readonly _dialogRef: OverlayRef,
private readonly _fileUploadService: FileUploadService, private readonly _fileUploadService: FileUploadService,
@ -20,8 +20,6 @@ export class FileDropComponent implements OnInit {
private readonly _statusOverlayService: StatusOverlayService private readonly _statusOverlayService: StatusOverlayService
) {} ) {}
ngOnInit() {}
close() { close() {
setTimeout(() => { setTimeout(() => {
this._dialogRef.detach(); this._dialogRef.detach();

View File

@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FileDropComponent } from './file-drop/file-drop.component'; import { FileDropComponent } from './file-drop/file-drop.component';
import { OverlayModule } from '@angular/cdk/overlay'; 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 { SharedModule } from '../shared/shared.module';
import { UploadDownloadDialogService } from './services/upload-download-dialog.service'; import { UploadDownloadDialogService } from './services/upload-download-dialog.service';
import { OverwriteFilesDialogComponent } from './dialogs/overwrite-files-dialog/overwrite-files-dialog.component'; import { OverwriteFilesDialogComponent } from './dialogs/overwrite-files-dialog/overwrite-files-dialog.component';
@ -13,9 +13,9 @@ import { FileDropOverlayService } from './services/file-drop-overlay.service';
@NgModule({ @NgModule({
imports: [CommonModule, SharedModule, OverlayModule], imports: [CommonModule, SharedModule, OverlayModule],
declarations: [FileDropComponent, UploadStatusOverlay, OverwriteFilesDialogComponent], declarations: [FileDropComponent, UploadStatusOverlayComponent, OverwriteFilesDialogComponent],
entryComponents: [FileDropComponent, UploadStatusOverlay], entryComponents: [FileDropComponent, UploadStatusOverlayComponent],
providers: [UploadDownloadDialogService, FileUploadService, FileDownloadService, StatusOverlayService, FileDropOverlayService], providers: [UploadDownloadDialogService, FileUploadService, FileDownloadService, StatusOverlayService, FileDropOverlayService],
exports: [FileDropComponent, UploadStatusOverlay] exports: [FileDropComponent, UploadStatusOverlayComponent]
}) })
export class FileUploadDownloadModule {} export class FileUploadDownloadModule {}

View File

@ -13,9 +13,9 @@ import { KeycloakService } from 'keycloak-angular';
@Injectable() @Injectable()
export class FileDownloadService { export class FileDownloadService {
public downloads: DownloadStatusWrapper[] = []; downloads: DownloadStatusWrapper[] = [];
public hasPendingDownloads; hasPendingDownloads;
constructor( constructor(
private readonly _applicationRef: ApplicationRef, private readonly _applicationRef: ApplicationRef,
@ -27,7 +27,7 @@ export class FileDownloadService {
private readonly _keycloakService: KeycloakService, private readonly _keycloakService: KeycloakService,
private readonly _fileManagementControllerService: FileManagementControllerService private readonly _fileManagementControllerService: FileManagementControllerService
) { ) {
interval(5000).subscribe((val) => { interval(5000).subscribe(() => {
if (_permissionsService.isUser()) { if (_permissionsService.isUser()) {
this.getDownloadStatus().subscribe(() => {}); this.getDownloadStatus().subscribe(() => {});
} }
@ -42,14 +42,10 @@ export class FileDownloadService {
reportTypes: ['WORD_SINGLE_FILE_EFSA_TEMPLATE', 'WORD_SINGLE_FILE_SYNGENTA_TEMPLATE', 'EXCEL_MULTI_FILE'], reportTypes: ['WORD_SINGLE_FILE_EFSA_TEMPLATE', 'WORD_SINGLE_FILE_SYNGENTA_TEMPLATE', 'EXCEL_MULTI_FILE'],
downloadFileTypes: ['PREVIEW', 'REDACTED'] downloadFileTypes: ['PREVIEW', 'REDACTED']
}) })
.pipe( .pipe(mergeMap(() => this.getDownloadStatus()));
mergeMap(() => {
return this.getDownloadStatus();
})
);
} }
public getDownloadStatus() { getDownloadStatus() {
return this._downloadControllerService.getDownloadStatus().pipe( return this._downloadControllerService.getDownloadStatus().pipe(
tap((statusResponse) => { tap((statusResponse) => {
this.downloads = statusResponse.downloadStatus.map((d) => new DownloadStatusWrapper(d)); 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 token = await this._keycloakService.getToken();
const anchor = document.createElement('a'); const anchor = document.createElement('a');
anchor.href = anchor.href =

View File

@ -8,8 +8,8 @@ export class FileDropOverlayService {
private _mouseIn = false; private _mouseIn = false;
private readonly _dropOverlayRef: OverlayRef; private readonly _dropOverlayRef: OverlayRef;
constructor(private overlay: Overlay, private readonly _injector: Injector) { constructor(private readonly _overlay: Overlay, private readonly _injector: Injector) {
this._dropOverlayRef = this.overlay.create({ this._dropOverlayRef = this._overlay.create({
height: '100vh', height: '100vh',
width: '100vw' width: '100vw'
}); });

View File

@ -32,7 +32,7 @@ export class FileUploadService {
private readonly _fileManagementControllerService: FileManagementControllerService, private readonly _fileManagementControllerService: FileManagementControllerService,
private readonly _dialogService: UploadDownloadDialogService private readonly _dialogService: UploadDownloadDialogService
) { ) {
interval(2500).subscribe((val) => { interval(2500).subscribe(() => {
this._handleUploads(); this._handleUploads();
}); });
} }
@ -54,7 +54,7 @@ export class FileUploadService {
for (let idx = 0; idx < files.length; ++idx) { for (let idx = 0; idx < files.length; ++idx) {
const file = files[idx]; const file = files[idx];
let currentOption = option; let currentOption = option;
if (!!projectFiles.find((pf) => pf.filename === file.file.name)) { if (projectFiles.find((pf) => pf.filename === file.file.name)) {
if (!option) { if (!option) {
const res = await this._dialogService.openOverwriteFileDialog(file.file.name); const res = await this._dialogService.openOverwriteFileDialog(file.file.name);
if (res.cancel) { if (res.cancel) {
@ -91,7 +91,7 @@ export class FileUploadService {
this.groupedFiles[file.projectId].push(file); this.groupedFiles[file.projectId].push(file);
} }
public filterFiles() { filterFiles() {
for (const file of this.files) { for (const file of this.files) {
if (file.completed && !file.error) { if (file.completed && !file.error) {
this.removeFile(file); this.removeFile(file);
@ -104,7 +104,7 @@ export class FileUploadService {
this.groupedFiles[file.projectId].splice(index, 1); this.groupedFiles[file.projectId].splice(index, 1);
} }
public get activeProjectKeys() { get activeProjectKeys() {
return Object.keys(this.groupedFiles).filter((projectId) => this.groupedFiles[projectId].length > 0); return Object.keys(this.groupedFiles).filter((projectId) => this.groupedFiles[projectId].length > 0);
} }

Some files were not shown because too many files have changed in this diff Show More