fix eslint errors
This commit is contained in:
parent
0464eb3789
commit
369b890e69
@ -62,14 +62,45 @@
|
||||
"@angular-eslint/use-pipe-transform-interface": "error",
|
||||
"@typescript-eslint/consistent-type-definitions": "error",
|
||||
"@typescript-eslint/dot-notation": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"off",
|
||||
"warn",
|
||||
{
|
||||
"accessibility": "explicit"
|
||||
"accessibility": "no-public"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/member-ordering": "error",
|
||||
"@typescript-eslint/naming-convention": "error",
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"error",
|
||||
{
|
||||
"selector": "memberLike",
|
||||
"modifiers": ["readonly"],
|
||||
"format": ["UPPER_CASE", "camelCase"]
|
||||
},
|
||||
{
|
||||
"selector": "enumMember",
|
||||
"format": ["UPPER_CASE"]
|
||||
},
|
||||
{
|
||||
"selector": "memberLike",
|
||||
"modifiers": ["private"],
|
||||
"format": ["camelCase"],
|
||||
"leadingUnderscore": "require"
|
||||
},
|
||||
{
|
||||
"selector": "memberLike",
|
||||
"modifiers": ["protected"],
|
||||
"format": ["camelCase"],
|
||||
"leadingUnderscore": "require"
|
||||
},
|
||||
{
|
||||
"selector": "memberLike",
|
||||
"modifiers": ["private", "readonly"],
|
||||
"format": ["UPPER_CASE", "camelCase"],
|
||||
"leadingUnderscore": "require"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-inferrable-types": [
|
||||
|
||||
@ -29,9 +29,9 @@ import { UserProfileScreenComponent } from './components/user-profile/user-profi
|
||||
import { PlatformLocation } from '@angular/common';
|
||||
import { BASE_HREF } from './tokens';
|
||||
|
||||
declare var ace;
|
||||
declare let ace;
|
||||
|
||||
export function HttpLoaderFactory(httpClient: HttpClient) {
|
||||
export function httpLoaderFactory(httpClient: HttpClient) {
|
||||
return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json');
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ const components = [AppComponent, LogoComponent, AuthErrorComponent, ToastCompon
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useFactory: HttpLoaderFactory,
|
||||
useFactory: httpLoaderFactory,
|
||||
deps: [HttpClient]
|
||||
}
|
||||
}),
|
||||
|
||||
@ -24,11 +24,11 @@ export class BaseScreenComponent {
|
||||
}
|
||||
|
||||
constructor(
|
||||
public readonly appStateService: AppStateService,
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly userPreferenceService: UserPreferenceService,
|
||||
public readonly titleService: Title,
|
||||
public readonly fileDownloadService: FileDownloadService,
|
||||
readonly appStateService: AppStateService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
readonly titleService: Title,
|
||||
readonly fileDownloadService: FileDownloadService,
|
||||
private readonly _statusOverlayService: StatusOverlayService,
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _router: Router,
|
||||
|
||||
@ -9,17 +9,17 @@ import { DownloadControllerService } from '@redaction/red-ui-http';
|
||||
styleUrls: ['./downloads-list-screen.component.scss']
|
||||
})
|
||||
export class DownloadsListScreenComponent implements OnInit {
|
||||
constructor(public readonly fileDownloadService: FileDownloadService, private readonly _downloadControllerService: DownloadControllerService) {}
|
||||
constructor(readonly fileDownloadService: FileDownloadService, private readonly _downloadControllerService: DownloadControllerService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.fileDownloadService.getDownloadStatus().subscribe();
|
||||
}
|
||||
|
||||
public get noData(): boolean {
|
||||
get noData(): boolean {
|
||||
return this.fileDownloadService.downloads.length === 0;
|
||||
}
|
||||
|
||||
public async downloadItem(download: DownloadStatusWrapper) {
|
||||
async downloadItem(download: DownloadStatusWrapper) {
|
||||
await this.fileDownloadService.performDownload(download);
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-logo',
|
||||
templateUrl: './logo.component.html',
|
||||
styleUrls: ['./logo.component.scss']
|
||||
})
|
||||
export class LogoComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
export class LogoComponent {}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
import * as moment from 'moment';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@ -13,23 +13,21 @@ interface Notification {
|
||||
templateUrl: './notifications.component.html',
|
||||
styleUrls: ['./notifications.component.scss']
|
||||
})
|
||||
export class NotificationsComponent implements OnInit {
|
||||
public notifications: Notification[] = [
|
||||
export class NotificationsComponent {
|
||||
notifications: Notification[] = [
|
||||
{ message: 'This is a notification with longer text wrapping on multiple lines', eventTime: 1607340971000, read: false },
|
||||
{ message: 'This is a <a>link</a>', eventTime: 1607254981000, read: true },
|
||||
{ message: 'This is a <b>notification 1</b>', eventTime: 1607254571000, read: false },
|
||||
{ message: 'Notification', eventTime: 1607385727000, read: true },
|
||||
{ message: 'Another notification', eventTime: 1606829412000, read: false }
|
||||
];
|
||||
public groupedNotifications: { dateString: string; notifications: Notification[] }[] = [];
|
||||
groupedNotifications: { dateString: string; notifications: Notification[] }[] = [];
|
||||
|
||||
constructor(private _translateService: TranslateService) {
|
||||
this._groupNotifications();
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public get hasUnread() {
|
||||
get hasUnread() {
|
||||
return this.notifications.filter((notification) => !notification.read).length > 0;
|
||||
}
|
||||
|
||||
@ -45,7 +43,7 @@ export class NotificationsComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public day(group: { dateString: string; notifications: Notification[] }): string {
|
||||
day(group: { dateString: string; notifications: Notification[] }): string {
|
||||
moment.locale(this._translateService.currentLang);
|
||||
return moment(group.notifications[0].eventTime).calendar({
|
||||
sameDay: `[${this._translateService.instant('notifications.today')}]`,
|
||||
@ -57,7 +55,7 @@ export class NotificationsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public eventTime(eventTime: number): string {
|
||||
eventTime(eventTime: number): string {
|
||||
moment.locale(this._translateService.currentLang);
|
||||
if (moment().isSame(eventTime, 'day')) {
|
||||
return moment(eventTime).fromNow();
|
||||
@ -66,7 +64,7 @@ export class NotificationsComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public toggleRead(notification: Notification, $event) {
|
||||
toggleRead(notification: Notification, $event) {
|
||||
$event.stopPropagation();
|
||||
notification.read = !notification.read;
|
||||
}
|
||||
|
||||
@ -7,16 +7,17 @@ import { Toast, ToastPackage, ToastrService } from 'ngx-toastr';
|
||||
styleUrls: ['./toast.component.scss']
|
||||
})
|
||||
export class ToastComponent extends Toast {
|
||||
constructor(protected toastrService: ToastrService, public toastPackage: ToastPackage) {
|
||||
super(toastrService, toastPackage);
|
||||
constructor(protected readonly _toastrService: ToastrService, readonly toastPackage: ToastPackage) {
|
||||
super(_toastrService, toastPackage);
|
||||
}
|
||||
|
||||
public get actions() {
|
||||
get actions() {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
return this.options.actions;
|
||||
}
|
||||
|
||||
public callAction($event: MouseEvent, action: Function) {
|
||||
callAction($event: MouseEvent, action: Function) {
|
||||
$event.stopPropagation();
|
||||
if (action) {
|
||||
action();
|
||||
|
||||
@ -19,12 +19,12 @@ interface ProfileModel {
|
||||
styleUrls: ['./user-profile-screen.component.scss']
|
||||
})
|
||||
export class UserProfileScreenComponent implements OnInit {
|
||||
public viewReady = false;
|
||||
public formGroup: FormGroup;
|
||||
viewReady = false;
|
||||
formGroup: FormGroup;
|
||||
private _profileModel: ProfileModel;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _userControllerService: UserControllerService,
|
||||
|
||||
@ -24,7 +24,7 @@ export abstract class ComponentHasChanges implements ComponentCanDeactivate {
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class PendingChangesGuard implements CanDeactivate<ComponentCanDeactivate> {
|
||||
constructor(private readonly translateService: TranslateService) {}
|
||||
constructor(private readonly _translateService: TranslateService) {}
|
||||
|
||||
canDeactivate(component: ComponentCanDeactivate): boolean | Observable<boolean> {
|
||||
// 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;
|
||||
// when navigating away from your angular app, the browser will show a generic warning message
|
||||
// see http://stackoverflow.com/a/42207299/7307355
|
||||
confirm(this.translateService.instant('pending-changes-guard'));
|
||||
confirm(this._translateService.instant('pending-changes-guard'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,36 +5,34 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LanguageService {
|
||||
constructor(private translateService: TranslateService) {
|
||||
translateService.addLangs(['en', 'de']);
|
||||
constructor(private readonly _translateService: TranslateService) {
|
||||
_translateService.addLangs(['en', 'de']);
|
||||
}
|
||||
|
||||
get currentLanguage() {
|
||||
return this.translateService.currentLang;
|
||||
return this._translateService.currentLang;
|
||||
}
|
||||
|
||||
chooseAndSetInitialLanguage() {
|
||||
let defaultLang: string;
|
||||
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
|
||||
// @ts-ignore
|
||||
if (this.translateService.getLangs().includes(localStorageLang)) {
|
||||
if (this._translateService.getLangs().includes(localStorageLang)) {
|
||||
defaultLang = localStorageLang;
|
||||
// @ts-ignore
|
||||
} else if (this.translateService.getLangs().includes(browserLang)) {
|
||||
} else if (this._translateService.getLangs().includes(browserLang)) {
|
||||
defaultLang = browserLang;
|
||||
} else {
|
||||
defaultLang = 'en';
|
||||
}
|
||||
document.documentElement.lang = defaultLang;
|
||||
this.translateService.setDefaultLang(defaultLang);
|
||||
this.translateService.use(defaultLang).subscribe(() => {});
|
||||
this._translateService.setDefaultLang(defaultLang);
|
||||
this._translateService.use(defaultLang).subscribe(() => {});
|
||||
}
|
||||
|
||||
changeLanguage(language: string) {
|
||||
localStorage.setItem('redaction.language', language);
|
||||
document.documentElement.lang = language;
|
||||
this.translateService.use(language).subscribe(() => {});
|
||||
this._translateService.use(language).subscribe(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ export class AnnotationPermissions {
|
||||
|
||||
canForceRedaction: boolean;
|
||||
|
||||
public static forUser(isManagerAndOwner: boolean, user: UserWrapper, annotation: AnnotationWrapper) {
|
||||
static forUser(isManagerAndOwner: boolean, user: UserWrapper, annotation: AnnotationWrapper) {
|
||||
const permissions: AnnotationPermissions = new AnnotationPermissions();
|
||||
|
||||
permissions.canUndo =
|
||||
@ -41,7 +41,7 @@ export class AnnotationPermissions {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public get canPerformMultipleRemoveActions() {
|
||||
get canPerformMultipleRemoveActions() {
|
||||
return (
|
||||
<any>this.canMarkTextOnlyAsFalsePositive +
|
||||
<any>this.canMarkAsFalsePositive +
|
||||
|
||||
@ -38,9 +38,7 @@ export class FileDataModel {
|
||||
let allAnnotations = entries.map((entry) => AnnotationWrapper.fromData(entry));
|
||||
|
||||
if (!areDevFeaturesEnabled) {
|
||||
allAnnotations = allAnnotations.filter((annotation) => {
|
||||
return !annotation.isFalsePositive;
|
||||
});
|
||||
allAnnotations = allAnnotations.filter((annotation) => !annotation.isFalsePositive);
|
||||
}
|
||||
|
||||
const visibleAnnotations = allAnnotations.filter((annotation) => {
|
||||
@ -113,7 +111,7 @@ export class FileDataModel {
|
||||
}
|
||||
|
||||
// an entry for this request already exists in the redactionLog
|
||||
if (!!relevantRedactionLogEntry) {
|
||||
if (relevantRedactionLogEntry) {
|
||||
relevantRedactionLogEntry.userId = forceRedaction.user;
|
||||
relevantRedactionLogEntry.dictionaryEntry = false;
|
||||
relevantRedactionLogEntry.force = true;
|
||||
@ -132,14 +130,14 @@ export class FileDataModel {
|
||||
const relevantRedactionLogEntry = result.find((r) => r.id === manual.id);
|
||||
|
||||
// a redaction-log entry is marked as a reason for another entry - hide it
|
||||
if (!!markedAsReasonRedactionLogEntry) {
|
||||
if (markedAsReasonRedactionLogEntry) {
|
||||
if (!(this._hasAlreadyBeenProcessed(manual) && manual.status === 'APPROVED')) {
|
||||
markedAsReasonRedactionLogEntry.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
// an entry for this request already exists in the redactionLog
|
||||
if (!!relevantRedactionLogEntry) {
|
||||
if (relevantRedactionLogEntry) {
|
||||
if (relevantRedactionLogEntry.status === 'DECLINED') {
|
||||
relevantRedactionLogEntry.hidden = true;
|
||||
return;
|
||||
@ -178,7 +176,7 @@ export class FileDataModel {
|
||||
redactionLogEntryWrapper.manualRedactionType = 'ADD';
|
||||
redactionLogEntryWrapper.manual = true;
|
||||
redactionLogEntryWrapper.comments = this.manualRedactions.comments[redactionLogEntryWrapper.id];
|
||||
if (!!markedAsReasonRedactionLogEntry) {
|
||||
if (markedAsReasonRedactionLogEntry) {
|
||||
// cleanup reason if the reason is another annotationId - it is not needed for drawing
|
||||
redactionLogEntryWrapper.reason = null;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FileAttributeConfig, FileAttributesConfig, FileStatus } from '@redaction/red-ui-http';
|
||||
import { FileAttributesConfig, FileStatus } from '@redaction/red-ui-http';
|
||||
import { StatusSorter } from '../../utils/sorters/status-sorter';
|
||||
|
||||
export class FileStatusWrapper {
|
||||
|
||||
@ -2,10 +2,10 @@ import { ManualRedactionEntry } from '@redaction/red-ui-http';
|
||||
|
||||
export class ManualRedactionEntryWrapper {
|
||||
constructor(
|
||||
public readonly quads: any,
|
||||
public readonly manualRedactionEntry: ManualRedactionEntry,
|
||||
public readonly type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE',
|
||||
public readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT',
|
||||
public readonly rectId?: string
|
||||
readonly quads: any,
|
||||
readonly manualRedactionEntry: ManualRedactionEntry,
|
||||
readonly type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE',
|
||||
readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT',
|
||||
readonly rectId?: string
|
||||
) {}
|
||||
}
|
||||
|
||||
@ -9,11 +9,11 @@ import { PermissionsService } from '../../../../services/permissions.service';
|
||||
styleUrls: ['./admin-breadcrumbs.component.scss']
|
||||
})
|
||||
export class AdminBreadcrumbsComponent {
|
||||
@Input() public root = false;
|
||||
@Input() root = false;
|
||||
|
||||
constructor(
|
||||
public readonly userPreferenceService: UserPreferenceService,
|
||||
public readonly permissionService: PermissionsService,
|
||||
public readonly appStateService: AppStateService
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
readonly permissionService: PermissionsService,
|
||||
readonly appStateService: AppStateService
|
||||
) {}
|
||||
}
|
||||
|
||||
@ -364,9 +364,7 @@ export class ComboChartComponent extends BaseChartComponent {
|
||||
}
|
||||
|
||||
onActivate(item) {
|
||||
const idx = this.activeEntries.findIndex((d) => {
|
||||
return d.name === item.name && d.value === item.value && d.series === item.series;
|
||||
});
|
||||
const idx = this.activeEntries.findIndex((d) => d.name === item.name && d.value === item.value && d.series === item.series);
|
||||
if (idx > -1) {
|
||||
return;
|
||||
}
|
||||
@ -376,9 +374,7 @@ export class ComboChartComponent extends BaseChartComponent {
|
||||
}
|
||||
|
||||
onDeactivate(item) {
|
||||
const idx = this.activeEntries.findIndex((d) => {
|
||||
return d.name === item.name && d.value === item.value && d.series === item.series;
|
||||
});
|
||||
const idx = this.activeEntries.findIndex((d) => d.name === item.name && d.value === item.value && d.series === item.series);
|
||||
|
||||
this.activeEntries.splice(idx, 1);
|
||||
this.activeEntries = [...this.activeEntries];
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component, Input, Output, EventEmitter, OnChanges, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { trigger, style, animate, transition } from '@angular/animations';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { animate, style, transition, trigger } from '@angular/animations';
|
||||
import { formatLabel } from '@swimlane/ngx-charts';
|
||||
|
||||
@Component({
|
||||
@ -68,7 +68,7 @@ export class ComboSeriesVerticalComponent implements OnChanges {
|
||||
x: any;
|
||||
y: any;
|
||||
|
||||
ngOnChanges(changes): void {
|
||||
ngOnChanges(): void {
|
||||
this.update();
|
||||
}
|
||||
|
||||
@ -163,23 +163,21 @@ export class ComboSeriesVerticalComponent implements OnChanges {
|
||||
this.getSeriesTooltips(this.seriesLine, index);
|
||||
const lineValue = this.seriesLine[0].series[index].value;
|
||||
bar.tooltipText = `
|
||||
<span class="tooltip-label">${tooltipLabel}</span>
|
||||
<span class="tooltip-val"> Y1 - ${value.toLocaleString()} • Y2 - ${lineValue.toLocaleString()}%</span>
|
||||
<span class='tooltip-label'>${tooltipLabel}</span>
|
||||
<span class='tooltip-val'> Y1 - ${value.toLocaleString()} • Y2 - ${lineValue.toLocaleString()}%</span>
|
||||
`;
|
||||
|
||||
return bar;
|
||||
});
|
||||
}
|
||||
|
||||
getSeriesTooltips(seriesLine, index) {
|
||||
return seriesLine.map((d) => {
|
||||
return d.series[index];
|
||||
});
|
||||
return seriesLine.map((d) => d.series[index]);
|
||||
}
|
||||
|
||||
isActive(entry): boolean {
|
||||
if (!this.activeEntries) return false;
|
||||
const item = this.activeEntries.find((d) => {
|
||||
return entry.name === d.name && entry.series === d.series;
|
||||
});
|
||||
const item = this.activeEntries.find((d) => entry.name === d.name && entry.series === d.series);
|
||||
return item !== undefined;
|
||||
}
|
||||
|
||||
|
||||
@ -17,14 +17,14 @@ export class RuleSetActionsComponent {
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _router: Router,
|
||||
public readonly permissionsService: PermissionsService
|
||||
readonly permissionsService: PermissionsService
|
||||
) {
|
||||
if (!this.ruleSetId) {
|
||||
this.ruleSetId = this._appStateService.activeRuleSetId;
|
||||
}
|
||||
}
|
||||
|
||||
public get ruleSet() {
|
||||
get ruleSet() {
|
||||
return this._appStateService.getRuleSetById(this.ruleSetId);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { PermissionsService } from '../../../../services/permissions.service';
|
||||
import { UserPreferenceService } from '../../../../services/user-preference.service';
|
||||
import { AppStateService } from '../../../../state/app-state.service';
|
||||
@ -8,10 +8,10 @@ import { AppStateService } from '../../../../state/app-state.service';
|
||||
templateUrl: './side-nav.component.html',
|
||||
styleUrls: ['./side-nav.component.scss']
|
||||
})
|
||||
export class SideNavComponent implements OnInit {
|
||||
export class SideNavComponent {
|
||||
@Input() type: 'settings' | 'project-templates';
|
||||
|
||||
public items: { [key: string]: { screen: string; onlyDevMode?: boolean; onlyAdmin?: boolean; userManagerOnly?: boolean; label?: string }[] } = {
|
||||
items: { [key: string]: { screen: string; onlyDevMode?: boolean; onlyAdmin?: boolean; userManagerOnly?: boolean; label?: string }[] } = {
|
||||
settings: [
|
||||
{ screen: 'project-templates', onlyAdmin: true },
|
||||
{ screen: 'digital-signature', onlyAdmin: true },
|
||||
@ -31,14 +31,12 @@ export class SideNavComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private readonly _appStateService: AppStateService,
|
||||
public readonly userPreferenceService: UserPreferenceService,
|
||||
public readonly permissionsService: PermissionsService
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
readonly permissionsService: PermissionsService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public get prefix() {
|
||||
if (!!this._appStateService.activeDictionaryType) {
|
||||
get prefix() {
|
||||
if (this._appStateService.activeDictionaryType) {
|
||||
return '../../';
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||
|
||||
@Component({
|
||||
@ -6,11 +6,7 @@ import { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-
|
||||
templateUrl: './users-stats.component.html',
|
||||
styleUrls: ['./users-stats.component.scss']
|
||||
})
|
||||
export class UsersStatsComponent implements OnInit {
|
||||
@Output() public toggleCollapse = new EventEmitter();
|
||||
export class UsersStatsComponent {
|
||||
@Output() toggleCollapse = new EventEmitter();
|
||||
@Input() chartData: DoughnutChartConfig[];
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
})
|
||||
export class AddEditDictionaryDialogComponent {
|
||||
dictionaryForm: FormGroup;
|
||||
public readonly dictionary: TypeValue;
|
||||
readonly dictionary: TypeValue;
|
||||
private readonly _ruleSetId: string;
|
||||
|
||||
constructor(
|
||||
@ -39,11 +39,11 @@ export class AddEditDictionaryDialogComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public get dictCaseSensitive() {
|
||||
get dictCaseSensitive() {
|
||||
return this.dictionary ? !this.dictionary.caseInsensitive : false;
|
||||
}
|
||||
|
||||
public get changed(): boolean {
|
||||
get changed(): boolean {
|
||||
if (!this.dictionary) return true;
|
||||
|
||||
for (const key of Object.keys(this.dictionaryForm.getRawValue())) {
|
||||
|
||||
@ -10,10 +10,10 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
styleUrls: ['./add-edit-file-attribute-dialog.component.scss']
|
||||
})
|
||||
export class AddEditFileAttributeDialogComponent {
|
||||
public fileAttributeForm: FormGroup;
|
||||
public fileAttribute: FileAttributeConfig;
|
||||
public ruleSetId: string;
|
||||
public readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE];
|
||||
fileAttributeForm: FormGroup;
|
||||
fileAttribute: FileAttributeConfig;
|
||||
ruleSetId: string;
|
||||
readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE];
|
||||
|
||||
constructor(
|
||||
private readonly _appStateService: AppStateService,
|
||||
@ -33,7 +33,7 @@ export class AddEditFileAttributeDialogComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public get changed(): boolean {
|
||||
get changed(): boolean {
|
||||
if (!this.fileAttribute) return true;
|
||||
|
||||
for (const key of Object.keys(this.fileAttributeForm.getRawValue())) {
|
||||
|
||||
@ -13,11 +13,11 @@ import { applyIntervalConstraints } from '../../../../utils/date-inputs-utils';
|
||||
styleUrls: ['./add-edit-rule-set-dialog.component.scss']
|
||||
})
|
||||
export class AddEditRuleSetDialogComponent {
|
||||
public ruleSetForm: FormGroup;
|
||||
public hasValidFrom: boolean;
|
||||
public hasValidTo: boolean;
|
||||
public downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED'];
|
||||
public reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum);
|
||||
ruleSetForm: FormGroup;
|
||||
hasValidFrom: boolean;
|
||||
hasValidTo: boolean;
|
||||
downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED'];
|
||||
reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum);
|
||||
|
||||
private _previousValidFrom: Moment;
|
||||
private _previousValidTo: Moment;
|
||||
@ -75,7 +75,7 @@ export class AddEditRuleSetDialogComponent {
|
||||
};
|
||||
}
|
||||
|
||||
public get changed(): boolean {
|
||||
get changed(): boolean {
|
||||
if (!this.ruleSet) return true;
|
||||
|
||||
for (const key of Object.keys(this.ruleSetForm.getRawValue())) {
|
||||
|
||||
@ -10,9 +10,9 @@ import { UserService } from '../../../../services/user.service';
|
||||
styleUrls: ['./add-edit-user-dialog.component.scss']
|
||||
})
|
||||
export class AddEditUserDialogComponent {
|
||||
public userForm: FormGroup;
|
||||
public ROLES = ['RED_USER', 'RED_MANAGER', 'RED_USER_ADMIN', 'RED_ADMIN'];
|
||||
private ROLE_REQUIREMENTS = { RED_MANAGER: 'RED_USER', RED_ADMIN: 'RED_USER_ADMIN' };
|
||||
userForm: FormGroup;
|
||||
readonly ROLES = ['RED_USER', 'RED_MANAGER', 'RED_USER_ADMIN', 'RED_ADMIN'];
|
||||
private readonly _ROLE_REQUIREMENTS = { RED_MANAGER: 'RED_USER', RED_ADMIN: 'RED_USER_ADMIN' };
|
||||
|
||||
constructor(
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
@ -28,9 +28,10 @@ export class AddEditUserDialogComponent {
|
||||
value: this.user && this.user.roles.indexOf(role) !== -1,
|
||||
disabled:
|
||||
this.user &&
|
||||
Object.keys(this.ROLE_REQUIREMENTS).reduce((value, key) => {
|
||||
return value || (role === this.ROLE_REQUIREMENTS[key] && this.user.roles.indexOf(key) !== -1);
|
||||
}, false)
|
||||
Object.keys(this._ROLE_REQUIREMENTS).reduce(
|
||||
(value, key) => value || (role === this._ROLE_REQUIREMENTS[key] && this.user.roles.indexOf(key) !== -1),
|
||||
false
|
||||
)
|
||||
}
|
||||
]
|
||||
}),
|
||||
@ -47,19 +48,19 @@ export class AddEditUserDialogComponent {
|
||||
}
|
||||
|
||||
private _setRolesRequirements() {
|
||||
for (const key of Object.keys(this.ROLE_REQUIREMENTS)) {
|
||||
for (const key of Object.keys(this._ROLE_REQUIREMENTS)) {
|
||||
this.userForm.controls[key].valueChanges.subscribe((checked) => {
|
||||
if (checked) {
|
||||
this.userForm.patchValue({ [this.ROLE_REQUIREMENTS[key]]: true });
|
||||
this.userForm.controls[this.ROLE_REQUIREMENTS[key]].disable();
|
||||
this.userForm.patchValue({ [this._ROLE_REQUIREMENTS[key]]: true });
|
||||
this.userForm.controls[this._ROLE_REQUIREMENTS[key]].disable();
|
||||
} else {
|
||||
this.userForm.controls[this.ROLE_REQUIREMENTS[key]].enable();
|
||||
this.userForm.controls[this._ROLE_REQUIREMENTS[key]].enable();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public get changed(): boolean {
|
||||
get changed(): boolean {
|
||||
if (!this.user) return true;
|
||||
|
||||
for (const key of Object.keys(this.userForm.getRawValue())) {
|
||||
@ -71,18 +72,18 @@ export class AddEditUserDialogComponent {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async save() {
|
||||
async save() {
|
||||
this.dialogRef.close({
|
||||
action: this.user ? 'UPDATE' : 'CREATE',
|
||||
user: { ...this.userForm.getRawValue(), roles: this.activeRoles }
|
||||
});
|
||||
}
|
||||
|
||||
public async delete() {
|
||||
async delete() {
|
||||
this.dialogRef.close('DELETE');
|
||||
}
|
||||
|
||||
public get activeRoles(): string[] {
|
||||
get activeRoles(): string[] {
|
||||
return this.ROLES.reduce((acc, role) => {
|
||||
if (this.userForm.get(role).value) {
|
||||
acc.push(role);
|
||||
|
||||
@ -9,12 +9,12 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
styleUrls: ['./confirm-delete-file-attribute-dialog.component.scss']
|
||||
})
|
||||
export class ConfirmDeleteFileAttributeDialogComponent {
|
||||
public fileAttribute: FileAttributeConfig;
|
||||
public checkboxes = [
|
||||
fileAttribute: FileAttributeConfig;
|
||||
checkboxes = [
|
||||
{ value: false, label: 'impacted-documents.' + this.type },
|
||||
{ value: false, label: 'lost-details' }
|
||||
];
|
||||
public showToast = false;
|
||||
showToast = false;
|
||||
|
||||
constructor(
|
||||
private readonly _appStateService: AppStateService,
|
||||
@ -24,11 +24,11 @@ export class ConfirmDeleteFileAttributeDialogComponent {
|
||||
this.fileAttribute = data;
|
||||
}
|
||||
|
||||
public get valid() {
|
||||
get valid() {
|
||||
return this.checkboxes[0].value && this.checkboxes[1].value;
|
||||
}
|
||||
|
||||
public deleteFileAttribute() {
|
||||
deleteFileAttribute() {
|
||||
if (this.valid) {
|
||||
this.dialogRef.close(true);
|
||||
} else {
|
||||
@ -36,11 +36,11 @@ export class ConfirmDeleteFileAttributeDialogComponent {
|
||||
}
|
||||
}
|
||||
|
||||
public get type(): 'bulk' | 'single' {
|
||||
get type(): 'bulk' | 'single' {
|
||||
return !this.fileAttribute ? 'bulk' : 'single';
|
||||
}
|
||||
|
||||
public cancel() {
|
||||
cancel() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { User } from '@redaction/red-ui-http';
|
||||
import { AppStateService } from '../../../../state/app-state.service';
|
||||
@ -8,13 +8,13 @@ import { AppStateService } from '../../../../state/app-state.service';
|
||||
templateUrl: './confirm-delete-users-dialog.component.html',
|
||||
styleUrls: ['./confirm-delete-users-dialog.component.scss']
|
||||
})
|
||||
export class ConfirmDeleteUsersDialogComponent implements OnInit {
|
||||
public checkboxes = [
|
||||
export class ConfirmDeleteUsersDialogComponent {
|
||||
checkboxes = [
|
||||
{ value: false, label: 'impacted-projects' },
|
||||
{ value: false, label: 'impacted-documents.' + this.type }
|
||||
];
|
||||
public showToast = false;
|
||||
public projectsCount: number;
|
||||
showToast = false;
|
||||
projectsCount: number;
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public users: User[],
|
||||
@ -31,8 +31,6 @@ export class ConfirmDeleteUsersDialogComponent implements OnInit {
|
||||
}).length;
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
async deleteUser() {
|
||||
if (this.valid) {
|
||||
this.dialogRef.close(true);
|
||||
@ -41,15 +39,15 @@ export class ConfirmDeleteUsersDialogComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public get valid() {
|
||||
get valid() {
|
||||
return this.checkboxes[0].value && this.checkboxes[1].value;
|
||||
}
|
||||
|
||||
public cancel() {
|
||||
cancel() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public get type(): 'bulk' | 'single' {
|
||||
get type(): 'bulk' | 'single' {
|
||||
return this.users.length > 1 ? 'bulk' : 'single';
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,11 +11,11 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
styleUrls: ['./edit-color-dialog.component.scss']
|
||||
})
|
||||
export class EditColorDialogComponent {
|
||||
public readonly colors: Colors;
|
||||
public readonly colorKey: string;
|
||||
readonly colors: Colors;
|
||||
readonly colorKey: string;
|
||||
private readonly _initialColor: string;
|
||||
private readonly _ruleSetId: string;
|
||||
public colorForm: FormGroup;
|
||||
colorForm: FormGroup;
|
||||
|
||||
constructor(
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
@ -35,7 +35,7 @@ export class EditColorDialogComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public get changed(): boolean {
|
||||
get changed(): boolean {
|
||||
return this.colorForm.get('color').value !== this._initialColor;
|
||||
}
|
||||
|
||||
|
||||
@ -9,12 +9,12 @@ import { FileAttributeConfig } from '@redaction/red-ui-http';
|
||||
styleUrls: ['./active-fields-listing.component.scss']
|
||||
})
|
||||
export class ActiveFieldsListingComponent extends BaseListingComponent<Field> implements OnChanges {
|
||||
@Input() public allEntities: Field[];
|
||||
@Output() public allEntitiesChange = new EventEmitter<Field[]>();
|
||||
@Output() public setHoveredColumn = new EventEmitter<string>();
|
||||
@Output() public toggleFieldActive = new EventEmitter<Field>();
|
||||
@Input() allEntities: Field[];
|
||||
@Output() allEntitiesChange = new EventEmitter<Field[]>();
|
||||
@Output() setHoveredColumn = new EventEmitter<string>();
|
||||
@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';
|
||||
|
||||
@ -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 = [...this.allEntities.filter((field) => !this.isEntitySelected(field))];
|
||||
this.allEntitiesChange.emit(this.allEntities);
|
||||
this.selectedEntitiesIds = [];
|
||||
}
|
||||
|
||||
public setAttributeForSelection(attribute: string, value: any) {
|
||||
setAttributeForSelection(attribute: string, value: any) {
|
||||
for (const csvColumn of this.selectedEntitiesIds) {
|
||||
this.allEntities.find((f) => f.csvColumn === csvColumn)[attribute] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public togglePrimary(field: Field) {
|
||||
togglePrimary(field: Field) {
|
||||
if (field.primaryAttribute) {
|
||||
field.primaryAttribute = false;
|
||||
} else {
|
||||
|
||||
@ -30,18 +30,18 @@ export interface Field {
|
||||
export class FileAttributesCsvImportDialogComponent extends BaseListingComponent<Field> {
|
||||
protected readonly _searchKey = 'csvColumn';
|
||||
|
||||
public csvFile: File;
|
||||
public ruleSetId: string;
|
||||
public parseResult: { data: any[]; errors: any[]; meta: any; fields: Field[] };
|
||||
public hoveredColumn: string;
|
||||
public activeFields: Field[] = [];
|
||||
public baseConfigForm: FormGroup;
|
||||
public isSearchOpen = false;
|
||||
public previewExpanded = true;
|
||||
public filteredKeyOptions: Observable<string[]>;
|
||||
public keepPreview = false;
|
||||
public columnSample = [];
|
||||
public initialParseConfig: { delimiter?: string; encoding?: string } = {};
|
||||
csvFile: File;
|
||||
ruleSetId: string;
|
||||
parseResult: { data: any[]; errors: any[]; meta: any; fields: Field[] };
|
||||
hoveredColumn: string;
|
||||
activeFields: Field[] = [];
|
||||
baseConfigForm: FormGroup;
|
||||
isSearchOpen = false;
|
||||
previewExpanded = true;
|
||||
filteredKeyOptions: Observable<string[]>;
|
||||
keepPreview = false;
|
||||
columnSample = [];
|
||||
initialParseConfig: { delimiter?: string; encoding?: string } = {};
|
||||
|
||||
@ViewChild(CdkVirtualScrollViewport, { static: false }) cdkVirtualScrollViewport: CdkVirtualScrollViewport;
|
||||
|
||||
@ -76,7 +76,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
|
||||
};
|
||||
}
|
||||
|
||||
public readFile() {
|
||||
readFile() {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('load', async (event) => {
|
||||
const parsedCsv = <any>event.target.result;
|
||||
@ -97,7 +97,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
|
||||
|
||||
for (const entity of this.allEntities) {
|
||||
const existing = this.data.existingConfiguration.fileAttributeConfigs.find((a) => a.csvColumnHeader === entity.csvColumn);
|
||||
if (!!existing) {
|
||||
if (existing) {
|
||||
entity.id = existing.id;
|
||||
entity.name = existing.label;
|
||||
entity.temporaryName = existing.label;
|
||||
@ -130,11 +130,11 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
|
||||
reader.readAsText(this.csvFile, this.baseConfigForm.get('encoding').value);
|
||||
}
|
||||
|
||||
public getSample(csvColumn: string) {
|
||||
getSample(csvColumn: string) {
|
||||
return this.parseResult?.data?.length ? this.parseResult?.data[0][csvColumn] : '';
|
||||
}
|
||||
|
||||
public getEntries(csvColumn: string) {
|
||||
getEntries(csvColumn: string) {
|
||||
if (this.parseResult?.data) {
|
||||
let count = 0;
|
||||
for (const entry of this.parseResult.data) {
|
||||
@ -148,11 +148,11 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
|
||||
}
|
||||
}
|
||||
|
||||
public isActive(field: Field): boolean {
|
||||
isActive(field: Field): boolean {
|
||||
return this.activeFields.indexOf(field) !== -1;
|
||||
}
|
||||
|
||||
public toggleFieldActive(field: Field) {
|
||||
toggleFieldActive(field: Field) {
|
||||
if (!this.isActive(field)) {
|
||||
this.activeFields = [...this.activeFields, field];
|
||||
} else {
|
||||
@ -174,15 +174,15 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
|
||||
};
|
||||
}
|
||||
|
||||
public activateAll() {
|
||||
activateAll() {
|
||||
this.activeFields = [...this.allEntities];
|
||||
}
|
||||
|
||||
public deactivateAll() {
|
||||
deactivateAll() {
|
||||
this.activeFields = [];
|
||||
}
|
||||
|
||||
public async save() {
|
||||
async save() {
|
||||
const newPrimary = !!this.activeFields.find((attr) => attr.primaryAttribute);
|
||||
|
||||
if (newPrimary) {
|
||||
@ -195,16 +195,14 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
|
||||
...this.data.existingConfiguration.fileAttributeConfigs.filter(
|
||||
(a) => !this.allEntities.find((entity) => entity.csvColumn === a.csvColumnHeader)
|
||||
),
|
||||
...this.activeFields.map((field) => {
|
||||
return {
|
||||
id: field.id,
|
||||
csvColumnHeader: field.csvColumn,
|
||||
editable: !field.readonly,
|
||||
label: field.name,
|
||||
type: field.type,
|
||||
primaryAttribute: field.primaryAttribute
|
||||
};
|
||||
})
|
||||
...this.activeFields.map((field) => ({
|
||||
id: field.id,
|
||||
csvColumnHeader: field.csvColumn,
|
||||
editable: !field.readonly,
|
||||
label: field.name,
|
||||
type: field.type,
|
||||
primaryAttribute: field.primaryAttribute
|
||||
}))
|
||||
]
|
||||
};
|
||||
|
||||
@ -226,7 +224,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
|
||||
public setHoveredColumn(column?: string) {
|
||||
setHoveredColumn(column?: string) {
|
||||
setTimeout(() => {
|
||||
if (this.keepPreview && !column) {
|
||||
return;
|
||||
@ -241,7 +239,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
|
||||
}, 0);
|
||||
}
|
||||
|
||||
public get changedParseConfig(): boolean {
|
||||
get changedParseConfig(): boolean {
|
||||
return (
|
||||
this.initialParseConfig.delimiter !== this.baseConfigForm.get('delimiter').value ||
|
||||
this.initialParseConfig.encoding !== this.baseConfigForm.get('encoding').value
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { UserService } from '../../../../services/user.service';
|
||||
@ -9,8 +9,8 @@ import { SMTPConfigurationModel } from '@redaction/red-ui-http';
|
||||
templateUrl: './smtp-auth-dialog.component.html',
|
||||
styleUrls: ['./smtp-auth-dialog.component.scss']
|
||||
})
|
||||
export class SmtpAuthDialogComponent implements OnInit {
|
||||
public authForm: FormGroup;
|
||||
export class SmtpAuthDialogComponent {
|
||||
authForm: FormGroup;
|
||||
|
||||
constructor(
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
@ -24,9 +24,7 @@ export class SmtpAuthDialogComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public save() {
|
||||
save() {
|
||||
this.dialogRef.close(this.authForm.getRawValue());
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,21 +14,21 @@ const PAGE_SIZE = 50;
|
||||
styleUrls: ['./audit-screen.component.scss']
|
||||
})
|
||||
export class AuditScreenComponent {
|
||||
public filterForm: FormGroup;
|
||||
public viewReady = false;
|
||||
public categories: string[] = [];
|
||||
public userIds: Set<string>;
|
||||
public logs: AuditResponse;
|
||||
public currentPage = 1;
|
||||
readonly ALL_CATEGORIES = 'audit-screen.all-categories';
|
||||
readonly ALL_USERS = 'audit-screen.all-users';
|
||||
|
||||
public ALL_CATEGORIES = 'audit-screen.all-categories';
|
||||
public ALL_USERS = 'audit-screen.all-users';
|
||||
filterForm: FormGroup;
|
||||
viewReady = false;
|
||||
categories: string[] = [];
|
||||
userIds: Set<string>;
|
||||
logs: AuditResponse;
|
||||
currentPage = 1;
|
||||
|
||||
private _previousFrom: Moment;
|
||||
private _previousTo: Moment;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _auditControllerService: AuditControllerService,
|
||||
private readonly _translateService: TranslateService
|
||||
@ -66,7 +66,7 @@ export class AuditScreenComponent {
|
||||
const userId = this.filterForm.get('userId').value;
|
||||
const from = this.filterForm.get('from').value;
|
||||
let to = this.filterForm.get('to').value;
|
||||
if (!!to) {
|
||||
if (to) {
|
||||
to = to.clone().add(1, 'd');
|
||||
}
|
||||
const logsRequestBody: AuditSearchRequest = {
|
||||
@ -94,14 +94,14 @@ export class AuditScreenComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public get totalPages(): number {
|
||||
get totalPages(): number {
|
||||
if (!this.logs) {
|
||||
return 0;
|
||||
}
|
||||
return Math.ceil(this.logs.totalHits / PAGE_SIZE);
|
||||
}
|
||||
|
||||
public pageChanged(page: number) {
|
||||
pageChanged(page: number) {
|
||||
this._fetchData(page);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import { BaseListingComponent } from '../../../shared/base/base-listing.componen
|
||||
export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: string; value: string }> {
|
||||
protected readonly _sortKey = 'default-colors';
|
||||
|
||||
public viewReady = false;
|
||||
viewReady = false;
|
||||
private _colorsObj: Colors;
|
||||
|
||||
constructor(
|
||||
@ -22,7 +22,7 @@ export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: st
|
||||
private readonly _activatedRoute: ActivatedRoute,
|
||||
private readonly _dictionaryControllerService: DictionaryControllerService,
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
protected readonly _injector: Injector
|
||||
) {
|
||||
super(_injector);
|
||||
@ -30,7 +30,7 @@ export class DefaultColorsScreenComponent extends BaseListingComponent<{ key: st
|
||||
this._loadColors();
|
||||
}
|
||||
|
||||
public async loadRuleSetsData(): Promise<void> {
|
||||
async loadRuleSetsData(): Promise<void> {
|
||||
await this._appStateService.loadAllRuleSets();
|
||||
}
|
||||
|
||||
|
||||
@ -19,15 +19,15 @@ export class DictionaryListingScreenComponent extends BaseListingComponent<TypeV
|
||||
protected readonly _selectionKey = 'type';
|
||||
protected readonly _sortKey = 'dictionary-listing';
|
||||
|
||||
public viewReady = false;
|
||||
public chartData: DoughnutChartConfig[] = [];
|
||||
viewReady = false;
|
||||
chartData: DoughnutChartConfig[] = [];
|
||||
|
||||
constructor(
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
private readonly _dictionaryControllerService: DictionaryControllerService,
|
||||
private readonly _activatedRoute: ActivatedRoute,
|
||||
private readonly _appStateService: AppStateService,
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
protected readonly _injector: Injector
|
||||
) {
|
||||
super(_injector);
|
||||
|
||||
@ -88,14 +88,14 @@
|
||||
<div class="red-input-group w-200 mr-8">
|
||||
<mat-select formControlName="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-select>
|
||||
</div>
|
||||
<div class="red-input-group w-200">
|
||||
<mat-select formControlName="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-select>
|
||||
</div>
|
||||
@ -114,13 +114,13 @@
|
||||
class="ace-redaction"
|
||||
>
|
||||
</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>
|
||||
<span class="heading-l" translate="dictionary-overview.select-dictionary"></span>
|
||||
</div>
|
||||
<ace-editor
|
||||
#compareEditorComponent
|
||||
*ngIf="compareForm.get('active').value && compareForm.get('dictionary').value !== SELECT_DICTIONARY"
|
||||
*ngIf="compareForm.get('active').value && compareForm.get('dictionary').value !== selectDictionary"
|
||||
[mode]="'text'"
|
||||
[theme]="'eclipse'"
|
||||
[options]="aceOptions"
|
||||
|
||||
@ -13,7 +13,8 @@ import { ComponentHasChanges } from '../../../../guards/can-deactivate.guard';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
|
||||
declare var ace;
|
||||
declare let ace;
|
||||
const MIN_WORD_LENGTH = 2;
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-dictionary-overview-screen',
|
||||
@ -21,8 +22,6 @@ declare var ace;
|
||||
styleUrls: ['./dictionary-overview-screen.component.scss']
|
||||
})
|
||||
export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit {
|
||||
static readonly MIN_WORD_LENGTH: number = 2;
|
||||
|
||||
activeEditMarkers: any[] = [];
|
||||
activeSearchMarkers: any[] = [];
|
||||
searchPositions: any[] = [];
|
||||
@ -35,18 +34,18 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
searchText = '';
|
||||
processing = true;
|
||||
|
||||
public SELECT_RULESET = { name: 'dictionary-overview.compare.select-ruleset' };
|
||||
public SELECT_DICTIONARY = { label: 'dictionary-overview.compare.select-dictionary' };
|
||||
public ruleSets: RuleSetModel[];
|
||||
public dictionaries: TypeValue[] = [this.SELECT_DICTIONARY];
|
||||
public compareForm: FormGroup;
|
||||
selectRuleSet = { name: 'dictionary-overview.compare.select-ruleset' };
|
||||
selectDictionary = { label: 'dictionary-overview.compare.select-dictionary' };
|
||||
ruleSets: RuleSetModel[];
|
||||
dictionaries: TypeValue[] = [this.selectDictionary];
|
||||
compareForm: FormGroup;
|
||||
|
||||
@ViewChild('editorComponent', { static: true }) private _editorComponent: AceEditorComponent;
|
||||
@ViewChild('compareEditorComponent') private _compareEditorComponent: AceEditorComponent;
|
||||
@ViewChild('fileInput') private _fileInput: ElementRef;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _notificationService: NotificationService,
|
||||
protected readonly _translateService: TranslateService,
|
||||
private readonly _dictionaryControllerService: DictionaryControllerService,
|
||||
@ -61,17 +60,17 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
|
||||
this.compareForm = this._formBuilder.group({
|
||||
active: [false],
|
||||
ruleSet: [{ value: this.SELECT_RULESET, disabled: true }],
|
||||
dictionary: [{ value: this.SELECT_DICTIONARY, disabled: true }]
|
||||
ruleSet: [{ value: this.selectRuleSet, disabled: true }],
|
||||
dictionary: [{ value: this.selectDictionary, disabled: true }]
|
||||
});
|
||||
|
||||
this.compareForm.valueChanges.subscribe((value) => {
|
||||
this._setFieldStatus('ruleSet', value.active);
|
||||
this._setFieldStatus('dictionary', value.active && this.compareForm.get('ruleSet').value !== this.SELECT_RULESET);
|
||||
this._setFieldStatus('dictionary', value.active && this.compareForm.get('ruleSet').value !== this.selectRuleSet);
|
||||
this._loadDictionaries();
|
||||
});
|
||||
|
||||
this.ruleSets = [this.SELECT_RULESET, ...this._appStateService.ruleSets];
|
||||
this.ruleSets = [this.selectRuleSet, ...this._appStateService.ruleSets];
|
||||
|
||||
this._initializeEditor();
|
||||
|
||||
@ -84,11 +83,11 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
});
|
||||
}
|
||||
|
||||
public get dictionary(): TypeValue {
|
||||
get dictionary(): TypeValue {
|
||||
return this._appStateService.activeDictionary;
|
||||
}
|
||||
|
||||
public get hasChanges() {
|
||||
get hasChanges() {
|
||||
return (
|
||||
this.currentDictionaryEntries.length &&
|
||||
(this.activeEditMarkers.length > 0 ||
|
||||
@ -112,14 +111,14 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
});
|
||||
}
|
||||
|
||||
public openEditDictionaryDialog($event: any) {
|
||||
openEditDictionaryDialog($event: any) {
|
||||
$event.stopPropagation();
|
||||
this._dialogService.openAddEditDictionaryDialog(this.dictionary, this.dictionary.ruleSetId, async () => {
|
||||
await this._appStateService.loadDictionaryData();
|
||||
});
|
||||
}
|
||||
|
||||
public openDeleteDictionaryDialog($event: any) {
|
||||
openDeleteDictionaryDialog($event: any) {
|
||||
this._dialogService.openDeleteDictionaryDialog($event, this.dictionary, this.dictionary.ruleSetId, async () => {
|
||||
await this._appStateService.loadDictionaryData();
|
||||
this._router.navigate(['..']);
|
||||
@ -127,7 +126,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
}
|
||||
|
||||
@debounce()
|
||||
public searchChanged(text: string) {
|
||||
searchChanged(text: string) {
|
||||
this.searchText = text.toLowerCase();
|
||||
this._applySearchMarkers();
|
||||
this.currentMatch = 0;
|
||||
@ -135,7 +134,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
}
|
||||
|
||||
@debounce(500)
|
||||
public textChanged($event: any) {
|
||||
textChanged($event: any) {
|
||||
this._applySearchMarkers();
|
||||
this.currentDictionaryEntries = $event.split('\n');
|
||||
this.changedLines = [];
|
||||
@ -151,28 +150,28 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
}
|
||||
}
|
||||
|
||||
const Range = ace.require('ace/range').Range;
|
||||
const range = ace.require('ace/range').Range;
|
||||
for (const i of this.changedLines) {
|
||||
const entry = this.currentDictionaryEntries[i];
|
||||
if (entry?.trim().length > 0) {
|
||||
// only mark non-empty lines
|
||||
this.activeEditMarkers.push(this._editorComponent.getEditor().getSession().addMarker(new Range(i, 0, i, 1), 'changed-row-marker', 'fullLine'));
|
||||
this.activeEditMarkers.push(this._editorComponent.getEditor().getSession().addMarker(new range(i, 0, i, 1), 'changed-row-marker', 'fullLine'));
|
||||
}
|
||||
if (entry?.trim().length > 0 && entry.trim().length < DictionaryOverviewScreenComponent.MIN_WORD_LENGTH) {
|
||||
if (entry?.trim().length > 0 && entry.trim().length < MIN_WORD_LENGTH) {
|
||||
// show lines that are too short
|
||||
this.activeEditMarkers.push(this._editorComponent.getEditor().getSession().addMarker(new Range(i, 0, i, 1), 'too-short-marker', 'fullLine'));
|
||||
this.activeEditMarkers.push(this._editorComponent.getEditor().getSession().addMarker(new range(i, 0, i, 1), 'too-short-marker', 'fullLine'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async saveEntries() {
|
||||
async saveEntries() {
|
||||
let entriesToAdd = [];
|
||||
this.currentDictionaryEntries.forEach((currentEntry) => {
|
||||
entriesToAdd.push(currentEntry);
|
||||
});
|
||||
// remove empty lines
|
||||
entriesToAdd = entriesToAdd.filter((e) => e && e.trim().length > 0).map((e) => e.trim());
|
||||
const invalidRowsExist = entriesToAdd.filter((e) => e.length < DictionaryOverviewScreenComponent.MIN_WORD_LENGTH);
|
||||
const invalidRowsExist = entriesToAdd.filter((e) => e.length < MIN_WORD_LENGTH);
|
||||
if (invalidRowsExist.length === 0) {
|
||||
// can add at least 1 - block UI
|
||||
this.processing = true;
|
||||
@ -210,13 +209,13 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
}
|
||||
}
|
||||
|
||||
public revert() {
|
||||
revert() {
|
||||
DictionaryOverviewScreenComponent._setEditorValue(this._editorComponent, this.initialDictionaryEntries);
|
||||
this.searchChanged('');
|
||||
this.processing = false;
|
||||
}
|
||||
|
||||
public nextSearchMatch() {
|
||||
nextSearchMatch() {
|
||||
// length = 3
|
||||
if (this.searchPositions.length > 0) {
|
||||
this.currentMatch = this.currentMatch < this.searchPositions.length ? this.currentMatch + 1 : 1;
|
||||
@ -224,14 +223,14 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
}
|
||||
}
|
||||
|
||||
public previousSearchMatch() {
|
||||
previousSearchMatch() {
|
||||
if (this.searchPositions.length > 0) {
|
||||
this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.searchPositions.length;
|
||||
this._gotoLine();
|
||||
}
|
||||
}
|
||||
|
||||
public download(): void {
|
||||
download(): void {
|
||||
const content = this._editorComponent.getEditor().getValue();
|
||||
const blob = new Blob([content], {
|
||||
type: 'text/plain;charset=utf-8'
|
||||
@ -239,7 +238,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
saveAs(blob, `${this.dictionary.label}.txt`);
|
||||
}
|
||||
|
||||
public upload($event): void {
|
||||
upload($event): void {
|
||||
const file = $event.target.files[0];
|
||||
const fileReader = new FileReader();
|
||||
|
||||
@ -253,18 +252,18 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
}
|
||||
|
||||
private _syncActiveLines() {
|
||||
if (!!this._compareEditorComponent) {
|
||||
if (this._compareEditorComponent) {
|
||||
this._compareEditorComponent.getEditor().gotoLine(this._activeRow);
|
||||
}
|
||||
}
|
||||
|
||||
private _onRuleSetChanged() {
|
||||
this._loadDictionaries();
|
||||
this.compareForm.patchValue({ dictionary: this.SELECT_DICTIONARY });
|
||||
this.compareForm.patchValue({ dictionary: this.selectDictionary });
|
||||
}
|
||||
|
||||
private _onDictionaryChanged(dictionary: TypeValue) {
|
||||
if (dictionary !== this.SELECT_DICTIONARY) {
|
||||
if (dictionary !== this.selectDictionary) {
|
||||
this._dictionaryControllerService.getDictionaryForType(dictionary.type, dictionary.ruleSetId).subscribe(
|
||||
(data) => {
|
||||
this.compareDictionaryEntries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' }));
|
||||
@ -285,12 +284,12 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
private _loadDictionaries() {
|
||||
const ruleSetId = this.compareForm.get('ruleSet').value.ruleSetId;
|
||||
if (!ruleSetId) {
|
||||
this.dictionaries = [this.SELECT_DICTIONARY];
|
||||
this.dictionaries = [this.selectDictionary];
|
||||
return;
|
||||
}
|
||||
const appStateDictionaryData = this._appStateService.dictionaryData[ruleSetId];
|
||||
this.dictionaries = [
|
||||
this.SELECT_DICTIONARY,
|
||||
this.selectDictionary,
|
||||
...Object.keys(appStateDictionaryData)
|
||||
.map((key) => appStateDictionaryData[key])
|
||||
.filter((d) => !d.virtual || d.type === 'false_positive')
|
||||
@ -317,13 +316,13 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
});
|
||||
this.activeSearchMarkers = [];
|
||||
|
||||
const Range = ace.require('ace/range').Range;
|
||||
const range = ace.require('ace/range').Range;
|
||||
for (const position of this.searchPositions) {
|
||||
this.activeSearchMarkers.push(
|
||||
this._editorComponent
|
||||
.getEditor()
|
||||
.getSession()
|
||||
.addMarker(new Range(position.row, position.column, position.row, position.column + position.length), 'search-marker', 'text')
|
||||
.addMarker(new range(position.row, position.column, position.row, position.column + position.length), 'search-marker', 'text')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,18 +12,18 @@ import { lastIndexOfEnd } from '../../../../utils/functions';
|
||||
styleUrls: ['./digital-signature-screen.component.scss']
|
||||
})
|
||||
export class DigitalSignatureScreenComponent {
|
||||
public digitalSignature: DigitalSignature;
|
||||
public digitalSignatureForm: FormGroup;
|
||||
digitalSignature: DigitalSignature;
|
||||
digitalSignatureForm: FormGroup;
|
||||
|
||||
public viewReady = false;
|
||||
public digitalSignatureExists = false;
|
||||
viewReady = false;
|
||||
digitalSignatureExists = false;
|
||||
|
||||
constructor(
|
||||
private readonly _digitalSignatureControllerService: DigitalSignatureControllerService,
|
||||
private readonly _notificationService: NotificationService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _translateService: TranslateService,
|
||||
public readonly permissionsService: PermissionsService
|
||||
readonly permissionsService: PermissionsService
|
||||
) {
|
||||
this.loadDigitalSignatureAndInitializeForm();
|
||||
}
|
||||
|
||||
@ -16,15 +16,15 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent<F
|
||||
protected readonly _selectionKey = 'id';
|
||||
protected readonly _sortKey = 'file-attributes-listing';
|
||||
|
||||
public viewReady = false;
|
||||
public loading = false;
|
||||
viewReady = false;
|
||||
loading = false;
|
||||
|
||||
private _existingConfiguration: FileAttributesConfig;
|
||||
|
||||
@ViewChild('fileInput') private _fileInput: ElementRef;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _fileAttributesService: FileAttributesControllerService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
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();
|
||||
this._dialogService.openAddEditFileAttributeDialog(fileAttribute, this._appStateService.activeRuleSetId, async (newValue: FileAttributeConfig) => {
|
||||
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();
|
||||
this._dialogService.openConfirmDeleteFileAttributeDialog(fileAttribute, this._appStateService.activeRuleSetId, async () => {
|
||||
this.loading = true;
|
||||
if (!!fileAttribute) {
|
||||
if (fileAttribute) {
|
||||
await this._fileAttributesService.deleteFileAttribute(this._appStateService.activeRuleSetId, fileAttribute.id).toPromise();
|
||||
} else {
|
||||
await this._fileAttributesService.deleteFileAttributes(this.selectedEntitiesIds, this._appStateService.activeRuleSetId).toPromise();
|
||||
@ -74,7 +74,7 @@ export class FileAttributesListingScreenComponent extends BaseListingComponent<F
|
||||
});
|
||||
}
|
||||
|
||||
public importCSV(files: FileList | File[]) {
|
||||
importCSV(files: FileList | File[]) {
|
||||
const csvFile = files[0];
|
||||
this._fileInput.nativeElement.value = null;
|
||||
|
||||
|
||||
@ -12,8 +12,8 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
})
|
||||
export class LicenseInformationScreenComponent implements OnInit {
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly appConfigService: AppConfigService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly appConfigService: AppConfigService,
|
||||
private readonly _licenseReportController: LicenseReportControllerService,
|
||||
private readonly _translateService: TranslateService
|
||||
) {}
|
||||
@ -21,12 +21,12 @@ export class LicenseInformationScreenComponent implements OnInit {
|
||||
get currentYear(): number {
|
||||
return new Date().getFullYear();
|
||||
}
|
||||
public currentInfo: LicenseReport = {};
|
||||
public totalInfo: LicenseReport = {};
|
||||
public unlicensedInfo: LicenseReport = {};
|
||||
public totalLicensedNumberOfPages = 0;
|
||||
public analysisPercentageOfLicense = 100;
|
||||
public viewReady = false;
|
||||
currentInfo: LicenseReport = {};
|
||||
totalInfo: LicenseReport = {};
|
||||
unlicensedInfo: LicenseReport = {};
|
||||
totalLicensedNumberOfPages = 0;
|
||||
analysisPercentageOfLicense = 100;
|
||||
viewReady = false;
|
||||
|
||||
barChart: any[] = [];
|
||||
lineChartSeries: any[] = [];
|
||||
@ -46,7 +46,7 @@ export class LicenseInformationScreenComponent implements OnInit {
|
||||
domain: ['#0389ec']
|
||||
};
|
||||
|
||||
public async ngOnInit() {
|
||||
async ngOnInit() {
|
||||
this.totalLicensedNumberOfPages = this.appConfigService.getConfig('LICENSE_PAGE_COUNT', 0);
|
||||
const startDate = moment(this.appConfigService.getConfig('LICENSE_START'), 'DD-MM-YYYY');
|
||||
const endDate = moment(this.appConfigService.getConfig('LICENSE_END'), 'DD-MM-YYYY');
|
||||
|
||||
@ -19,8 +19,8 @@ export class RuleSetsListingScreenComponent extends BaseListingComponent<RuleSet
|
||||
constructor(
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly userPreferenceService: UserPreferenceService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
protected readonly _injector: Injector
|
||||
) {
|
||||
super(_injector);
|
||||
@ -30,7 +30,7 @@ export class RuleSetsListingScreenComponent extends BaseListingComponent<RuleSet
|
||||
this.loadRuleSetsData();
|
||||
}
|
||||
|
||||
public loadRuleSetsData() {
|
||||
loadRuleSetsData() {
|
||||
this._appStateService.reset();
|
||||
this.allEntities = this._appStateService.ruleSets;
|
||||
this._executeSearchImmediately();
|
||||
@ -51,7 +51,7 @@ export class RuleSetsListingScreenComponent extends BaseListingComponent<RuleSet
|
||||
});
|
||||
}
|
||||
|
||||
public openAddRuleSetDialog() {
|
||||
openAddRuleSetDialog() {
|
||||
this._dialogService.openAddEditRuleSetDialog(null, async (newRuleSet) => {
|
||||
if (newRuleSet) {
|
||||
this.loadRuleSetsData();
|
||||
|
||||
@ -9,7 +9,7 @@ import { ComponentHasChanges } from '../../../../guards/can-deactivate.guard';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { AppStateService } from '../../../../state/app-state.service';
|
||||
|
||||
declare var ace;
|
||||
declare let ace;
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-rules-screen',
|
||||
@ -17,14 +17,14 @@ declare var ace;
|
||||
styleUrls: ['./rules-screen.component.scss']
|
||||
})
|
||||
export class RulesScreenComponent extends ComponentHasChanges {
|
||||
public aceOptions = { showPrintMargin: false };
|
||||
public rules: string;
|
||||
public processing = true;
|
||||
aceOptions = { showPrintMargin: false };
|
||||
rules: string;
|
||||
processing = true;
|
||||
|
||||
public initialLines: string[] = [];
|
||||
public currentLines: string[] = [];
|
||||
public changedLines: number[] = [];
|
||||
public activeEditMarkers: any[] = [];
|
||||
initialLines: string[] = [];
|
||||
currentLines: string[] = [];
|
||||
changedLines: number[] = [];
|
||||
activeEditMarkers: any[] = [];
|
||||
|
||||
@ViewChild('editorComponent', { static: true })
|
||||
editorComponent: AceEditorComponent;
|
||||
@ -33,7 +33,7 @@ export class RulesScreenComponent extends ComponentHasChanges {
|
||||
private _fileInput: ElementRef;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _rulesControllerService: RulesControllerService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _notificationService: NotificationService,
|
||||
@ -57,7 +57,7 @@ export class RulesScreenComponent extends ComponentHasChanges {
|
||||
);
|
||||
}
|
||||
|
||||
public textChanged($event: any) {
|
||||
textChanged($event: any) {
|
||||
this.currentLines = $event.split('\n');
|
||||
this.changedLines = [];
|
||||
this.activeEditMarkers.forEach((am) => {
|
||||
@ -72,21 +72,21 @@ export class RulesScreenComponent extends ComponentHasChanges {
|
||||
}
|
||||
}
|
||||
|
||||
const Range = ace.require('ace/range').Range;
|
||||
const range = ace.require('ace/range').Range;
|
||||
for (const i of this.changedLines) {
|
||||
const entry = this.currentLines[i];
|
||||
if (entry?.trim().length > 0) {
|
||||
// only mark non-empty lines
|
||||
this.activeEditMarkers.push(this.editorComponent.getEditor().getSession().addMarker(new Range(i, 0, i, 1), 'changed-row-marker', 'fullLine'));
|
||||
this.activeEditMarkers.push(this.editorComponent.getEditor().getSession().addMarker(new range(i, 0, i, 1), 'changed-row-marker', 'fullLine'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public get hasChanges(): boolean {
|
||||
get hasChanges(): boolean {
|
||||
return this.activeEditMarkers.length > 0;
|
||||
}
|
||||
|
||||
public async save(): Promise<void> {
|
||||
async save(): Promise<void> {
|
||||
this.processing = true;
|
||||
this._rulesControllerService
|
||||
.uploadRules({
|
||||
@ -109,14 +109,14 @@ export class RulesScreenComponent extends ComponentHasChanges {
|
||||
);
|
||||
}
|
||||
|
||||
public revert(): void {
|
||||
revert(): void {
|
||||
this.initialLines = this.rules.split('\n');
|
||||
this.editorComponent.getEditor().setValue(this.rules);
|
||||
this.editorComponent.getEditor().clearSelection();
|
||||
this.processing = false;
|
||||
}
|
||||
|
||||
public download(): void {
|
||||
download(): void {
|
||||
const content = this.editorComponent.getEditor().getValue();
|
||||
const blob = new Blob([content], {
|
||||
type: 'text/plain;charset=utf-8'
|
||||
@ -124,7 +124,7 @@ export class RulesScreenComponent extends ComponentHasChanges {
|
||||
saveAs(blob, 'rules.txt');
|
||||
}
|
||||
|
||||
public upload($event): void {
|
||||
upload($event): void {
|
||||
const file = $event.target.files[0];
|
||||
const fileReader = new FileReader();
|
||||
|
||||
|
||||
@ -12,13 +12,13 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
styleUrls: ['./smtp-config-screen.component.scss']
|
||||
})
|
||||
export class SmtpConfigScreenComponent implements OnInit {
|
||||
public viewReady = false;
|
||||
public configForm: FormGroup;
|
||||
viewReady = false;
|
||||
configForm: FormGroup;
|
||||
|
||||
private _initialValue: SMTPConfigurationModel;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _smtpConfigService: SmtpConfigurationControllerService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
@ -60,7 +60,7 @@ export class SmtpConfigScreenComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public get changed(): boolean {
|
||||
get changed(): boolean {
|
||||
if (!this._initialValue) return true;
|
||||
|
||||
for (const key of Object.keys(this.configForm.getRawValue())) {
|
||||
@ -72,14 +72,14 @@ export class SmtpConfigScreenComponent implements OnInit {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async save() {
|
||||
async save() {
|
||||
this.viewReady = false;
|
||||
await this._smtpConfigService.updateSMTPConfiguration(this.configForm.getRawValue()).toPromise();
|
||||
this._initialValue = this.configForm.getRawValue();
|
||||
this.viewReady = true;
|
||||
}
|
||||
|
||||
public openAuthConfigDialog(skipDisableOnCancel?: boolean) {
|
||||
openAuthConfigDialog(skipDisableOnCancel?: boolean) {
|
||||
this._dialogService.openSMTPAuthConfigDialog(this.configForm.getRawValue(), (authConfig) => {
|
||||
if (authConfig) {
|
||||
this.configForm.patchValue(authConfig);
|
||||
@ -89,10 +89,10 @@ export class SmtpConfigScreenComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public async testConnection() {
|
||||
async testConnection() {
|
||||
this.viewReady = false;
|
||||
try {
|
||||
const res = await this._smtpConfigService.testSMTPConfiguration(this.configForm.getRawValue()).toPromise();
|
||||
await this._smtpConfigService.testSMTPConfiguration(this.configForm.getRawValue()).toPromise();
|
||||
this._notificationService.showToastNotification(
|
||||
this._translateService.instant('smtp-config-screen.test.success'),
|
||||
undefined,
|
||||
|
||||
@ -16,14 +16,14 @@ import { BaseListingComponent } from '../../../shared/base/base-listing.componen
|
||||
export class UserListingScreenComponent extends BaseListingComponent<User> implements OnInit {
|
||||
protected readonly _selectionKey = 'userId';
|
||||
|
||||
public viewReady = false;
|
||||
public loading = false;
|
||||
public collapsedDetails = false;
|
||||
public chartData: DoughnutChartConfig[] = [];
|
||||
viewReady = false;
|
||||
loading = false;
|
||||
collapsedDetails = false;
|
||||
chartData: DoughnutChartConfig[] = [];
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly userService: UserService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly userService: UserService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _adminDialogService: AdminDialogService,
|
||||
private readonly _userControllerService: UserControllerService,
|
||||
@ -33,7 +33,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
|
||||
super(_injector);
|
||||
}
|
||||
|
||||
public async ngOnInit() {
|
||||
async ngOnInit() {
|
||||
await this._loadData();
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
|
||||
return this.userService.getName(user);
|
||||
}
|
||||
|
||||
public openAddEditUserDialog($event: MouseEvent, user?: User) {
|
||||
openAddEditUserDialog($event: MouseEvent, user?: User) {
|
||||
$event.stopPropagation();
|
||||
this._adminDialogService.openAddEditUserDialog(user, async (result) => {
|
||||
if (result === 'DELETE') {
|
||||
@ -58,7 +58,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
|
||||
});
|
||||
}
|
||||
|
||||
public openDeleteUserDialog(users: User[], $event?: MouseEvent) {
|
||||
openDeleteUserDialog(users: User[], $event?: MouseEvent) {
|
||||
$event?.stopPropagation();
|
||||
this._adminDialogService.openConfirmDeleteUsersDialog(users, async () => {
|
||||
this.loading = true;
|
||||
@ -112,26 +112,26 @@ export class UserListingScreenComponent extends BaseListingComponent<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');
|
||||
}
|
||||
|
||||
public async toggleActive(user: User) {
|
||||
async toggleActive(user: User) {
|
||||
this.loading = true;
|
||||
user.roles = this.userService.isActive(user) ? [] : ['RED_USER'];
|
||||
await this._userControllerService.addRoleToUsers(user.roles, user.userId).toPromise();
|
||||
await this._loadData();
|
||||
}
|
||||
|
||||
public toggleCollapsedDetails() {
|
||||
toggleCollapsedDetails() {
|
||||
this.collapsedDetails = !this.collapsedDetails;
|
||||
}
|
||||
|
||||
public async bulkDelete() {
|
||||
async bulkDelete() {
|
||||
this.openDeleteUserDialog(this.allEntities.filter((u) => this.isEntitySelected(u)));
|
||||
}
|
||||
|
||||
public get canDeleteSelected(): boolean {
|
||||
get canDeleteSelected(): boolean {
|
||||
return this.selectedEntitiesIds.indexOf(this.userService.userId) === -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,8 +34,8 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
@ViewChild('viewer', { static: true })
|
||||
private _viewer: ElementRef;
|
||||
|
||||
public viewReady = false;
|
||||
public configForm: FormGroup;
|
||||
viewReady = false;
|
||||
configForm: FormGroup;
|
||||
|
||||
get changed(): boolean {
|
||||
if (this._watermark === DEFAULT_WATERMARK) {
|
||||
@ -50,8 +50,8 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
}
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly appStateService: AppStateService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly appStateService: AppStateService,
|
||||
@Inject(BASE_HREF) private readonly _baseHref: string,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _watermarkControllerService: WatermarkControllerService,
|
||||
@ -85,11 +85,11 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
}
|
||||
|
||||
@debounce()
|
||||
public configChanged() {
|
||||
configChanged() {
|
||||
this._drawWatermark();
|
||||
}
|
||||
|
||||
public save() {
|
||||
save() {
|
||||
const watermark = {
|
||||
...this.configForm.getRawValue()
|
||||
};
|
||||
@ -113,12 +113,12 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
public revert() {
|
||||
revert() {
|
||||
this.configForm.setValue({ ...this._watermark });
|
||||
this.configChanged();
|
||||
}
|
||||
|
||||
public triggerChanges() {}
|
||||
triggerChanges() {}
|
||||
|
||||
private _loadViewer() {
|
||||
if (!this._instance) {
|
||||
@ -158,16 +158,16 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
}
|
||||
|
||||
private async _drawWatermark() {
|
||||
const PDFNet = this._instance.PDFNet;
|
||||
const pdfNet = this._instance.PDFNet;
|
||||
const document = await this._instance.docViewer.getDocument().getPDFDoc();
|
||||
|
||||
await PDFNet.runWithCleanup(
|
||||
await pdfNet.runWithCleanup(
|
||||
async () => {
|
||||
await document.lock();
|
||||
|
||||
const pageSet = await PDFNet.PageSet.createSinglePage(1);
|
||||
const pageSet = await pdfNet.PageSet.createSinglePage(1);
|
||||
|
||||
await PDFNet.Stamper.deleteStamps(document, pageSet);
|
||||
await pdfNet.Stamper.deleteStamps(document, pageSet);
|
||||
|
||||
const text = this.configForm.get('text').value || '';
|
||||
const fontSize = this.configForm.get('fontSize').value;
|
||||
@ -178,8 +178,8 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
|
||||
const rgbColor = hexToRgb(color);
|
||||
|
||||
const stamper = await PDFNet.Stamper.create(3, fontSize, 0);
|
||||
await stamper.setFontColor(await PDFNet.ColorPt.init(rgbColor.r / 255, rgbColor.g / 255, rgbColor.b / 255));
|
||||
const stamper = await pdfNet.Stamper.create(3, fontSize, 0);
|
||||
await stamper.setFontColor(await pdfNet.ColorPt.init(rgbColor.r / 255, rgbColor.g / 255, rgbColor.b / 255));
|
||||
await stamper.setOpacity(opacity / 100);
|
||||
|
||||
switch (orientation) {
|
||||
@ -195,7 +195,7 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
await stamper.setRotation(-45);
|
||||
}
|
||||
|
||||
const font = await PDFNet.Font.createAndEmbed(document, this._convertFont(fontType));
|
||||
const font = await pdfNet.Font.createAndEmbed(document, this._convertFont(fontType));
|
||||
await stamper.setFont(font);
|
||||
await stamper.setTextAlignment(0);
|
||||
await stamper.stampText(document, text, pageSet);
|
||||
@ -219,7 +219,7 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public setValue(type: 'fontType' | 'orientation' | 'hexColor', value: any) {
|
||||
setValue(type: 'fontType' | 'orientation' | 'hexColor', value: any) {
|
||||
if (!this.configForm.get(type).disabled) {
|
||||
this.configForm.get(type).setValue(value);
|
||||
this.configChanged();
|
||||
|
||||
@ -53,7 +53,7 @@ export class AdminDialogService {
|
||||
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();
|
||||
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
|
||||
ref.afterClosed().subscribe(async (result) => {
|
||||
@ -65,7 +65,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openDeleteRuleSetDialog($event: MouseEvent, ruleSet: RuleSetModel, cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
|
||||
openDeleteRuleSetDialog($event: MouseEvent, ruleSet: RuleSetModel, cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
|
||||
$event.stopPropagation();
|
||||
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
|
||||
ref.afterClosed().subscribe(async (result) => {
|
||||
@ -77,7 +77,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAddEditDictionaryDialog(dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef<AddEditDictionaryDialogComponent> {
|
||||
openAddEditDictionaryDialog(dictionary: TypeValue, ruleSetId: string, cb?: Function): MatDialogRef<AddEditDictionaryDialogComponent> {
|
||||
const ref = this._dialog.open(AddEditDictionaryDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: { dictionary, ruleSetId },
|
||||
@ -93,7 +93,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openEditColorsDialog(colors: Colors, colorKey: string, ruleSetId: string, cb?: Function): MatDialogRef<EditColorDialogComponent> {
|
||||
openEditColorsDialog(colors: Colors, colorKey: string, ruleSetId: string, cb?: Function): MatDialogRef<EditColorDialogComponent> {
|
||||
const ref = this._dialog.open(EditColorDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: { colors, colorKey, ruleSetId },
|
||||
@ -109,7 +109,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAddEditRuleSetDialog(ruleSet: RuleSetModel, cb?: Function): MatDialogRef<AddEditRuleSetDialogComponent> {
|
||||
openAddEditRuleSetDialog(ruleSet: RuleSetModel, cb?: Function): MatDialogRef<AddEditRuleSetDialogComponent> {
|
||||
const ref = this._dialog.open(AddEditRuleSetDialogComponent, {
|
||||
...dialogConfig,
|
||||
width: '900px',
|
||||
@ -126,7 +126,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openImportFileAttributeCSVDialog(
|
||||
openImportFileAttributeCSVDialog(
|
||||
csv: File,
|
||||
ruleSetId: string,
|
||||
existingConfiguration: FileAttributesConfig,
|
||||
@ -146,11 +146,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAddEditFileAttributeDialog(
|
||||
fileAttribute: FileAttributeConfig,
|
||||
ruleSetId: string,
|
||||
cb?: Function
|
||||
): MatDialogRef<AddEditFileAttributeDialogComponent> {
|
||||
openAddEditFileAttributeDialog(fileAttribute: FileAttributeConfig, ruleSetId: string, cb?: Function): MatDialogRef<AddEditFileAttributeDialogComponent> {
|
||||
const ref = this._dialog.open(AddEditFileAttributeDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: { fileAttribute, ruleSetId },
|
||||
@ -166,7 +162,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openConfirmDeleteFileAttributeDialog(
|
||||
openConfirmDeleteFileAttributeDialog(
|
||||
fileAttribute: FileAttributeConfig,
|
||||
ruleSetId: string,
|
||||
cb?: Function
|
||||
@ -186,7 +182,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openSMTPAuthConfigDialog(smtpConfig: SMTPConfigurationModel, cb?: Function): MatDialogRef<SmtpAuthDialogComponent> {
|
||||
openSMTPAuthConfigDialog(smtpConfig: SMTPConfigurationModel, cb?: Function): MatDialogRef<SmtpAuthDialogComponent> {
|
||||
const ref = this._dialog.open(SmtpAuthDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: smtpConfig,
|
||||
@ -202,7 +198,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAddEditUserDialog(user?: User, cb?: Function): MatDialogRef<AddEditUserDialogComponent> {
|
||||
openAddEditUserDialog(user?: User, cb?: Function): MatDialogRef<AddEditUserDialogComponent> {
|
||||
const ref = this._dialog.open(AddEditUserDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: user,
|
||||
@ -218,7 +214,7 @@ export class AdminDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openConfirmDeleteUsersDialog(users: User[], cb?: Function): MatDialogRef<ConfirmDeleteUsersDialogComponent> {
|
||||
openConfirmDeleteUsersDialog(users: User[], cb?: Function): MatDialogRef<ConfirmDeleteUsersDialogComponent> {
|
||||
const ref = this._dialog.open(ConfirmDeleteUsersDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: users,
|
||||
|
||||
@ -21,7 +21,7 @@ export class AuthGuard extends KeycloakAuthGuard {
|
||||
super(_router, _keycloak);
|
||||
}
|
||||
|
||||
public async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||
async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||
if (!this.authenticated) {
|
||||
await this._keycloak.login({
|
||||
idpHint: this._appConfigService.getConfig(AppConfigKey.OAUTH_IDP_HINT, null),
|
||||
|
||||
@ -8,8 +8,7 @@ import { AppConfigKey, AppConfigService } from '../app-config/app-config.service
|
||||
import { BASE_HREF } from '../../tokens';
|
||||
|
||||
export function keycloakInitializer(keycloak: KeycloakService, appConfigService: AppConfigService, baseUrl) {
|
||||
return () => {
|
||||
return appConfigService
|
||||
return () => appConfigService
|
||||
.loadAppConfig()
|
||||
.toPromise()
|
||||
.then(() => {
|
||||
@ -33,7 +32,6 @@ export function keycloakInitializer(keycloak: KeycloakService, appConfigService:
|
||||
};
|
||||
return keycloak.init(options).then(() => configureAutomaticRedirectToLoginScreen(keycloak));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakService) {
|
||||
|
||||
@ -9,7 +9,7 @@ import { DomSanitizer } from '@angular/platform-browser';
|
||||
exports: [MatIconModule]
|
||||
})
|
||||
export class IconsModule {
|
||||
constructor(private iconRegistry: MatIconRegistry, private sanitizer: DomSanitizer) {
|
||||
constructor(private readonly _iconRegistry: MatIconRegistry, private readonly _sanitizer: DomSanitizer) {
|
||||
const icons = [
|
||||
'add',
|
||||
'analyse',
|
||||
@ -84,7 +84,7 @@ export class IconsModule {
|
||||
];
|
||||
|
||||
for (const icon of icons) {
|
||||
iconRegistry.addSvgIconInNamespace('red', icon, sanitizer.bypassSecurityTrustResourceUrl(`/assets/icons/general/${icon}.svg`));
|
||||
_iconRegistry.addSvgIconInNamespace('red', icon, _sanitizer.bypassSecurityTrustResourceUrl(`/assets/icons/general/${icon}.svg`));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,17 +35,17 @@ export class AnnotationActionsComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
public get viewerAnnotation(): Annotations.Annotation {
|
||||
get viewerAnnotation(): Annotations.Annotation {
|
||||
return this.viewer.annotManager.getAnnotationById(this.annotation.id);
|
||||
}
|
||||
|
||||
public hideAnnotation($event: MouseEvent) {
|
||||
hideAnnotation($event: MouseEvent) {
|
||||
$event.stopPropagation();
|
||||
this.viewer.annotManager.hideAnnotations([this.viewerAnnotation]);
|
||||
this.viewer.annotManager.deselectAllAnnotations();
|
||||
}
|
||||
|
||||
public showAnnotation($event: MouseEvent) {
|
||||
showAnnotation($event: MouseEvent) {
|
||||
$event.stopPropagation();
|
||||
this.viewer.annotManager.showAnnotations([this.viewerAnnotation]);
|
||||
this.viewer.annotManager.deselectAllAnnotations();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { AppStateService } from '../../../../state/app-state.service';
|
||||
import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper';
|
||||
import { AnnotationActionsService } from '../../services/annotation-actions.service';
|
||||
@ -11,7 +11,7 @@ import { MatMenuTrigger } from '@angular/material/menu';
|
||||
templateUrl: './annotation-remove-actions.component.html',
|
||||
styleUrls: ['./annotation-remove-actions.component.scss']
|
||||
})
|
||||
export class AnnotationRemoveActionsComponent implements OnInit {
|
||||
export class AnnotationRemoveActionsComponent {
|
||||
@Output() menuOpenChange = new EventEmitter<boolean>();
|
||||
@Input() annotationsChanged: EventEmitter<AnnotationWrapper>;
|
||||
@Input() menuOpen: boolean;
|
||||
@ -19,7 +19,7 @@ export class AnnotationRemoveActionsComponent implements OnInit {
|
||||
@Input() tooltipPosition: 'before' | 'above' = 'before';
|
||||
|
||||
@ViewChild(MatMenuTrigger) matMenuTrigger: MatMenuTrigger;
|
||||
public permissions: {
|
||||
permissions: {
|
||||
canRemoveOrSuggestToRemoveOnlyHere: boolean;
|
||||
canPerformMultipleRemoveActions: boolean;
|
||||
canNotPerformMultipleRemoveActions: boolean;
|
||||
@ -28,49 +28,47 @@ export class AnnotationRemoveActionsComponent implements OnInit {
|
||||
};
|
||||
|
||||
constructor(
|
||||
public readonly appStateService: AppStateService,
|
||||
readonly appStateService: AppStateService,
|
||||
private readonly _annotationActionsService: AnnotationActionsService,
|
||||
private readonly _permissionsService: PermissionsService
|
||||
) {}
|
||||
|
||||
private _annotations: AnnotationWrapper[];
|
||||
|
||||
public get annotations(): AnnotationWrapper[] {
|
||||
get annotations(): AnnotationWrapper[] {
|
||||
return this._annotations;
|
||||
}
|
||||
|
||||
@Input()
|
||||
public set annotations(value: AnnotationWrapper[]) {
|
||||
set annotations(value: AnnotationWrapper[]) {
|
||||
this._annotations = value.filter((a) => a !== undefined);
|
||||
this._setPermissions();
|
||||
}
|
||||
|
||||
public get dictionaryColor() {
|
||||
get dictionaryColor() {
|
||||
return this.appStateService.getDictionaryColor('suggestion-add-dictionary');
|
||||
}
|
||||
|
||||
public get suggestionColor() {
|
||||
get suggestionColor() {
|
||||
return this.appStateService.getDictionaryColor('suggestion');
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public openMenu($event: MouseEvent) {
|
||||
openMenu($event: MouseEvent) {
|
||||
$event.stopPropagation();
|
||||
this.matMenuTrigger.openMenu();
|
||||
this.menuOpenChange.emit(true);
|
||||
}
|
||||
|
||||
public onMenuClosed() {
|
||||
onMenuClosed() {
|
||||
this.menuOpenChange.emit(false);
|
||||
}
|
||||
|
||||
public suggestRemoveAnnotations($event, removeFromDict: boolean) {
|
||||
suggestRemoveAnnotations($event, removeFromDict: boolean) {
|
||||
$event.stopPropagation();
|
||||
this._annotationActionsService.suggestRemoveAnnotation($event, this.annotations, removeFromDict, this.annotationsChanged);
|
||||
}
|
||||
|
||||
public markAsFalsePositive($event) {
|
||||
markAsFalsePositive($event) {
|
||||
this._annotationActionsService.markAsFalsePositive($event, this.annotations, this.annotationsChanged);
|
||||
}
|
||||
|
||||
|
||||
@ -16,8 +16,8 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service';
|
||||
})
|
||||
export class ProjectOverviewBulkActionsComponent {
|
||||
@Input() selectedFileIds: string[];
|
||||
@Output() private reload = new EventEmitter();
|
||||
public loading = false;
|
||||
@Output() private _reload = new EventEmitter();
|
||||
loading = false;
|
||||
|
||||
constructor(
|
||||
private readonly _appStateService: AppStateService,
|
||||
@ -39,52 +39,52 @@ export class ProjectOverviewBulkActionsComponent {
|
||||
return this.selectedFileIds.map((fileId) => this._appStateService.getFileById(this._appStateService.activeProject.project.projectId, fileId));
|
||||
}
|
||||
|
||||
public get areAllFilesSelected() {
|
||||
get areAllFilesSelected() {
|
||||
return this._appStateService.activeProject.files.length !== 0 && this.selectedFileIds.length === this._appStateService.activeProject.files.length;
|
||||
}
|
||||
|
||||
public get areSomeFilesSelected() {
|
||||
get areSomeFilesSelected() {
|
||||
return this.selectedFileIds.length > 0;
|
||||
}
|
||||
|
||||
public get canDelete() {
|
||||
get canDelete() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canDeleteFile(file), true);
|
||||
}
|
||||
|
||||
public get canAssign() {
|
||||
get canAssign() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canAssignReviewer(file), true);
|
||||
}
|
||||
|
||||
public get canReanalyse() {
|
||||
get canReanalyse() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canReanalyseFile(file), true);
|
||||
}
|
||||
|
||||
public get canOcr() {
|
||||
get canOcr() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canOcrFile(file), true);
|
||||
}
|
||||
|
||||
public get fileStatuses() {
|
||||
get fileStatuses() {
|
||||
return this.selectedFiles.map((file) => file.fileStatus.status);
|
||||
}
|
||||
|
||||
public delete() {
|
||||
delete() {
|
||||
this.loading = true;
|
||||
this._dialogService.openDeleteFilesDialog(null, this._appStateService.activeProject.project.projectId, this.selectedFileIds, () => {
|
||||
this.reload.emit();
|
||||
this._reload.emit();
|
||||
this.loading = false;
|
||||
this.selectedFileIds.splice(0, this.selectedFileIds.length);
|
||||
});
|
||||
}
|
||||
|
||||
public assign() {
|
||||
assign() {
|
||||
this.loading = true;
|
||||
this._dialogService.openBulkAssignFileReviewerDialog(this.selectedFileIds, () => {
|
||||
this.reload.emit();
|
||||
this._reload.emit();
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
public async reanalyse() {
|
||||
async reanalyse() {
|
||||
const fileIds = this.selectedFiles.filter((file) => this._permissionsService.fileRequiresReanalysis(file)).map((file) => file.fileId);
|
||||
this._performBulkAction(this._reanalysisControllerService.reanalyzeFilesForProject(fileIds, this._appStateService.activeProject.projectId));
|
||||
}
|
||||
@ -94,45 +94,45 @@ export class ProjectOverviewBulkActionsComponent {
|
||||
}
|
||||
|
||||
// Under review
|
||||
public get canSetToUnderReview() {
|
||||
get canSetToUnderReview() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canSetUnderReview(file), true);
|
||||
}
|
||||
|
||||
public setToUnderReview() {
|
||||
setToUnderReview() {
|
||||
this._performBulkAction(this._fileActionService.setFileUnderReview(this.selectedFiles));
|
||||
}
|
||||
|
||||
// Under approval
|
||||
public get canSetToUnderApproval() {
|
||||
get canSetToUnderApproval() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canSetUnderApproval(file), true);
|
||||
}
|
||||
|
||||
public setToUnderApproval() {
|
||||
setToUnderApproval() {
|
||||
this._performBulkAction(this._fileActionService.setFileUnderApproval(this.selectedFiles));
|
||||
}
|
||||
|
||||
// Approve
|
||||
public get isReadyForApproval() {
|
||||
get isReadyForApproval() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.isReadyForApproval(file), true);
|
||||
}
|
||||
|
||||
public get canApprove() {
|
||||
get canApprove() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canApprove(file), true);
|
||||
}
|
||||
|
||||
public approveDocuments() {
|
||||
approveDocuments() {
|
||||
this._performBulkAction(this._fileActionService.setFileApproved(this.selectedFiles));
|
||||
}
|
||||
|
||||
// Undo approval
|
||||
public get canUndoApproval() {
|
||||
get canUndoApproval() {
|
||||
return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canUndoApproval(file), true);
|
||||
}
|
||||
|
||||
private _performBulkAction(obs: Observable<any>) {
|
||||
this.loading = true;
|
||||
obs.subscribe().add(() => {
|
||||
this.reload.emit();
|
||||
this._reload.emit();
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@ -14,14 +14,14 @@ import { PermissionsService } from '../../../../services/permissions.service';
|
||||
styleUrls: ['./comments.component.scss']
|
||||
})
|
||||
export class CommentsComponent {
|
||||
@Input() public annotation: AnnotationWrapper;
|
||||
public expanded = false;
|
||||
public commentForm: FormGroup;
|
||||
public addingComment = false;
|
||||
@Input() annotation: AnnotationWrapper;
|
||||
expanded = false;
|
||||
commentForm: FormGroup;
|
||||
addingComment = false;
|
||||
|
||||
constructor(
|
||||
public readonly translateService: TranslateService,
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly translateService: TranslateService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
@ -37,7 +37,7 @@ export class CommentsComponent {
|
||||
return !this.annotation.isChangeLogRemoved;
|
||||
}
|
||||
|
||||
public toggleExpandComments($event: MouseEvent): void {
|
||||
toggleExpandComments($event: MouseEvent): void {
|
||||
$event.stopPropagation();
|
||||
if (!this.annotation.comments.length) {
|
||||
return;
|
||||
@ -46,7 +46,7 @@ export class CommentsComponent {
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
public toggleAddingComment($event?: MouseEvent): void {
|
||||
toggleAddingComment($event?: MouseEvent): void {
|
||||
$event?.stopPropagation();
|
||||
this.addingComment = !this.addingComment;
|
||||
if (this.addingComment) {
|
||||
@ -55,7 +55,7 @@ export class CommentsComponent {
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
public addComment(): void {
|
||||
addComment(): void {
|
||||
const value = this.commentForm.value.comment;
|
||||
if (value) {
|
||||
this._manualAnnotationService.addComment(value, this.annotation.id).subscribe((commentResponse) => {
|
||||
@ -70,7 +70,7 @@ export class CommentsComponent {
|
||||
}
|
||||
}
|
||||
|
||||
public deleteComment(comment: Comment): void {
|
||||
deleteComment(comment: Comment): void {
|
||||
this._manualAnnotationService.deleteComment(comment.id, this.annotation.id).subscribe(() => {
|
||||
this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1);
|
||||
if (!this.annotation.comments.length) {
|
||||
@ -79,11 +79,11 @@ export class CommentsComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public isCommentOwner(comment: Comment): boolean {
|
||||
isCommentOwner(comment: Comment): boolean {
|
||||
return comment.user === this._userService.userId;
|
||||
}
|
||||
|
||||
public getOwnerName(comment: Comment): string {
|
||||
getOwnerName(comment: Comment): string {
|
||||
return this._userService.getNameForId(comment.user);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { FileAttributesConfig, FileStatus } from '@redaction/red-ui-http';
|
||||
import { AppStateService } from '../../../../state/app-state.service';
|
||||
import { ProjectsDialogService } from '../../services/projects-dialog.service';
|
||||
@ -8,27 +8,25 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service';
|
||||
templateUrl: './document-info.component.html',
|
||||
styleUrls: ['./document-info.component.scss']
|
||||
})
|
||||
export class DocumentInfoComponent implements OnInit {
|
||||
export class DocumentInfoComponent {
|
||||
@Input() file: FileStatus;
|
||||
@Output() closeDocumentInfoView = new EventEmitter();
|
||||
|
||||
public fileAttributesConfig: FileAttributesConfig;
|
||||
fileAttributesConfig: FileAttributesConfig;
|
||||
|
||||
constructor(private readonly _appStateService: AppStateService, private readonly _dialogService: ProjectsDialogService) {
|
||||
this.fileAttributesConfig = this._appStateService.activeFileAttributesConfig;
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public get project() {
|
||||
get project() {
|
||||
return this._appStateService.getProjectById(this.file.projectId);
|
||||
}
|
||||
|
||||
public edit() {
|
||||
edit() {
|
||||
this._dialogService.openDocumentInfoDialog(this.file);
|
||||
}
|
||||
|
||||
public get ruleSetName(): string {
|
||||
get ruleSetName(): string {
|
||||
return this._appStateService.getRuleSetById(this.project.ruleSetId).name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,8 +19,8 @@ export class FileActionsComponent implements OnInit {
|
||||
screen: 'file-preview' | 'project-overview';
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly appStateService: AppStateService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly appStateService: AppStateService,
|
||||
private readonly _dialogService: ProjectsDialogService,
|
||||
private readonly _fileActionService: FileActionService
|
||||
) {}
|
||||
@ -39,15 +39,15 @@ export class FileActionsComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public toggleViewDocumentInfo() {
|
||||
toggleViewDocumentInfo() {
|
||||
this.actionPerformed.emit('view-document-info');
|
||||
}
|
||||
|
||||
public get tooltipPosition() {
|
||||
get tooltipPosition() {
|
||||
return this.screen === 'file-preview' ? 'below' : 'above';
|
||||
}
|
||||
|
||||
public get buttonType() {
|
||||
get buttonType() {
|
||||
return this.screen === 'file-preview' ? 'default' : 'dark-bg';
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
styleUrls: ['./file-workload.component.scss']
|
||||
})
|
||||
export class FileWorkloadComponent {
|
||||
public displayedAnnotations: { [key: number]: { annotations: AnnotationWrapper[] } } = {};
|
||||
displayedAnnotations: { [key: number]: { annotations: AnnotationWrapper[] } } = {};
|
||||
private _annotations: AnnotationWrapper[];
|
||||
|
||||
@Input()
|
||||
@ -41,21 +41,21 @@ export class FileWorkloadComponent {
|
||||
@Output() toggleSkipped = new EventEmitter<any>();
|
||||
@Output() annotationsChanged = new EventEmitter<AnnotationWrapper>();
|
||||
|
||||
public quickScrollFirstEnabled = false;
|
||||
public quickScrollLastEnabled = false;
|
||||
public displayedPages: number[] = [];
|
||||
public pagesPanelActive = true;
|
||||
quickScrollFirstEnabled = false;
|
||||
quickScrollLastEnabled = false;
|
||||
displayedPages: number[] = [];
|
||||
pagesPanelActive = true;
|
||||
|
||||
@ViewChild('annotationsElement') private _annotationsElement: ElementRef;
|
||||
@ViewChild('quickNavigation') private _quickNavigationElement: ElementRef;
|
||||
|
||||
private _multiSelectActive = false;
|
||||
|
||||
public get multiSelectActive(): boolean {
|
||||
get multiSelectActive(): boolean {
|
||||
return this._multiSelectActive;
|
||||
}
|
||||
|
||||
public set multiSelectActive(value: boolean) {
|
||||
set multiSelectActive(value: boolean) {
|
||||
this._multiSelectActive = value;
|
||||
if (!value) {
|
||||
this.selectAnnotations.emit();
|
||||
@ -67,7 +67,7 @@ export class FileWorkloadComponent {
|
||||
|
||||
constructor(private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _annotationProcessingService: AnnotationProcessingService) {}
|
||||
|
||||
private get firstSelectedAnnotation() {
|
||||
private get _firstSelectedAnnotation() {
|
||||
return this.selectedAnnotations?.length ? this.selectedAnnotations[0] : null;
|
||||
}
|
||||
|
||||
@ -82,37 +82,37 @@ export class FileWorkloadComponent {
|
||||
}
|
||||
}
|
||||
|
||||
public annotationIsSelected(annotation: AnnotationWrapper) {
|
||||
annotationIsSelected(annotation: AnnotationWrapper) {
|
||||
return this.selectedAnnotations?.find((a) => a?.id === annotation.id);
|
||||
}
|
||||
|
||||
public logAnnotation(annotation: AnnotationWrapper) {
|
||||
logAnnotation(annotation: AnnotationWrapper) {
|
||||
console.log(annotation);
|
||||
}
|
||||
|
||||
public pageHasSelection(page: number) {
|
||||
pageHasSelection(page: number) {
|
||||
return this.multiSelectActive && !!this.selectedAnnotations?.find((a) => a.pageNumber === page);
|
||||
}
|
||||
|
||||
public selectAllOnActivePage() {
|
||||
selectAllOnActivePage() {
|
||||
this.selectAnnotations.emit(this.displayedAnnotations[this.activeViewerPage].annotations);
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
public deselectAllOnActivePage() {
|
||||
deselectAllOnActivePage() {
|
||||
this.deselectAnnotations.emit(this.displayedAnnotations[this.activeViewerPage].annotations);
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
@debounce(0)
|
||||
public filtersChanged(filters: { primary: FilterModel[]; secondary?: FilterModel[] }) {
|
||||
filtersChanged(filters: { primary: FilterModel[]; secondary?: FilterModel[] }) {
|
||||
this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(this._annotations, filters.primary, filters.secondary);
|
||||
this.displayedPages = Object.keys(this.displayedAnnotations).map((key) => Number(key));
|
||||
this.computeQuickNavButtonsState();
|
||||
this._changeDetectorRef.markForCheck();
|
||||
}
|
||||
|
||||
public computeQuickNavButtonsState() {
|
||||
computeQuickNavButtonsState() {
|
||||
setTimeout(() => {
|
||||
const element: HTMLElement = this._quickNavigationElement.nativeElement.querySelector(`#pages`);
|
||||
const { scrollTop, scrollHeight, clientHeight } = element;
|
||||
@ -121,7 +121,7 @@ export class FileWorkloadComponent {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
public annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) {
|
||||
annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) {
|
||||
this.pagesPanelActive = false;
|
||||
if (this.annotationIsSelected(annotation)) {
|
||||
this.deselectAnnotations.emit([annotation]);
|
||||
@ -166,28 +166,28 @@ export class FileWorkloadComponent {
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
public scrollAnnotations() {
|
||||
if (this.firstSelectedAnnotation?.pageNumber === this.activeViewerPage) {
|
||||
scrollAnnotations() {
|
||||
if (this._firstSelectedAnnotation?.pageNumber === this.activeViewerPage) {
|
||||
return;
|
||||
}
|
||||
this.scrollAnnotationsToPage(this.activeViewerPage, 'always');
|
||||
}
|
||||
|
||||
public scrollAnnotationsToPage(page: number, mode: 'always' | 'if-needed' = 'if-needed') {
|
||||
scrollAnnotationsToPage(page: number, mode: 'always' | 'if-needed' = 'if-needed') {
|
||||
const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[anotation-page-header="${page}"]`);
|
||||
FileWorkloadComponent._scrollToFirstElement(elements, mode);
|
||||
}
|
||||
|
||||
@debounce()
|
||||
public scrollToSelectedAnnotation() {
|
||||
scrollToSelectedAnnotation() {
|
||||
if (!this.selectedAnnotations || this.selectedAnnotations.length === 0) {
|
||||
return;
|
||||
}
|
||||
const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[annotation-id="${this.firstSelectedAnnotation?.id}"].active`);
|
||||
const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[annotation-id="${this._firstSelectedAnnotation?.id}"].active`);
|
||||
FileWorkloadComponent._scrollToFirstElement(elements);
|
||||
}
|
||||
|
||||
public scrollQuickNavigation() {
|
||||
scrollQuickNavigation() {
|
||||
let quickNavPageIndex = this.displayedPages.findIndex((p) => p >= this.activeViewerPage);
|
||||
if (quickNavPageIndex === -1 || this.displayedPages[quickNavPageIndex] !== this.activeViewerPage) {
|
||||
quickNavPageIndex = Math.max(0, quickNavPageIndex - 1);
|
||||
@ -195,24 +195,24 @@ export class FileWorkloadComponent {
|
||||
this._scrollQuickNavigationToPage(this.displayedPages[quickNavPageIndex]);
|
||||
}
|
||||
|
||||
public scrollQuickNavFirst() {
|
||||
scrollQuickNavFirst() {
|
||||
if (this.displayedPages.length > 0) {
|
||||
this._scrollQuickNavigationToPage(this.displayedPages[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public scrollQuickNavLast() {
|
||||
scrollQuickNavLast() {
|
||||
if (this.displayedPages.length > 0) {
|
||||
this._scrollQuickNavigationToPage(this.displayedPages[this.displayedPages.length - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
public pageSelectedByClick($event: number) {
|
||||
pageSelectedByClick($event: number) {
|
||||
this.pagesPanelActive = true;
|
||||
this.selectPage.emit($event);
|
||||
}
|
||||
|
||||
public preventKeyDefault($event: KeyboardEvent) {
|
||||
preventKeyDefault($event: KeyboardEvent) {
|
||||
if (COMMAND_KEY_ARRAY.includes($event.key) && !(($event.target as any).localName === 'input')) {
|
||||
$event.preventDefault();
|
||||
}
|
||||
@ -220,23 +220,23 @@ export class FileWorkloadComponent {
|
||||
|
||||
private _selectFirstAnnotationOnCurrentPageIfNecessary() {
|
||||
if (
|
||||
(!this.firstSelectedAnnotation || this.activeViewerPage !== this.firstSelectedAnnotation.pageNumber) &&
|
||||
(!this._firstSelectedAnnotation || this.activeViewerPage !== this._firstSelectedAnnotation.pageNumber) &&
|
||||
this.displayedPages.indexOf(this.activeViewerPage) >= 0
|
||||
) {
|
||||
this.selectAnnotations.emit([this.displayedAnnotations[this.activeViewerPage].annotations[0]]);
|
||||
}
|
||||
}
|
||||
|
||||
public jumpToPreviousWithAnnotations() {
|
||||
jumpToPreviousWithAnnotations() {
|
||||
this.selectPage.emit(this._prevPageWithAnnotations());
|
||||
}
|
||||
|
||||
public jumpToNextWithAnnotations() {
|
||||
jumpToNextWithAnnotations() {
|
||||
this.selectPage.emit(this._nextPageWithAnnotations());
|
||||
}
|
||||
|
||||
private _navigateAnnotations($event: KeyboardEvent) {
|
||||
if (!this.firstSelectedAnnotation || this.activeViewerPage !== this.firstSelectedAnnotation.pageNumber) {
|
||||
if (!this._firstSelectedAnnotation || this.activeViewerPage !== this._firstSelectedAnnotation.pageNumber) {
|
||||
const pageIdx = this.displayedPages.indexOf(this.activeViewerPage);
|
||||
if (pageIdx !== -1) {
|
||||
// Displayed page has annotations
|
||||
@ -257,10 +257,10 @@ export class FileWorkloadComponent {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const page = this.firstSelectedAnnotation.pageNumber;
|
||||
const page = this._firstSelectedAnnotation.pageNumber;
|
||||
const pageIdx = this.displayedPages.indexOf(page);
|
||||
const annotationsOnPage = this.displayedAnnotations[page].annotations;
|
||||
const idx = annotationsOnPage.findIndex((a) => a.id === this.firstSelectedAnnotation.id);
|
||||
const idx = annotationsOnPage.findIndex((a) => a.id === this._firstSelectedAnnotation.id);
|
||||
|
||||
if ($event.key === 'ArrowDown') {
|
||||
if (idx + 1 !== annotationsOnPage.length) {
|
||||
|
||||
@ -394,11 +394,11 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
};
|
||||
}
|
||||
|
||||
public deselectAllAnnotations() {
|
||||
deselectAllAnnotations() {
|
||||
this.instance.annotManager.deselectAllAnnotations();
|
||||
}
|
||||
|
||||
public selectAnnotations($event: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) {
|
||||
selectAnnotations($event: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) {
|
||||
let annotations: AnnotationWrapper[];
|
||||
let multiSelect: boolean;
|
||||
if ($event instanceof Array) {
|
||||
@ -419,11 +419,11 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
this.instance.annotManager.jumpToAnnotation(annotationsFromViewer[0]);
|
||||
}
|
||||
|
||||
public deselectAnnotations(annotations: AnnotationWrapper[]) {
|
||||
deselectAnnotations(annotations: AnnotationWrapper[]) {
|
||||
this.instance.annotManager.deselectAnnotations(annotations.map((ann) => this.instance.annotManager.getAnnotationById(ann.id)));
|
||||
}
|
||||
|
||||
public navigateToPage(pageNumber: number) {
|
||||
navigateToPage(pageNumber: number) {
|
||||
const activePage = this.instance.docViewer.getCurrentPage();
|
||||
if (activePage !== pageNumber) {
|
||||
this.instance.docViewer.displayPageLocation(pageNumber, 0, 0);
|
||||
|
||||
@ -15,16 +15,16 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service';
|
||||
styleUrls: ['./project-details.component.scss']
|
||||
})
|
||||
export class ProjectDetailsComponent implements OnInit {
|
||||
public documentsChartData: DoughnutChartConfig[] = [];
|
||||
@Input() public filters: { needsWorkFilters: FilterModel[]; statusFilters: FilterModel[] };
|
||||
@Output() public filtersChanged = new EventEmitter();
|
||||
@Output() public openAssignProjectMembersDialog = new EventEmitter();
|
||||
@Output() public toggleCollapse = new EventEmitter();
|
||||
documentsChartData: DoughnutChartConfig[] = [];
|
||||
@Input() filters: { needsWorkFilters: FilterModel[]; statusFilters: FilterModel[] };
|
||||
@Output() filtersChanged = new EventEmitter();
|
||||
@Output() openAssignProjectMembersDialog = new EventEmitter();
|
||||
@Output() toggleCollapse = new EventEmitter();
|
||||
|
||||
constructor(
|
||||
public readonly appStateService: AppStateService,
|
||||
public readonly translateChartService: TranslateChartService,
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly appStateService: AppStateService,
|
||||
readonly translateChartService: TranslateChartService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _dialogService: ProjectsDialogService,
|
||||
private readonly _router: Router
|
||||
@ -37,11 +37,11 @@ export class ProjectDetailsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public get memberIds(): string[] {
|
||||
get memberIds(): string[] {
|
||||
return this.appStateService.activeProject.project.memberIds;
|
||||
}
|
||||
|
||||
public calculateChartConfig(): void {
|
||||
calculateChartConfig(): void {
|
||||
if (this.appStateService.activeProject) {
|
||||
const groups = groupBy(this.appStateService.activeProject?.files, 'status');
|
||||
this.documentsChartData = [];
|
||||
@ -58,7 +58,7 @@ export class ProjectDetailsComponent implements OnInit {
|
||||
return this.appStateService.activeProject.hasFiles;
|
||||
}
|
||||
|
||||
public toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void {
|
||||
toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void {
|
||||
const filter = this.filters[filterType].find((f) => f.key === key);
|
||||
filter.checked = !filter.checked;
|
||||
this.filtersChanged.emit(this.filters);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { PermissionsService } from '../../../../services/permissions.service';
|
||||
import { ProjectWrapper } from '../../../../state/model/project.wrapper';
|
||||
import { StatusSorter } from '../../../../utils/sorters/status-sorter';
|
||||
@ -13,27 +13,25 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service';
|
||||
templateUrl: './project-listing-actions.component.html',
|
||||
styleUrls: ['./project-listing-actions.component.scss']
|
||||
})
|
||||
export class ProjectListingActionsComponent implements OnInit {
|
||||
export class ProjectListingActionsComponent {
|
||||
@Input() project: ProjectWrapper;
|
||||
@Output() actionPerformed = new EventEmitter<ProjectWrapper | undefined>();
|
||||
actionMenuOpen = false;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly appStateService: AppStateService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly appStateService: AppStateService,
|
||||
private readonly _dialogService: ProjectsDialogService,
|
||||
private readonly _fileManagementControllerService: FileManagementControllerService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) {
|
||||
openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) {
|
||||
this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project, (pw: ProjectWrapper) => {
|
||||
this.actionPerformed.emit(pw);
|
||||
});
|
||||
}
|
||||
|
||||
public openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper) {
|
||||
openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper) {
|
||||
this._dialogService.openDeleteProjectDialog($event, project, () => {
|
||||
this.actionPerformed.emit();
|
||||
});
|
||||
@ -53,7 +51,7 @@ export class ProjectListingActionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
// Download Files
|
||||
public downloadRedactedFiles($event: MouseEvent, project: ProjectWrapper) {
|
||||
downloadRedactedFiles($event: MouseEvent, project: ProjectWrapper) {
|
||||
$event.stopPropagation();
|
||||
this._fileManagementControllerService
|
||||
.downloadRedactedFiles({ fileIds: project.files.map((file) => file.fileId) }, project.projectId, false, 'response')
|
||||
@ -62,11 +60,11 @@ export class ProjectListingActionsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public canDownloadRedactedFiles(project: ProjectWrapper) {
|
||||
canDownloadRedactedFiles(project: ProjectWrapper) {
|
||||
return project.files.length > 0 && project.files.reduce((acc, file) => acc && this.permissionsService.canDownloadRedactedFile(file), true);
|
||||
}
|
||||
|
||||
public getProjectStatusConfig(pw: ProjectWrapper) {
|
||||
getProjectStatusConfig(pw: ProjectWrapper) {
|
||||
const obj = pw.files.reduce((acc, file) => {
|
||||
const status = file.status;
|
||||
if (!acc[status]) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||
import { AppStateService } from '../../../../state/app-state.service';
|
||||
import { FilterModel } from '../../../shared/components/filter/model/filter.model';
|
||||
@ -8,25 +8,23 @@ import { FilterModel } from '../../../shared/components/filter/model/filter.mode
|
||||
templateUrl: './project-listing-details.component.html',
|
||||
styleUrls: ['./project-listing-details.component.scss']
|
||||
})
|
||||
export class ProjectListingDetailsComponent implements OnInit {
|
||||
@Input() public projectsChartData: DoughnutChartConfig[];
|
||||
@Input() public documentsChartData: DoughnutChartConfig[];
|
||||
@Input() public filters: { statusFilters: FilterModel[] };
|
||||
@Output() public filtersChanged = new EventEmitter();
|
||||
export class ProjectListingDetailsComponent {
|
||||
@Input() projectsChartData: DoughnutChartConfig[];
|
||||
@Input() documentsChartData: DoughnutChartConfig[];
|
||||
@Input() filters: { statusFilters: FilterModel[] };
|
||||
@Output() filtersChanged = new EventEmitter();
|
||||
|
||||
constructor(private readonly _appStateService: AppStateService) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public get totalPages() {
|
||||
get totalPages() {
|
||||
return this._appStateService.totalAnalysedPages;
|
||||
}
|
||||
|
||||
public get totalPeople() {
|
||||
get totalPeople() {
|
||||
return this._appStateService.totalPeople;
|
||||
}
|
||||
|
||||
public toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void {
|
||||
toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void {
|
||||
const filter = this.filters[filterType].find((f) => f.key === key);
|
||||
filter.checked = !filter.checked;
|
||||
this.filtersChanged.emit(this.filters);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { PermissionsService } from '../../../../services/permissions.service';
|
||||
|
||||
@Component({
|
||||
@ -6,41 +6,39 @@ import { PermissionsService } from '../../../../services/permissions.service';
|
||||
templateUrl: './team-members.component.html',
|
||||
styleUrls: ['./team-members.component.scss']
|
||||
})
|
||||
export class TeamMembersComponent implements OnInit {
|
||||
@Input() public memberIds: string[];
|
||||
@Input() public perLine: number;
|
||||
@Input() public canAdd = true;
|
||||
@Input() public largeSpacing = false;
|
||||
@Input() public canRemove = false;
|
||||
@Input() public unremovableMembers: string[] = [];
|
||||
@Output() public openAssignProjectMembersDialog = new EventEmitter();
|
||||
@Output() public remove = new EventEmitter<string>();
|
||||
export class TeamMembersComponent {
|
||||
@Input() memberIds: string[];
|
||||
@Input() perLine: number;
|
||||
@Input() canAdd = true;
|
||||
@Input() largeSpacing = false;
|
||||
@Input() canRemove = false;
|
||||
@Input() unremovableMembers: string[] = [];
|
||||
@Output() openAssignProjectMembersDialog = new EventEmitter();
|
||||
@Output() remove = new EventEmitter<string>();
|
||||
|
||||
@ViewChild('container', { static: true }) container: ElementRef;
|
||||
|
||||
public expandedTeam = false;
|
||||
expandedTeam = false;
|
||||
|
||||
constructor(public permissionsService: PermissionsService) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public get maxTeamMembersBeforeExpand(): number {
|
||||
get maxTeamMembersBeforeExpand(): number {
|
||||
return this.perLine - (this.canAdd ? 1 : 0);
|
||||
}
|
||||
|
||||
public get displayedMembers(): string[] {
|
||||
get displayedMembers(): string[] {
|
||||
return this.expandedTeam || !this.overflowCount ? this.memberIds : this.memberIds.slice(0, this.maxTeamMembersBeforeExpand - 1);
|
||||
}
|
||||
|
||||
public toggleExpandedTeam() {
|
||||
toggleExpandedTeam() {
|
||||
this.expandedTeam = !this.expandedTeam;
|
||||
}
|
||||
|
||||
public get overflowCount() {
|
||||
get overflowCount() {
|
||||
return this.memberIds.length > this.maxTeamMembersBeforeExpand ? this.memberIds.length - (this.maxTeamMembersBeforeExpand - 1) : 0;
|
||||
}
|
||||
|
||||
public canRemoveMember(userId: string) {
|
||||
canRemoveMember(userId: string) {
|
||||
return this.canRemove && this.unremovableMembers.indexOf(userId) === -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,11 +12,11 @@ import * as moment from 'moment';
|
||||
styleUrls: ['./add-edit-project-dialog.component.scss']
|
||||
})
|
||||
export class AddEditProjectDialogComponent {
|
||||
public projectForm: FormGroup;
|
||||
public hasDueDate: boolean;
|
||||
public downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED'];
|
||||
public reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum);
|
||||
public ruleSets: RuleSetModel[];
|
||||
projectForm: FormGroup;
|
||||
hasDueDate: boolean;
|
||||
downloadTypesEnum = ['ORIGINAL', 'PREVIEW', 'REDACTED'];
|
||||
reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum);
|
||||
ruleSets: RuleSetModel[];
|
||||
|
||||
constructor(
|
||||
private readonly _appStateService: AppStateService,
|
||||
@ -55,7 +55,7 @@ export class AddEditProjectDialogComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public get changed() {
|
||||
get changed() {
|
||||
if (!this.project) {
|
||||
return true;
|
||||
}
|
||||
@ -80,7 +80,7 @@ export class AddEditProjectDialogComponent {
|
||||
return false;
|
||||
}
|
||||
|
||||
public get disabled() {
|
||||
get disabled() {
|
||||
if (this.hasDueDate && this.projectForm.get('dueDate').value === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -21,11 +21,11 @@ class DialogData {
|
||||
styleUrls: ['./assign-owner-dialog.component.scss']
|
||||
})
|
||||
export class AssignOwnerDialogComponent {
|
||||
public usersForm: FormGroup;
|
||||
public searchForm: FormGroup;
|
||||
usersForm: FormGroup;
|
||||
searchForm: FormGroup;
|
||||
|
||||
constructor(
|
||||
public readonly userService: UserService,
|
||||
readonly userService: UserService,
|
||||
private readonly _projectControllerService: ProjectControllerService,
|
||||
private readonly _notificationService: NotificationService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
@ -70,23 +70,23 @@ export class AssignOwnerDialogComponent {
|
||||
}
|
||||
}
|
||||
|
||||
public get selectedSingleUser(): string {
|
||||
get selectedSingleUser(): string {
|
||||
return this.usersForm.get('singleUser').value;
|
||||
}
|
||||
|
||||
public get selectedApproversList(): string[] {
|
||||
get selectedApproversList(): string[] {
|
||||
return this.usersForm.get('approvers').value;
|
||||
}
|
||||
|
||||
public get selectedReviewersList(): string[] {
|
||||
get selectedReviewersList(): string[] {
|
||||
return this.selectedUsersList.filter((m) => this.selectedApproversList.indexOf(m) === -1);
|
||||
}
|
||||
|
||||
public get selectedUsersList(): string[] {
|
||||
get selectedUsersList(): string[] {
|
||||
return this.usersForm.get('members').value;
|
||||
}
|
||||
|
||||
public isOwner(userId: string): boolean {
|
||||
isOwner(userId: string): boolean {
|
||||
return userId === this.selectedSingleUser;
|
||||
}
|
||||
|
||||
@ -138,15 +138,15 @@ export class AssignOwnerDialogComponent {
|
||||
.map((user) => user.userId);
|
||||
}
|
||||
|
||||
public isMemberSelected(userId: string): boolean {
|
||||
isMemberSelected(userId: string): boolean {
|
||||
return this.selectedUsersList.indexOf(userId) !== -1;
|
||||
}
|
||||
|
||||
public isApprover(userId: string): boolean {
|
||||
isApprover(userId: string): boolean {
|
||||
return this.selectedApproversList.indexOf(userId) !== -1;
|
||||
}
|
||||
|
||||
public toggleApprover(userId: string, $event?: MouseEvent) {
|
||||
toggleApprover(userId: string, $event?: MouseEvent) {
|
||||
$event?.stopPropagation();
|
||||
|
||||
if (this.isOwner(userId) && this.isApprover(userId)) {
|
||||
@ -163,7 +163,7 @@ export class AssignOwnerDialogComponent {
|
||||
}
|
||||
}
|
||||
|
||||
public toggleSelected(userId: string) {
|
||||
toggleSelected(userId: string) {
|
||||
if (this.isMemberSelected(userId)) {
|
||||
this.selectedUsersList.splice(this.selectedUsersList.indexOf(userId), 1);
|
||||
|
||||
@ -189,7 +189,7 @@ export class AssignOwnerDialogComponent {
|
||||
return false;
|
||||
}
|
||||
|
||||
public get changed(): boolean {
|
||||
get changed(): boolean {
|
||||
if (this.data.ignoreChanged) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -11,9 +11,9 @@ import { ProjectWrapper } from '../../../../state/model/project.wrapper';
|
||||
styleUrls: ['./document-info-dialog.component.scss']
|
||||
})
|
||||
export class DocumentInfoDialogComponent implements OnInit {
|
||||
public documentInfoForm: FormGroup;
|
||||
public file: FileStatus;
|
||||
public attributes: FileAttributeConfig[];
|
||||
documentInfoForm: FormGroup;
|
||||
file: FileStatus;
|
||||
attributes: FileAttributeConfig[];
|
||||
|
||||
private _project: ProjectWrapper;
|
||||
|
||||
@ -36,7 +36,7 @@ export class DocumentInfoDialogComponent implements OnInit {
|
||||
this.documentInfoForm = this._formBuilder.group(formConfig);
|
||||
}
|
||||
|
||||
public async saveDocumentInfo() {
|
||||
async saveDocumentInfo() {
|
||||
const attributeIdToValue = { ...this.file.fileAttributes?.attributeIdToValue, ...this.documentInfoForm.getRawValue() };
|
||||
await this._fileAttributesService.setFileAttributes({ attributeIdToValue }, this.file.projectId, this.file.fileId).toPromise();
|
||||
this.file.fileAttributes = { attributeIdToValue };
|
||||
|
||||
@ -84,7 +84,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
||||
this.redactionDictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||
}
|
||||
|
||||
public get displayedDictionaryLabel() {
|
||||
get displayedDictionaryLabel() {
|
||||
const dictType = this.redactionForm.get('dictionary').value;
|
||||
if (dictType) {
|
||||
return this.redactionDictionaries.find((d) => d.type === dictType).label;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { ConfirmationDialogInput } from '../../../shared/dialogs/confirmation-dialog/confirmation-dialog.component';
|
||||
|
||||
export interface RemoveAnnotationsDialogInput {
|
||||
annotationsToRemove: AnnotationWrapper[];
|
||||
@ -14,15 +13,13 @@ export interface RemoveAnnotationsDialogInput {
|
||||
templateUrl: './remove-annotations-dialog.component.html',
|
||||
styleUrls: ['./remove-annotations-dialog.component.scss']
|
||||
})
|
||||
export class RemoveAnnotationsDialogComponent implements OnInit {
|
||||
export class RemoveAnnotationsDialogComponent {
|
||||
constructor(
|
||||
private readonly _translateService: TranslateService,
|
||||
public dialogRef: MatDialogRef<RemoveAnnotationsDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: RemoveAnnotationsDialogInput
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
deny() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
@ -38,15 +38,15 @@ const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f'];
|
||||
styleUrls: ['./file-preview-screen.component.scss']
|
||||
})
|
||||
export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, OnDetach {
|
||||
public dialogRef: MatDialogRef<any>;
|
||||
public viewMode: ViewMode = 'STANDARD';
|
||||
public fullScreen = false;
|
||||
public editingReviewer = false;
|
||||
public reviewerForm: FormGroup;
|
||||
public shouldDeselectAnnotationsOnPageChange = true;
|
||||
public analysisProgressInSeconds = 0;
|
||||
public analysisProgress: number;
|
||||
public analysisInterval: number;
|
||||
dialogRef: MatDialogRef<any>;
|
||||
viewMode: ViewMode = 'STANDARD';
|
||||
fullScreen = false;
|
||||
editingReviewer = false;
|
||||
reviewerForm: FormGroup;
|
||||
shouldDeselectAnnotationsOnPageChange = true;
|
||||
analysisProgressInSeconds = 0;
|
||||
analysisProgress: number;
|
||||
analysisInterval: number;
|
||||
fileData: FileDataModel;
|
||||
annotationData: AnnotationData;
|
||||
selectedAnnotations: AnnotationWrapper[];
|
||||
@ -59,19 +59,19 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
fileReanalysedSubscription: Subscription;
|
||||
hideSkipped = false;
|
||||
displayPDFViewer = false;
|
||||
public viewDocumentInfo = false;
|
||||
viewDocumentInfo = false;
|
||||
private _instance: WebViewerInstance;
|
||||
private _lastPage: string;
|
||||
|
||||
@ViewChild('fileWorkloadComponent') private _workloadComponent: FileWorkloadComponent;
|
||||
@ViewChild(PdfViewerComponent) private _viewerComponent: PdfViewerComponent;
|
||||
@ViewChild(FileWorkloadComponent) public fileWorkloadComponent: FileWorkloadComponent;
|
||||
@ViewChild(FileWorkloadComponent) fileWorkloadComponent: FileWorkloadComponent;
|
||||
|
||||
constructor(
|
||||
public readonly appStateService: AppStateService,
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly userPreferenceService: UserPreferenceService,
|
||||
public readonly userService: UserService,
|
||||
readonly appStateService: AppStateService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
readonly userService: UserService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _activatedRoute: ActivatedRoute,
|
||||
private readonly _dialogService: ProjectsDialogService,
|
||||
@ -135,7 +135,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
const redactions = allAnnotations.filter((a) => a.getCustomData('redaction'));
|
||||
|
||||
switch (this.viewMode) {
|
||||
case 'STANDARD':
|
||||
case 'STANDARD': {
|
||||
const standardEntries = allAnnotations.filter((a) => !a.getCustomData('changeLogRemoved'));
|
||||
const nonStandardEntries = allAnnotations.filter((a) => a.getCustomData('changeLogRemoved'));
|
||||
redactions.forEach((redaction) => {
|
||||
@ -144,7 +144,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
this._instance.annotManager.showAnnotations(standardEntries);
|
||||
this._instance.annotManager.hideAnnotations(nonStandardEntries);
|
||||
break;
|
||||
case 'DELTA':
|
||||
}
|
||||
case 'DELTA': {
|
||||
const changeLogEntries = allAnnotations.filter((a) => a.getCustomData('changeLog'));
|
||||
const nonChangeLogEntries = allAnnotations.filter((a) => !a.getCustomData('changeLog'));
|
||||
redactions.forEach((redaction) => {
|
||||
@ -153,7 +154,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
this._instance.annotManager.showAnnotations(changeLogEntries);
|
||||
this._instance.annotManager.hideAnnotations(nonChangeLogEntries);
|
||||
break;
|
||||
case 'REDACTED':
|
||||
}
|
||||
case 'REDACTED': {
|
||||
const redactionEntries = allAnnotations.filter((a) => a.getCustomData('redaction'));
|
||||
const nonRedactionEntries = allAnnotations.filter((a) => !a.getCustomData('redaction'));
|
||||
redactions.forEach((redaction) => {
|
||||
@ -162,6 +164,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
this._instance.annotManager.showAnnotations(redactionEntries);
|
||||
this._instance.annotManager.hideAnnotations(nonRedactionEntries);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.rebuildFilters();
|
||||
@ -184,7 +187,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
ngOnInit(): void {
|
||||
this.displayPDFViewer = true;
|
||||
|
||||
document.documentElement.addEventListener('fullscreenchange', (event) => {
|
||||
document.documentElement.addEventListener('fullscreenchange', () => {
|
||||
if (!document.fullscreenElement) {
|
||||
this.fullScreen = false;
|
||||
}
|
||||
@ -201,7 +204,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
this._unsubscribeFromFileUpdates();
|
||||
}
|
||||
|
||||
public rebuildFilters(deletePreviousAnnotations: boolean = false) {
|
||||
rebuildFilters(deletePreviousAnnotations: boolean = false) {
|
||||
const startTime = new Date().getTime();
|
||||
if (deletePreviousAnnotations) {
|
||||
this.activeViewer.annotManager.deleteAnnotations(this.activeViewer.annotManager.getAnnotationsList(), {
|
||||
@ -246,7 +249,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
}
|
||||
|
||||
selectAnnotations(annotations?: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) {
|
||||
if (!!annotations) {
|
||||
if (annotations) {
|
||||
this._viewerComponent.selectAnnotations(annotations);
|
||||
} else {
|
||||
this._viewerComponent.deselectAllAnnotations();
|
||||
@ -278,7 +281,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
});
|
||||
}
|
||||
|
||||
public toggleFullScreen() {
|
||||
toggleFullScreen() {
|
||||
this.fullScreen = !this.fullScreen;
|
||||
if (this.fullScreen) {
|
||||
this._openFullScreen();
|
||||
@ -371,7 +374,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
}
|
||||
}
|
||||
|
||||
public async assignToMe() {
|
||||
async assignToMe() {
|
||||
await this._fileActionService.assignToMe(this.fileData.fileStatus, async () => {
|
||||
await this.appStateService.reloadActiveFile();
|
||||
this.resetReviewerForm();
|
||||
@ -379,7 +382,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
});
|
||||
}
|
||||
|
||||
public assignReviewer() {
|
||||
assignReviewer() {
|
||||
const reviewerId = this.reviewerForm.get('reviewer').value;
|
||||
|
||||
this._statusControllerService.setFileReviewer(this.fileData.fileStatus.projectId, this.fileData.fileStatus.fileId, reviewerId).subscribe(async () => {
|
||||
@ -392,7 +395,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
});
|
||||
}
|
||||
|
||||
public resetReviewerForm() {
|
||||
resetReviewerForm() {
|
||||
this.reviewerForm.setValue({ reviewer: this.appStateService.activeFile.currentReviewer });
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@
|
||||
<redaction-initials-avatar [userId]="pw.project.ownerId" [withName]="true"></redaction-initials-avatar>
|
||||
</div>
|
||||
<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 class="scrollbar-placeholder"></div>
|
||||
</div>
|
||||
|
||||
@ -20,7 +20,7 @@ import { filter, tap } from 'rxjs/operators';
|
||||
import { TranslateChartService } from '../../../../services/translate-chart.service';
|
||||
import { RedactionFilterSorter } from '../../../../utils/sorters/redaction-filter-sorter';
|
||||
import { StatusSorter } from '../../../../utils/sorters/status-sorter';
|
||||
import { ActivatedRouteSnapshot, NavigationEnd, NavigationStart, Router } from '@angular/router';
|
||||
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
|
||||
import { FilterComponent } from '../../../shared/components/filter/filter.component';
|
||||
import { ProjectsDialogService } from '../../services/projects-dialog.service';
|
||||
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
||||
@ -36,15 +36,15 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
|
||||
protected readonly _searchKey = 'name';
|
||||
protected readonly _sortKey = 'project-listing';
|
||||
|
||||
public projectsChartData: DoughnutChartConfig[] = [];
|
||||
public documentsChartData: DoughnutChartConfig[] = [];
|
||||
projectsChartData: DoughnutChartConfig[] = [];
|
||||
documentsChartData: DoughnutChartConfig[] = [];
|
||||
|
||||
public statusFilters: FilterModel[];
|
||||
public peopleFilters: FilterModel[];
|
||||
public needsWorkFilters: FilterModel[];
|
||||
public ruleSetFilters: FilterModel[];
|
||||
statusFilters: FilterModel[];
|
||||
peopleFilters: FilterModel[];
|
||||
needsWorkFilters: FilterModel[];
|
||||
ruleSetFilters: FilterModel[];
|
||||
|
||||
public detailsContainerFilters: {
|
||||
detailsContainerFilters: {
|
||||
statusFilters: FilterModel[];
|
||||
} = {
|
||||
statusFilters: []
|
||||
@ -64,7 +64,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
|
||||
private _fileChangedSub: Subscription;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _translateChartService: TranslateChartService,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _dialogService: ProjectsDialogService,
|
||||
@ -78,7 +78,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
|
||||
this._loadEntitiesFromState();
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
ngOnInit(): void {
|
||||
this._calculateData();
|
||||
|
||||
this._projectAutoUpdateTimer = timer(0, 10000)
|
||||
@ -103,7 +103,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
|
||||
});
|
||||
}
|
||||
|
||||
ngOnAttach(previousRoute: ActivatedRouteSnapshot) {
|
||||
ngOnAttach() {
|
||||
this._appStateService.reset();
|
||||
this._loadEntitiesFromState();
|
||||
this.ngOnInit();
|
||||
@ -124,11 +124,11 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
|
||||
this.allEntities = this._appStateService.allProjects;
|
||||
}
|
||||
|
||||
public get noData() {
|
||||
get noData() {
|
||||
return this.allEntities.length === 0;
|
||||
}
|
||||
|
||||
protected get filterComponents(): FilterComponent[] {
|
||||
protected get _filterComponents(): FilterComponent[] {
|
||||
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);
|
||||
}
|
||||
|
||||
public get user() {
|
||||
get user() {
|
||||
return this._userService.user;
|
||||
}
|
||||
|
||||
public get activeProjectsCount() {
|
||||
get activeProjectsCount() {
|
||||
return this.allEntities.filter((p) => p.project.status === Project.StatusEnum.ACTIVE).length;
|
||||
}
|
||||
|
||||
public get inactiveProjectsCount() {
|
||||
get inactiveProjectsCount() {
|
||||
return this.allEntities.length - this.activeProjectsCount;
|
||||
}
|
||||
|
||||
public documentCount(project: ProjectWrapper) {
|
||||
documentCount(project: ProjectWrapper) {
|
||||
return project.files.length;
|
||||
}
|
||||
|
||||
public userCount(project: ProjectWrapper) {
|
||||
userCount(project: ProjectWrapper) {
|
||||
return project.numberOfMembers;
|
||||
}
|
||||
|
||||
public canOpenProject(pw: ProjectWrapper): boolean {
|
||||
return true;
|
||||
canOpenProject(pw: ProjectWrapper): boolean {
|
||||
return !!pw;
|
||||
}
|
||||
|
||||
public getRuleSet(pw: ProjectWrapper): RuleSetModel {
|
||||
getRuleSet(pw: ProjectWrapper): RuleSetModel {
|
||||
return this._appStateService.getRuleSetById(pw.project.ruleSetId);
|
||||
}
|
||||
|
||||
public openAddProjectDialog(): void {
|
||||
openAddProjectDialog(): void {
|
||||
this._dialogService.openAddProjectDialog((addResponse) => {
|
||||
this._calculateData();
|
||||
this._router.navigate([`/main/projects/${addResponse.project.projectId}`]);
|
||||
@ -191,7 +191,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
|
||||
});
|
||||
}
|
||||
|
||||
public openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) {
|
||||
openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) {
|
||||
this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project);
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
|
||||
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 [
|
||||
{ values: this.statusFilters, checker: projectStatusChecker },
|
||||
{ values: this.peopleFilters, checker: projectMemberChecker },
|
||||
@ -275,13 +275,13 @@ export class ProjectListingScreenComponent extends BaseListingComponent<ProjectW
|
||||
];
|
||||
}
|
||||
|
||||
protected preFilter() {
|
||||
protected _preFilter() {
|
||||
this.detailsContainerFilters = {
|
||||
statusFilters: this.statusFilters.map((f) => ({ ...f }))
|
||||
};
|
||||
}
|
||||
|
||||
public actionPerformed(pw: ProjectWrapper) {
|
||||
actionPerformed() {
|
||||
this._calculateData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component, HostListener, Injector, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, NavigationEnd, NavigationStart, Router } from '@angular/router';
|
||||
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
|
||||
import { NotificationService, NotificationType } from '../../../../services/notification.service';
|
||||
import { AppStateService } from '../../../../state/app-state.service';
|
||||
import { FileDropOverlayService } from '../../../upload-download/services/file-drop-overlay.service';
|
||||
@ -19,7 +19,6 @@ import { Subscription, timer } from 'rxjs';
|
||||
import { filter, tap } from 'rxjs/operators';
|
||||
import { RedactionFilterSorter } from '../../../../utils/sorters/redaction-filter-sorter';
|
||||
import { StatusSorter } from '../../../../utils/sorters/status-sorter';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { convertFiles, handleFileDrop } from '../../../../utils/file-drop-utils';
|
||||
import { FilterComponent } from '../../../shared/components/filter/filter.component';
|
||||
import { ProjectsDialogService } from '../../services/projects-dialog.service';
|
||||
@ -38,10 +37,10 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
|
||||
protected readonly _selectionKey = 'fileId';
|
||||
protected readonly _sortKey = 'project-overview';
|
||||
|
||||
public statusFilters: FilterModel[];
|
||||
public peopleFilters: FilterModel[];
|
||||
public needsWorkFilters: FilterModel[];
|
||||
public collapsedDetails = false;
|
||||
statusFilters: FilterModel[];
|
||||
peopleFilters: FilterModel[];
|
||||
needsWorkFilters: FilterModel[];
|
||||
collapsedDetails = false;
|
||||
|
||||
detailsContainerFilters: {
|
||||
needsWorkFilters: FilterModel[];
|
||||
@ -62,7 +61,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
|
||||
@ViewChild('needsWorkFilter') private _needsWorkFilterComponent: FilterComponent;
|
||||
|
||||
constructor(
|
||||
public readonly permissionsService: PermissionsService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _notificationService: NotificationService,
|
||||
private readonly _dialogService: ProjectsDialogService,
|
||||
@ -112,7 +111,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
|
||||
this._routerEventsScrollPositionSub.unsubscribe();
|
||||
}
|
||||
|
||||
ngOnAttach(previousRoute: ActivatedRouteSnapshot) {
|
||||
ngOnAttach() {
|
||||
this._loadEntitiesFromState();
|
||||
this.ngOnInit();
|
||||
this._scrollBar.scrollTo({ top: this._lastScrollPosition });
|
||||
@ -122,11 +121,11 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
|
||||
this.ngOnDestroy();
|
||||
}
|
||||
|
||||
public get activeProject(): ProjectWrapper {
|
||||
get activeProject(): ProjectWrapper {
|
||||
return this._appStateService.activeProject;
|
||||
}
|
||||
|
||||
public reanalyseProject() {
|
||||
reanalyseProject() {
|
||||
return this._appStateService
|
||||
.reanalyzeProject()
|
||||
.then(() => {
|
||||
@ -146,19 +145,19 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
|
||||
});
|
||||
}
|
||||
|
||||
public isPending(fileStatusWrapper: FileStatusWrapper) {
|
||||
isPending(fileStatusWrapper: FileStatusWrapper) {
|
||||
return fileStatusWrapper.status === FileStatus.StatusEnum.UNPROCESSED;
|
||||
}
|
||||
|
||||
public isError(fileStatusWrapper: FileStatusWrapper) {
|
||||
isError(fileStatusWrapper: FileStatusWrapper) {
|
||||
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);
|
||||
}
|
||||
|
||||
protected get filterComponents(): FilterComponent[] {
|
||||
protected get _filterComponents(): FilterComponent[] {
|
||||
return [this._statusFilterComponent, this._peopleFilterComponent, this._needsWorkFilterComponent];
|
||||
}
|
||||
|
||||
@ -183,7 +182,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
public fileId(index, item) {
|
||||
fileId(index, item) {
|
||||
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] : [];
|
||||
}
|
||||
|
||||
protected get filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] {
|
||||
protected get _filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] {
|
||||
return [
|
||||
{ values: this.statusFilters, checker: keyChecker('status') },
|
||||
{ values: this.peopleFilters, checker: keyChecker('currentReviewer') },
|
||||
@ -296,7 +295,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
|
||||
];
|
||||
}
|
||||
|
||||
protected preFilter() {
|
||||
protected _preFilter() {
|
||||
this.detailsContainerFilters = {
|
||||
needsWorkFilters: this.needsWorkFilters.map((f) => ({ ...f })),
|
||||
statusFilters: this.statusFilters.map((f) => ({ ...f }))
|
||||
@ -308,23 +307,23 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent<FileSta
|
||||
this.reloadProjects();
|
||||
}
|
||||
|
||||
public openEditProjectDialog($event: MouseEvent) {
|
||||
openEditProjectDialog($event: MouseEvent) {
|
||||
this._dialogService.openEditProjectDialog($event, this.activeProject);
|
||||
}
|
||||
|
||||
public openDeleteProjectDialog($event: MouseEvent) {
|
||||
openDeleteProjectDialog($event: MouseEvent) {
|
||||
this._dialogService.openDeleteProjectDialog($event, this.activeProject, () => {
|
||||
this._router.navigate(['/main/projects']);
|
||||
});
|
||||
}
|
||||
|
||||
public openAssignProjectMembersDialog(): void {
|
||||
openAssignProjectMembersDialog(): void {
|
||||
this._dialogService.openAssignProjectMembersAndOwnerDialog(null, this.activeProject, () => {
|
||||
this.reloadProjects();
|
||||
});
|
||||
}
|
||||
|
||||
public toggleCollapsedDetails() {
|
||||
toggleCollapsedDetails() {
|
||||
this.collapsedDetails = !this.collapsedDetails;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,21 +21,21 @@ export class AnnotationActionsService {
|
||||
private readonly _dialogService: ProjectsDialogService
|
||||
) {}
|
||||
|
||||
public acceptSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
acceptSuggestion($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
$event?.stopPropagation();
|
||||
annotations.forEach((annotation) => {
|
||||
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();
|
||||
annotations.forEach((annotation) => {
|
||||
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();
|
||||
this._dialogService.openForceRedactionDialog($event, (request) => {
|
||||
annotations.forEach((annotation) => {
|
||||
@ -48,7 +48,7 @@ export class AnnotationActionsService {
|
||||
});
|
||||
}
|
||||
|
||||
public suggestRemoveAnnotation(
|
||||
suggestRemoveAnnotation(
|
||||
$event: MouseEvent,
|
||||
annotations: AnnotationWrapper[],
|
||||
removeFromDictionary: boolean,
|
||||
@ -65,7 +65,7 @@ export class AnnotationActionsService {
|
||||
});
|
||||
}
|
||||
|
||||
public markAsFalsePositive($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
markAsFalsePositive($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
annotations.forEach((annotation) => {
|
||||
const permissions = AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, annotation);
|
||||
const value = permissions.canMarkTextOnlyAsFalsePositive ? annotation.value : this._getFalsePositiveText(annotation);
|
||||
@ -74,7 +74,7 @@ export class AnnotationActionsService {
|
||||
});
|
||||
}
|
||||
|
||||
public undoDirectAction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
undoDirectAction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
$event?.stopPropagation();
|
||||
|
||||
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();
|
||||
|
||||
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 annotationPermissions = annotations.map((a) => {
|
||||
return {
|
||||
annotation: a,
|
||||
permissions: AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, a)
|
||||
};
|
||||
});
|
||||
const annotationPermissions = annotations.map((a) => ({
|
||||
annotation: a,
|
||||
permissions: AnnotationPermissions.forUser(this._permissionsService.isManagerAndOwner(), this._permissionsService.currentUser, a)
|
||||
}));
|
||||
|
||||
const canForceRedaction = annotationPermissions.reduce((acc, next) => acc && next.permissions.canForceRedaction, true);
|
||||
if (canForceRedaction) {
|
||||
|
||||
@ -14,7 +14,7 @@ export class AnnotationDrawService {
|
||||
private readonly _userPreferenceService: UserPreferenceService
|
||||
) {}
|
||||
|
||||
public drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[], hideSkipped: boolean = false) {
|
||||
drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[], hideSkipped: boolean = false) {
|
||||
const annotations = [];
|
||||
annotationWrappers.forEach((annotation) => {
|
||||
annotations.push(this.computeAnnotation(activeViewer, annotation, hideSkipped));
|
||||
@ -33,7 +33,7 @@ export class AnnotationDrawService {
|
||||
}
|
||||
}
|
||||
|
||||
public drawSections(activeViewer: WebViewerInstance, sectionGrid: SectionGrid) {
|
||||
drawSections(activeViewer: WebViewerInstance, sectionGrid: SectionGrid) {
|
||||
const sections = [];
|
||||
for (const page of Object.keys(sectionGrid.rectanglesPerPage)) {
|
||||
const sectionRectangles: SectionRectangle[] = sectionGrid.rectanglesPerPage[page];
|
||||
@ -49,7 +49,7 @@ export class AnnotationDrawService {
|
||||
annotationManager.drawAnnotationsFromList(sections);
|
||||
}
|
||||
|
||||
public computeSection(activeViewer: WebViewerInstance, pageNumber: number, sectionRectangle: SectionRectangle) {
|
||||
computeSection(activeViewer: WebViewerInstance, pageNumber: number, sectionRectangle: SectionRectangle) {
|
||||
const rectangleAnnot = new activeViewer.Annotations.RectangleAnnotation();
|
||||
const pageHeight = activeViewer.docViewer.getPageHeight(pageNumber);
|
||||
const rectangle = {
|
||||
@ -70,7 +70,7 @@ export class AnnotationDrawService {
|
||||
return rectangleAnnot;
|
||||
}
|
||||
|
||||
public computeAnnotation(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper, hideSkipped: boolean = false) {
|
||||
computeAnnotation(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper, hideSkipped: boolean = false) {
|
||||
const pageNumber = annotationWrapper.pageNumber;
|
||||
const highlight = new activeViewer.Annotations.TextHighlightAnnotation();
|
||||
highlight.PageNumber = pageNumber;
|
||||
@ -133,7 +133,7 @@ export class AnnotationDrawService {
|
||||
return new activeViewer.CoreControls.Math.Quad(x1, y1, x2, y2, x3, y3, x4, y4);
|
||||
}
|
||||
|
||||
public annotationToQuads(annotation: Annotations.Annotation, activeViewer: WebViewerInstance, pageNumber: number) {
|
||||
annotationToQuads(annotation: Annotations.Annotation, activeViewer: WebViewerInstance) {
|
||||
const x1 = annotation.getRect().x1;
|
||||
const y1 = annotation.getRect().y1 + annotation.getRect().getHeight();
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ export class AnnotationProcessingService {
|
||||
flatFilters.push(...filter.filters);
|
||||
});
|
||||
|
||||
return !!filterBy ? flatFilters.filter((f) => filterBy(f)) : flatFilters;
|
||||
return filterBy ? flatFilters.filter((f) => filterBy(f)) : flatFilters;
|
||||
}
|
||||
|
||||
private _matchesOne = (filters: FilterModel[], condition: (filter: FilterModel) => boolean): boolean => {
|
||||
|
||||
@ -18,21 +18,21 @@ export class FileActionService {
|
||||
private readonly _appStateService: AppStateService
|
||||
) {}
|
||||
|
||||
public reanalyseFile(fileStatusWrapper?: FileStatusWrapper, priority = -1) {
|
||||
reanalyseFile(fileStatusWrapper?: FileStatusWrapper, priority = -1) {
|
||||
if (!fileStatusWrapper) {
|
||||
fileStatusWrapper = this._appStateService.activeFile;
|
||||
}
|
||||
return this._reanalysisControllerService.reanalyzeFile(this._appStateService.activeProject.project.projectId, fileStatusWrapper.fileId, priority);
|
||||
}
|
||||
|
||||
public toggleAnalysis(fileStatusWrapper?: FileStatusWrapper) {
|
||||
toggleAnalysis(fileStatusWrapper?: FileStatusWrapper) {
|
||||
if (!fileStatusWrapper) {
|
||||
fileStatusWrapper = this._appStateService.activeFile;
|
||||
}
|
||||
return this._reanalysisControllerService.toggleAnalysis(fileStatusWrapper.projectId, fileStatusWrapper.fileId, fileStatusWrapper.isExcluded);
|
||||
}
|
||||
|
||||
public async assignProjectReviewerFromOverview(file?: FileStatusWrapper, callback?: Function) {
|
||||
async assignProjectReviewerFromOverview(file?: FileStatusWrapper, callback?: Function) {
|
||||
if (this._permissionsService.isManagerAndOwner()) {
|
||||
this._openAssignReviewerDialog(file, callback);
|
||||
} else {
|
||||
@ -49,7 +49,7 @@ export class FileActionService {
|
||||
});
|
||||
}
|
||||
|
||||
public assignProjectReviewer(file?: FileStatus, callback?: Function, ignoreDialogChanges = false) {
|
||||
assignProjectReviewer(file?: FileStatus, callback?: Function, ignoreDialogChanges = false) {
|
||||
this._dialogService.openAssignFileReviewerDialog(
|
||||
file ? file : this._appStateService.activeFile,
|
||||
async () => {
|
||||
@ -62,7 +62,7 @@ export class FileActionService {
|
||||
);
|
||||
}
|
||||
|
||||
public async assignToMe(file?: FileStatus, callback?: Function) {
|
||||
async assignToMe(file?: FileStatus, callback?: Function) {
|
||||
if (!file.currentReviewer) {
|
||||
await this._assignReviewerToCurrentUser(file, callback);
|
||||
} else {
|
||||
|
||||
@ -66,7 +66,7 @@ export class ManualAnnotationService {
|
||||
// this wraps
|
||||
// /manualRedaction/redaction/force
|
||||
// /manualRedaction/request/force
|
||||
public forceRedaction(request: ForceRedactionRequest) {
|
||||
forceRedaction(request: ForceRedactionRequest) {
|
||||
if (this._permissionsService.isManagerAndOwner()) {
|
||||
return this._makeForceRedaction(request);
|
||||
} else {
|
||||
@ -76,7 +76,7 @@ export class ManualAnnotationService {
|
||||
|
||||
// this wraps
|
||||
// /manualRedaction/approve
|
||||
public approveRequest(annotationId: string, addToDictionary: boolean = false) {
|
||||
approveRequest(annotationId: string, addToDictionary: boolean = false) {
|
||||
// for only here - approve the request
|
||||
return this._manualRedactionControllerService
|
||||
.approveRequest(
|
||||
|
||||
@ -41,9 +41,7 @@ export class PdfViewerDataService {
|
||||
const viewedPagesObs = this.getViewedPagesForActiveFile();
|
||||
|
||||
return forkJoin([fileObs, reactionLogObs, redactionChangeLogObs, manualRedactionsObs, viewedPagesObs]).pipe(
|
||||
map((data) => {
|
||||
return new FileDataModel(this._appStateService.activeFile, ...data);
|
||||
})
|
||||
map((data) => new FileDataModel(this._appStateService.activeFile, ...data))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -5,9 +5,7 @@ import {
|
||||
FileManagementControllerService,
|
||||
FileStatus,
|
||||
ManualRedactionControllerService,
|
||||
RuleSetControllerService,
|
||||
RuleSetModel,
|
||||
TypeValue
|
||||
RuleSetControllerService
|
||||
} from '@redaction/red-ui-http';
|
||||
import { AddEditProjectDialogComponent } from '../dialogs/add-edit-project-dialog/add-edit-project-dialog.component';
|
||||
import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component';
|
||||
@ -44,7 +42,7 @@ export class ProjectsDialogService {
|
||||
private readonly _manualRedactionControllerService: ManualRedactionControllerService
|
||||
) {}
|
||||
|
||||
public openDeleteFilesDialog($event: MouseEvent, projectId: string, fileIds: string[], cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
|
||||
openDeleteFilesDialog($event: MouseEvent, projectId: string, fileIds: string[], cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
|
||||
const ref = this._dialog.open(ConfirmationDialogComponent, {
|
||||
@ -70,7 +68,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openManualAnnotationDialog($event: ManualRedactionEntryWrapper, cb?: Function): MatDialogRef<ManualAnnotationDialogComponent> {
|
||||
openManualAnnotationDialog($event: ManualRedactionEntryWrapper, cb?: Function): MatDialogRef<ManualAnnotationDialogComponent> {
|
||||
const ref = this._dialog.open(ManualAnnotationDialogComponent, {
|
||||
...dialogConfig,
|
||||
autoFocus: true,
|
||||
@ -86,7 +84,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAcceptSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, callback?: Function): MatDialogRef<ConfirmationDialogComponent> {
|
||||
openAcceptSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, callback?: Function): MatDialogRef<ConfirmationDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
|
||||
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
|
||||
@ -103,7 +101,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openRejectSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, rejectCallback: () => void): MatDialogRef<ConfirmationDialogComponent> {
|
||||
openRejectSuggestionModal($event: MouseEvent, annotation: AnnotationWrapper, rejectCallback: () => void): MatDialogRef<ConfirmationDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
|
||||
const ref = this._dialog.open(ConfirmationDialogComponent, {
|
||||
@ -122,7 +120,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openEditProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<AddEditProjectDialogComponent> {
|
||||
openEditProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<AddEditProjectDialogComponent> {
|
||||
$event.stopPropagation();
|
||||
const ref = this._dialog.open(AddEditProjectDialogComponent, {
|
||||
...dialogConfig,
|
||||
@ -138,7 +136,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openForceRedactionDialog($event: MouseEvent, cb?: Function): MatDialogRef<ForceRedactionDialogComponent> {
|
||||
openForceRedactionDialog($event: MouseEvent, cb?: Function): MatDialogRef<ForceRedactionDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
const ref = this._dialog.open(ForceRedactionDialogComponent, {
|
||||
...dialogConfig
|
||||
@ -151,7 +149,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openRemoveFromDictionaryDialog(
|
||||
openRemoveFromDictionaryDialog(
|
||||
$event: MouseEvent,
|
||||
annotations: AnnotationWrapper[],
|
||||
removeFromDictionary: boolean,
|
||||
@ -170,7 +168,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
|
||||
openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<ConfirmationDialogComponent> {
|
||||
$event.stopPropagation();
|
||||
const ref = this._dialog.open(ConfirmationDialogComponent, {
|
||||
...dialogConfig,
|
||||
@ -189,7 +187,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAssignProjectMembersAndOwnerDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<AssignOwnerDialogComponent> {
|
||||
openAssignProjectMembersAndOwnerDialog($event: MouseEvent, project: ProjectWrapper, cb?: Function): MatDialogRef<AssignOwnerDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
const ref = this._dialog.open(AssignOwnerDialogComponent, {
|
||||
...dialogConfig,
|
||||
@ -203,7 +201,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAssignFileReviewerDialog(file: FileStatus, cb?: Function, ignoreDialogChanges = false): MatDialogRef<AssignOwnerDialogComponent> {
|
||||
openAssignFileReviewerDialog(file: FileStatus, cb?: Function, ignoreDialogChanges = false): MatDialogRef<AssignOwnerDialogComponent> {
|
||||
const ref = this._dialog.open(AssignOwnerDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: { type: 'file', files: [file], ignoreChanged: ignoreDialogChanges }
|
||||
@ -216,7 +214,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAssignFileToMeDialog(file: FileStatus, cb?: Function) {
|
||||
openAssignFileToMeDialog(file: FileStatus, cb?: Function) {
|
||||
const ref = this._dialog.open(ConfirmationDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: new ConfirmationDialogInput({
|
||||
@ -229,7 +227,7 @@ export class ProjectsDialogService {
|
||||
});
|
||||
}
|
||||
|
||||
public openBulkAssignFileReviewerDialog(fileIds: string[], cb?: Function): MatDialogRef<AssignOwnerDialogComponent> {
|
||||
openBulkAssignFileReviewerDialog(fileIds: string[], cb?: Function): MatDialogRef<AssignOwnerDialogComponent> {
|
||||
const projectId = this._appStateService.activeProject.project.projectId;
|
||||
const ref = this._dialog.open(AssignOwnerDialogComponent, {
|
||||
...dialogConfig,
|
||||
@ -246,7 +244,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openAddProjectDialog(cb?: Function): MatDialogRef<AddEditProjectDialogComponent> {
|
||||
openAddProjectDialog(cb?: Function): MatDialogRef<AddEditProjectDialogComponent> {
|
||||
const ref = this._dialog.open(AddEditProjectDialogComponent, {
|
||||
...dialogConfig,
|
||||
autoFocus: true
|
||||
@ -259,7 +257,7 @@ export class ProjectsDialogService {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public openDocumentInfoDialog(file: FileStatus, cb?: Function): MatDialogRef<DocumentInfoDialogComponent> {
|
||||
openDocumentInfoDialog(file: FileStatus, cb?: Function): MatDialogRef<DocumentInfoDialogComponent> {
|
||||
const ref = this._dialog.open(DocumentInfoDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: file,
|
||||
|
||||
@ -11,12 +11,12 @@ import { ScreenName, SortingOption, SortingService } from '../../../services/sor
|
||||
// Usage: overwrite necessary methods/members in your component
|
||||
|
||||
@Component({ template: '' })
|
||||
export class BaseListingComponent<T = any> {
|
||||
public allEntities: T[] = [];
|
||||
public filteredEntities: T[] = [];
|
||||
public displayedEntities: T[] = [];
|
||||
public selectedEntitiesIds: string[] = [];
|
||||
public searchForm: FormGroup;
|
||||
export abstract class BaseListingComponent<T = any> {
|
||||
allEntities: T[] = [];
|
||||
filteredEntities: T[] = [];
|
||||
displayedEntities: T[] = [];
|
||||
selectedEntitiesIds: string[] = [];
|
||||
searchForm: FormGroup;
|
||||
|
||||
protected readonly _formBuilder: FormBuilder;
|
||||
protected readonly _changeDetectorRef: ChangeDetectorRef;
|
||||
@ -24,55 +24,34 @@ export class BaseListingComponent<T = any> {
|
||||
|
||||
// ----
|
||||
// Overwrite in child class:
|
||||
protected readonly _searchKey: string;
|
||||
protected readonly _selectionKey: string;
|
||||
protected readonly _sortKey: ScreenName;
|
||||
protected abstract readonly _searchKey: string;
|
||||
protected abstract readonly _selectionKey: string;
|
||||
protected abstract readonly _sortKey: ScreenName;
|
||||
|
||||
protected get filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] {
|
||||
protected get _filters(): { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
protected preFilter() {
|
||||
protected _preFilter() {
|
||||
return;
|
||||
}
|
||||
|
||||
protected get filterComponents(): FilterComponent[] {
|
||||
protected get _filterComponents(): FilterComponent[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
protected _searchField(entity: T): string {
|
||||
return entity[this.searchKey];
|
||||
return entity[this._searchKey];
|
||||
}
|
||||
// ----
|
||||
|
||||
constructor(protected readonly _injector: Injector) {
|
||||
protected constructor(protected readonly _injector: Injector) {
|
||||
this._formBuilder = this._injector.get<FormBuilder>(FormBuilder);
|
||||
this._changeDetectorRef = this._injector.get<ChangeDetectorRef>(ChangeDetectorRef);
|
||||
this._sortingService = this._injector.get<SortingService>(SortingService);
|
||||
this._initSearch();
|
||||
}
|
||||
|
||||
private get searchKey(): string {
|
||||
if (!this._searchKey) {
|
||||
throw new Error('Not implemented.');
|
||||
}
|
||||
return this._searchKey;
|
||||
}
|
||||
|
||||
private get selectionKey(): string {
|
||||
if (!this._selectionKey) {
|
||||
throw new Error('Not implemented.');
|
||||
}
|
||||
return this._selectionKey;
|
||||
}
|
||||
|
||||
private get sortKey(): ScreenName {
|
||||
if (!this._sortKey) {
|
||||
throw new Error('Not implemented.');
|
||||
}
|
||||
return this._sortKey;
|
||||
}
|
||||
|
||||
// Search
|
||||
|
||||
private _initSearch() {
|
||||
@ -89,7 +68,7 @@ export class BaseListingComponent<T = any> {
|
||||
}
|
||||
|
||||
protected _executeSearchImmediately() {
|
||||
this.displayedEntities = (this.filters.length ? this.filteredEntities : this.allEntities).filter((entity) =>
|
||||
this.displayedEntities = (this._filters.length ? this.filteredEntities : this.allEntities).filter((entity) =>
|
||||
this._searchField(entity).toLowerCase().includes(this.searchForm.get('query').value.toLowerCase())
|
||||
);
|
||||
this._updateSelection();
|
||||
@ -97,13 +76,13 @@ export class BaseListingComponent<T = any> {
|
||||
|
||||
protected _updateSelection() {
|
||||
if (this._selectionKey) {
|
||||
this.selectedEntitiesIds = this.displayedEntities.map((entity) => entity[this.selectionKey]).filter((id) => this.selectedEntitiesIds.includes(id));
|
||||
this.selectedEntitiesIds = this.displayedEntities.map((entity) => entity[this._selectionKey]).filter((id) => this.selectedEntitiesIds.includes(id));
|
||||
}
|
||||
}
|
||||
|
||||
// Filter
|
||||
|
||||
public filtersChanged(filters?: { [key: string]: FilterModel[] }): void {
|
||||
filtersChanged(filters?: { [key: string]: FilterModel[] }): void {
|
||||
if (filters) {
|
||||
for (const key of Object.keys(filters)) {
|
||||
for (let idx = 0; idx < this[key].length; ++idx) {
|
||||
@ -115,23 +94,23 @@ export class BaseListingComponent<T = any> {
|
||||
}
|
||||
|
||||
protected _filterEntities() {
|
||||
this.preFilter();
|
||||
this.filteredEntities = getFilteredEntities(this.allEntities, this.filters);
|
||||
this._preFilter();
|
||||
this.filteredEntities = getFilteredEntities(this.allEntities, this._filters);
|
||||
this._executeSearch();
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
public resetFilters() {
|
||||
for (const filterComponent of this.filterComponents.filter((f) => !!f)) {
|
||||
resetFilters() {
|
||||
for (const filterComponent of this._filterComponents.filter((f) => !!f)) {
|
||||
filterComponent.deactivateAllFilters();
|
||||
}
|
||||
this.filtersChanged();
|
||||
this.searchForm.reset({ query: '' });
|
||||
}
|
||||
|
||||
public get hasActiveFilters() {
|
||||
get hasActiveFilters() {
|
||||
return (
|
||||
this.filterComponents.filter((f) => !!f).reduce((prev, component) => prev || component?.hasActiveFilters, false) ||
|
||||
this._filterComponents.filter((f) => !!f).reduce((prev, component) => prev || component?.hasActiveFilters, false) ||
|
||||
this.searchForm.get('query').value
|
||||
);
|
||||
}
|
||||
@ -140,41 +119,41 @@ export class BaseListingComponent<T = any> {
|
||||
|
||||
toggleEntitySelected($event: MouseEvent, entity: T) {
|
||||
$event.stopPropagation();
|
||||
const idx = this.selectedEntitiesIds.indexOf(entity[this.selectionKey]);
|
||||
const idx = this.selectedEntitiesIds.indexOf(entity[this._selectionKey]);
|
||||
if (idx === -1) {
|
||||
this.selectedEntitiesIds.push(entity[this.selectionKey]);
|
||||
this.selectedEntitiesIds.push(entity[this._selectionKey]);
|
||||
} else {
|
||||
this.selectedEntitiesIds.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public toggleSelectAll() {
|
||||
toggleSelectAll() {
|
||||
if (this.areSomeEntitiesSelected) {
|
||||
this.selectedEntitiesIds = [];
|
||||
} else {
|
||||
this.selectedEntitiesIds = this.displayedEntities.map((entity) => entity[this.selectionKey]);
|
||||
this.selectedEntitiesIds = this.displayedEntities.map((entity) => entity[this._selectionKey]);
|
||||
}
|
||||
}
|
||||
|
||||
public get areAllEntitiesSelected() {
|
||||
get areAllEntitiesSelected() {
|
||||
return this.displayedEntities.length !== 0 && this.selectedEntitiesIds.length === this.displayedEntities.length;
|
||||
}
|
||||
|
||||
public get areSomeEntitiesSelected() {
|
||||
get areSomeEntitiesSelected() {
|
||||
return this.selectedEntitiesIds.length > 0;
|
||||
}
|
||||
|
||||
public isEntitySelected(entity: T) {
|
||||
return this.selectedEntitiesIds.indexOf(entity[this.selectionKey]) !== -1;
|
||||
isEntitySelected(entity: T) {
|
||||
return this.selectedEntitiesIds.indexOf(entity[this._selectionKey]) !== -1;
|
||||
}
|
||||
|
||||
// Sort
|
||||
|
||||
public get sortingOption(): SortingOption {
|
||||
return this._sortingService.getSortingOption(this.sortKey);
|
||||
get sortingOption(): SortingOption {
|
||||
return this._sortingService.getSortingOption(this._sortKey);
|
||||
}
|
||||
|
||||
public toggleSort($event) {
|
||||
this._sortingService.toggleSort(this.sortKey, $event);
|
||||
toggleSort($event) {
|
||||
this._sortingService.toggleSort(this._sortKey, $event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,19 +20,19 @@ export class AnnotationIconComponent implements OnInit {
|
||||
this.icon.nativeElement.style.setProperty('--color', this.backgroundColor);
|
||||
}
|
||||
|
||||
public get isHint() {
|
||||
get isHint() {
|
||||
return this.type === 'circle' || this.dictType?.type === 'hint';
|
||||
}
|
||||
|
||||
public get isRequest() {
|
||||
get isRequest() {
|
||||
return this.type === 'rhombus' || this.dictType?.type === 'redaction';
|
||||
}
|
||||
|
||||
public get isRecommendation() {
|
||||
get isRecommendation() {
|
||||
return this.type === 'hexagon' || this.dictType?.type === 'recommendation';
|
||||
}
|
||||
|
||||
public get backgroundColor() {
|
||||
get backgroundColor() {
|
||||
return this.color || this.dictType?.hexColor;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,12 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-chevron-button',
|
||||
templateUrl: './chevron-button.component.html',
|
||||
styleUrls: ['./chevron-button.component.scss']
|
||||
})
|
||||
export class ChevronButtonComponent implements OnInit {
|
||||
export class ChevronButtonComponent {
|
||||
@Input() text: string;
|
||||
@Input() showDot = false;
|
||||
@Input() primary = false;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
|
||||
@Component({
|
||||
@ -6,7 +6,7 @@ import { MatTooltip } from '@angular/material/tooltip';
|
||||
templateUrl: './circle-button.component.html',
|
||||
styleUrls: ['./circle-button.component.scss']
|
||||
})
|
||||
export class CircleButtonComponent implements OnInit {
|
||||
export class CircleButtonComponent {
|
||||
@Input() icon: string;
|
||||
@Input() tooltip: string;
|
||||
@Input() showDot = false;
|
||||
@ -20,10 +20,6 @@ export class CircleButtonComponent implements OnInit {
|
||||
|
||||
@ViewChild(MatTooltip) matTooltip: MatTooltip;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
performAction($event: any) {
|
||||
if (!this.disabled) {
|
||||
if (this.removeTooltip) {
|
||||
|
||||
@ -1,19 +1,15 @@
|
||||
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
|
||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-icon-button',
|
||||
templateUrl: './icon-button.component.html',
|
||||
styleUrls: ['./icon-button.component.scss']
|
||||
})
|
||||
export class IconButtonComponent implements OnInit {
|
||||
export class IconButtonComponent {
|
||||
@Input() icon: string;
|
||||
@Input() text: string;
|
||||
@Input() showDot = false;
|
||||
@Input() disabled = false;
|
||||
@Input() type: 'default' | 'show-bg' | 'primary' = 'default';
|
||||
@Output() action = new EventEmitter<any>();
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { UserWrapper } from '../../../../../services/user.service';
|
||||
|
||||
@Component({
|
||||
@ -6,11 +6,7 @@ import { UserWrapper } from '../../../../../services/user.service';
|
||||
templateUrl: './user-button.component.html',
|
||||
styleUrls: ['./user-button.component.scss']
|
||||
})
|
||||
export class UserButtonComponent implements OnInit {
|
||||
export class UserButtonComponent {
|
||||
@Input() user: UserWrapper;
|
||||
@Input() showDot = false;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, ElementRef, HostBinding, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
|
||||
import { Component, ElementRef, HostBinding, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-round-checkbox',
|
||||
@ -23,7 +23,7 @@ export class RoundCheckboxComponent implements OnInit, OnChanges {
|
||||
this._wrapper.nativeElement.style.setProperty('--size', this.size + 'px');
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
ngOnChanges(): void {
|
||||
this._activeClass = this.active && !this.indeterminate;
|
||||
this._inactiveClass = !this.active && !this.indeterminate;
|
||||
this._indeterminateClass = this.indeterminate;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, TemplateRef } from '@angular/core';
|
||||
import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, Output, TemplateRef } from '@angular/core';
|
||||
import { FilterModel } from './model/filter.model';
|
||||
import { handleCheckedValue } from './utils/filter-utils';
|
||||
import { MAT_CHECKBOX_DEFAULT_OPTIONS } from '@angular/material/checkbox';
|
||||
@ -35,7 +35,7 @@ export class FilterComponent implements OnChanges {
|
||||
|
||||
constructor(private readonly _changeDetectorRef: ChangeDetectorRef) {}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
ngOnChanges(): void {
|
||||
this.atLeastOneFilterIsExpandable = false;
|
||||
this.atLeastOneSecondaryFilterIsExpandable = false;
|
||||
this.primaryFilters?.forEach((f) => {
|
||||
|
||||
@ -144,13 +144,9 @@ export const annotationFilterChecker = (input: FileStatusWrapper | ProjectWrappe
|
||||
|
||||
export const projectStatusChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.hasStatus(filter.key);
|
||||
|
||||
export const projectMemberChecker = (pw: ProjectWrapper, filter: FilterModel) => {
|
||||
return pw.hasMember(filter.key);
|
||||
};
|
||||
export const projectMemberChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.hasMember(filter.key);
|
||||
|
||||
export const ruleSetChecker = (pw: ProjectWrapper, filter: FilterModel) => {
|
||||
return pw.ruleSetId === filter.key;
|
||||
};
|
||||
export const ruleSetChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.ruleSetId === filter.key;
|
||||
|
||||
export const dueDateChecker = (pw: ProjectWrapper, filter: FilterModel) => pw.dueDateMatches(filter.key);
|
||||
|
||||
|
||||
@ -9,17 +9,19 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
styleUrls: ['./initials-avatar.component.scss']
|
||||
})
|
||||
export class InitialsAvatarComponent implements OnChanges {
|
||||
@Input() public userId: string;
|
||||
@Input() public user: User;
|
||||
@Input() public color = 'lightgray';
|
||||
@Input() public size: 'small' | 'large' = 'small';
|
||||
@Input() public withName = false;
|
||||
@Input() public showYou = false;
|
||||
@Input() public tooltipPosition: 'below' | 'above' = 'above';
|
||||
@Input() userId: string;
|
||||
@Input() user: User;
|
||||
@Input() color = 'lightgray';
|
||||
@Input() size: 'small' | 'large' = 'small';
|
||||
@Input() withName = false;
|
||||
@Input() showYou = false;
|
||||
@Input() tooltipPosition: 'below' | 'above' = 'above';
|
||||
|
||||
public displayName: string;
|
||||
public initials: string;
|
||||
public colorClass: string;
|
||||
displayName: string;
|
||||
|
||||
initials: string;
|
||||
|
||||
colorClass: string;
|
||||
|
||||
constructor(private readonly _userService: UserService, private readonly _translateService: TranslateService) {}
|
||||
|
||||
@ -71,11 +73,11 @@ export class InitialsAvatarComponent implements OnChanges {
|
||||
return this.user && this._userService.userId === this.user.userId;
|
||||
}
|
||||
|
||||
public get hasBorder(): boolean {
|
||||
return !!this.user && !this._isCurrentUser && this._userService.isManager(this.user);
|
||||
get hasBorder(): boolean {
|
||||
return !!this.user && this._userService.userId !== this.userId && this._userService.isManager(this.user);
|
||||
}
|
||||
|
||||
public get disabled(): boolean {
|
||||
get disabled(): boolean {
|
||||
return !this._userService.isActive(this.user);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
|
||||
const DISPLAYED_ITEMS = 5;
|
||||
|
||||
@ -7,34 +7,30 @@ const DISPLAYED_ITEMS = 5;
|
||||
templateUrl: './pagination.component.html',
|
||||
styleUrls: ['./pagination.component.scss']
|
||||
})
|
||||
export class PaginationComponent implements OnInit {
|
||||
export class PaginationComponent {
|
||||
private _currentPage: number;
|
||||
private _totalPages: number;
|
||||
|
||||
public displayedPages: (number | string)[];
|
||||
displayedPages: (number | string)[];
|
||||
|
||||
@Input()
|
||||
public set settings(value: { currentPage: number; totalPages: number }) {
|
||||
set settings(value: { currentPage: number; totalPages: number }) {
|
||||
this._currentPage = value.currentPage;
|
||||
this._totalPages = value.totalPages;
|
||||
this._updatePagesArray();
|
||||
}
|
||||
|
||||
public get currentPage() {
|
||||
get currentPage() {
|
||||
return this._currentPage;
|
||||
}
|
||||
|
||||
public get totalPages() {
|
||||
get totalPages() {
|
||||
return this._totalPages;
|
||||
}
|
||||
|
||||
@Output() pageChanged = new EventEmitter<number>();
|
||||
|
||||
public displayed;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
displayed;
|
||||
|
||||
private _updatePagesArray() {
|
||||
this.displayedPages = [0];
|
||||
@ -52,17 +48,17 @@ export class PaginationComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public get allDisplayed(): boolean {
|
||||
get allDisplayed(): boolean {
|
||||
return this.totalPages > DISPLAYED_ITEMS;
|
||||
}
|
||||
|
||||
public selectPage(page: number | string) {
|
||||
selectPage(page: number | string) {
|
||||
if (page !== '...') {
|
||||
this.pageChanged.emit(page as number);
|
||||
}
|
||||
}
|
||||
|
||||
public displayValue(page: number | string) {
|
||||
displayValue(page: number | string) {
|
||||
return page === '...' ? page : (page as number) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
@ -6,24 +6,20 @@ import { FormGroup } from '@angular/forms';
|
||||
templateUrl: './search-input.component.html',
|
||||
styleUrls: ['./search-input.component.scss']
|
||||
})
|
||||
export class SearchInputComponent implements OnInit {
|
||||
export class SearchInputComponent {
|
||||
@Input() form: FormGroup;
|
||||
@Input() placeholder: string;
|
||||
@Input() width: number | 'full' = 250;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public get hasContent() {
|
||||
get hasContent() {
|
||||
return !!this.form.get('query').value.length;
|
||||
}
|
||||
|
||||
public clearContent() {
|
||||
clearContent() {
|
||||
this.form.patchValue({ query: '' });
|
||||
}
|
||||
|
||||
public get computedWidth() {
|
||||
get computedWidth() {
|
||||
return this.width === 'full' ? '100%' : `${this.width}px`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor {
|
||||
this._onChange = fn;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
registerOnTouched(fn: any): void {}
|
||||
|
||||
writeValue(value: string[]): void {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { Color } from '../../../../utils/types';
|
||||
import { FilterModel } from '../filter/model/filter.model';
|
||||
|
||||
@ -25,18 +25,18 @@ export class SimpleDoughnutChartComponent implements OnChanges {
|
||||
@Input() totalType: 'sum' | 'count' = 'sum';
|
||||
@Input() counterText: string;
|
||||
@Output()
|
||||
public toggleFilter = new EventEmitter<string>();
|
||||
toggleFilter = new EventEmitter<string>();
|
||||
|
||||
public chartData: any[] = [];
|
||||
public perimeter: number;
|
||||
public cx = 0;
|
||||
public cy = 0;
|
||||
public size = 0;
|
||||
public parsedConfig: { color: Color; active?: boolean; checked: boolean; label: string; value: number; key?: string }[];
|
||||
chartData: any[] = [];
|
||||
perimeter: number;
|
||||
cx = 0;
|
||||
cy = 0;
|
||||
size = 0;
|
||||
parsedConfig: { color: Color; active?: boolean; checked: boolean; label: string; value: number; key?: string }[];
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
ngOnChanges(): void {
|
||||
this.calculateChartData();
|
||||
this.cx = this.radius + this.strokeWidth / 2;
|
||||
this.cy = this.radius + this.strokeWidth / 2;
|
||||
@ -89,7 +89,7 @@ export class SimpleDoughnutChartComponent implements OnChanges {
|
||||
return `rotate(${this.chartData[index].degrees}, ${this.cx}, ${this.cy})`;
|
||||
}
|
||||
|
||||
public getLabel(config: DoughnutChartConfig): string {
|
||||
getLabel(config: DoughnutChartConfig): string {
|
||||
return this.totalType === 'sum' ? `${config.value} ${config.label}` : `${config.label} (${config.value} ${this.counterText})`;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
||||
import { Color } from '../../../../utils/types';
|
||||
|
||||
@Component({
|
||||
@ -9,7 +9,7 @@ import { Color } from '../../../../utils/types';
|
||||
})
|
||||
export class StatusBarComponent {
|
||||
@Input()
|
||||
public config: {
|
||||
config: {
|
||||
length: number;
|
||||
color: Color;
|
||||
label?: string;
|
||||
@ -17,7 +17,7 @@ export class StatusBarComponent {
|
||||
}[] = [];
|
||||
|
||||
@Input()
|
||||
public small = false;
|
||||
small = false;
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { SortingOption } from '../../../../services/sorting.service';
|
||||
|
||||
@Component({
|
||||
@ -6,19 +6,15 @@ import { SortingOption } from '../../../../services/sorting.service';
|
||||
templateUrl: './table-col-name.component.html',
|
||||
styleUrls: ['./table-col-name.component.scss']
|
||||
})
|
||||
export class TableColNameComponent implements OnInit {
|
||||
@Input() public activeSortingOption: SortingOption;
|
||||
@Input() public column: string;
|
||||
@Input() public label: string;
|
||||
@Input() public withSort = false;
|
||||
@Input() public class: string;
|
||||
@Input() public leftIcon: string;
|
||||
@Input() public rightIcon: string;
|
||||
@Input() public rightIconTooltip: string;
|
||||
export class TableColNameComponent {
|
||||
@Input() activeSortingOption: SortingOption;
|
||||
@Input() column: string;
|
||||
@Input() label: string;
|
||||
@Input() withSort = false;
|
||||
@Input() class: string;
|
||||
@Input() leftIcon: string;
|
||||
@Input() rightIcon: string;
|
||||
@Input() rightIconTooltip: string;
|
||||
|
||||
@Output() public toggleSort = new EventEmitter<string>();
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
@Output() toggleSort = new EventEmitter<string>();
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
export class ConfirmationDialogInput {
|
||||
public title?: string;
|
||||
public question?: string;
|
||||
public confirmationText?: string;
|
||||
public denyText?: string;
|
||||
public translateParams?: {};
|
||||
title?: string;
|
||||
question?: string;
|
||||
confirmationText?: string;
|
||||
denyText?: string;
|
||||
translateParams?: Record<string, unknown>;
|
||||
|
||||
constructor(options: ConfirmationDialogInput) {
|
||||
this.title = options.title || ConfirmationDialogInput.default().title;
|
||||
@ -33,7 +33,7 @@ export class ConfirmationDialogInput {
|
||||
templateUrl: './confirmation-dialog.component.html',
|
||||
styleUrls: ['./confirmation-dialog.component.scss']
|
||||
})
|
||||
export class ConfirmationDialogComponent implements OnInit {
|
||||
export class ConfirmationDialogComponent {
|
||||
constructor(
|
||||
private readonly _translateService: TranslateService,
|
||||
public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
|
||||
@ -44,8 +44,6 @@ export class ConfirmationDialogComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
deny() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { AfterContentChecked, Directive, ElementRef, HostBinding } from '@angula
|
||||
exportAs: 'redactionHasScrollbar'
|
||||
})
|
||||
export class HasScrollbarDirective implements AfterContentChecked {
|
||||
constructor(private el: ElementRef) {}
|
||||
constructor(private readonly _elementRef: ElementRef) {}
|
||||
|
||||
@HostBinding('class') class = '';
|
||||
|
||||
@ -20,7 +20,7 @@ export class HasScrollbarDirective implements AfterContentChecked {
|
||||
}
|
||||
}
|
||||
|
||||
public get hasScrollbar() {
|
||||
return this.el?.nativeElement.clientHeight < this.el?.nativeElement.scrollHeight;
|
||||
get hasScrollbar() {
|
||||
return this._elementRef?.nativeElement.clientHeight < this._elementRef?.nativeElement.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ export class SyncWidthDirective implements AfterViewInit, OnDestroy {
|
||||
redactionSyncWidth: string;
|
||||
private _interval: number;
|
||||
|
||||
constructor(private el: ElementRef) {}
|
||||
constructor(private readonly _elementRef: ElementRef) {}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this._interval = setInterval(() => {
|
||||
@ -24,14 +24,14 @@ export class SyncWidthDirective implements AfterViewInit, OnDestroy {
|
||||
|
||||
@debounce(10)
|
||||
matchWidth() {
|
||||
const headerItems = this.el.nativeElement.children;
|
||||
const tableRows = this.el.nativeElement.parentElement.getElementsByClassName(this.redactionSyncWidth);
|
||||
const headerItems = this._elementRef.nativeElement.children;
|
||||
const tableRows = this._elementRef.nativeElement.parentElement.getElementsByClassName(this.redactionSyncWidth);
|
||||
|
||||
if (!tableRows || !tableRows.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.el.nativeElement.setAttribute('synced', true);
|
||||
this._elementRef.nativeElement.setAttribute('synced', true);
|
||||
|
||||
const { tableRow, length } = this._sampleRow(tableRows);
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@ -7,8 +7,8 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
templateUrl: './overwrite-files-dialog.component.html',
|
||||
styleUrls: ['./overwrite-files-dialog.component.scss']
|
||||
})
|
||||
export class OverwriteFilesDialogComponent implements OnInit {
|
||||
public remember = false;
|
||||
export class OverwriteFilesDialogComponent {
|
||||
remember = false;
|
||||
|
||||
constructor(
|
||||
private readonly _translateService: TranslateService,
|
||||
@ -16,8 +16,6 @@ export class OverwriteFilesDialogComponent implements OnInit {
|
||||
@Inject(MAT_DIALOG_DATA) public filename: string
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
cancel() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectorRef, Component, HostListener, OnInit } from '@angular/core';
|
||||
import { ChangeDetectorRef, Component, HostListener } from '@angular/core';
|
||||
import { FileUploadService } from '../services/file-upload.service';
|
||||
import { FileUploadModel } from '../model/file-upload.model';
|
||||
import { OverlayRef } from '@angular/cdk/overlay';
|
||||
@ -11,7 +11,7 @@ import { AppStateService } from '../../../state/app-state.service';
|
||||
templateUrl: './file-drop.component.html',
|
||||
styleUrls: ['./file-drop.component.scss']
|
||||
})
|
||||
export class FileDropComponent implements OnInit {
|
||||
export class FileDropComponent {
|
||||
constructor(
|
||||
private readonly _dialogRef: OverlayRef,
|
||||
private readonly _fileUploadService: FileUploadService,
|
||||
@ -20,8 +20,6 @@ export class FileDropComponent implements OnInit {
|
||||
private readonly _statusOverlayService: StatusOverlayService
|
||||
) {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
close() {
|
||||
setTimeout(() => {
|
||||
this._dialogRef.detach();
|
||||
|
||||
@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FileDropComponent } from './file-drop/file-drop.component';
|
||||
import { OverlayModule } from '@angular/cdk/overlay';
|
||||
import { UploadStatusOverlay } from './upload-status-overlay/upload-status-overlay.component';
|
||||
import { UploadStatusOverlayComponent } from './upload-status-overlay/upload-status-overlay.component';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { UploadDownloadDialogService } from './services/upload-download-dialog.service';
|
||||
import { OverwriteFilesDialogComponent } from './dialogs/overwrite-files-dialog/overwrite-files-dialog.component';
|
||||
@ -13,9 +13,9 @@ import { FileDropOverlayService } from './services/file-drop-overlay.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, SharedModule, OverlayModule],
|
||||
declarations: [FileDropComponent, UploadStatusOverlay, OverwriteFilesDialogComponent],
|
||||
entryComponents: [FileDropComponent, UploadStatusOverlay],
|
||||
declarations: [FileDropComponent, UploadStatusOverlayComponent, OverwriteFilesDialogComponent],
|
||||
entryComponents: [FileDropComponent, UploadStatusOverlayComponent],
|
||||
providers: [UploadDownloadDialogService, FileUploadService, FileDownloadService, StatusOverlayService, FileDropOverlayService],
|
||||
exports: [FileDropComponent, UploadStatusOverlay]
|
||||
exports: [FileDropComponent, UploadStatusOverlayComponent]
|
||||
})
|
||||
export class FileUploadDownloadModule {}
|
||||
|
||||
@ -13,9 +13,9 @@ import { KeycloakService } from 'keycloak-angular';
|
||||
|
||||
@Injectable()
|
||||
export class FileDownloadService {
|
||||
public downloads: DownloadStatusWrapper[] = [];
|
||||
downloads: DownloadStatusWrapper[] = [];
|
||||
|
||||
public hasPendingDownloads;
|
||||
hasPendingDownloads;
|
||||
|
||||
constructor(
|
||||
private readonly _applicationRef: ApplicationRef,
|
||||
@ -27,7 +27,7 @@ export class FileDownloadService {
|
||||
private readonly _keycloakService: KeycloakService,
|
||||
private readonly _fileManagementControllerService: FileManagementControllerService
|
||||
) {
|
||||
interval(5000).subscribe((val) => {
|
||||
interval(5000).subscribe(() => {
|
||||
if (_permissionsService.isUser()) {
|
||||
this.getDownloadStatus().subscribe(() => {});
|
||||
}
|
||||
@ -42,14 +42,10 @@ export class FileDownloadService {
|
||||
reportTypes: ['WORD_SINGLE_FILE_EFSA_TEMPLATE', 'WORD_SINGLE_FILE_SYNGENTA_TEMPLATE', 'EXCEL_MULTI_FILE'],
|
||||
downloadFileTypes: ['PREVIEW', 'REDACTED']
|
||||
})
|
||||
.pipe(
|
||||
mergeMap(() => {
|
||||
return this.getDownloadStatus();
|
||||
})
|
||||
);
|
||||
.pipe(mergeMap(() => this.getDownloadStatus()));
|
||||
}
|
||||
|
||||
public getDownloadStatus() {
|
||||
getDownloadStatus() {
|
||||
return this._downloadControllerService.getDownloadStatus().pipe(
|
||||
tap((statusResponse) => {
|
||||
this.downloads = statusResponse.downloadStatus.map((d) => new DownloadStatusWrapper(d));
|
||||
@ -58,7 +54,7 @@ export class FileDownloadService {
|
||||
);
|
||||
}
|
||||
|
||||
public async performDownload(status: DownloadStatusWrapper) {
|
||||
async performDownload(status: DownloadStatusWrapper) {
|
||||
const token = await this._keycloakService.getToken();
|
||||
const anchor = document.createElement('a');
|
||||
anchor.href =
|
||||
|
||||
@ -8,8 +8,8 @@ export class FileDropOverlayService {
|
||||
private _mouseIn = false;
|
||||
private readonly _dropOverlayRef: OverlayRef;
|
||||
|
||||
constructor(private overlay: Overlay, private readonly _injector: Injector) {
|
||||
this._dropOverlayRef = this.overlay.create({
|
||||
constructor(private readonly _overlay: Overlay, private readonly _injector: Injector) {
|
||||
this._dropOverlayRef = this._overlay.create({
|
||||
height: '100vh',
|
||||
width: '100vw'
|
||||
});
|
||||
|
||||
@ -32,7 +32,7 @@ export class FileUploadService {
|
||||
private readonly _fileManagementControllerService: FileManagementControllerService,
|
||||
private readonly _dialogService: UploadDownloadDialogService
|
||||
) {
|
||||
interval(2500).subscribe((val) => {
|
||||
interval(2500).subscribe(() => {
|
||||
this._handleUploads();
|
||||
});
|
||||
}
|
||||
@ -54,7 +54,7 @@ export class FileUploadService {
|
||||
for (let idx = 0; idx < files.length; ++idx) {
|
||||
const file = files[idx];
|
||||
let currentOption = option;
|
||||
if (!!projectFiles.find((pf) => pf.filename === file.file.name)) {
|
||||
if (projectFiles.find((pf) => pf.filename === file.file.name)) {
|
||||
if (!option) {
|
||||
const res = await this._dialogService.openOverwriteFileDialog(file.file.name);
|
||||
if (res.cancel) {
|
||||
@ -91,7 +91,7 @@ export class FileUploadService {
|
||||
this.groupedFiles[file.projectId].push(file);
|
||||
}
|
||||
|
||||
public filterFiles() {
|
||||
filterFiles() {
|
||||
for (const file of this.files) {
|
||||
if (file.completed && !file.error) {
|
||||
this.removeFile(file);
|
||||
@ -104,7 +104,7 @@ export class FileUploadService {
|
||||
this.groupedFiles[file.projectId].splice(index, 1);
|
||||
}
|
||||
|
||||
public get activeProjectKeys() {
|
||||
get activeProjectKeys() {
|
||||
return Object.keys(this.groupedFiles).filter((projectId) => this.groupedFiles[projectId].length > 0);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user