remove arrow parens and arrange code

This commit is contained in:
Dan Percic 2021-06-01 16:50:10 +03:00
parent a4042f2c32
commit 5cf7ccb81c
173 changed files with 1656 additions and 882 deletions

View File

@ -135,6 +135,7 @@
"@typescript-eslint/prefer-function-type": "error", "@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/unified-signatures": "error", "@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "error", "arrow-body-style": "error",
"arrow-parens": ["error", "as-needed"],
"constructor-super": "error", "constructor-super": "error",
"eqeqeq": ["error", "smart"], "eqeqeq": ["error", "smart"],
"guard-for-in": "error", "guard-for-in": "error",

View File

@ -4,6 +4,7 @@
"tabWidth": 4, "tabWidth": 4,
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"arrowParens": "avoid",
"overrides": [ "overrides": [
{ {
"files": "{apps}/**/*.html", "files": "{apps}/**/*.html",

View File

@ -38,13 +38,12 @@ const routes = [
{ {
path: 'main/admin', path: 'main/admin',
component: BaseScreenComponent, component: BaseScreenComponent,
loadChildren: () => import('./modules/admin/admin.module').then((m) => m.AdminModule) loadChildren: () => import('./modules/admin/admin.module').then(m => m.AdminModule)
}, },
{ {
path: 'main/dossiers', path: 'main/dossiers',
component: BaseScreenComponent, component: BaseScreenComponent,
loadChildren: () => loadChildren: () => import('./modules/dossier/dossiers.module').then(m => m.DossiersModule)
import('./modules/dossier/dossiers.module').then((m) => m.DossiersModule)
}, },
{ {
path: 'main/downloads', path: 'main/downloads',

View File

@ -115,7 +115,7 @@ export class AppModule {
} }
private _configureKeyCloakRouteHandling() { private _configureKeyCloakRouteHandling() {
this._route.queryParamMap.subscribe((queryParams) => { this._route.queryParamMap.subscribe(queryParams => {
if ( if (
queryParams.has('code') || queryParams.has('code') ||
queryParams.has('state') || queryParams.has('state') ||

View File

@ -32,7 +32,7 @@ export class NotificationsComponent {
} }
get hasUnread() { get hasUnread() {
return this.notifications.filter((notification) => !notification.read).length > 0; return this.notifications.filter(notification => !notification.read).length > 0;
} }
day(group: { dateString: string; notifications: Notification[] }): string { day(group: { dateString: string; notifications: Notification[] }): string {

View File

@ -40,13 +40,13 @@ export class FileDataModel {
areDevFeaturesEnabled: boolean areDevFeaturesEnabled: boolean
): AnnotationData { ): AnnotationData {
const entries: RedactionLogEntryWrapper[] = this._convertData(dictionaryData); const entries: RedactionLogEntryWrapper[] = this._convertData(dictionaryData);
let allAnnotations = entries.map((entry) => AnnotationWrapper.fromData(entry)); let allAnnotations = entries.map(entry => AnnotationWrapper.fromData(entry));
if (!areDevFeaturesEnabled) { if (!areDevFeaturesEnabled) {
allAnnotations = allAnnotations.filter((annotation) => !annotation.isFalsePositive); allAnnotations = allAnnotations.filter(annotation => !annotation.isFalsePositive);
} }
const visibleAnnotations = allAnnotations.filter((annotation) => { const visibleAnnotations = allAnnotations.filter(annotation => {
if (viewMode === 'STANDARD') { if (viewMode === 'STANDARD') {
return !annotation.isChangeLogRemoved; return !annotation.isChangeLogRemoved;
} else if (viewMode === 'DELTA') { } else if (viewMode === 'DELTA') {
@ -67,11 +67,11 @@ export class FileDataModel {
}): RedactionLogEntryWrapper[] { }): RedactionLogEntryWrapper[] {
let result: RedactionLogEntryWrapper[] = []; let result: RedactionLogEntryWrapper[] = [];
this.redactionChangeLog?.redactionLogEntry?.forEach((changeLogEntry) => { this.redactionChangeLog?.redactionLogEntry?.forEach(changeLogEntry => {
if (changeLogEntry.changeType === 'REMOVED') { if (changeLogEntry.changeType === 'REMOVED') {
// Fix backend issue where some annotations are both added and removed // Fix backend issue where some annotations are both added and removed
const sameEntryExistsAsAdd = !!this.redactionChangeLog.redactionLogEntry.find( const sameEntryExistsAsAdd = !!this.redactionChangeLog.redactionLogEntry.find(
(rle) => rle.id === changeLogEntry.id && rle.changeType === 'ADDED' rle => rle.id === changeLogEntry.id && rle.changeType === 'ADDED'
); );
if (sameEntryExistsAsAdd) { if (sameEntryExistsAsAdd) {
return; return;
@ -92,14 +92,14 @@ export class FileDataModel {
} }
}); });
this.redactionLog.redactionLogEntry?.forEach((redactionLogEntry) => { this.redactionLog.redactionLogEntry?.forEach(redactionLogEntry => {
// false positive entries from the redaction-log need to be skipped // false positive entries from the redaction-log need to be skipped
if (redactionLogEntry.type?.toLowerCase() === 'false_positive') { if (redactionLogEntry.type?.toLowerCase() === 'false_positive') {
return; return;
} }
const existingChangeLogEntry = this.redactionChangeLog?.redactionLogEntry?.find( const existingChangeLogEntry = this.redactionChangeLog?.redactionLogEntry?.find(
(rle) => rle.id === redactionLogEntry.id rle => rle.id === redactionLogEntry.id
); );
// copy the redactionLog Entry // copy the redactionLog Entry
@ -114,8 +114,8 @@ export class FileDataModel {
result.push(redactionLogEntryWrapper); result.push(redactionLogEntryWrapper);
}); });
this.manualRedactions.forceRedactions?.forEach((forceRedaction) => { this.manualRedactions.forceRedactions?.forEach(forceRedaction => {
const relevantRedactionLogEntry = result.find((r) => r.id === forceRedaction.id); const relevantRedactionLogEntry = result.find(r => r.id === forceRedaction.id);
if (forceRedaction.status === 'DECLINED') { if (forceRedaction.status === 'DECLINED') {
relevantRedactionLogEntry.status = 'DECLINED'; relevantRedactionLogEntry.status = 'DECLINED';
@ -142,10 +142,10 @@ export class FileDataModel {
} }
}); });
this.manualRedactions.entriesToAdd?.forEach((manual) => { this.manualRedactions.entriesToAdd?.forEach(manual => {
const markedAsReasonRedactionLogEntry = result.find((r) => r.id === manual.reason); const markedAsReasonRedactionLogEntry = result.find(r => r.id === manual.reason);
const relevantRedactionLogEntry = result.find((r) => r.id === manual.id); const relevantRedactionLogEntry = result.find(r => r.id === manual.id);
// a redaction-log entry is marked as a reason for another entry - hide it // a redaction-log entry is marked as a reason for another entry - hide it
if (markedAsReasonRedactionLogEntry) { if (markedAsReasonRedactionLogEntry) {
@ -206,8 +206,8 @@ export class FileDataModel {
} }
}); });
this.manualRedactions.idsToRemove?.forEach((idToRemove) => { this.manualRedactions.idsToRemove?.forEach(idToRemove => {
const relevantRedactionLogEntry = result.find((r) => r.id === idToRemove.id); const relevantRedactionLogEntry = result.find(r => r.id === idToRemove.id);
if (!relevantRedactionLogEntry) { if (!relevantRedactionLogEntry) {
// idRemove for something that doesn't exist - skip // idRemove for something that doesn't exist - skip
@ -230,11 +230,11 @@ export class FileDataModel {
} }
}); });
result.forEach((redactionLogEntry) => { result.forEach(redactionLogEntry => {
if (redactionLogEntry.manual) { if (redactionLogEntry.manual) {
if (redactionLogEntry.manualRedactionType === 'ADD') { if (redactionLogEntry.manualRedactionType === 'ADD') {
const foundManualEntry = this.manualRedactions.entriesToAdd.find( const foundManualEntry = this.manualRedactions.entriesToAdd.find(
(me) => me.id === redactionLogEntry.id me => me.id === redactionLogEntry.id
); );
// ADD has been undone - not yet processed // ADD has been undone - not yet processed
if (!foundManualEntry) { if (!foundManualEntry) {
@ -243,7 +243,7 @@ export class FileDataModel {
} }
if (redactionLogEntry.manualRedactionType === 'REMOVE') { if (redactionLogEntry.manualRedactionType === 'REMOVE') {
const foundManualEntry = this.manualRedactions.idsToRemove.find( const foundManualEntry = this.manualRedactions.idsToRemove.find(
(me) => me.id === redactionLogEntry.id me => me.id === redactionLogEntry.id
); );
// REMOVE has been undone - not yet processed // REMOVE has been undone - not yet processed
if (!foundManualEntry) { if (!foundManualEntry) {
@ -256,7 +256,7 @@ export class FileDataModel {
}); });
// remove undone entriesToAdd and idsToRemove // remove undone entriesToAdd and idsToRemove
result = result.filter((redactionLogEntry) => !redactionLogEntry.hidden); result = result.filter(redactionLogEntry => !redactionLogEntry.hidden);
return result; return result;
} }

View File

@ -15,7 +15,7 @@ export class FileStatusWrapper {
if (fileAttributesConfig) { if (fileAttributesConfig) {
const primary = fileAttributesConfig.fileAttributeConfigs?.find( const primary = fileAttributesConfig.fileAttributeConfigs?.find(
(c) => c.primaryAttribute c => c.primaryAttribute
); );
if (primary && fileStatus.fileAttributes?.attributeIdToValue) { if (primary && fileStatus.fileAttributes?.attributeIdToValue) {
this.primaryAttribute = fileStatus.fileAttributes?.attributeIdToValue[primary.id]; this.primaryAttribute = fileStatus.fileAttributes?.attributeIdToValue[primary.id];

View File

@ -179,7 +179,7 @@ export class ComboChartComponent extends BaseChartComponent {
name: this.yAxisLabel, name: this.yAxisLabel,
series: this.results series: this.results
}); });
return this.combinedSeries.map((d) => d.name); return this.combinedSeries.map(d => d.name);
} }
isDate(value): boolean { isDate(value): boolean {
@ -228,7 +228,7 @@ export class ComboChartComponent extends BaseChartComponent {
const max = Math.max(...values); const max = Math.max(...values);
domain = [min, max]; domain = [min, max];
} else if (this.scaleType === 'linear') { } else if (this.scaleType === 'linear') {
values = values.map((v) => Number(v)); values = values.map(v => Number(v));
const min = Math.min(...values); const min = Math.min(...values);
const max = Math.max(...values); const max = Math.max(...values);
domain = [min, max]; domain = [min, max];
@ -317,11 +317,11 @@ export class ComboChartComponent extends BaseChartComponent {
} }
getXDomain(): any[] { getXDomain(): any[] {
return this.results.map((d) => d.name); return this.results.map(d => d.name);
} }
getYDomain() { getYDomain() {
const values = this.results.map((d) => d.value); const values = this.results.map(d => d.value);
const min = Math.min(0, ...values); const min = Math.min(0, ...values);
const max = Math.max(...values); const max = Math.max(...values);
if (this.yLeftAxisScaleFactor) { if (this.yLeftAxisScaleFactor) {
@ -388,7 +388,7 @@ export class ComboChartComponent extends BaseChartComponent {
onActivate(item) { onActivate(item) {
const idx = this.activeEntries.findIndex( const idx = this.activeEntries.findIndex(
(d) => d.name === item.name && d.value === item.value && d.series === item.series d => d.name === item.name && d.value === item.value && d.series === item.series
); );
if (idx > -1) { if (idx > -1) {
return; return;
@ -400,7 +400,7 @@ export class ComboChartComponent extends BaseChartComponent {
onDeactivate(item) { onDeactivate(item) {
const idx = this.activeEntries.findIndex( const idx = this.activeEntries.findIndex(
(d) => d.name === item.name && d.value === item.value && d.series === item.series d => d.name === item.name && d.value === item.value && d.series === item.series
); );
this.activeEntries.splice(idx, 1); this.activeEntries.splice(idx, 1);

View File

@ -89,7 +89,7 @@ export class ComboSeriesVerticalComponent implements OnChanges {
let d0 = 0; let d0 = 0;
let total; let total;
if (this.type === 'normalized') { if (this.type === 'normalized') {
total = this.series.map((d) => d.value).reduce((sum, d) => sum + d, 0); total = this.series.map(d => d.value).reduce((sum, d) => sum + d, 0);
} }
this.bars = this.series.map((d, index) => { this.bars = this.series.map((d, index) => {
@ -184,13 +184,13 @@ export class ComboSeriesVerticalComponent implements OnChanges {
} }
getSeriesTooltips(seriesLine, index) { getSeriesTooltips(seriesLine, index) {
return seriesLine.map((d) => d.series[index]); return seriesLine.map(d => d.series[index]);
} }
isActive(entry): boolean { isActive(entry): boolean {
if (!this.activeEntries) return false; if (!this.activeEntries) return false;
const item = this.activeEntries.find( const item = this.activeEntries.find(
(d) => entry.name === d.name && entry.series === d.series d => entry.name === d.name && entry.series === d.series
); );
return item !== undefined; return item !== undefined;
} }

View File

@ -32,7 +32,7 @@ export class DossierTemplateActionsComponent {
$event.stopPropagation(); $event.stopPropagation();
this._dialogService.openAddEditDossierTemplateDialog( this._dialogService.openAddEditDossierTemplateDialog(
this.dossierTemplate, this.dossierTemplate,
async (newDossierTemplate) => { async newDossierTemplate => {
if (newDossierTemplate && this.loadDossierTemplatesData) { if (newDossierTemplate && this.loadDossierTemplatesData) {
this.loadDossierTemplatesData.emit(); this.loadDossierTemplatesData.emit();
} }

View File

@ -82,7 +82,7 @@ export class AddEditDictionaryDialogComponent {
() => { () => {
this.dialogRef.close({ dictionary: this.dictionary ? null : typeValue }); this.dialogRef.close({ dictionary: this.dictionary ? null : typeValue });
}, },
(error) => { error => {
if (error.status === 409) { if (error.status === 409) {
this._notifyError('add-edit-dictionary.error.dictionary-already-exists'); this._notifyError('add-edit-dictionary.error.dictionary-already-exists');
} else if (error.status === 400) { } else if (error.status === 400) {

View File

@ -62,7 +62,7 @@ export class AddEditDossierTemplateDialogComponent {
this._previousValidFrom = this.dossierTemplateForm.get('validFrom').value; this._previousValidFrom = this.dossierTemplateForm.get('validFrom').value;
this._previousValidTo = this.dossierTemplateForm.get('validTo').value; this._previousValidTo = this.dossierTemplateForm.get('validTo').value;
this.dossierTemplateForm.valueChanges.subscribe((value) => { this.dossierTemplateForm.valueChanges.subscribe(value => {
this._applyValidityIntervalConstraints(value); this._applyValidityIntervalConstraints(value);
}); });
} }
@ -138,7 +138,7 @@ export class AddEditDossierTemplateDialogComponent {
} }
private _requiredIfValidator(predicate) { private _requiredIfValidator(predicate) {
return (formControl) => { return formControl => {
if (!formControl.parent) { if (!formControl.parent) {
return null; return null;
} }

View File

@ -87,7 +87,7 @@ export class AddEditUserDialogComponent {
private _setRolesRequirements() { private _setRolesRequirements() {
for (const key of Object.keys(this._ROLE_REQUIREMENTS)) { for (const key of Object.keys(this._ROLE_REQUIREMENTS)) {
this.userForm.controls[key].valueChanges.subscribe((checked) => { this.userForm.controls[key].valueChanges.subscribe(checked => {
if (checked) { if (checked) {
this.userForm.patchValue({ [this._ROLE_REQUIREMENTS[key]]: true }); this.userForm.patchValue({ [this._ROLE_REQUIREMENTS[key]]: true });
this.userForm.controls[this._ROLE_REQUIREMENTS[key]].disable(); this.userForm.controls[this._ROLE_REQUIREMENTS[key]].disable();

View File

@ -21,7 +21,7 @@ export class ConfirmDeleteUsersDialogComponent {
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
public dialogRef: MatDialogRef<ConfirmDeleteUsersDialogComponent> public dialogRef: MatDialogRef<ConfirmDeleteUsersDialogComponent>
) { ) {
this.dossiersCount = this._appStateService.allDossiers.filter((pw) => { this.dossiersCount = this._appStateService.allDossiers.filter(pw => {
for (const user of this.users) { for (const user of this.users) {
if (pw.memberIds.indexOf(user.userId) !== -1) { if (pw.memberIds.indexOf(user.userId) !== -1) {
return true; return true;

View File

@ -43,16 +43,16 @@ export class ActiveFieldsListingComponent extends BaseListingComponent<Field> im
deactivateSelection() { deactivateSelection() {
this.allEntities this.allEntities
.filter((field) => this.isEntitySelected(field)) .filter(field => this.isEntitySelected(field))
.forEach((field) => (field.primaryAttribute = false)); .forEach(field => (field.primaryAttribute = false));
this.allEntities = [...this.allEntities.filter((field) => !this.isEntitySelected(field))]; this.allEntities = [...this.allEntities.filter(field => !this.isEntitySelected(field))];
this.allEntitiesChange.emit(this.allEntities); this.allEntitiesChange.emit(this.allEntities);
this.selectedEntitiesIds = []; this.selectedEntitiesIds = [];
} }
setAttributeForSelection(attribute: string, value: any) { setAttributeForSelection(attribute: string, value: any) {
for (const csvColumn of this.selectedEntitiesIds) { for (const csvColumn of this.selectedEntitiesIds) {
this.allEntities.find((f) => f.csvColumn === csvColumn)[attribute] = value; this.allEntities.find(f => f.csvColumn === csvColumn)[attribute] = value;
} }
} }

View File

@ -87,7 +87,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
readFile() { readFile() {
const reader = new FileReader(); const reader = new FileReader();
reader.addEventListener('load', async (event) => { reader.addEventListener('load', async event => {
const parsedCsv = <any>event.target.result; const parsedCsv = <any>event.target.result;
this.parseResult = Papa.parse(parsedCsv, { this.parseResult = Papa.parse(parsedCsv, {
header: true, header: true,
@ -100,7 +100,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
this.parseResult.meta.fields = Object.keys(this.parseResult.data[0]); this.parseResult.meta.fields = Object.keys(this.parseResult.data[0]);
} }
this.allEntities = this.parseResult.meta.fields.map((field) => this.allEntities = this.parseResult.meta.fields.map(field =>
this._buildAttribute(field) this._buildAttribute(field)
); );
this.displayedEntities = [...this.allEntities]; this.displayedEntities = [...this.allEntities];
@ -108,7 +108,7 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
for (const entity of this.allEntities) { for (const entity of this.allEntities) {
const existing = this.data.existingConfiguration.fileAttributeConfigs.find( const existing = this.data.existingConfiguration.fileAttributeConfigs.find(
(a) => a.csvColumnHeader === entity.csvColumn a => a.csvColumnHeader === entity.csvColumn
); );
if (existing) { if (existing) {
entity.id = existing.id; entity.id = existing.id;
@ -130,18 +130,18 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
map((value: string) => map((value: string) =>
this.allEntities this.allEntities
.filter( .filter(
(field) => field =>
field.csvColumn.toLowerCase().indexOf(value.toLowerCase()) !== field.csvColumn.toLowerCase().indexOf(value.toLowerCase()) !==
-1 -1
) )
.map((field) => field.csvColumn) .map(field => field.csvColumn)
) )
); );
if ( if (
this.data.existingConfiguration && this.data.existingConfiguration &&
this.allEntities.find( this.allEntities.find(
(entity) => entity =>
entity.csvColumn === entity.csvColumn ===
this.data.existingConfiguration.filenameMappingColumnHeaderName this.data.existingConfiguration.filenameMappingColumnHeaderName
) )
@ -200,11 +200,11 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
} }
async save() { async save() {
const newPrimary = !!this.activeFields.find((attr) => attr.primaryAttribute); const newPrimary = !!this.activeFields.find(attr => attr.primaryAttribute);
if (newPrimary) { if (newPrimary) {
this.data.existingConfiguration.fileAttributeConfigs.forEach( this.data.existingConfiguration.fileAttributeConfigs.forEach(
(attr) => (attr.primaryAttribute = false) attr => (attr.primaryAttribute = false)
); );
} }
@ -212,10 +212,9 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
...this.baseConfigForm.getRawValue(), ...this.baseConfigForm.getRawValue(),
fileAttributeConfigs: [ fileAttributeConfigs: [
...this.data.existingConfiguration.fileAttributeConfigs.filter( ...this.data.existingConfiguration.fileAttributeConfigs.filter(
(a) => a => !this.allEntities.find(entity => entity.csvColumn === a.csvColumnHeader)
!this.allEntities.find((entity) => entity.csvColumn === a.csvColumnHeader)
), ),
...this.activeFields.map((field) => ({ ...this.activeFields.map(field => ({
id: field.id, id: field.id,
csvColumnHeader: field.csvColumn, csvColumnHeader: field.csvColumn,
editable: !field.readonly, editable: !field.readonly,
@ -259,8 +258,8 @@ export class FileAttributesCsvImportDialogComponent extends BaseListingComponent
this.columnSample = []; this.columnSample = [];
} else { } else {
this.columnSample = this.parseResult.data this.columnSample = this.parseResult.data
.filter((row) => !!row[column]) .filter(row => !!row[column])
.map((row) => row[column]); .map(row => row[column]);
} }
}, 0); }, 0);
} }

View File

@ -40,7 +40,7 @@ export class AuditScreenComponent {
to: [] to: []
}); });
this.filterForm.valueChanges.subscribe((value) => { this.filterForm.valueChanges.subscribe(value => {
if (!this._updateDateFilters(value)) { if (!this._updateDateFilters(value)) {
this._fetchData(); this._fetchData();
} }
@ -102,12 +102,12 @@ export class AuditScreenComponent {
promises.push(this._auditControllerService.getAuditCategories().toPromise()); promises.push(this._auditControllerService.getAuditCategories().toPromise());
promises.push(this._auditControllerService.searchAuditLog(logsRequestBody).toPromise()); promises.push(this._auditControllerService.searchAuditLog(logsRequestBody).toPromise());
Promise.all(promises).then((data) => { Promise.all(promises).then(data => {
this.categories = data[0].map((c) => c.category); this.categories = data[0].map(c => c.category);
this.categories.splice(0, 0, this.ALL_CATEGORIES); this.categories.splice(0, 0, this.ALL_CATEGORIES);
this.logs = data[1]; this.logs = data[1];
this.userIds = new Set<string>([this.ALL_USERS]); this.userIds = new Set<string>([this.ALL_USERS]);
for (const id of this.logs.data.map((log) => log.userId).filter((uid) => !!uid)) { for (const id of this.logs.data.map(log => log.userId).filter(uid => !!uid)) {
this.userIds.add(id); this.userIds.add(id);
} }
this.viewReady = true; this.viewReady = true;

View File

@ -54,9 +54,9 @@ export class DefaultColorsScreenComponent extends BaseListingComponent<{
this._dictionaryControllerService this._dictionaryControllerService
.getColors(this._appStateService.activeDossierTemplateId) .getColors(this._appStateService.activeDossierTemplateId)
.toPromise() .toPromise()
.then((data) => { .then(data => {
this._colorsObj = data; this._colorsObj = data;
this.allEntities = Object.keys(data).map((key) => ({ this.allEntities = Object.keys(data).map(key => ({
key, key,
value: data[key] value: data[key]
})); }));

View File

@ -48,7 +48,7 @@ export class DictionaryListingScreenComponent
this._dialogService.openAddEditDictionaryDialog( this._dialogService.openAddEditDictionaryDialog(
dict, dict,
this._appStateService.activeDossierTemplateId, this._appStateService.activeDossierTemplateId,
async (newDictionary) => { async newDictionary => {
if (newDictionary) { if (newDictionary) {
await this._appStateService.loadDictionaryData(); await this._appStateService.loadDictionaryData();
this._loadDictionaryData(); this._loadDictionaryData();
@ -73,14 +73,14 @@ export class DictionaryListingScreenComponent
const appStateDictionaryData = const appStateDictionaryData =
this._appStateService.dictionaryData[this._appStateService.activeDossierTemplateId]; this._appStateService.dictionaryData[this._appStateService.activeDossierTemplateId];
this.allEntities = Object.keys(appStateDictionaryData) this.allEntities = Object.keys(appStateDictionaryData)
.map((key) => appStateDictionaryData[key]) .map(key => appStateDictionaryData[key])
.filter((d) => !d.virtual); .filter(d => !d.virtual);
this.displayedEntities = [...this.allEntities]; this.displayedEntities = [...this.allEntities];
const dataObs = this.allEntities.map((dict) => const dataObs = this.allEntities.map(dict =>
this._dictionaryControllerService this._dictionaryControllerService
.getDictionaryForType(this._appStateService.activeDossierTemplateId, dict.type) .getDictionaryForType(this._appStateService.activeDossierTemplateId, dict.type)
.pipe( .pipe(
tap((values) => { tap(values => {
dict.entries = values.entries ? values.entries : []; dict.entries = values.entries ? values.entries : [];
}), }),
catchError(() => { catchError(() => {

View File

@ -63,10 +63,10 @@
<redaction-admin-side-nav type="dossier-templates"></redaction-admin-side-nav> <redaction-admin-side-nav type="dossier-templates"></redaction-admin-side-nav>
<redaction-dictionary-manager <redaction-dictionary-manager
[initialEntries]="entries"
[canEdit]="permissionsService.isAdmin()"
(saveDictionary)="saveEntries($event)"
#dictionaryManager #dictionaryManager
(saveDictionary)="saveEntries($event)"
[canEdit]="permissionsService.isAdmin()"
[initialEntries]="entries"
></redaction-dictionary-manager> ></redaction-dictionary-manager>
<div class="right-container"> <div class="right-container">

View File

@ -41,10 +41,6 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
); );
} }
ngOnInit(): void {
this._loadEntries();
}
get dictionary(): TypeValueWrapper { get dictionary(): TypeValueWrapper {
return this._appStateService.activeDictionary; return this._appStateService.activeDictionary;
} }
@ -53,6 +49,10 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
return this._dictionaryManager.hasChanges; return this._dictionaryManager.hasChanges;
} }
ngOnInit(): void {
this._loadEntries();
}
openEditDictionaryDialog($event: any) { openEditDictionaryDialog($event: any) {
$event.stopPropagation(); $event.stopPropagation();
this._dialogService.openAddEditDictionaryDialog( this._dialogService.openAddEditDictionaryDialog(
@ -123,7 +123,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
this._dictionaryControllerService this._dictionaryControllerService
.getDictionaryForType(this.dictionary.dossierTemplateId, this.dictionary.type) .getDictionaryForType(this.dictionary.dossierTemplateId, this.dictionary.type)
.subscribe( .subscribe(
(data) => { data => {
this.processing = false; this.processing = false;
this.entries = data.entries.sort((str1, str2) => this.entries = data.entries.sort((str1, str2) =>
str1.localeCompare(str2, undefined, { sensitivity: 'accent' }) str1.localeCompare(str2, undefined, { sensitivity: 'accent' })

View File

@ -55,7 +55,7 @@ export class DigitalSignatureScreenComponent {
NotificationType.SUCCESS NotificationType.SUCCESS
); );
}, },
(error) => { error => {
if (error.status === 400) { if (error.status === 400) {
this._notificationService.showToastNotification( this._notificationService.showToastNotification(
this._translateService.instant( this._translateService.instant(
@ -117,7 +117,7 @@ export class DigitalSignatureScreenComponent {
this._digitalSignatureControllerService this._digitalSignatureControllerService
.getDigitalSignature() .getDigitalSignature()
.subscribe( .subscribe(
(digitalSignature) => { digitalSignature => {
this.digitalSignatureExists = true; this.digitalSignatureExists = true;
this.digitalSignature = digitalSignature; this.digitalSignature = digitalSignature;
}, },

View File

@ -41,7 +41,7 @@ export class DossierTemplatesListingScreenComponent
} }
openAddDossierTemplateDialog() { openAddDossierTemplateDialog() {
this._dialogService.openAddEditDossierTemplateDialog(null, async (newDossierTemplate) => { this._dialogService.openAddEditDossierTemplateDialog(null, async newDossierTemplate => {
if (newDossierTemplate) { if (newDossierTemplate) {
this.loadDossierTemplatesData(); this.loadDossierTemplatesData();
} }
@ -49,12 +49,12 @@ export class DossierTemplatesListingScreenComponent
} }
private _loadDossierTemplateStats() { private _loadDossierTemplateStats() {
this.allEntities.forEach((rs) => { this.allEntities.forEach(rs => {
const dictionaries = this._appStateService.dictionaryData[rs.dossierTemplateId]; const dictionaries = this._appStateService.dictionaryData[rs.dossierTemplateId];
if (dictionaries) { if (dictionaries) {
rs.dictionariesCount = Object.keys(dictionaries) rs.dictionariesCount = Object.keys(dictionaries)
.map((key) => dictionaries[key]) .map(key => dictionaries[key])
.filter((d) => !d.virtual || d.type === 'false_positive').length; .filter(d => !d.virtual || d.type === 'false_positive').length;
} else { } else {
rs.dictionariesCount = 0; rs.dictionariesCount = 0;
rs.totalDictionaryEntries = 0; rs.totalDictionaryEntries = 0;

View File

@ -68,7 +68,7 @@ export class LicenseInformationScreenComponent implements OnInit {
); );
} }
Promise.all(promises).then((reports) => { Promise.all(promises).then(reports => {
[this.currentInfo, this.totalInfo, this.unlicensedInfo] = reports; [this.currentInfo, this.totalInfo, this.unlicensedInfo] = reports;
this.viewReady = true; this.viewReady = true;
this.analysisPercentageOfLicense = this.analysisPercentageOfLicense =

View File

@ -21,9 +21,9 @@
<div class="editor-container"> <div class="editor-container">
<ngx-monaco-editor <ngx-monaco-editor
[options]="editorOptions"
[(ngModel)]="codeEditorText"
(init)="onCodeEditorInit($event)" (init)="onCodeEditorInit($event)"
[(ngModel)]="codeEditorText"
[options]="editorOptions"
></ngx-monaco-editor> ></ngx-monaco-editor>
</div> </div>
<div *ngIf="hasChanges && permissionsService.isAdmin()" class="changes-box"> <div *ngIf="hasChanges && permissionsService.isAdmin()" class="changes-box">

View File

@ -50,19 +50,6 @@ export class RulesScreenComponent extends ComponentHasChanges {
this._initialize(); this._initialize();
} }
onCodeEditorInit(editor: ICodeEditor) {
this._codeEditor = editor;
(window as any).monaco.editor.defineTheme('redaction', {
base: 'vs',
inherit: true,
rules: [],
colors: {
'editor.lineHighlightBackground': '#f4f5f7'
}
});
(window as any).monaco.editor.setTheme('redaction');
}
get hasChanges(): boolean { get hasChanges(): boolean {
return this.currentLines.toString() !== this.initialLines.toString(); return this.currentLines.toString() !== this.initialLines.toString();
} }
@ -76,28 +63,28 @@ export class RulesScreenComponent extends ComponentHasChanges {
this.codeEditorTextChanged(); this.codeEditorTextChanged();
} }
onCodeEditorInit(editor: ICodeEditor) {
this._codeEditor = editor;
(window as any).monaco.editor.defineTheme('redaction', {
base: 'vs',
inherit: true,
rules: [],
colors: {
'editor.lineHighlightBackground': '#f4f5f7'
}
});
(window as any).monaco.editor.setTheme('redaction');
}
@debounce() @debounce()
codeEditorTextChanged() { codeEditorTextChanged() {
const newDecorations = this.currentLines const newDecorations = this.currentLines
.filter((entry) => this._isNew(entry)) .filter(entry => this._isNew(entry))
.map((entry) => this._makeDecorationFor(entry)); .map(entry => this._makeDecorationFor(entry));
this._decorations = this._codeEditor.deltaDecorations(this._decorations, newDecorations); this._decorations = this._codeEditor.deltaDecorations(this._decorations, newDecorations);
} }
private _isNew(entry: string): boolean {
return this.initialLines.indexOf(entry) < 0 && entry?.trim().length > 0;
}
private _makeDecorationFor(entry: string): IModelDeltaDecoration {
const line = this.currentLines.indexOf(entry) + 1;
return {
range: new monaco.Range(line, 1, line, 1),
options: { isWholeLine: true, className: 'changed-row-marker' }
} as IModelDeltaDecoration;
}
async save(): Promise<void> { async save(): Promise<void> {
this.processing = true; this.processing = true;
this._rulesControllerService this._rulesControllerService
@ -152,11 +139,24 @@ export class RulesScreenComponent extends ComponentHasChanges {
} }
} }
private _isNew(entry: string): boolean {
return this.initialLines.indexOf(entry) < 0 && entry?.trim().length > 0;
}
private _makeDecorationFor(entry: string): IModelDeltaDecoration {
const line = this.currentLines.indexOf(entry) + 1;
return {
range: new monaco.Range(line, 1, line, 1),
options: { isWholeLine: true, className: 'changed-row-marker' }
} as IModelDeltaDecoration;
}
private _initialize() { private _initialize() {
this._rulesControllerService this._rulesControllerService
.downloadRules(this._appStateService.activeDossierTemplateId) .downloadRules(this._appStateService.activeDossierTemplateId)
.subscribe( .subscribe(
(rules) => { rules => {
this.currentLines = this.initialLines = rules.rules.split('\n'); this.currentLines = this.initialLines = rules.rules.split('\n');
this.revert(); this.revert();
}, },

View File

@ -40,7 +40,7 @@ export class SmtpConfigScreenComponent implements OnInit {
password: [undefined] password: [undefined]
}); });
this.configForm.controls.auth.valueChanges.subscribe((auth) => { this.configForm.controls.auth.valueChanges.subscribe(auth => {
if (auth) { if (auth) {
this.openAuthConfigDialog(); this.openAuthConfigDialog();
} }
@ -73,16 +73,13 @@ export class SmtpConfigScreenComponent implements OnInit {
} }
openAuthConfigDialog(skipDisableOnCancel?: boolean) { openAuthConfigDialog(skipDisableOnCancel?: boolean) {
this._dialogService.openSMTPAuthConfigDialog( this._dialogService.openSMTPAuthConfigDialog(this.configForm.getRawValue(), authConfig => {
this.configForm.getRawValue(), if (authConfig) {
(authConfig) => { this.configForm.patchValue(authConfig);
if (authConfig) { } else if (!skipDisableOnCancel) {
this.configForm.patchValue(authConfig); this.configForm.patchValue({ auth: false }, { emitEvent: false });
} else if (!skipDisableOnCancel) {
this.configForm.patchValue({ auth: false }, { emitEvent: false });
}
} }
); });
} }
async testConnection() { async testConnection() {

View File

@ -42,7 +42,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
openAddEditUserDialog($event: MouseEvent, user?: User) { openAddEditUserDialog($event: MouseEvent, user?: User) {
$event.stopPropagation(); $event.stopPropagation();
this._adminDialogService.openAddEditUserDialog(user, async (result) => { this._adminDialogService.openAddEditUserDialog(user, async result => {
if (result === 'DELETE') { if (result === 'DELETE') {
this.openDeleteUserDialog([user]); this.openDeleteUserDialog([user]);
} else { } else {
@ -63,14 +63,14 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
$event?.stopPropagation(); $event?.stopPropagation();
this._adminDialogService.openConfirmDeleteUsersDialog(users, async () => { this._adminDialogService.openConfirmDeleteUsersDialog(users, async () => {
this.loading = true; this.loading = true;
await this._userControllerService.deleteUsers(users.map((u) => u.userId)).toPromise(); await this._userControllerService.deleteUsers(users.map(u => u.userId)).toPromise();
await this._loadData(); await this._loadData();
}); });
} }
getDisplayRoles(user: User) { getDisplayRoles(user: User) {
return ( return (
user.roles.map((role) => this._translateService.instant('roles.' + role)).join(', ') || user.roles.map(role => this._translateService.instant('roles.' + role)).join(', ') ||
this._translateService.instant('roles.NO_ROLE') this._translateService.instant('roles.NO_ROLE')
); );
} }
@ -87,7 +87,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
} }
async bulkDelete() { async bulkDelete() {
this.openDeleteUserDialog(this.allEntities.filter((u) => this.isEntitySelected(u))); this.openDeleteUserDialog(this.allEntities.filter(u => this.isEntitySelected(u)));
} }
protected _searchField(user: any): string { protected _searchField(user: any): string {
@ -106,36 +106,34 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
this.chartData = this._translateChartService.translateRoles( this.chartData = this._translateChartService.translateRoles(
[ [
{ {
value: this.allEntities.filter((user) => !this.userService.isActive(user)) value: this.allEntities.filter(user => !this.userService.isActive(user)).length,
.length,
color: 'INACTIVE', color: 'INACTIVE',
label: 'INACTIVE' label: 'INACTIVE'
}, },
{ {
value: this.allEntities.filter( value: this.allEntities.filter(
(user) => user.roles.length === 1 && user.roles[0] === 'RED_USER' user => user.roles.length === 1 && user.roles[0] === 'RED_USER'
).length, ).length,
color: 'REGULAR', color: 'REGULAR',
label: 'REGULAR' label: 'REGULAR'
}, },
{ {
value: this.allEntities.filter( value: this.allEntities.filter(
(user) => user => this.userService.isManager(user) && !this.userService.isAdmin(user)
this.userService.isManager(user) && !this.userService.isAdmin(user)
).length, ).length,
color: 'MANAGER', color: 'MANAGER',
label: 'RED_MANAGER' label: 'RED_MANAGER'
}, },
{ {
value: this.allEntities.filter( value: this.allEntities.filter(
(user) => this.userService.isManager(user) && this.userService.isAdmin(user) user => this.userService.isManager(user) && this.userService.isAdmin(user)
).length, ).length,
color: 'MANAGER_ADMIN', color: 'MANAGER_ADMIN',
label: 'MANAGER_ADMIN' label: 'MANAGER_ADMIN'
}, },
{ {
value: this.allEntities.filter( value: this.allEntities.filter(
(user) => user =>
this.userService.isUserAdmin(user) && !this.userService.isAdmin(user) this.userService.isUserAdmin(user) && !this.userService.isAdmin(user)
).length, ).length,
color: 'USER_ADMIN', color: 'USER_ADMIN',
@ -143,13 +141,12 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
}, },
{ {
value: this.allEntities.filter( value: this.allEntities.filter(
(user) => user => this.userService.isAdmin(user) && !this.userService.isManager(user)
this.userService.isAdmin(user) && !this.userService.isManager(user)
).length, ).length,
color: 'ADMIN', color: 'ADMIN',
label: 'RED_ADMIN' label: 'RED_ADMIN'
} }
].filter((type) => type.value > 0) ].filter(type => type.value > 0)
); );
} }
} }

View File

@ -129,7 +129,7 @@ export class WatermarkScreenComponent implements OnInit {
this._watermarkControllerService this._watermarkControllerService
.getWatermark(this.appStateService.activeDossierTemplateId) .getWatermark(this.appStateService.activeDossierTemplateId)
.subscribe( .subscribe(
(watermark) => { watermark => {
this._watermark = watermark; this._watermark = watermark;
this.configForm.setValue({ ...this._watermark }); this.configForm.setValue({ ...this._watermark });
this._loadViewer(); this._loadViewer();
@ -153,7 +153,7 @@ export class WatermarkScreenComponent implements OnInit {
isReadOnly: true isReadOnly: true
}, },
this._viewer.nativeElement this._viewer.nativeElement
).then((instance) => { ).then(instance => {
this._instance = instance; this._instance = instance;
instance.docViewer.on('documentLoaded', () => { instance.docViewer.on('documentLoaded', () => {
@ -167,7 +167,7 @@ export class WatermarkScreenComponent implements OnInit {
.request('get', '/assets/pdftron/blank.pdf', { .request('get', '/assets/pdftron/blank.pdf', {
responseType: 'blob' responseType: 'blob'
}) })
.subscribe((blobData) => { .subscribe(blobData => {
console.log('load blank'); console.log('load blank');
this._instance.loadDocument(blobData, { filename: 'blank.pdf' }); this._instance.loadDocument(blobData, { filename: 'blank.pdf' });
}); });

View File

@ -61,7 +61,7 @@ export class AdminDialogService {
): MatDialogRef<ConfirmationDialogComponent> { ): MatDialogRef<ConfirmationDialogComponent> {
$event.stopPropagation(); $event.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
ref.afterClosed().subscribe(async (result) => { ref.afterClosed().subscribe(async result => {
if (result) { if (result) {
await this._dictionaryControllerService await this._dictionaryControllerService
.deleteType(dictionary.type, dossierTemplateId) .deleteType(dictionary.type, dossierTemplateId)
@ -79,7 +79,7 @@ export class AdminDialogService {
): MatDialogRef<ConfirmationDialogComponent> { ): MatDialogRef<ConfirmationDialogComponent> {
$event.stopPropagation(); $event.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
ref.afterClosed().subscribe(async (result) => { ref.afterClosed().subscribe(async result => {
if (result) { if (result) {
await this._dossierTemplateControllerService await this._dossierTemplateControllerService
.getAllDossierTemplates(dossierTemplate.dossierTemplateId) .getAllDossierTemplates(dossierTemplate.dossierTemplateId)
@ -101,7 +101,7 @@ export class AdminDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -122,7 +122,7 @@ export class AdminDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -142,7 +142,7 @@ export class AdminDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -162,7 +162,7 @@ export class AdminDialogService {
data: { csv, dossierTemplateId, existingConfiguration } data: { csv, dossierTemplateId, existingConfiguration }
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -182,7 +182,7 @@ export class AdminDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -202,7 +202,7 @@ export class AdminDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -221,7 +221,7 @@ export class AdminDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (cb) { if (cb) {
cb(result); cb(result);
} }
@ -237,7 +237,7 @@ export class AdminDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -256,7 +256,7 @@ export class AdminDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }

View File

@ -42,10 +42,14 @@ export class AppConfigService {
private readonly _titleService: Title private readonly _titleService: Title
) {} ) {}
get version(): string {
return packageInfo.version;
}
loadAppConfig(): Observable<any> { loadAppConfig(): Observable<any> {
this._cacheApiService this._cacheApiService
.getCachedValue(AppConfigKey.FRONTEND_APP_VERSION) .getCachedValue(AppConfigKey.FRONTEND_APP_VERSION)
.then(async (lastVersion) => { .then(async lastVersion => {
console.log( console.log(
'[REDACTION] Last app version: ', '[REDACTION] Last app version: ',
lastVersion, lastVersion,
@ -63,7 +67,7 @@ export class AppConfigService {
}); });
return this._httpClient.get<any>('/assets/config/config.json').pipe( return this._httpClient.get<any>('/assets/config/config.json').pipe(
tap((config) => { tap(config => {
console.log('[REDACTION] Started with config: ', config); console.log('[REDACTION] Started with config: ', config);
this._config = config; this._config = config;
this._config[AppConfigKey.FRONTEND_APP_VERSION] = this.version; this._config[AppConfigKey.FRONTEND_APP_VERSION] = this.version;
@ -75,8 +79,4 @@ export class AppConfigService {
getConfig(key: AppConfigKey | string, defaultValue?: any) { getConfig(key: AppConfigKey | string, defaultValue?: any) {
return this._config[key] ? this._config[key] : defaultValue; return this._config[key] ? this._config[key] : defaultValue;
} }
get version(): string {
return packageInfo.version;
}
} }

View File

@ -15,7 +15,7 @@ export class RedRoleGuard implements CanActivate {
) {} ) {}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
return new Observable((obs) => { return new Observable(obs => {
if (!this._userService.user.hasAnyREDRoles) { if (!this._userService.user.hasAnyREDRoles) {
this._router.navigate(['/auth-error']); this._router.navigate(['/auth-error']);
this._appLoadStateService.pushLoadingEvent(false); this._appLoadStateService.pushLoadingEvent(false);

View File

@ -41,7 +41,7 @@ export class AnnotationRemoveActionsComponent {
@Input() @Input()
set annotations(value: AnnotationWrapper[]) { set annotations(value: AnnotationWrapper[]) {
this._annotations = value.filter((a) => a !== undefined); this._annotations = value.filter(a => a !== undefined);
this._setPermissions(); this._setPermissions();
} }

View File

@ -10,8 +10,8 @@
<redaction-circle-button <redaction-circle-button
(action)="assign()" (action)="assign()"
*ngIf="canAssign" *ngIf="canAssign"
icon="red:assign"
[tooltip]="assignTooltip" [tooltip]="assignTooltip"
icon="red:assign"
type="dark-bg" type="dark-bg"
></redaction-circle-button> ></redaction-circle-button>
@ -43,8 +43,8 @@
</redaction-circle-button> </redaction-circle-button>
<redaction-file-download-btn <redaction-file-download-btn
[file]="selectedFiles"
[dossier]="dossier" [dossier]="dossier"
[file]="selectedFiles"
></redaction-file-download-btn> ></redaction-file-download-btn>
<!-- Approved--> <!-- Approved-->

View File

@ -42,7 +42,7 @@ export class DossierOverviewBulkActionsComponent {
} }
get selectedFiles(): FileStatusWrapper[] { get selectedFiles(): FileStatusWrapper[] {
return this.selectedFileIds.map((fileId) => return this.selectedFileIds.map(fileId =>
this._appStateService.getFileById( this._appStateService.getFileById(
this._appStateService.activeDossier.dossier.dossierId, this._appStateService.activeDossier.dossier.dossierId,
fileId fileId
@ -119,7 +119,7 @@ export class DossierOverviewBulkActionsComponent {
} }
get fileStatuses() { get fileStatuses() {
return this.selectedFiles.map((file) => file.fileStatus.status); return this.selectedFiles.map(file => file.fileStatus.status);
} }
// Under review // Under review
@ -189,7 +189,7 @@ export class DossierOverviewBulkActionsComponent {
// If more than 1 approver - show dialog and ask who to assign // If more than 1 approver - show dialog and ask who to assign
if (this._appStateService.activeDossier.approverIds.length > 1) { if (this._appStateService.activeDossier.approverIds.length > 1) {
this.loading = true; this.loading = true;
const files = this.selectedFileIds.map((fileId) => const files = this.selectedFileIds.map(fileId =>
this._appStateService.getFileById(this._appStateService.activeDossierId, fileId) this._appStateService.getFileById(this._appStateService.activeDossierId, fileId)
); );
@ -214,8 +214,8 @@ export class DossierOverviewBulkActionsComponent {
async reanalyse() { async reanalyse() {
const fileIds = this.selectedFiles const fileIds = this.selectedFiles
.filter((file) => this._permissionsService.fileRequiresReanalysis(file)) .filter(file => this._permissionsService.fileRequiresReanalysis(file))
.map((file) => file.fileId); .map(file => file.fileId);
this._performBulkAction( this._performBulkAction(
this._reanalysisControllerService.reanalyzeFilesForDossier( this._reanalysisControllerService.reanalyzeFilesForDossier(
fileIds, fileIds,
@ -240,17 +240,9 @@ export class DossierOverviewBulkActionsComponent {
this._performBulkAction(from(this._fileActionService.assignToMe(this.selectedFiles))); this._performBulkAction(from(this._fileActionService.assignToMe(this.selectedFiles)));
} }
private _performBulkAction(obs: Observable<any>) {
this.loading = true;
obs.subscribe().add(() => {
this.reload.emit();
this.loading = false;
});
}
assign() { assign() {
this.loading = true; this.loading = true;
const files = this.selectedFileIds.map((fileId) => const files = this.selectedFileIds.map(fileId =>
this._appStateService.getFileById(this._appStateService.activeDossierId, fileId) this._appStateService.getFileById(this._appStateService.activeDossierId, fileId)
); );
@ -261,4 +253,12 @@ export class DossierOverviewBulkActionsComponent {
this.loading = false; this.loading = false;
}); });
} }
private _performBulkAction(obs: Observable<any>) {
this.loading = true;
obs.subscribe().add(() => {
this.reload.emit();
this.loading = false;
});
}
} }

View File

@ -60,7 +60,7 @@ export class CommentsComponent {
if (value) { if (value) {
this._manualAnnotationService this._manualAnnotationService
.addComment(value, this.annotation.id) .addComment(value, this.annotation.id)
.subscribe((commentResponse) => { .subscribe(commentResponse => {
this.annotation.comments.push({ this.annotation.comments.push({
text: value, text: value,
id: commentResponse.commentId, id: commentResponse.commentId,

View File

@ -122,9 +122,9 @@
</span> </span>
</div> </div>
<div <div
(click)="openDossierDictionaryDialog.emit()"
*ngIf="appStateService.activeDossier.type" *ngIf="appStateService.activeDossier.type"
class="pointer" class="pointer"
(click)="openDossierDictionaryDialog.emit()"
> >
<mat-icon svgIcon="red:dictionary"></mat-icon> <mat-icon svgIcon="red:dictionary"></mat-icon>
<span>{{ 'dossier-overview.dossier-details.dictionary' | translate }} </span> <span>{{ 'dossier-overview.dossier-details.dictionary' | translate }} </span>

View File

@ -67,7 +67,7 @@ export class DossierDetailsComponent implements OnInit {
} }
toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void { toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void {
const filter = this.filters[filterType].find((f) => f.key === key); const filter = this.filters[filterType].find(f => f.key === key);
filter.checked = !filter.checked; filter.checked = !filter.checked;
this.filtersChanged.emit(this.filters); this.filtersChanged.emit(this.filters);
} }

View File

@ -28,8 +28,8 @@
</redaction-circle-button> </redaction-circle-button>
<redaction-file-download-btn <redaction-file-download-btn
[file]="dossier.files"
[dossier]="dossier" [dossier]="dossier"
[file]="dossier.files"
type="dark-bg" type="dark-bg"
></redaction-file-download-btn> ></redaction-file-download-btn>
</div> </div>

View File

@ -55,6 +55,6 @@ export class DossierListingActionsComponent {
return Object.keys(obj) return Object.keys(obj)
.sort((a, b) => StatusSorter[a] - StatusSorter[b]) .sort((a, b) => StatusSorter[a] - StatusSorter[b])
.map((status) => ({ length: obj[status], color: status })); .map(status => ({ length: obj[status], color: status }));
} }
} }

View File

@ -25,7 +25,7 @@ export class DossierListingDetailsComponent {
} }
toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void { toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void {
const filter = this.filters[filterType].find((f) => f.key === key); const filter = this.filters[filterType].find(f => f.key === key);
filter.checked = !filter.checked; filter.checked = !filter.checked;
this.filtersChanged.emit(this.filters); this.filtersChanged.emit(this.filters);
} }

View File

@ -31,26 +31,26 @@
<redaction-circle-button <redaction-circle-button
(action)="assign($event)" (action)="assign($event)"
*ngIf="canAssign && screen === 'dossier-overview'" *ngIf="canAssign && screen === 'dossier-overview'"
icon="red:assign"
[tooltip]="assignTooltip"
[tooltipPosition]="tooltipPosition" [tooltipPosition]="tooltipPosition"
[tooltip]="assignTooltip"
[type]="buttonType" [type]="buttonType"
icon="red:assign"
></redaction-circle-button> ></redaction-circle-button>
<redaction-circle-button <redaction-circle-button
(action)="assignToMe($event)" (action)="assignToMe($event)"
*ngIf="canAssignToSelf && screen === 'dossier-overview'" *ngIf="canAssignToSelf && screen === 'dossier-overview'"
icon="red:assign-me"
tooltip="dossier-overview.assign-me"
[tooltipPosition]="tooltipPosition" [tooltipPosition]="tooltipPosition"
[type]="buttonType" [type]="buttonType"
icon="red:assign-me"
tooltip="dossier-overview.assign-me"
> >
</redaction-circle-button> </redaction-circle-button>
<!-- download redacted file--> <!-- download redacted file-->
<redaction-file-download-btn <redaction-file-download-btn
[file]="fileStatus"
[dossier]="appStateService.activeDossier" [dossier]="appStateService.activeDossier"
[file]="fileStatus"
[tooltipClass]="'small'" [tooltipClass]="'small'"
[tooltipPosition]="tooltipPosition" [tooltipPosition]="tooltipPosition"
[type]="buttonType" [type]="buttonType"

View File

@ -96,7 +96,7 @@ export class FileWorkloadComponent {
} }
annotationIsSelected(annotation: AnnotationWrapper) { annotationIsSelected(annotation: AnnotationWrapper) {
return this.selectedAnnotations?.find((a) => a?.id === annotation.id); return this.selectedAnnotations?.find(a => a?.id === annotation.id);
} }
logAnnotation(annotation: AnnotationWrapper) { logAnnotation(annotation: AnnotationWrapper) {
@ -105,7 +105,7 @@ export class FileWorkloadComponent {
pageHasSelection(page: number) { pageHasSelection(page: number) {
return ( return (
this.multiSelectActive && !!this.selectedAnnotations?.find((a) => a.pageNumber === page) this.multiSelectActive && !!this.selectedAnnotations?.find(a => a.pageNumber === page)
); );
} }
@ -126,7 +126,7 @@ export class FileWorkloadComponent {
filters.primary, filters.primary,
filters.secondary filters.secondary
); );
this.displayedPages = Object.keys(this.displayedAnnotations).map((key) => Number(key)); this.displayedPages = Object.keys(this.displayedAnnotations).map(key => Number(key));
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
} }
@ -210,7 +210,7 @@ export class FileWorkloadComponent {
} }
scrollQuickNavigation() { scrollQuickNavigation() {
let quickNavPageIndex = this.displayedPages.findIndex((p) => p >= this.activeViewerPage); let quickNavPageIndex = this.displayedPages.findIndex(p => p >= this.activeViewerPage);
if ( if (
quickNavPageIndex === -1 || quickNavPageIndex === -1 ||
this.displayedPages[quickNavPageIndex] !== this.activeViewerPage this.displayedPages[quickNavPageIndex] !== this.activeViewerPage
@ -300,9 +300,7 @@ export class FileWorkloadComponent {
const page = this._firstSelectedAnnotation.pageNumber; const page = this._firstSelectedAnnotation.pageNumber;
const pageIdx = this.displayedPages.indexOf(page); const pageIdx = this.displayedPages.indexOf(page);
const annotationsOnPage = this.displayedAnnotations[page].annotations; const annotationsOnPage = this.displayedAnnotations[page].annotations;
const idx = annotationsOnPage.findIndex( const idx = annotationsOnPage.findIndex(a => a.id === this._firstSelectedAnnotation.id);
(a) => a.id === this._firstSelectedAnnotation.id
);
if ($event.key === 'ArrowDown') { if ($event.key === 'ArrowDown') {
if (idx + 1 !== annotationsOnPage.length) { if (idx + 1 !== annotationsOnPage.length) {

View File

@ -102,7 +102,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
this.deselectAllAnnotations(); this.deselectAllAnnotations();
} }
const annotationsFromViewer = annotations.map((ann) => const annotationsFromViewer = annotations.map(ann =>
this.instance.annotManager.getAnnotationById(ann.id) this.instance.annotManager.getAnnotationById(ann.id)
); );
this.instance.annotManager.selectAnnotations(annotationsFromViewer); this.instance.annotManager.selectAnnotations(annotationsFromViewer);
@ -112,7 +112,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
deselectAnnotations(annotations: AnnotationWrapper[]) { deselectAnnotations(annotations: AnnotationWrapper[]) {
this.instance.annotManager.deselectAnnotations( this.instance.annotManager.deselectAnnotations(
annotations.map((ann) => this.instance.annotManager.getAnnotationById(ann.id)) annotations.map(ann => this.instance.annotManager.getAnnotationById(ann.id))
); );
} }
@ -141,7 +141,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
css: this._convertPath('/assets/pdftron/stylesheet.css') css: this._convertPath('/assets/pdftron/stylesheet.css')
}, },
this.viewer.nativeElement this.viewer.nativeElement
).then((instance) => { ).then(instance => {
this.instance = instance; this.instance = instance;
this._disableElements(); this._disableElements();
this._disableHotkeys(); this._disableHotkeys();
@ -149,7 +149,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
instance.annotManager.on('annotationSelected', (annotations, action) => { instance.annotManager.on('annotationSelected', (annotations, action) => {
this.annotationSelected.emit( this.annotationSelected.emit(
instance.annotManager.getSelectedAnnotations().map((ann) => ann.Id) instance.annotManager.getSelectedAnnotations().map(ann => ann.Id)
); );
if (action === 'deselected') { if (action === 'deselected') {
this._toggleRectangleAnnotationAction(true); this._toggleRectangleAnnotationAction(true);
@ -162,7 +162,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
} }
}); });
instance.annotManager.on('annotationChanged', (annotations) => { instance.annotManager.on('annotationChanged', annotations => {
// when a rectangle is drawn, // when a rectangle is drawn,
// it returns one annotation with tool name 'AnnotationCreateRectangle; // it returns one annotation with tool name 'AnnotationCreateRectangle;
// this will auto select rectangle after drawing // this will auto select rectangle after drawing
@ -174,7 +174,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
} }
}); });
instance.docViewer.on('pageNumberUpdated', (pageNumber) => { instance.docViewer.on('pageNumberUpdated', pageNumber => {
if (this.shouldDeselectAnnotationsOnPageChange) { if (this.shouldDeselectAnnotationsOnPageChange) {
this.deselectAllAnnotations(); this.deselectAllAnnotations();
} }
@ -183,7 +183,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
instance.docViewer.on('documentLoaded', this._documentLoaded); instance.docViewer.on('documentLoaded', this._documentLoaded);
instance.docViewer.on('keyUp', ($event) => { instance.docViewer.on('keyUp', $event => {
// arrows and full-screen // arrows and full-screen
if ($event.target?.tagName?.toLowerCase() !== 'input') { if ($event.target?.tagName?.toLowerCase() !== 'input') {
if ($event.key.startsWith('Arrow') || $event.key === 'f') { if ($event.key.startsWith('Arrow') || $event.key === 'f') {
@ -259,7 +259,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
'annotationGroupButton' 'annotationGroupButton'
]); ]);
this.instance.setHeaderItems((header) => { this.instance.setHeaderItems(header => {
const originalHeaderItems = header.getItems(); const originalHeaderItems = header.getItems();
originalHeaderItems.splice(8, 0, { originalHeaderItems.splice(8, 0, {
type: 'divider', type: 'divider',
@ -289,8 +289,8 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
} }
const annotationWrappers = viewerAnnotations const annotationWrappers = viewerAnnotations
.map((va) => this.annotations.find((a) => a.id === va.Id)) .map(va => this.annotations.find(a => a.id === va.Id))
.filter((va) => !!va); .filter(va => !!va);
this.instance.annotationPopup.update([]); this.instance.annotationPopup.update([]);
if (annotationWrappers.length === 0) { if (annotationWrappers.length === 0) {

View File

@ -1,3 +1,3 @@
<button class="scroll-button pointer" *ngIf="showScrollButton()" (click)="scroll()"> <button (click)="scroll()" *ngIf="showScrollButton()" class="scroll-button pointer">
<mat-icon svgIcon="red:arrow-down-o"></mat-icon> <mat-icon svgIcon="red:arrow-down-o"></mat-icon>
</button> </button>

View File

@ -37,7 +37,7 @@ export class TeamMembersManagerComponent implements OnInit {
} }
get selectedReviewersList(): string[] { get selectedReviewersList(): string[] {
return this.selectedMembersList.filter((m) => this.selectedApproversList.indexOf(m) === -1); return this.selectedMembersList.filter(m => this.selectedApproversList.indexOf(m) === -1);
} }
get selectedMembersList(): string[] { get selectedMembersList(): string[] {
@ -45,20 +45,20 @@ export class TeamMembersManagerComponent implements OnInit {
} }
get ownersSelectOptions() { get ownersSelectOptions() {
return this.userService.managerUsers.map((m) => m.userId); return this.userService.managerUsers.map(m => m.userId);
} }
get membersSelectOptions() { get membersSelectOptions() {
const searchQuery = this.searchForm.get('query').value; const searchQuery = this.searchForm.get('query').value;
return this.userService.eligibleUsers return this.userService.eligibleUsers
.filter((user) => .filter(user =>
this.userService this.userService
.getNameForId(user.userId) .getNameForId(user.userId)
.toLowerCase() .toLowerCase()
.includes(searchQuery.toLowerCase()) .includes(searchQuery.toLowerCase())
) )
.filter((user) => this.selectedOwnerId !== user.userId) .filter(user => this.selectedOwnerId !== user.userId)
.map((user) => user.userId); .map(user => user.userId);
} }
get valid(): boolean { get valid(): boolean {
@ -161,7 +161,7 @@ export class TeamMembersManagerComponent implements OnInit {
this.searchForm = this._formBuilder.group({ this.searchForm = this._formBuilder.group({
query: [''] query: ['']
}); });
this.teamForm.get('owner').valueChanges.subscribe((owner) => { this.teamForm.get('owner').valueChanges.subscribe(owner => {
if (!this.isApprover(owner)) { if (!this.isApprover(owner)) {
this.toggleApprover(owner); this.toggleApprover(owner);
} }

View File

@ -57,7 +57,7 @@ export class AddDossierDialogComponent {
const dossier: Dossier = this._formToObject(); const dossier: Dossier = this._formToObject();
const foundDossier = this._appStateService.allDossiers.find( const foundDossier = this._appStateService.allDossiers.find(
(p) => p.dossier.dossierId === dossier.dossierId p => p.dossier.dossierId === dossier.dossierId
); );
if (foundDossier) { if (foundDossier) {
dossier.memberIds = foundDossier.memberIds; dossier.memberIds = foundDossier.memberIds;
@ -80,7 +80,7 @@ export class AddDossierDialogComponent {
dossierTemplateChanged(dossierTemplateId) { dossierTemplateChanged(dossierTemplateId) {
// get current selected dossierTemplate // get current selected dossierTemplate
const dossierTemplate = this.dossierTemplates.find( const dossierTemplate = this.dossierTemplates.find(
(r) => r.dossierTemplateId === dossierTemplateId r => r.dossierTemplateId === dossierTemplateId
); );
if (dossierTemplate) { if (dossierTemplate) {
// update dropdown values // update dropdown values
@ -95,7 +95,7 @@ export class AddDossierDialogComponent {
} }
private _filterInvalidDossierTemplates() { private _filterInvalidDossierTemplates() {
this.dossierTemplates = this._appStateService.dossierTemplates.filter((r) => { this.dossierTemplates = this._appStateService.dossierTemplates.filter(r => {
const notYetValid = !!r.validFrom && moment(r.validFrom).isAfter(moment()); const notYetValid = !!r.validFrom && moment(r.validFrom).isAfter(moment());
const notValidAnymore = !!r.validTo && moment(r.validTo).add(1, 'd').isBefore(moment()); const notValidAnymore = !!r.validTo && moment(r.validTo).add(1, 'd').isBefore(moment());
return !(notYetValid || notValidAnymore); return !(notYetValid || notValidAnymore);

View File

@ -74,7 +74,7 @@ export class AssignReviewerApproverDialogComponent {
if (this.data.mode === 'reviewer') { if (this.data.mode === 'reviewer') {
await this._statusControllerService await this._statusControllerService
.setFileReviewerForList( .setFileReviewerForList(
this.data.files.map((f) => f.fileId), this.data.files.map(f => f.fileId),
this._appStateService.activeDossierId, this._appStateService.activeDossierId,
selectedUser selectedUser
) )
@ -82,7 +82,7 @@ export class AssignReviewerApproverDialogComponent {
} else { } else {
await this._statusControllerService await this._statusControllerService
.setStatusUnderApprovalForList( .setStatusUnderApprovalForList(
this.data.files.map((f) => f.fileId), this.data.files.map(f => f.fileId),
this._appStateService.activeDossierId, this._appStateService.activeDossierId,
selectedUser selectedUser
) )

View File

@ -37,7 +37,7 @@ export class DocumentInfoDialogComponent implements OnInit {
await this._fileAttributesService await this._fileAttributesService
.getFileAttributesConfiguration(this._dossier.dossierTemplateId) .getFileAttributesConfiguration(this._dossier.dossierTemplateId)
.toPromise() .toPromise()
).fileAttributeConfigs.filter((attr) => attr.editable); ).fileAttributeConfigs.filter(attr => attr.editable);
const formConfig = this.attributes.reduce( const formConfig = this.attributes.reduce(
(acc, attr) => ({ (acc, attr) => ({
...acc, ...acc,

View File

@ -5,9 +5,9 @@
<div class="dialog-content"> <div class="dialog-content">
<redaction-dictionary-manager <redaction-dictionary-manager
#dictionaryManager #dictionaryManager
[withFloatingActions]="false"
[canEdit]="canEdit" [canEdit]="canEdit"
[initialEntries]="dossier.type?.entries" [initialEntries]="dossier.type?.entries"
[withFloatingActions]="false"
></redaction-dictionary-manager> ></redaction-dictionary-manager>
</div> </div>

View File

@ -12,7 +12,6 @@ import { EditDossierDictionaryComponent } from './dictionary/edit-dossier-dictio
import { EditDossierTeamMembersComponent } from './team-members/edit-dossier-team-members.component'; import { EditDossierTeamMembersComponent } from './team-members/edit-dossier-team-members.component';
@Component({ @Component({
selector: 'redaction-edit-dossier-dialog',
templateUrl: './edit-dossier-dialog.component.html', templateUrl: './edit-dossier-dialog.component.html',
styleUrls: ['./edit-dossier-dialog.component.scss'] styleUrls: ['./edit-dossier-dialog.component.scss']
}) })
@ -50,7 +49,7 @@ export class EditDossierDialogComponent {
} }
get activeNavItem(): { key: string; title?: string } { get activeNavItem(): { key: string; title?: string } {
return this.navItems.find((item) => item.key === this.activeNav); return this.navItems.find(item => item.key === this.activeNav);
} }
get activeComponent(): EditDossierSectionInterface { get activeComponent(): EditDossierSectionInterface {

View File

@ -94,7 +94,7 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
} }
private _filterInvalidDossierTemplates() { private _filterInvalidDossierTemplates() {
this.dossierTemplates = this._appStateService.dossierTemplates.filter((r) => { this.dossierTemplates = this._appStateService.dossierTemplates.filter(r => {
if (this.dossierWrapper?.dossierTemplateId === r.dossierTemplateId) { if (this.dossierWrapper?.dossierTemplateId === r.dossierTemplateId) {
return true; return true;
} }

View File

@ -40,8 +40,8 @@ export class ForceRedactionDialogComponent implements OnInit {
async ngOnInit() { async ngOnInit() {
this._legalBasisMappingControllerService this._legalBasisMappingControllerService
.getLegalBasisMapping(this._appStateService.activeDossier.dossierTemplateId) .getLegalBasisMapping(this._appStateService.activeDossier.dossierTemplateId)
.subscribe((data) => { .subscribe(data => {
data.map((lbm) => { data.map(lbm => {
this.legalOptions.push({ this.legalOptions.push({
legalBasis: lbm.reason, legalBasis: lbm.reason,
description: lbm.description, description: lbm.description,

View File

@ -53,7 +53,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
get displayedDictionaryLabel() { get displayedDictionaryLabel() {
const dictType = this.redactionForm.get('dictionary').value; const dictType = this.redactionForm.get('dictionary').value;
if (dictType) { if (dictType) {
return this.redactionDictionaries.find((d) => d.type === dictType).label; return this.redactionDictionaries.find(d => d.type === dictType).label;
} }
return null; return null;
} }
@ -61,8 +61,8 @@ export class ManualAnnotationDialogComponent implements OnInit {
async ngOnInit() { async ngOnInit() {
this._legalBasisMappingControllerService this._legalBasisMappingControllerService
.getLegalBasisMapping(this._appStateService.activeDossier.dossierTemplateId) .getLegalBasisMapping(this._appStateService.activeDossier.dossierTemplateId)
.subscribe((data) => { .subscribe(data => {
data.map((lbm) => { data.map(lbm => {
this.legalOptions.push({ this.legalOptions.push({
legalBasis: lbm.reason, legalBasis: lbm.reason,
description: lbm.description, description: lbm.description,
@ -105,7 +105,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
this._manualAnnotationService this._manualAnnotationService
.addAnnotation(this.manualRedactionEntryWrapper.manualRedactionEntry) .addAnnotation(this.manualRedactionEntryWrapper.manualRedactionEntry)
.subscribe( .subscribe(
(response) => { response => {
this.dialogRef.close( this.dialogRef.close(
new ManualAnnotationResponse(this.manualRedactionEntryWrapper, response) new ManualAnnotationResponse(this.manualRedactionEntryWrapper, response)
); );

View File

@ -171,9 +171,9 @@
</cdk-virtual-scroll-viewport> </cdk-virtual-scroll-viewport>
<redaction-scroll-button <redaction-scroll-button
[scrollViewport]="scrollBar"
[itemSize]="itemSize"
*ngIf="scrollBar && itemSize > 0" *ngIf="scrollBar && itemSize > 0"
[itemSize]="itemSize"
[scrollViewport]="scrollBar"
></redaction-scroll-button> ></redaction-scroll-button>
</div> </div>
@ -182,8 +182,8 @@
(filtersChanged)="filtersChanged($event)" (filtersChanged)="filtersChanged($event)"
*ngIf="allEntities.length" *ngIf="allEntities.length"
[documentsChartData]="documentsChartData" [documentsChartData]="documentsChartData"
[filters]="detailsContainerFilters"
[dossiersChartData]="dossiersChartData" [dossiersChartData]="dossiersChartData"
[filters]="detailsContainerFilters"
></redaction-dossier-listing-details> ></redaction-dossier-listing-details>
</div> </div>
</div> </div>

View File

@ -7,10 +7,10 @@ import { groupBy } from '@utils/functions';
import { FilterModel } from '@shared/components/filter/model/filter.model'; import { FilterModel } from '@shared/components/filter/model/filter.model';
import { import {
annotationFilterChecker, annotationFilterChecker,
processFilters,
dossierMemberChecker, dossierMemberChecker,
dossierStatusChecker, dossierStatusChecker,
dossierTemplateChecker dossierTemplateChecker,
processFilters
} from '@shared/components/filter/utils/filter-utils'; } from '@shared/components/filter/utils/filter-utils';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { PermissionsService } from '@services/permissions.service'; import { PermissionsService } from '@services/permissions.service';
@ -48,13 +48,11 @@ export class DossierListingScreenComponent
statusFilters: [] statusFilters: []
}; };
readonly itemSize = 85; readonly itemSize = 85;
@ViewChild(CdkVirtualScrollViewport) scrollBar: CdkVirtualScrollViewport;
protected readonly _searchKey = 'name'; protected readonly _searchKey = 'name';
protected readonly _sortKey = 'dossier-listing'; protected readonly _sortKey = 'dossier-listing';
private _dossierAutoUpdateTimer: Subscription; private _dossierAutoUpdateTimer: Subscription;
private _lastScrollPosition: number; private _lastScrollPosition: number;
@ViewChild(CdkVirtualScrollViewport) scrollBar: CdkVirtualScrollViewport;
@ViewChild('statusFilter') private _statusFilterComponent: FilterComponent; @ViewChild('statusFilter') private _statusFilterComponent: FilterComponent;
@ViewChild('peopleFilter') private _peopleFilterComponent: FilterComponent; @ViewChild('peopleFilter') private _peopleFilterComponent: FilterComponent;
@ViewChild('needsWorkFilter') private _needsWorkFilterComponent: FilterComponent; @ViewChild('needsWorkFilter') private _needsWorkFilterComponent: FilterComponent;
@ -87,8 +85,7 @@ export class DossierListingScreenComponent
} }
get activeDossiersCount() { get activeDossiersCount() {
return this.allEntities.filter((p) => p.dossier.status === Dossier.StatusEnum.ACTIVE) return this.allEntities.filter(p => p.dossier.status === Dossier.StatusEnum.ACTIVE).length;
.length;
} }
get inactiveDossiersCount() { get inactiveDossiersCount() {
@ -142,10 +139,10 @@ export class DossierListingScreenComponent
this._routerEventsScrollPositionSub = this._router.events this._routerEventsScrollPositionSub = this._router.events
.pipe( .pipe(
filter( filter(
(events) => events instanceof NavigationStart || events instanceof NavigationEnd events => events instanceof NavigationStart || events instanceof NavigationEnd
) )
) )
.subscribe((event) => { .subscribe(event => {
if (event instanceof NavigationStart && event.url !== '/main/dossiers') { if (event instanceof NavigationStart && event.url !== '/main/dossiers') {
this._lastScrollPosition = this.scrollBar.measureScrollOffset('top'); this._lastScrollPosition = this.scrollBar.measureScrollOffset('top');
} }
@ -186,7 +183,7 @@ export class DossierListingScreenComponent
} }
openAddDossierDialog(): void { openAddDossierDialog(): void {
this._dialogService.openAddDossierDialog((addResponse) => { this._dialogService.openAddDossierDialog(addResponse => {
this._calculateData(); this._calculateData();
this._router.navigate([`/main/dossiers/${addResponse.dossier.dossierId}`]); this._router.navigate([`/main/dossiers/${addResponse.dossier.dossierId}`]);
if (addResponse.addMembers) { if (addResponse.addMembers) {
@ -205,7 +202,7 @@ export class DossierListingScreenComponent
protected _preFilter() { protected _preFilter() {
this.detailsContainerFilters = { this.detailsContainerFilters = {
statusFilters: this.statusFilters.map((f) => ({ ...f })) statusFilters: this.statusFilters.map(f => ({ ...f }))
}; };
} }
@ -241,16 +238,16 @@ export class DossierListingScreenComponent
const allDistinctPeople = new Set<string>(); const allDistinctPeople = new Set<string>();
const allDistinctNeedsWork = new Set<string>(); const allDistinctNeedsWork = new Set<string>();
const allDistinctDossierTemplates = new Set<string>(); const allDistinctDossierTemplates = new Set<string>();
this.allEntities.forEach((entry) => { this.allEntities.forEach(entry => {
// all people // all people
entry.dossier.memberIds.forEach((memberId) => allDistinctPeople.add(memberId)); entry.dossier.memberIds.forEach(memberId => allDistinctPeople.add(memberId));
// file statuses // file statuses
entry.files.forEach((file) => { entry.files.forEach(file => {
allDistinctFileStatus.add(file.status); allDistinctFileStatus.add(file.status);
}); });
// Needs work // Needs work
entry.files.forEach((file) => { entry.files.forEach(file => {
if (this.permissionsService.fileRequiresReanalysis(file)) if (this.permissionsService.fileRequiresReanalysis(file))
allDistinctNeedsWork.add('analysis'); allDistinctNeedsWork.add('analysis');
if (entry.hintsOnly) allDistinctNeedsWork.add('hint'); if (entry.hintsOnly) allDistinctNeedsWork.add('hint');
@ -264,7 +261,7 @@ export class DossierListingScreenComponent
}); });
const statusFilters = []; const statusFilters = [];
allDistinctFileStatus.forEach((status) => { allDistinctFileStatus.forEach(status => {
statusFilters.push({ statusFilters.push({
key: status, key: status,
label: this._translateService.instant(status) label: this._translateService.instant(status)
@ -274,7 +271,7 @@ export class DossierListingScreenComponent
this.statusFilters = processFilters(this.statusFilters, statusFilters); this.statusFilters = processFilters(this.statusFilters, statusFilters);
const peopleFilters = []; const peopleFilters = [];
allDistinctPeople.forEach((userId) => { allDistinctPeople.forEach(userId => {
peopleFilters.push({ peopleFilters.push({
key: userId, key: userId,
label: this._userService.getNameForId(userId) label: this._userService.getNameForId(userId)
@ -283,7 +280,7 @@ export class DossierListingScreenComponent
this.peopleFilters = processFilters(this.peopleFilters, peopleFilters); this.peopleFilters = processFilters(this.peopleFilters, peopleFilters);
const needsWorkFilters = []; const needsWorkFilters = [];
allDistinctNeedsWork.forEach((type) => { allDistinctNeedsWork.forEach(type => {
needsWorkFilters.push({ needsWorkFilters.push({
key: type, key: type,
label: this._translateService.instant('filter.' + type) label: this._translateService.instant('filter.' + type)
@ -296,7 +293,7 @@ export class DossierListingScreenComponent
this.needsWorkFilters = processFilters(this.needsWorkFilters, needsWorkFilters); this.needsWorkFilters = processFilters(this.needsWorkFilters, needsWorkFilters);
const dossierTemplateFilters = []; const dossierTemplateFilters = [];
allDistinctDossierTemplates.forEach((dossierTemplateId) => { allDistinctDossierTemplates.forEach(dossierTemplateId => {
dossierTemplateFilters.push({ dossierTemplateFilters.push({
key: dossierTemplateId, key: dossierTemplateId,
label: this._appStateService.getDossierTemplateById(dossierTemplateId).name label: this._appStateService.getDossierTemplateById(dossierTemplateId).name

View File

@ -56,8 +56,8 @@
<!-- ></redaction-circle-button>--> <!-- ></redaction-circle-button>-->
<redaction-file-download-btn <redaction-file-download-btn
[file]="allEntities"
[dossier]="activeDossier" [dossier]="activeDossier"
[file]="allEntities"
tooltipPosition="below" tooltipPosition="below"
></redaction-file-download-btn> ></redaction-file-download-btn>
@ -311,9 +311,9 @@
</cdk-virtual-scroll-viewport> </cdk-virtual-scroll-viewport>
<redaction-scroll-button <redaction-scroll-button
[scrollViewport]="scrollBar"
[itemSize]="itemSize"
*ngIf="scrollBar && itemSize > 0" *ngIf="scrollBar && itemSize > 0"
[itemSize]="itemSize"
[scrollViewport]="scrollBar"
></redaction-scroll-button> ></redaction-scroll-button>
</div> </div>

View File

@ -49,6 +49,7 @@ export class DossierOverviewScreenComponent
statusFilters: FilterModel[]; statusFilters: FilterModel[];
} = { needsWorkFilters: [], statusFilters: [] }; } = { needsWorkFilters: [], statusFilters: [] };
readonly itemSize = 80; readonly itemSize = 80;
@ViewChild(CdkVirtualScrollViewport) scrollBar: CdkVirtualScrollViewport;
protected readonly _searchKey = 'searchField'; protected readonly _searchKey = 'searchField';
protected readonly _selectionKey = 'fileId'; protected readonly _selectionKey = 'fileId';
protected readonly _sortKey = 'dossier-overview'; protected readonly _sortKey = 'dossier-overview';
@ -59,9 +60,6 @@ export class DossierOverviewScreenComponent
private _fileChangedSub: Subscription; private _fileChangedSub: Subscription;
private _lastScrollPosition: number; private _lastScrollPosition: number;
private _lastOpenedFileId = ''; private _lastOpenedFileId = '';
@ViewChild(CdkVirtualScrollViewport) scrollBar: CdkVirtualScrollViewport;
@ViewChild('statusFilter') private _statusFilterComponent: FilterComponent; @ViewChild('statusFilter') private _statusFilterComponent: FilterComponent;
@ViewChild('peopleFilter') private _peopleFilterComponent: FilterComponent; @ViewChild('peopleFilter') private _peopleFilterComponent: FilterComponent;
@ViewChild('needsWorkFilter') private _needsWorkFilterComponent: FilterComponent; @ViewChild('needsWorkFilter') private _needsWorkFilterComponent: FilterComponent;
@ -119,7 +117,7 @@ export class DossierOverviewScreenComponent
} }
ngOnInit(): void { ngOnInit(): void {
this._userPreferenceControllerService.getAllUserAttributes().subscribe((attributes) => { this._userPreferenceControllerService.getAllUserAttributes().subscribe(attributes => {
if (attributes === null || attributes === undefined) return; if (attributes === null || attributes === undefined) return;
const key = 'Dossier-Recent-' + this.activeDossier.dossierId; const key = 'Dossier-Recent-' + this.activeDossier.dossierId;
if (attributes[key]?.length > 0) { if (attributes[key]?.length > 0) {
@ -145,7 +143,7 @@ export class DossierOverviewScreenComponent
}); });
this._routerEventsScrollPositionSub = this._router.events this._routerEventsScrollPositionSub = this._router.events
.pipe(filter((events) => events instanceof NavigationStart)) .pipe(filter(events => events instanceof NavigationStart))
.subscribe((event: NavigationStart) => { .subscribe((event: NavigationStart) => {
if (!event.url.endsWith(this._appStateService.activeDossierId)) { if (!event.url.endsWith(this._appStateService.activeDossierId)) {
this._lastScrollPosition = this.scrollBar.measureScrollOffset('top'); this._lastScrollPosition = this.scrollBar.measureScrollOffset('top');
@ -286,8 +284,8 @@ export class DossierOverviewScreenComponent
protected _preFilter() { protected _preFilter() {
this.detailsContainerFilters = { this.detailsContainerFilters = {
needsWorkFilters: this.needsWorkFilters.map((f) => ({ ...f })), needsWorkFilters: this.needsWorkFilters.map(f => ({ ...f })),
statusFilters: this.statusFilters.map((f) => ({ ...f })) statusFilters: this.statusFilters.map(f => ({ ...f }))
}; };
} }
@ -314,18 +312,18 @@ export class DossierOverviewScreenComponent
const allDistinctNeedsWork = new Set<string>(); const allDistinctNeedsWork = new Set<string>();
// All people // All people
this.allEntities.forEach((file) => allDistinctPeople.add(file.currentReviewer)); this.allEntities.forEach(file => allDistinctPeople.add(file.currentReviewer));
// File statuses // File statuses
this.allEntities.forEach((file) => allDistinctFileStatusWrapper.add(file.status)); this.allEntities.forEach(file => allDistinctFileStatusWrapper.add(file.status));
// Added dates // Added dates
this.allEntities.forEach((file) => this.allEntities.forEach(file =>
allDistinctAddedDates.add(moment(file.added).format('DD/MM/YYYY')) allDistinctAddedDates.add(moment(file.added).format('DD/MM/YYYY'))
); );
// Needs work // Needs work
this.allEntities.forEach((file) => { this.allEntities.forEach(file => {
if (this.permissionsService.fileRequiresReanalysis(file)) if (this.permissionsService.fileRequiresReanalysis(file))
allDistinctNeedsWork.add('analysis'); allDistinctNeedsWork.add('analysis');
if (file.hintsOnly) allDistinctNeedsWork.add('hint'); if (file.hintsOnly) allDistinctNeedsWork.add('hint');
@ -337,7 +335,7 @@ export class DossierOverviewScreenComponent
}); });
const statusFilters = []; const statusFilters = [];
allDistinctFileStatusWrapper.forEach((status) => { allDistinctFileStatusWrapper.forEach(status => {
statusFilters.push({ statusFilters.push({
key: status, key: status,
label: this._translateService.instant(status) label: this._translateService.instant(status)
@ -356,7 +354,7 @@ export class DossierOverviewScreenComponent
label: this._translateService.instant('initials-avatar.unassigned') label: this._translateService.instant('initials-avatar.unassigned')
}); });
} }
allDistinctPeople.forEach((userId) => { allDistinctPeople.forEach(userId => {
peopleFilters.push({ peopleFilters.push({
key: userId, key: userId,
label: this._userService.getNameForId(userId) label: this._userService.getNameForId(userId)
@ -365,7 +363,7 @@ export class DossierOverviewScreenComponent
this.peopleFilters = processFilters(this.peopleFilters, peopleFilters); this.peopleFilters = processFilters(this.peopleFilters, peopleFilters);
const needsWorkFilters = []; const needsWorkFilters = [];
allDistinctNeedsWork.forEach((type) => { allDistinctNeedsWork.forEach(type => {
needsWorkFilters.push({ needsWorkFilters.push({
key: type, key: type,
label: this._translateService.instant('filter.' + type) label: this._translateService.instant('filter.' + type)

View File

@ -118,8 +118,8 @@
permissionsService.canAssignUser() && permissionsService.canAssignUser() &&
appStateService.activeFile.currentReviewer appStateService.activeFile.currentReviewer
" "
icon="red:edit"
[tooltip]="assignTooltip" [tooltip]="assignTooltip"
icon="red:edit"
tooltipPosition="below" tooltipPosition="below"
> >
</redaction-circle-button> </redaction-circle-button>

View File

@ -174,16 +174,16 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
} }
updateViewMode() { updateViewMode() {
const annotations = this._getAnnotations((a) => a.getCustomData('redacto-manager')); const annotations = this._getAnnotations(a => a.getCustomData('redacto-manager'));
const redactions = annotations.filter((a) => a.getCustomData('redaction')); const redactions = annotations.filter(a => a.getCustomData('redaction'));
switch (this.viewMode) { switch (this.viewMode) {
case 'STANDARD': { case 'STANDARD': {
this._setAnnotationsColor(redactions, 'annotationColor'); this._setAnnotationsColor(redactions, 'annotationColor');
const standardEntries = annotations.filter( const standardEntries = annotations.filter(
(a) => !a.getCustomData('changeLogRemoved') a => !a.getCustomData('changeLogRemoved')
); );
const nonStandardEntries = annotations.filter((a) => const nonStandardEntries = annotations.filter(a =>
a.getCustomData('changeLogRemoved') a.getCustomData('changeLogRemoved')
); );
this._show(standardEntries); this._show(standardEntries);
@ -191,19 +191,15 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
break; break;
} }
case 'DELTA': { case 'DELTA': {
const changeLogEntries = annotations.filter((a) => a.getCustomData('changeLog')); const changeLogEntries = annotations.filter(a => a.getCustomData('changeLog'));
const nonChangeLogEntries = annotations.filter( const nonChangeLogEntries = annotations.filter(a => !a.getCustomData('changeLog'));
(a) => !a.getCustomData('changeLog')
);
this._setAnnotationsColor(redactions, 'annotationColor'); this._setAnnotationsColor(redactions, 'annotationColor');
this._show(changeLogEntries); this._show(changeLogEntries);
this._hide(nonChangeLogEntries); this._hide(nonChangeLogEntries);
break; break;
} }
case 'REDACTED': { case 'REDACTED': {
const nonRedactionEntries = annotations.filter( const nonRedactionEntries = annotations.filter(a => !a.getCustomData('redaction'));
(a) => !a.getCustomData('redaction')
);
this._setAnnotationsColor(redactions, 'redactionColor'); this._setAnnotationsColor(redactions, 'redactionColor');
this._show(redactions); this._show(redactions);
this._hide(nonRedactionEntries); this._hide(nonRedactionEntries);
@ -294,10 +290,10 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
handleAnnotationSelected(annotationIds: string[]) { handleAnnotationSelected(annotationIds: string[]) {
this.selectedAnnotations = annotationIds this.selectedAnnotations = annotationIds
.map((annotationId) => .map(annotationId =>
this.annotations.find((annotationWrapper) => annotationWrapper.id === annotationId) this.annotations.find(annotationWrapper => annotationWrapper.id === annotationId)
) )
.filter((ann) => ann !== undefined); .filter(ann => ann !== undefined);
if (this.selectedAnnotations.length > 1) { if (this.selectedAnnotations.length > 1) {
this._workloadComponent.multiSelectActive = true; this._workloadComponent.multiSelectActive = true;
} }
@ -338,9 +334,9 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
this.activeViewer.annotManager.deleteAnnotation(annotation); this.activeViewer.annotManager.deleteAnnotation(annotation);
this.fileData.fileStatus = await this.appStateService.reloadActiveFile(); this.fileData.fileStatus = await this.appStateService.reloadActiveFile();
const distinctPages = $event.manualRedactionEntry.positions const distinctPages = $event.manualRedactionEntry.positions
.map((p) => p.page) .map(p => p.page)
.filter((item, pos, self) => self.indexOf(item) === pos); .filter((item, pos, self) => self.indexOf(item) === pos);
distinctPages.forEach((page) => { distinctPages.forEach(page => {
this._cleanupAndRedrawManualAnnotationsForEntirePage(page); this._cleanupAndRedrawManualAnnotationsForEntirePage(page);
}); });
} }
@ -507,7 +503,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
this.fileData.fileStatus.lastUploaded, this.fileData.fileStatus.lastUploaded,
'response' 'response'
) )
.subscribe((data) => { .subscribe(data => {
download(data, this.fileData.fileStatus.filename); download(data, this.fileData.fileStatus.filename);
}); });
} }
@ -566,7 +562,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
private _loadFileData(performUpdate: boolean = false) { private _loadFileData(performUpdate: boolean = false) {
return this._fileDownloadService.loadActiveFileData().pipe( return this._fileDownloadService.loadActiveFileData().pipe(
tap((fileDataModel) => { tap(fileDataModel => {
if (fileDataModel.fileStatus.isWorkable) { if (fileDataModel.fileStatus.isWorkable) {
if (performUpdate) { if (performUpdate) {
this.fileData.redactionLog = fileDataModel.redactionLog; this.fileData.redactionLog = fileDataModel.redactionLog;
@ -600,44 +596,40 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
/* Get the documentElement (<html>) to display the page in fullscreen */ /* Get the documentElement (<html>) to display the page in fullscreen */
private _cleanupAndRedrawManualAnnotations() { private _cleanupAndRedrawManualAnnotations() {
this._fileDownloadService this._fileDownloadService.loadActiveFileManualAnnotations().subscribe(manualRedactions => {
.loadActiveFileManualAnnotations() this.fileData.manualRedactions = manualRedactions;
.subscribe((manualRedactions) => { this.rebuildFilters();
this.fileData.manualRedactions = manualRedactions; this._annotationDrawService.drawAnnotations(
this.rebuildFilters(); this._instance,
this._annotationDrawService.drawAnnotations( this.annotationData.allAnnotations,
this._instance, this.hideSkipped
this.annotationData.allAnnotations, );
this.hideSkipped });
);
});
} }
private async _cleanupAndRedrawManualAnnotationsForEntirePage(page: number) { private async _cleanupAndRedrawManualAnnotationsForEntirePage(page: number) {
const currentPageAnnotations = this.annotations.filter((a) => a.pageNumber === page); const currentPageAnnotations = this.annotations.filter(a => a.pageNumber === page);
const currentPageAnnotationIds = currentPageAnnotations.map((a) => a.id); const currentPageAnnotationIds = currentPageAnnotations.map(a => a.id);
this.fileData.fileStatus = await this.appStateService.reloadActiveFile(); this.fileData.fileStatus = await this.appStateService.reloadActiveFile();
this._fileDownloadService this._fileDownloadService.loadActiveFileManualAnnotations().subscribe(manualRedactions => {
.loadActiveFileManualAnnotations() this.fileData.manualRedactions = manualRedactions;
.subscribe((manualRedactions) => { this.rebuildFilters();
this.fileData.manualRedactions = manualRedactions; if (this.viewMode === 'STANDARD') {
this.rebuildFilters(); currentPageAnnotationIds.forEach(id => {
if (this.viewMode === 'STANDARD') { this._findAndDeleteAnnotation(id);
currentPageAnnotationIds.forEach((id) => { });
this._findAndDeleteAnnotation(id); const newPageAnnotations = this.annotations.filter(
}); item => item.pageNumber === page
const newPageAnnotations = this.annotations.filter( );
(item) => item.pageNumber === page this._handleDeltaAnnotationFilters(currentPageAnnotations, newPageAnnotations);
); this._annotationDrawService.drawAnnotations(
this._handleDeltaAnnotationFilters(currentPageAnnotations, newPageAnnotations); this._instance,
this._annotationDrawService.drawAnnotations( newPageAnnotations,
this._instance, this.hideSkipped
newPageAnnotations, );
this.hideSkipped }
); });
}
});
} }
private _handleDeltaAnnotationFilters( private _handleDeltaAnnotationFilters(
@ -645,8 +637,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
newPageAnnotations: AnnotationWrapper[] newPageAnnotations: AnnotationWrapper[]
) { ) {
const hasAnyFilterSet = const hasAnyFilterSet =
this.primaryFilters.find((f) => f.checked || f.indeterminate) || this.primaryFilters.find(f => f.checked || f.indeterminate) ||
this.secondaryFilters.find((f) => f.checked || f.indeterminate); this.secondaryFilters.find(f => f.checked || f.indeterminate);
if (hasAnyFilterSet) { if (hasAnyFilterSet) {
const oldPageSpecificFilters = const oldPageSpecificFilters =
this._annotationProcessingService.getAnnotationFilter(currentPageAnnotations); this._annotationProcessingService.getAnnotationFilter(currentPageAnnotations);
@ -706,7 +698,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
} }
private _handleIgnoreAnnotationsDrawing() { private _handleIgnoreAnnotationsDrawing() {
const ignored = this._getAnnotations((a) => a.getCustomData('skipped')); const ignored = this._getAnnotations(a => a.getCustomData('skipped'));
return this.hideSkipped ? this._hide(ignored) : this._show(ignored); return this.hideSkipped ? this._hide(ignored) : this._show(ignored);
} }
@ -724,7 +716,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
} }
private _setAnnotationsColor(annotations, customData: string) { private _setAnnotationsColor(annotations, customData: string) {
annotations.forEach((annotation) => { annotations.forEach(annotation => {
annotation['StrokeColor'] = annotation.getCustomData(customData); annotation['StrokeColor'] = annotation.getCustomData(customData);
}); });
} }

View File

@ -27,7 +27,7 @@ export class AnnotationActionsService {
annotationsChanged: EventEmitter<AnnotationWrapper> annotationsChanged: EventEmitter<AnnotationWrapper>
) { ) {
$event?.stopPropagation(); $event?.stopPropagation();
annotations.forEach((annotation) => { annotations.forEach(annotation => {
this._processObsAndEmit( this._processObsAndEmit(
this._manualAnnotationService.approveRequest( this._manualAnnotationService.approveRequest(
annotation.id, annotation.id,
@ -45,7 +45,7 @@ export class AnnotationActionsService {
annotationsChanged: EventEmitter<AnnotationWrapper> annotationsChanged: EventEmitter<AnnotationWrapper>
) { ) {
$event?.stopPropagation(); $event?.stopPropagation();
annotations.forEach((annotation) => { annotations.forEach(annotation => {
this._processObsAndEmit( this._processObsAndEmit(
this._manualAnnotationService.declineOrRemoveRequest(annotation), this._manualAnnotationService.declineOrRemoveRequest(annotation),
annotation, annotation,
@ -60,8 +60,8 @@ export class AnnotationActionsService {
annotationsChanged: EventEmitter<AnnotationWrapper> annotationsChanged: EventEmitter<AnnotationWrapper>
) { ) {
$event?.stopPropagation(); $event?.stopPropagation();
this._dialogService.openForceRedactionDialog($event, (request) => { this._dialogService.openForceRedactionDialog($event, request => {
annotations.forEach((annotation) => { annotations.forEach(annotation => {
this._processObsAndEmit( this._processObsAndEmit(
this._manualAnnotationService.forceRedaction({ this._manualAnnotationService.forceRedaction({
...request, ...request,
@ -85,7 +85,7 @@ export class AnnotationActionsService {
annotations, annotations,
removeFromDictionary, removeFromDictionary,
() => { () => {
annotations.forEach((annotation) => { annotations.forEach(annotation => {
this._processObsAndEmit( this._processObsAndEmit(
this._manualAnnotationService.removeOrSuggestRemoveAnnotation( this._manualAnnotationService.removeOrSuggestRemoveAnnotation(
annotation, annotation,
@ -104,7 +104,7 @@ export class AnnotationActionsService {
annotations: AnnotationWrapper[], annotations: AnnotationWrapper[],
annotationsChanged: EventEmitter<AnnotationWrapper> annotationsChanged: EventEmitter<AnnotationWrapper>
) { ) {
annotations.forEach((annotation) => { annotations.forEach(annotation => {
const permissions = AnnotationPermissions.forUser( const permissions = AnnotationPermissions.forUser(
this._permissionsService.isApprover(), this._permissionsService.isApprover(),
this._permissionsService.currentUser, this._permissionsService.currentUser,
@ -125,7 +125,7 @@ export class AnnotationActionsService {
) { ) {
$event?.stopPropagation(); $event?.stopPropagation();
annotations.forEach((annotation) => { annotations.forEach(annotation => {
this._processObsAndEmit( this._processObsAndEmit(
this._manualAnnotationService.undoRequest(annotation), this._manualAnnotationService.undoRequest(annotation),
annotation, annotation,
@ -141,7 +141,7 @@ export class AnnotationActionsService {
) { ) {
$event?.stopPropagation(); $event?.stopPropagation();
annotations.forEach((annotation) => { annotations.forEach(annotation => {
this._processObsAndEmit( this._processObsAndEmit(
this._manualAnnotationService.addRecommendation(annotation), this._manualAnnotationService.addRecommendation(annotation),
annotation, annotation,
@ -156,7 +156,7 @@ export class AnnotationActionsService {
): Record<string, unknown>[] { ): Record<string, unknown>[] {
const availableActions = []; const availableActions = [];
const annotationPermissions = annotations.map((a) => ({ const annotationPermissions = annotations.map(a => ({
annotation: a, annotation: a,
permissions: AnnotationPermissions.forUser( permissions: AnnotationPermissions.forUser(
this._permissionsService.isApprover(), this._permissionsService.isApprover(),

View File

@ -25,7 +25,7 @@ export class AnnotationDrawService {
hideSkipped: boolean = false hideSkipped: boolean = false
) { ) {
const annotations = []; const annotations = [];
annotationWrappers.forEach((annotation) => { annotationWrappers.forEach(annotation => {
annotations.push(this.computeAnnotation(activeViewer, annotation, hideSkipped)); annotations.push(this.computeAnnotation(activeViewer, annotation, hideSkipped));
}); });
@ -39,7 +39,7 @@ export class AnnotationDrawService {
this._appStateService.activeDossierId, this._appStateService.activeDossierId,
this._appStateService.activeFileId this._appStateService.activeFileId
) )
.subscribe((sectionGrid) => { .subscribe(sectionGrid => {
this.drawSections(activeViewer, sectionGrid); this.drawSections(activeViewer, sectionGrid);
}); });
} }
@ -49,7 +49,7 @@ export class AnnotationDrawService {
const sections = []; const sections = [];
for (const page of Object.keys(sectionGrid.rectanglesPerPage)) { for (const page of Object.keys(sectionGrid.rectanglesPerPage)) {
const sectionRectangles: SectionRectangle[] = sectionGrid.rectanglesPerPage[page]; const sectionRectangles: SectionRectangle[] = sectionGrid.rectanglesPerPage[page];
sectionRectangles.forEach((sectionRectangle) => { sectionRectangles.forEach(sectionRectangle => {
sections.push( sections.push(
this.computeSection(activeViewer, parseInt(page, 10), sectionRectangle) this.computeSection(activeViewer, parseInt(page, 10), sectionRectangle)
); );
@ -174,7 +174,7 @@ export class AnnotationDrawService {
pageNumber: number pageNumber: number
): any[] { ): any[] {
const pageHeight = activeViewer.docViewer.getPageHeight(pageNumber); const pageHeight = activeViewer.docViewer.getPageHeight(pageNumber);
return positions.map((p) => this._rectangleToQuad(p, activeViewer, pageHeight)); return positions.map(p => this._rectangleToQuad(p, activeViewer, pageHeight));
} }
private _rectangleToQuad( private _rectangleToQuad(

View File

@ -24,7 +24,7 @@ export class AnnotationProcessingService {
const filterMap = new Map<string, FilterModel>(); const filterMap = new Map<string, FilterModel>();
const filters: FilterModel[] = []; const filters: FilterModel[] = [];
annotations?.forEach((a) => { annotations?.forEach(a => {
const topLevelFilter = const topLevelFilter =
a.superType !== 'hint' && a.superType !== 'hint' &&
a.superType !== 'redaction' && a.superType !== 'redaction' &&
@ -75,20 +75,18 @@ export class AnnotationProcessingService {
): { [key: number]: { annotations: AnnotationWrapper[] } } { ): { [key: number]: { annotations: AnnotationWrapper[] } } {
const obj = {}; const obj = {};
const primaryFlatFilters = this._getFlatFilters(primaryFilters, (f) => f.checked); const primaryFlatFilters = this._getFlatFilters(primaryFilters, f => f.checked);
const secondaryFlatFilters = this._getFlatFilters(secondaryFilters, (f) => f.checked); const secondaryFlatFilters = this._getFlatFilters(secondaryFilters, f => f.checked);
for (const annotation of annotations) { for (const annotation of annotations) {
if ( if (!this._matchesOne(primaryFlatFilters, f => this._checkByFilterKey(f, annotation))) {
!this._matchesOne(primaryFlatFilters, (f) => this._checkByFilterKey(f, annotation))
) {
continue; continue;
} }
if ( if (
!this._matchesAll( !this._matchesAll(
secondaryFlatFilters, secondaryFlatFilters,
(f) => f =>
(!!f.checker && f.checker(annotation)) || (!!f.checker && f.checker(annotation)) ||
this._checkByFilterKey(f, annotation) this._checkByFilterKey(f, annotation)
) )
@ -112,7 +110,7 @@ export class AnnotationProcessingService {
obj[pageNumber][annotation.superType]++; obj[pageNumber][annotation.superType]++;
} }
Object.keys(obj).map((page) => { Object.keys(obj).map(page => {
obj[page].annotations = this._sortAnnotations(obj[page].annotations); obj[page].annotations = this._sortAnnotations(obj[page].annotations);
}); });
@ -139,12 +137,12 @@ export class AnnotationProcessingService {
private _getFlatFilters(filters: FilterModel[], filterBy?: (f: FilterModel) => boolean) { private _getFlatFilters(filters: FilterModel[], filterBy?: (f: FilterModel) => boolean) {
const flatFilters: FilterModel[] = []; const flatFilters: FilterModel[] = [];
filters.forEach((filter) => { filters.forEach(filter => {
flatFilters.push(filter); flatFilters.push(filter);
flatFilters.push(...filter.filters); flatFilters.push(...filter.filters);
}); });
return filterBy ? flatFilters.filter((f) => filterBy(f)) : flatFilters; return filterBy ? flatFilters.filter(f => filterBy(f)) : flatFilters;
} }
private _matchesOne = ( private _matchesOne = (

View File

@ -2,10 +2,10 @@ import { Injectable } from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { import {
DictionaryControllerService, DictionaryControllerService,
DossierTemplateControllerService,
FileManagementControllerService, FileManagementControllerService,
FileStatus, FileStatus,
ManualRedactionControllerService, ManualRedactionControllerService
DossierTemplateControllerService
} from '@redaction/red-ui-http'; } from '@redaction/red-ui-http';
import { AddDossierDialogComponent } from '../dialogs/add-dossier-dialog/add-dossier-dialog.component'; import { AddDossierDialogComponent } from '../dialogs/add-dossier-dialog/add-dossier-dialog.component';
import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component'; import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component';
@ -65,7 +65,7 @@ export class DossiersDialogService {
}) })
}); });
ref.afterClosed().subscribe(async (result) => { ref.afterClosed().subscribe(async result => {
if (result) { if (result) {
try { try {
await this._fileManagementControllerService await this._fileManagementControllerService
@ -96,7 +96,7 @@ export class DossiersDialogService {
data: $event data: $event
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (cb) { if (cb) {
cb(result); cb(result);
} }
@ -113,11 +113,11 @@ export class DossiersDialogService {
$event?.stopPropagation(); $event?.stopPropagation();
const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig);
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result) { if (result) {
this._manualAnnotationService this._manualAnnotationService
.approveRequest(annotation.id) .approveRequest(annotation.id)
.subscribe((acceptResult) => { .subscribe(acceptResult => {
if (callback) { if (callback) {
callback(acceptResult); callback(acceptResult);
} }
@ -140,7 +140,7 @@ export class DossiersDialogService {
maxWidth: '90vw' maxWidth: '90vw'
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result) { if (result) {
this._manualAnnotationService.declineOrRemoveRequest(annotation).subscribe(() => { this._manualAnnotationService.declineOrRemoveRequest(annotation).subscribe(() => {
rejectCallback(); rejectCallback();
@ -159,7 +159,7 @@ export class DossiersDialogService {
const ref = this._dialog.open(ForceRedactionDialogComponent, { const ref = this._dialog.open(ForceRedactionDialogComponent, {
...dialogConfig ...dialogConfig
}); });
ref.afterClosed().subscribe(async (result) => { ref.afterClosed().subscribe(async result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -178,7 +178,7 @@ export class DossiersDialogService {
...dialogConfig, ...dialogConfig,
data: { annotationsToRemove: annotations, removeFromDictionary: removeFromDictionary } data: { annotationsToRemove: annotations, removeFromDictionary: removeFromDictionary }
}); });
ref.afterClosed().subscribe(async (result) => { ref.afterClosed().subscribe(async result => {
if (result) { if (result) {
if (cb) cb(); if (cb) cb();
} }
@ -200,7 +200,7 @@ export class DossiersDialogService {
}) })
}); });
ref.afterClosed().subscribe(async (result) => { ref.afterClosed().subscribe(async result => {
if (result) { if (result) {
await this._appStateService.deleteDossier(dossier); await this._appStateService.deleteDossier(dossier);
if (cb) cb(); if (cb) cb();
@ -219,7 +219,7 @@ export class DossiersDialogService {
...dialogConfig, ...dialogConfig,
data: { dossierWrapper } data: { dossierWrapper }
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (cb) { if (cb) {
cb(result); cb(result);
} }
@ -240,7 +240,7 @@ export class DossiersDialogService {
autoFocus: false, autoFocus: false,
data: dossier data: dossier
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (cb) { if (cb) {
cb(result); cb(result);
} }
@ -256,7 +256,7 @@ export class DossiersDialogService {
question: 'confirmation-dialog.assign-file-to-me.question' question: 'confirmation-dialog.assign-file-to-me.question'
}) })
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) cb(result); if (result && cb) cb(result);
}); });
} }
@ -286,7 +286,7 @@ export class DossiersDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) cb(result); if (result && cb) cb(result);
}); });
@ -318,7 +318,7 @@ export class DossiersDialogService {
autoFocus: true autoFocus: true
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result && cb) { if (result && cb) {
cb(result); cb(result);
} }
@ -339,7 +339,7 @@ export class DossiersDialogService {
maxWidth: '90vw' maxWidth: '90vw'
}); });
ref.afterClosed().subscribe((result) => { ref.afterClosed().subscribe(result => {
if (result) { if (result) {
this._manualAnnotationService this._manualAnnotationService
.removeOrSuggestRemoveAnnotation(annotation) .removeOrSuggestRemoveAnnotation(annotation)

View File

@ -112,7 +112,7 @@ export class FileActionService {
} }
return this._statusControllerService.setStatusUnderApprovalForList( return this._statusControllerService.setStatusUnderApprovalForList(
fileStatus.map((f) => f.fileId), fileStatus.map(f => f.fileId),
this._appStateService.activeDossierId, this._appStateService.activeDossierId,
approverId approverId
); );
@ -123,7 +123,7 @@ export class FileActionService {
fileStatus = [fileStatus]; fileStatus = [fileStatus];
} }
return this._statusControllerService.setStatusApprovedForList( return this._statusControllerService.setStatusApprovedForList(
fileStatus.map((f) => f.fileId), fileStatus.map(f => f.fileId),
this._appStateService.activeDossierId this._appStateService.activeDossierId
); );
} }
@ -133,7 +133,7 @@ export class FileActionService {
fileStatus = [fileStatus]; fileStatus = [fileStatus];
} }
return this._statusControllerService.setStatusUnderReviewForList( return this._statusControllerService.setStatusUnderReviewForList(
fileStatus.map((f) => f.fileId), fileStatus.map(f => f.fileId),
this._appStateService.activeDossierId this._appStateService.activeDossierId
); );
} }
@ -143,7 +143,7 @@ export class FileActionService {
fileStatus = [fileStatus]; fileStatus = [fileStatus];
} }
return this._reanalysisControllerService.ocrFiles( return this._reanalysisControllerService.ocrFiles(
fileStatus.map((f) => f.fileId), fileStatus.map(f => f.fileId),
this._appStateService.activeDossierId this._appStateService.activeDossierId
); );
} }
@ -170,7 +170,7 @@ export class FileActionService {
} }
await this._statusControllerService await this._statusControllerService
.setFileReviewerForList( .setFileReviewerForList(
fileStatus.map((f) => f.fileId), fileStatus.map(f => f.fileId),
this._appStateService.activeDossierId, this._appStateService.activeDossierId,
this._userService.userId this._userService.userId
) )

View File

@ -94,7 +94,7 @@ export class ManualAnnotationService {
.pipe( .pipe(
tap( tap(
() => this._notify(this._getMessage('approve', addToDictionary)), () => this._notify(this._getMessage('approve', addToDictionary)),
(error) => error =>
this._notify( this._notify(
this._getMessage('approve', addToDictionary, true), this._getMessage('approve', addToDictionary, true),
NotificationType.ERROR, NotificationType.ERROR,
@ -117,7 +117,7 @@ export class ManualAnnotationService {
this._notify( this._notify(
this._getMessage('undo', annotationWrapper.isModifyDictionary) this._getMessage('undo', annotationWrapper.isModifyDictionary)
), ),
(error) => error =>
this._notify( this._notify(
this._getMessage('undo', annotationWrapper.isModifyDictionary, true), this._getMessage('undo', annotationWrapper.isModifyDictionary, true),
NotificationType.ERROR, NotificationType.ERROR,
@ -144,7 +144,7 @@ export class ManualAnnotationService {
this._notify( this._notify(
this._getMessage('decline', annotationWrapper.isModifyDictionary) this._getMessage('decline', annotationWrapper.isModifyDictionary)
), ),
(error) => error =>
this._notify( this._notify(
this._getMessage( this._getMessage(
'decline', 'decline',
@ -169,7 +169,7 @@ export class ManualAnnotationService {
this._notify( this._notify(
this._getMessage('undo', annotationWrapper.isModifyDictionary) this._getMessage('undo', annotationWrapper.isModifyDictionary)
), ),
(error) => error =>
this._notify( this._notify(
this._getMessage( this._getMessage(
'undo', 'undo',
@ -203,7 +203,7 @@ export class ManualAnnotationService {
.pipe( .pipe(
tap( tap(
() => this._notify(this._getMessage('decline', false)), () => this._notify(this._getMessage('decline', false)),
(error) => error =>
this._notify( this._notify(
this._getMessage('decline', false, true), this._getMessage('decline', false, true),
NotificationType.ERROR, NotificationType.ERROR,
@ -225,7 +225,7 @@ export class ManualAnnotationService {
.pipe( .pipe(
tap( tap(
() => this._notify(this._getMessage('remove', removeFromDictionary)), () => this._notify(this._getMessage('remove', removeFromDictionary)),
(error) => error =>
this._notify( this._notify(
this._getMessage('remove', removeFromDictionary, true), this._getMessage('remove', removeFromDictionary, true),
NotificationType.ERROR, NotificationType.ERROR,
@ -249,7 +249,7 @@ export class ManualAnnotationService {
tap( tap(
() => () =>
this._notify(this._getMessage('request-remove', removeFromDictionary)), this._notify(this._getMessage('request-remove', removeFromDictionary)),
(error) => error =>
this._notify( this._notify(
this._getMessage('request-remove', removeFromDictionary, true), this._getMessage('request-remove', removeFromDictionary, true),
NotificationType.ERROR, NotificationType.ERROR,
@ -292,7 +292,7 @@ export class ManualAnnotationService {
.pipe( .pipe(
tap( tap(
() => this._notify(this._getMessage('suggest', false)), () => this._notify(this._getMessage('suggest', false)),
(error) => error =>
this._notify( this._notify(
this._getMessage('suggest', false, true), this._getMessage('suggest', false, true),
NotificationType.ERROR, NotificationType.ERROR,
@ -312,7 +312,7 @@ export class ManualAnnotationService {
.pipe( .pipe(
tap( tap(
() => this._notify(this._getMessage('add', false)), () => this._notify(this._getMessage('add', false)),
(error) => error =>
this._notify( this._notify(
this._getMessage('add', false, true), this._getMessage('add', false, true),
NotificationType.ERROR, NotificationType.ERROR,
@ -335,7 +335,7 @@ export class ManualAnnotationService {
this._notify( this._notify(
this._getMessage('suggest', manualRedactionEntry.addToDictionary) this._getMessage('suggest', manualRedactionEntry.addToDictionary)
), ),
(error) => error =>
this._notify( this._notify(
this._getMessage('suggest', manualRedactionEntry.addToDictionary, true), this._getMessage('suggest', manualRedactionEntry.addToDictionary, true),
NotificationType.ERROR, NotificationType.ERROR,
@ -356,7 +356,7 @@ export class ManualAnnotationService {
tap( tap(
() => () =>
this._notify(this._getMessage('add', manualRedactionEntry.addToDictionary)), this._notify(this._getMessage('add', manualRedactionEntry.addToDictionary)),
(error) => error =>
this._notify( this._notify(
this._getMessage('add', manualRedactionEntry.addToDictionary, true), this._getMessage('add', manualRedactionEntry.addToDictionary, true),
NotificationType.ERROR, NotificationType.ERROR,

View File

@ -58,7 +58,7 @@ export class PdfViewerDataService {
redactionChangeLogObs, redactionChangeLogObs,
manualRedactionsObs, manualRedactionsObs,
viewedPagesObs viewedPagesObs
]).pipe(map((data) => new FileDataModel(this._appStateService.activeFile, ...data))); ]).pipe(map(data => new FileDataModel(this._appStateService.activeFile, ...data)));
} }
getViewedPagesForActiveFile() { getViewedPagesForActiveFile() {

View File

@ -38,7 +38,7 @@ export abstract class BaseListingComponent<T = any> {
get hasActiveFilters() { get hasActiveFilters() {
return ( return (
this._filterComponents this._filterComponents
.filter((f) => !!f) .filter(f => !!f)
.reduce((prev, component) => prev || component?.hasActiveFilters, false) || .reduce((prev, component) => prev || component?.hasActiveFilters, false) ||
this.searchForm.get('query').value this.searchForm.get('query').value
); );
@ -106,7 +106,7 @@ export abstract class BaseListingComponent<T = any> {
} }
resetFilters() { resetFilters() {
for (const filterComponent of this._filterComponents.filter((f) => !!f)) { for (const filterComponent of this._filterComponents.filter(f => !!f)) {
filterComponent.deactivateAllFilters(); filterComponent.deactivateAllFilters();
} }
this.filtersChanged(); this.filtersChanged();
@ -130,7 +130,7 @@ export abstract class BaseListingComponent<T = any> {
this.selectedEntitiesIds = []; this.selectedEntitiesIds = [];
} else { } else {
this.selectedEntitiesIds = this.displayedEntities.map( this.selectedEntitiesIds = this.displayedEntities.map(
(entity) => entity[this._getSelectionKey] entity => entity[this._getSelectionKey]
); );
} }
} }
@ -161,7 +161,7 @@ export abstract class BaseListingComponent<T = any> {
protected _executeSearchImmediately() { protected _executeSearchImmediately() {
this.displayedEntities = ( this.displayedEntities = (
this._filters.length ? this.filteredEntities : this.allEntities this._filters.length ? this.filteredEntities : this.allEntities
).filter((entity) => ).filter(entity =>
this._searchField(entity) this._searchField(entity)
.toLowerCase() .toLowerCase()
.includes(this.searchForm.get('query').value.toLowerCase()) .includes(this.searchForm.get('query').value.toLowerCase())
@ -172,8 +172,8 @@ export abstract class BaseListingComponent<T = any> {
protected _updateSelection() { protected _updateSelection() {
if (this._selectionKey) { if (this._selectionKey) {
this.selectedEntitiesIds = this.displayedEntities this.selectedEntitiesIds = this.displayedEntities
.map((entity) => entity[this._getSelectionKey]) .map(entity => entity[this._getSelectionKey])
.filter((id) => this.selectedEntitiesIds.includes(id)); .filter(id => this.selectedEntitiesIds.includes(id));
} }
} }

View File

@ -62,11 +62,11 @@ export class FilterComponent implements OnChanges {
ngOnChanges(): void { ngOnChanges(): void {
this.atLeastOneFilterIsExpandable = false; this.atLeastOneFilterIsExpandable = false;
this.atLeastOneSecondaryFilterIsExpandable = false; this.atLeastOneSecondaryFilterIsExpandable = false;
this.primaryFilters?.forEach((f) => { this.primaryFilters?.forEach(f => {
this.atLeastOneFilterIsExpandable = this.atLeastOneFilterIsExpandable =
this.atLeastOneFilterIsExpandable || this.isExpandable(f); this.atLeastOneFilterIsExpandable || this.isExpandable(f);
}); });
this.secondaryFilters?.forEach((f) => { this.secondaryFilters?.forEach(f => {
this.atLeastOneSecondaryFilterIsExpandable = this.atLeastOneSecondaryFilterIsExpandable =
this.atLeastOneSecondaryFilterIsExpandable || this.isExpandable(f); this.atLeastOneSecondaryFilterIsExpandable || this.isExpandable(f);
}); });
@ -83,7 +83,7 @@ export class FilterComponent implements OnChanges {
filter.checked = false; filter.checked = false;
} }
filter.indeterminate = false; filter.indeterminate = false;
filter.filters?.forEach((f) => (f.checked = filter.checked)); filter.filters?.forEach(f => (f.checked = filter.checked));
} }
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
this.applyFilters(); this.applyFilters();
@ -133,10 +133,10 @@ export class FilterComponent implements OnChanges {
private _setAllFilters(value: boolean) { private _setAllFilters(value: boolean) {
const filters = value ? this.primaryFilters : this._allFilters; const filters = value ? this.primaryFilters : this._allFilters;
filters.forEach((f) => { filters.forEach(f => {
f.checked = value; f.checked = value;
f.indeterminate = false; f.indeterminate = false;
f.filters?.forEach((ff) => { f.filters?.forEach(ff => {
ff.checked = value; ff.checked = value;
}); });
}); });

View File

@ -6,7 +6,7 @@ import { PermissionsService } from '@services/permissions.service';
export function processFilters(oldFilters: FilterModel[], newFilters: FilterModel[]) { export function processFilters(oldFilters: FilterModel[], newFilters: FilterModel[]) {
copySettings(oldFilters, newFilters); copySettings(oldFilters, newFilters);
if (newFilters) { if (newFilters) {
newFilters.forEach((filter) => { newFilters.forEach(filter => {
handleCheckedValue(filter); handleCheckedValue(filter);
}); });
} }
@ -20,17 +20,15 @@ export function handleFilterDelta(
) { ) {
const newFiltersDelta = {}; const newFiltersDelta = {};
for (const newFilter of newFilters) { for (const newFilter of newFilters) {
const oldFilter = oldFilters.find((f) => f.key === newFilter.key); const oldFilter = oldFilters.find(f => f.key === newFilter.key);
if (!oldFilter || oldFilter.matches !== newFilter.matches) { if (!oldFilter || oldFilter.matches !== newFilter.matches) {
newFiltersDelta[newFilter.key] = {}; newFiltersDelta[newFilter.key] = {};
newFilter.filters.forEach( newFilter.filters.forEach(filter => (newFiltersDelta[newFilter.key][filter.key] = {}));
(filter) => (newFiltersDelta[newFilter.key][filter.key] = {})
);
} }
if (!oldFilter) { if (!oldFilter) {
for (const childFilter of newFilter.filters) { for (const childFilter of newFilter.filters) {
const oldFilterChild = oldFilter?.filters.find((f) => f.key === childFilter.key); const oldFilterChild = oldFilter?.filters.find(f => f.key === childFilter.key);
if (!oldFilterChild || oldFilterChild.matches !== childFilter.matches) { if (!oldFilterChild || oldFilterChild.matches !== childFilter.matches) {
if (!newFiltersDelta[newFilter.key]) { if (!newFiltersDelta[newFilter.key]) {
newFiltersDelta[newFilter.key] = {}; newFiltersDelta[newFilter.key] = {};
@ -42,14 +40,14 @@ export function handleFilterDelta(
} }
for (const key of Object.keys(newFiltersDelta)) { for (const key of Object.keys(newFiltersDelta)) {
const foundFilter = allFilters.find((f) => f.key === key); const foundFilter = allFilters.find(f => f.key === key);
if (foundFilter) { if (foundFilter) {
// if has children // if has children
if (!foundFilter.filters?.length) { if (!foundFilter.filters?.length) {
foundFilter.checked = true; foundFilter.checked = true;
} else { } else {
for (const subKey of Object.keys(newFiltersDelta[key])) { for (const subKey of Object.keys(newFiltersDelta[key])) {
const childFilter = foundFilter.filters.find((f) => f.key === subKey); const childFilter = foundFilter.filters.find(f => f.key === subKey);
if (childFilter) { if (childFilter) {
childFilter.checked = true; childFilter.checked = true;
} }
@ -57,7 +55,7 @@ export function handleFilterDelta(
} }
} }
} }
allFilters.forEach((filter) => { allFilters.forEach(filter => {
handleCheckedValue(filter); handleCheckedValue(filter);
}); });
} }
@ -65,7 +63,7 @@ export function handleFilterDelta(
function copySettings(oldFilters: FilterModel[], newFilters: FilterModel[]) { function copySettings(oldFilters: FilterModel[], newFilters: FilterModel[]) {
if (oldFilters && newFilters) { if (oldFilters && newFilters) {
for (const oldFilter of oldFilters) { for (const oldFilter of oldFilters) {
const newFilter = newFilters.find((f) => f.key === oldFilter.key); const newFilter = newFilters.find(f => f.key === oldFilter.key);
if (newFilter) { if (newFilter) {
newFilter.checked = oldFilter.checked; newFilter.checked = oldFilter.checked;
newFilter.indeterminate = oldFilter.indeterminate; newFilter.indeterminate = oldFilter.indeterminate;
@ -95,7 +93,7 @@ export function checkFilter(
validateArgs: any = [], validateArgs: any = [],
matchAll: boolean = false matchAll: boolean = false
) { ) {
const hasChecked = filters.find((f) => f.checked); const hasChecked = filters.find(f => f.checked);
if (validateArgs) { if (validateArgs) {
if (!Array.isArray(validateArgs)) { if (!Array.isArray(validateArgs)) {

View File

@ -76,9 +76,9 @@ export class InitialsAvatarComponent implements OnChanges {
return this._userService return this._userService
.getName(this.user) .getName(this.user)
.split(' ') .split(' ')
.filter((value) => value !== ' ') .filter(value => value !== ' ')
.filter((value, idx) => idx < 2) .filter((value, idx) => idx < 2)
.map((str) => str[0]) .map(str => str[0])
.join(''); .join('');
} }
} }

View File

@ -31,11 +31,11 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor {
ngAfterViewInit(): void { ngAfterViewInit(): void {
this._selectChips(this._value); this._selectChips(this._value);
this.chipList.chipSelectionChanges.pipe(map((event) => event.source)).subscribe((chip) => { this.chipList.chipSelectionChanges.pipe(map(event => event.source)).subscribe(chip => {
if (chip.selected) { if (chip.selected) {
this._value = [...this._value, chip.value]; this._value = [...this._value, chip.value];
} else { } else {
this._value = this._value.filter((o) => o !== chip.value); this._value = this._value.filter(o => o !== chip.value);
} }
this._propagateChange(this._value); this._propagateChange(this._value);
@ -66,20 +66,20 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor {
selectAll($event) { selectAll($event) {
$event.stopPropagation(); $event.stopPropagation();
this.chipList.chips.forEach((chip) => chip.select()); this.chipList.chips.forEach(chip => chip.select());
} }
deselectAll($event) { deselectAll($event) {
$event.stopPropagation(); $event.stopPropagation();
this.chipList.chips.forEach((chip) => chip.deselect()); this.chipList.chips.forEach(chip => chip.deselect());
} }
private _selectChips(value: string[]): void { private _selectChips(value: string[]): void {
this.chipList.chips.forEach((chip) => chip.deselect()); this.chipList.chips.forEach(chip => chip.deselect());
const chipsToSelect = this.chipList.chips.filter((c) => value.includes(c.value)); const chipsToSelect = this.chipList.chips.filter(c => value.includes(c.value));
chipsToSelect.forEach((chip) => chip.select()); chipsToSelect.forEach(chip => chip.select());
} }
private _propagateChange(value: string[]): void { private _propagateChange(value: string[]): void {

View File

@ -48,7 +48,7 @@ export class SimpleDoughnutChartComponent implements OnChanges {
} }
get dataTotal() { get dataTotal() {
return this.config.map((v) => v.value).reduce((acc, val) => acc + val, 0); return this.config.map(v => v.value).reduce((acc, val) => acc + val, 0);
} }
get displayedDataTotal() { get displayedDataTotal() {
@ -60,16 +60,16 @@ export class SimpleDoughnutChartComponent implements OnChanges {
this.cx = this.radius + this.strokeWidth / 2; this.cx = this.radius + this.strokeWidth / 2;
this.cy = this.radius + this.strokeWidth / 2; this.cy = this.radius + this.strokeWidth / 2;
this.size = this.strokeWidth + this.radius * 2; this.size = this.strokeWidth + this.radius * 2;
this.parsedConfig = this.config.map((el) => ({ this.parsedConfig = this.config.map(el => ({
...el, ...el,
checked: this.filter?.find((f) => f.key === el.key)?.checked checked: this.filter?.find(f => f.key === el.key)?.checked
})); }));
} }
calculateChartData() { calculateChartData() {
const newData = []; const newData = [];
let angleOffset = -90; let angleOffset = -90;
this.config.forEach((dataVal) => { this.config.forEach(dataVal => {
if (dataVal.value > 0) { if (dataVal.value > 0) {
const data = { const data = {
degrees: angleOffset degrees: angleOffset

View File

@ -26,12 +26,12 @@ export class DictionarySaveService {
showToast = true showToast = true
): Observable<any> { ): Observable<any> {
let entriesToAdd = []; let entriesToAdd = [];
entries.forEach((currentEntry) => { entries.forEach(currentEntry => {
entriesToAdd.push(currentEntry); entriesToAdd.push(currentEntry);
}); });
// remove empty lines // remove empty lines
entriesToAdd = entriesToAdd.filter((e) => e && e.trim().length > 0).map((e) => e.trim()); entriesToAdd = entriesToAdd.filter(e => e && e.trim().length > 0).map(e => e.trim());
const invalidRowsExist = entriesToAdd.filter((e) => e.length < MIN_WORD_LENGTH); const invalidRowsExist = entriesToAdd.filter(e => e.length < MIN_WORD_LENGTH);
if (invalidRowsExist.length === 0) { if (invalidRowsExist.length === 0) {
// can add at least 1 - block UI // can add at least 1 - block UI
let obs: Observable<any>; let obs: Observable<any>;

View File

@ -40,7 +40,7 @@ export class FileDownloadService {
): Observable<any> { ): Observable<any> {
return this._downloadControllerService return this._downloadControllerService
.prepareDownload({ .prepareDownload({
fileIds: fileStatusWrappers.map((f) => f.fileId), fileIds: fileStatusWrappers.map(f => f.fileId),
dossierId: dossier.dossierId dossierId: dossier.dossierId
}) })
.pipe(mergeMap(() => this.getDownloadStatus())); .pipe(mergeMap(() => this.getDownloadStatus()));
@ -48,13 +48,11 @@ export class FileDownloadService {
getDownloadStatus() { getDownloadStatus() {
return this._downloadControllerService.getDownloadStatus().pipe( return this._downloadControllerService.getDownloadStatus().pipe(
tap((statusResponse) => { tap(statusResponse => {
this.downloads = statusResponse.downloadStatus.map( this.downloads = statusResponse.downloadStatus.map(
(d) => new DownloadStatusWrapper(d) d => new DownloadStatusWrapper(d)
);
this.hasPendingDownloads = !!this.downloads.find(
(f) => !f.lastDownload && f.isReady
); );
this.hasPendingDownloads = !!this.downloads.find(f => !f.lastDownload && f.isReady);
}) })
); );
} }

View File

@ -15,7 +15,7 @@ export class FileDropOverlayService {
}); });
} }
dragListener = (e) => { dragListener = e => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if (this._mouseIn) { if (this._mouseIn) {
@ -23,13 +23,13 @@ export class FileDropOverlayService {
} }
return false; return false;
}; };
mouseIn = (e) => { mouseIn = e => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this._mouseIn = true; this._mouseIn = true;
return false; return false;
}; };
mouseOut = (e) => { mouseOut = e => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if (e.toElement == null && e.relatedTarget == null) { if (e.toElement == null && e.relatedTarget == null) {

View File

@ -39,7 +39,7 @@ export class FileUploadService {
get activeDossierKeys() { get activeDossierKeys() {
return Object.keys(this.groupedFiles).filter( return Object.keys(this.groupedFiles).filter(
(dossierId) => this.groupedFiles[dossierId].length > 0 dossierId => this.groupedFiles[dossierId].length > 0
); );
} }
@ -60,7 +60,7 @@ export class FileUploadService {
for (let idx = 0; idx < files.length; ++idx) { for (let idx = 0; idx < files.length; ++idx) {
const file = files[idx]; const file = files[idx];
let currentOption = option; let currentOption = option;
if (dossierFiles.find((pf) => pf.filename === file.file.name)) { if (dossierFiles.find(pf => pf.filename === file.file.name)) {
if (!option) { if (!option) {
const res = await this._dialogService.openOverwriteFileDialog(file.file.name); const res = await this._dialogService.openOverwriteFileDialog(file.file.name);
if (res.cancel) { if (res.cancel) {
@ -87,7 +87,7 @@ export class FileUploadService {
} }
} }
this.files.push(...files); this.files.push(...files);
files.forEach((newFile) => { files.forEach(newFile => {
this._addFileToGroup(newFile); this._addFileToGroup(newFile);
this.scheduleUpload(newFile); this.scheduleUpload(newFile);
}); });
@ -160,7 +160,7 @@ export class FileUploadService {
true true
); );
const subscription = obs.subscribe( const subscription = obs.subscribe(
async (event) => { async event => {
if (event.type === HttpEventType.UploadProgress) { if (event.type === HttpEventType.UploadProgress) {
uploadFile.progress = Math.round( uploadFile.progress = Math.round(
(event.loaded / (event.total || event.loaded)) * 100 (event.loaded / (event.total || event.loaded)) * 100
@ -197,7 +197,7 @@ export class FileUploadService {
} }
private _removeUpload(fileUploadModel: FileUploadModel) { private _removeUpload(fileUploadModel: FileUploadModel) {
const index = this._activeUploads.findIndex((au) => au.fileUploadModel === fileUploadModel); const index = this._activeUploads.findIndex(au => au.fileUploadModel === fileUploadModel);
if (index > -1) { if (index > -1) {
const subscription = this._activeUploads[index].subscription; const subscription = this._activeUploads[index].subscription;
if (subscription) { if (subscription) {

View File

@ -23,6 +23,6 @@ export class UploadDownloadDialogService {
return ref return ref
.afterClosed() .afterClosed()
.toPromise() .toPromise()
.then((res) => res || { cancel: true }); .then(res => res || { cancel: true });
} }
} }

View File

@ -20,7 +20,7 @@ export class ToastAction {
}) })
export class NotificationService { export class NotificationService {
constructor(private readonly _toastr: ToastrService, private readonly _router: Router) { constructor(private readonly _toastr: ToastrService, private readonly _router: Router) {
_router.events.subscribe((event) => { _router.events.subscribe(event => {
if (event instanceof NavigationStart) { if (event instanceof NavigationStart) {
this._toastr.clear(); this._toastr.clear();
} }

View File

@ -58,7 +58,7 @@ export class PermissionsService {
} }
return ( return (
this.isApprover(dossier) && this.isApprover(dossier) &&
dossier.files.filter((file) => this.fileRequiresReanalysis(file)).length > 0 dossier.files.filter(file => this.fileRequiresReanalysis(file)).length > 0
); );
} }

View File

@ -10,7 +10,7 @@ export class RouterHistoryService {
constructor(private readonly _router: Router) { constructor(private readonly _router: Router) {
this._router.events this._router.events
.pipe(filter((event) => event instanceof NavigationEnd)) .pipe(filter(event => event instanceof NavigationEnd))
.subscribe((event: NavigationEnd) => { .subscribe((event: NavigationEnd) => {
if (event.url.startsWith('/main/dossiers')) { if (event.url.startsWith('/main/dossiers')) {
this._lastDossiersScreen = event.url; this._lastDossiersScreen = event.url;

View File

@ -9,11 +9,11 @@ export class TranslateChartService {
constructor(private readonly _translateService: TranslateService) {} constructor(private readonly _translateService: TranslateService) {}
translateStatus(config: DoughnutChartConfig[]): DoughnutChartConfig[] { translateStatus(config: DoughnutChartConfig[]): DoughnutChartConfig[] {
return config.map((val) => ({ ...val, label: this._translateService.instant(val.label) })); return config.map(val => ({ ...val, label: this._translateService.instant(val.label) }));
} }
translateRoles(config: DoughnutChartConfig[]): DoughnutChartConfig[] { translateRoles(config: DoughnutChartConfig[]): DoughnutChartConfig[] {
return config.map((val) => ({ return config.map(val => ({
...val, ...val,
label: this._translateService.instant(`roles.${val.label}`).toLowerCase() label: this._translateService.instant(`roles.${val.label}`).toLowerCase()
})); }));

View File

@ -71,12 +71,12 @@ export class UserService {
} }
get managerUsers(): User[] { get managerUsers(): User[] {
return this._allUsers.filter((u) => u.roles.indexOf('RED_MANAGER') >= 0); return this._allUsers.filter(u => u.roles.indexOf('RED_MANAGER') >= 0);
} }
get eligibleUsers(): User[] { get eligibleUsers(): User[] {
return this._allUsers.filter( return this._allUsers.filter(
(u) => u.roles.indexOf('RED_USER') >= 0 || u.roles.indexOf('RED_MANAGER') >= 0 u => u.roles.indexOf('RED_USER') >= 0 || u.roles.indexOf('RED_MANAGER') >= 0
); );
} }
@ -97,7 +97,7 @@ export class UserService {
async loadAllUsers() { async loadAllUsers() {
const allUsers = await this._userControllerService.getUsers().toPromise(); const allUsers = await this._userControllerService.getUsers().toPromise();
this._allUsers = allUsers.filter((u) => this._hasAnyRedRole(u)); this._allUsers = allUsers.filter(u => this._hasAnyRedRole(u));
return allUsers; return allUsers;
} }
@ -113,7 +113,7 @@ export class UserService {
} }
getUserById(id: string) { getUserById(id: string) {
return this._allUsers.find((u) => u.userId === id); return this._allUsers.find(u => u.userId === id);
} }
getNameForId(userId: string) { getNameForId(userId: string) {

View File

@ -89,7 +89,7 @@ export class AppStateService {
get aggregatedFiles(): FileStatusWrapper[] { get aggregatedFiles(): FileStatusWrapper[] {
const result: FileStatusWrapper[] = []; const result: FileStatusWrapper[] = [];
this._appState.dossiers.forEach((p) => { this._appState.dossiers.forEach(p => {
result.push(...p.files); result.push(...p.files);
}); });
return result; return result;
@ -128,7 +128,7 @@ export class AppStateService {
} }
get activeDossier(): DossierWrapper { get activeDossier(): DossierWrapper {
return this._appState.dossiers.find((p) => p.dossierId === this.activeDossierId); return this._appState.dossiers.find(p => p.dossierId === this.activeDossierId);
} }
get allDossiers(): DossierWrapper[] { get allDossiers(): DossierWrapper[] {
@ -140,7 +140,7 @@ export class AppStateService {
} }
get activeFile(): FileStatusWrapper { get activeFile(): FileStatusWrapper {
return this.activeDossier?.files.find((f) => f.fileId === this.activeFileId); return this.activeDossier?.files.find(f => f.fileId === this.activeFileId);
} }
get activeFileId(): string { get activeFileId(): string {
@ -207,7 +207,7 @@ export class AppStateService {
} }
getDossierTemplateById(id: string): DossierTemplateModelWrapper { getDossierTemplateById(id: string): DossierTemplateModelWrapper {
return this.dossierTemplates.find((rs) => rs.dossierTemplateId === id); return this.dossierTemplates.find(rs => rs.dossierTemplateId === id);
} }
getDictionaryTypeValue(key: string, dossierTemplateId?: string) { getDictionaryTypeValue(key: string, dossierTemplateId?: string) {
@ -230,26 +230,26 @@ export class AppStateService {
} }
getDossierById(id: string) { getDossierById(id: string) {
return this.allDossiers.find((dossier) => dossier.dossier.dossierId === id); return this.allDossiers.find(dossier => dossier.dossier.dossierId === id);
} }
getFileById(dossierId: string, fileId: string) { getFileById(dossierId: string, fileId: string) {
return this.getDossierById(dossierId).files.find((file) => file.fileId === fileId); return this.getDossierById(dossierId).files.find(file => file.fileId === fileId);
} }
async loadAllDossiers(emitEvents: boolean = true) { async loadAllDossiers(emitEvents: boolean = true) {
const dossiers = await this._dossierControllerService.getDossiers().toPromise(); const dossiers = await this._dossierControllerService.getDossiers().toPromise();
if (dossiers) { if (dossiers) {
const mappedDossiers = dossiers.map( const mappedDossiers = dossiers.map(
(p) => new DossierWrapper(p, this._getExistingFiles(p.dossierId)) p => new DossierWrapper(p, this._getExistingFiles(p.dossierId))
); );
const fileData = await this._statusControllerService const fileData = await this._statusControllerService
.getFileStatusForDossiers(mappedDossiers.map((p) => p.dossierId)) .getFileStatusForDossiers(mappedDossiers.map(p => p.dossierId))
.toPromise(); .toPromise();
for (const dossierId of Object.keys(fileData)) { for (const dossierId of Object.keys(fileData)) {
const dossier = mappedDossiers.find((p) => p.dossierId === dossierId); const dossier = mappedDossiers.find(p => p.dossierId === dossierId);
this._processFiles(dossier, fileData[dossierId], emitEvents); this._processFiles(dossier, fileData[dossierId], emitEvents);
} }
@ -273,7 +273,7 @@ export class AppStateService {
this.activeDossier.dossierTemplateId, this.activeDossier.dossierTemplateId,
this._appState.fileAttributesConfig[this.activeDossier.dossierTemplateId] this._appState.fileAttributesConfig[this.activeDossier.dossierTemplateId]
); );
this.activeDossier.files = this.activeDossier.files.map((file) => this.activeDossier.files = this.activeDossier.files.map(file =>
file.fileId === activeFileWrapper.fileId ? activeFileWrapper : file file.fileId === activeFileWrapper.fileId ? activeFileWrapper : file
); );
@ -320,7 +320,7 @@ export class AppStateService {
this._dictionaryControllerService this._dictionaryControllerService
.getDictionaryForType(dossierTemplateId, 'dossier_redaction', dossierId) .getDictionaryForType(dossierTemplateId, 'dossier_redaction', dossierId)
.subscribe( .subscribe(
(typeData) => { typeData => {
this.activeDossier.type = typeData; this.activeDossier.type = typeData;
}, },
() => { () => {
@ -378,7 +378,7 @@ export class AppStateService {
.then( .then(
() => { () => {
const index = this._appState.dossiers.findIndex( const index = this._appState.dossiers.findIndex(
(p) => p.dossier.dossierId === dossier.dossierId p => p.dossier.dossierId === dossier.dossierId
); );
this._appState.dossiers.splice(index, 1); this._appState.dossiers.splice(index, 1);
this._appState.dossiers = [...this._appState.dossiers]; this._appState.dossiers = [...this._appState.dossiers];
@ -399,7 +399,7 @@ export class AppStateService {
.createOrUpdateDossier(dossier) .createOrUpdateDossier(dossier)
.toPromise(); .toPromise();
let foundDossier = this._appState.dossiers.find( let foundDossier = this._appState.dossiers.find(
(p) => p.dossier.dossierId === updatedDossier.dossierId p => p.dossier.dossierId === updatedDossier.dossierId
); );
if (foundDossier) { if (foundDossier) {
Object.assign((foundDossier.dossier = updatedDossier)); Object.assign((foundDossier.dossier = updatedDossier));
@ -433,7 +433,7 @@ export class AppStateService {
.getAllDossierTemplates1() .getAllDossierTemplates1()
.toPromise(); .toPromise();
this._appState.dossierTemplates = dossierTemplates.map( this._appState.dossierTemplates = dossierTemplates.map(
(dossierTemplate) => new DossierTemplateModelWrapper(dossierTemplate) dossierTemplate => new DossierTemplateModelWrapper(dossierTemplate)
); );
this._appState.fileAttributesConfig = {}; this._appState.fileAttributesConfig = {};
for (const dossierTemplate of this._appState.dossierTemplates) { for (const dossierTemplate of this._appState.dossierTemplates) {
@ -470,7 +470,7 @@ export class AppStateService {
dictionaryData: { [key: string]: any } dictionaryData: { [key: string]: any }
): Observable<any>[] { ): Observable<any>[] {
const typeObs = this._dictionaryControllerService.getAllTypes(dossierTemplateId).pipe( const typeObs = this._dictionaryControllerService.getAllTypes(dossierTemplateId).pipe(
tap((typesResponse) => { tap(typesResponse => {
for (const type of typesResponse.types) { for (const type of typesResponse.types) {
dictionaryData[type.type] = type; dictionaryData[type.type] = type;
dictionaryData[type.type].label = humanize(type.type, false); dictionaryData[type.type].label = humanize(type.type, false);
@ -479,7 +479,7 @@ export class AppStateService {
); );
const colorsObs = this._dictionaryControllerService.getColors(dossierTemplateId).pipe( const colorsObs = this._dictionaryControllerService.getColors(dossierTemplateId).pipe(
tap((colors) => { tap(colors => {
// declined // declined
dictionaryData['declined-suggestion'] = new TypeValueWrapper( dictionaryData['declined-suggestion'] = new TypeValueWrapper(
{ {
@ -682,7 +682,7 @@ export class AppStateService {
} }
private _getExistingFiles(dossierId: string) { private _getExistingFiles(dossierId: string) {
const found = this._appState.dossiers.find((p) => p.dossier.dossierId === dossierId); const found = this._appState.dossiers.find(p => p.dossier.dossierId === dossierId);
return found ? found.files : []; return found ? found.files : [];
} }
@ -730,7 +730,7 @@ export class AppStateService {
} }
dossier.files = files.map( dossier.files = files.map(
(f) => f =>
new FileStatusWrapper( new FileStatusWrapper(
f, f,
this._userService.getNameForId(f.currentReviewer), this._userService.getNameForId(f.currentReviewer),
@ -741,8 +741,8 @@ export class AppStateService {
this._computeStats(); this._computeStats();
if (emitEvents) { if (emitEvents) {
fileReanalysedEvent.forEach((file) => this.fileReanalysed.emit(file)); fileReanalysedEvent.forEach(file => this.fileReanalysed.emit(file));
fileStatusChangedEvent.forEach((file) => this.fileChanged.emit(file)); fileStatusChangedEvent.forEach(file => this.fileChanged.emit(file));
} }
return files; return files;
@ -752,13 +752,13 @@ export class AppStateService {
let totalAnalysedPages = 0; let totalAnalysedPages = 0;
let totalDocuments = 0; let totalDocuments = 0;
const totalPeople = new Set<string>(); const totalPeople = new Set<string>();
this._appState.dossiers.forEach((p) => { this._appState.dossiers.forEach(p => {
totalDocuments += p.files.length; totalDocuments += p.files.length;
if (p.dossier.memberIds) { if (p.dossier.memberIds) {
p.dossier.memberIds.forEach((m) => totalPeople.add(m)); p.dossier.memberIds.forEach(m => totalPeople.add(m));
} }
let numberOfPages = 0; let numberOfPages = 0;
p.files.forEach((f) => { p.files.forEach(f => {
numberOfPages += f.numberOfPages; numberOfPages += f.numberOfPages;
}); });
p.totalNumberOfPages = numberOfPages; p.totalNumberOfPages = numberOfPages;

View File

@ -21,14 +21,6 @@ export class DossierWrapper {
private _files: FileStatusWrapper[]; private _files: FileStatusWrapper[];
get hasMoreThanOneApprover() {
return this.approverIds.length > 1;
}
get hasMoreThanOneReviewer() {
return this.memberIds.length > 1;
}
get files() { get files() {
return this._files; return this._files;
} }
@ -38,6 +30,14 @@ export class DossierWrapper {
this._recomputeFileStatus(); this._recomputeFileStatus();
} }
get hasMoreThanOneApprover() {
return this.approverIds.length > 1;
}
get hasMoreThanOneReviewer() {
return this.memberIds.length > 1;
}
get dossierName() { get dossierName() {
return this.dossier.dossierName; return this.dossier.dossierName;
} }
@ -91,7 +91,7 @@ export class DossierWrapper {
} }
hasStatus(status: string) { hasStatus(status: string) {
return this._files.find((f) => f.status === status); return this._files.find(f => f.status === status);
} }
hasMember(key: string) { hasMember(key: string) {
@ -114,7 +114,7 @@ export class DossierWrapper {
this.allFilesApproved = true; this.allFilesApproved = true;
this.totalNumberOfPages = 0; this.totalNumberOfPages = 0;
this.hasPendingOrProcessing = false; this.hasPendingOrProcessing = false;
this._files.forEach((f) => { this._files.forEach(f => {
this.hintsOnly = this.hintsOnly || f.hintsOnly; this.hintsOnly = this.hintsOnly || f.hintsOnly;
this.hasRedactions = this.hasRedactions || f.hasRedactions; this.hasRedactions = this.hasRedactions || f.hasRedactions;
this.hasRequests = this.hasRequests || f.hasRequests; this.hasRequests = this.hasRequests || f.hasRequests;

View File

@ -63,7 +63,7 @@ export class CustomRouteReuseStrategy implements RouteReuseStrategy {
.map((el: ActivatedRouteSnapshot) => .map((el: ActivatedRouteSnapshot) =>
el.routeConfig ? el.routeConfig.path + JSON.stringify(el.params) : '' el.routeConfig ? el.routeConfig.path + JSON.stringify(el.params) : ''
) )
.filter((str) => str.length > 0) .filter(str => str.length > 0)
.join(''); .join('');
} }

View File

@ -48,7 +48,7 @@ export function convertFiles(files: FileList | File[], dossier: DossierWrapper):
} }
uploadFiles = uploadFiles.filter( uploadFiles = uploadFiles.filter(
(file) => file =>
file.file.type?.toLowerCase() === 'application/pdf' || file.file.type?.toLowerCase() === 'application/pdf' ||
file.file.name.toLowerCase().endsWith('.pdf') || file.file.name.toLowerCase().endsWith('.pdf') ||
file.file.type?.toLowerCase() === 'application/zip' || file.file.type?.toLowerCase() === 'application/zip' ||

View File

@ -48,7 +48,7 @@ export function getFirstRelevantTextPart(text, direction: 'FORWARD' | 'BACKWARD'
let accumulator = ''; let accumulator = '';
const breakChars = ['/', ':', ' ']; const breakChars = ['/', ':', ' '];
const handle = (i) => { const handle = i => {
const char = text[i]; const char = text[i];
if (breakChars.indexOf(char) >= 0) { if (breakChars.indexOf(char) >= 0) {
spaceCount += 1; spaceCount += 1;

View File

@ -10,7 +10,7 @@ export function syncScroll(elements: HTMLElement[]) {
loopElement.eX = loopElement.eY = 0; loopElement.eX = loopElement.eY = 0;
((el) => { (el => {
el['addEventListener']( el['addEventListener'](
'scroll', 'scroll',
(el.scrollSync = () => { (el.scrollSync = () => {

View File

@ -704,7 +704,7 @@
}, },
"compare": { "compare": {
"compare": "Vergleichen Sie", "compare": "Vergleichen Sie",
"select-dossier-template": "Wählen Sie Dossiervorlage", "select-dossier": "Wählen Sie Dossiervorlage",
"select-dictionary": "Wählen Sie Wörterbuch" "select-dictionary": "Wählen Sie Wörterbuch"
}, },
"select-dictionary": "Wählen Sie oben ein Wörterbuch aus, um es mit dem aktuellen zu vergleichen." "select-dictionary": "Wählen Sie oben ein Wörterbuch aus, um es mit dem aktuellen zu vergleichen."

View File

@ -745,8 +745,7 @@
}, },
"compare": { "compare": {
"compare": "Compare", "compare": "Compare",
"select-dossier-template": "Select Dossier Template", "select-dossier": "Select Dossier"
"select-dictionary": "Select Dictionary"
}, },
"select-dictionary": "Select a dictionary above to compare with the current one." "select-dictionary": "Select a dictionary above to compare with the current one."
}, },

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg height="100px" version="1.1" viewBox="0 0 100 100" width="100px" xmlns="http://www.w3.org/2000/svg"> <svg height="100px" version="1.1" viewBox="0 0 100 100" width="100px"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd" id="analyse" stroke="none" stroke-width="1"> <g fill="none" fill-rule="evenodd" id="analyse" stroke="none" stroke-width="1">
<path <path
d="M16.5,89 L16.5,100 L0,100 L0,89 L16.5,89 Z M44.5,89 L44.5,100 L28,100 L28,89 L44.5,89 Z M72,89 L72,100 L55.5,100 L55.5,89 L72,89 Z M100,89 L100,100 L83.5,100 L83.5,89 L100,89 Z M16.5,66.5 L16.5,77.5 L0,77.5 L0,66.5 L16.5,66.5 Z M44.5,66.5 L44.5,77.5 L28,77.5 L28,66.5 L44.5,66.5 Z M72,66.5 L72,77.5 L55.5,77.5 L55.5,66.5 L72,66.5 Z M100,66.5 L100,77.5 L83.5,77.5 L83.5,66.5 L100,66.5 Z M16.5,44.5 L16.5,55.5 L0,55.5 L0,44.5 L16.5,44.5 Z M44.5,44.5 L44.5,55.5 L28,55.5 L28,44.5 L44.5,44.5 Z M100,44.5 L100,55.5 L83.5,55.5 L83.5,44.5 L100,44.5 Z M44.5,22 L44.5,33 L28,33 L28,22 L44.5,22 Z M100,22 L100,33 L83.5,33 L83.5,22 L100,22 Z M44.5,0 L44.5,11 L28,11 L28,0 L44.5,0 Z" d="M16.5,89 L16.5,100 L0,100 L0,89 L16.5,89 Z M44.5,89 L44.5,100 L28,100 L28,89 L44.5,89 Z M72,89 L72,100 L55.5,100 L55.5,89 L72,89 Z M100,89 L100,100 L83.5,100 L83.5,89 L100,89 Z M16.5,66.5 L16.5,77.5 L0,77.5 L0,66.5 L16.5,66.5 Z M44.5,66.5 L44.5,77.5 L28,77.5 L28,66.5 L44.5,66.5 Z M72,66.5 L72,77.5 L55.5,77.5 L55.5,66.5 L72,66.5 Z M100,66.5 L100,77.5 L83.5,77.5 L83.5,66.5 L100,66.5 Z M16.5,44.5 L16.5,55.5 L0,55.5 L0,44.5 L16.5,44.5 Z M44.5,44.5 L44.5,55.5 L28,55.5 L28,44.5 L44.5,44.5 Z M100,44.5 L100,55.5 L83.5,55.5 L83.5,44.5 L100,44.5 Z M44.5,22 L44.5,33 L28,33 L28,22 L44.5,22 Z M100,22 L100,33 L83.5,33 L83.5,22 L100,22 Z M44.5,0 L44.5,11 L28,11 L28,0 L44.5,0 Z"

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px" xmlns="http://www.w3.org/2000/svg"> <svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd" id="Styleguide" stroke="none" stroke-width="1"> <g fill="none" fill-rule="evenodd" id="Styleguide" stroke="none" stroke-width="1">
<g fill="currentColor" fill-rule="nonzero" id="Styleguide-Actions" <g fill="currentColor" fill-rule="nonzero" id="Styleguide-Actions"
transform="translate(-62.000000, -567.000000)"> transform="translate(-62.000000, -567.000000)">

Before

Width:  |  Height:  |  Size: 952 B

After

Width:  |  Height:  |  Size: 957 B

View File

@ -1,8 +1,8 @@
<svg <svg
width="24" fill="none"
height="24" height="24"
viewBox="0 0 24 24" viewBox="0 0 24 24"
fill="none" width="24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<path <path
@ -10,9 +10,9 @@
fill="currentColor" fill="currentColor"
/> />
<path <path
fill-rule="evenodd"
clip-rule="evenodd" clip-rule="evenodd"
d="M19.7782 19.7782C15.4824 24.0739 8.51759 24.0739 4.22183 19.7782C-0.0739417 15.4824 -0.0739417 8.51759 4.22183 4.22183C8.51759 -0.0739419 15.4824 -0.0739419 19.7782 4.22183C24.0739 8.51759 24.0739 15.4824 19.7782 19.7782ZM18.364 18.364C14.8492 21.8787 9.15076 21.8787 5.63604 18.364C2.12132 14.8492 2.12132 9.15076 5.63604 5.63604C9.15076 2.12132 14.8492 2.12132 18.364 5.63604C21.8787 9.15076 21.8787 14.8492 18.364 18.364Z" d="M19.7782 19.7782C15.4824 24.0739 8.51759 24.0739 4.22183 19.7782C-0.0739417 15.4824 -0.0739417 8.51759 4.22183 4.22183C8.51759 -0.0739419 15.4824 -0.0739419 19.7782 4.22183C24.0739 8.51759 24.0739 15.4824 19.7782 19.7782ZM18.364 18.364C14.8492 21.8787 9.15076 21.8787 5.63604 18.364C2.12132 14.8492 2.12132 9.15076 5.63604 5.63604C9.15076 2.12132 14.8492 2.12132 18.364 5.63604C21.8787 9.15076 21.8787 14.8492 18.364 18.364Z"
fill="currentColor" fill="currentColor"
fill-rule="evenodd"
/> />
</svg> </svg>

Before

Width:  |  Height:  |  Size: 841 B

After

Width:  |  Height:  |  Size: 841 B

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px" xmlns="http://www.w3.org/2000/svg"> <svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd" id="Styleguide" stroke="none" stroke-width="1"> <g fill="none" fill-rule="evenodd" id="Styleguide" stroke="none" stroke-width="1">
<g id="Styleguide-Buttons" transform="translate(-469.000000, -757.000000)"> <g id="Styleguide-Buttons" transform="translate(-469.000000, -757.000000)">
<rect height="906" width="904" x="0" y="0"></rect> <rect height="906" width="904" x="0" y="0"></rect>

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 678 B

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px" xmlns="http://www.w3.org/2000/svg"> <svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd" id="right_expandable" stroke="none" stroke-width="1"> <g fill="none" fill-rule="evenodd" id="right_expandable" stroke="none" stroke-width="1">
<polygon fill="currentColor" id="Fill-1" <polygon fill="currentColor" id="Fill-1"
points="7 9 10 5 4 5" points="7 9 10 5 4 5"

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 465 B

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px" xmlns="http://www.w3.org/2000/svg"> <svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px"
xmlns="http://www.w3.org/2000/svg">
<defs> <defs>
<rect height="50" id="path-1" width="1440" x="0" y="61"></rect> <rect height="50" id="path-1" width="1440" x="0" y="61"></rect>
<filter filterUnits="objectBoundingBox" height="128.0%" id="filter-2" width="101.0%" x="-0.5%" y="-10.0%"> <filter filterUnits="objectBoundingBox" height="128.0%" id="filter-2" width="101.0%"
x="-0.5%" y="-10.0%">
<feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset> <feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="2"></feGaussianBlur> <feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1"
stdDeviation="2"></feGaussianBlur>
<feColorMatrix in="shadowBlurOuter1" <feColorMatrix in="shadowBlurOuter1"
type="matrix" type="matrix"
values="0 0 0 0 0.88627451 0 0 0 0 0.894117647 0 0 0 0 0.91372549 0 0 0 1 0"></feColorMatrix> values="0 0 0 0 0.88627451 0 0 0 0 0.894117647 0 0 0 0 0.91372549 0 0 0 1 0"></feColorMatrix>
@ -13,7 +16,8 @@
<g fill="none" fill-rule="evenodd" id="Assignee" stroke="none" stroke-width="1"> <g fill="none" fill-rule="evenodd" id="Assignee" stroke="none" stroke-width="1">
<g id="01.-Unassigned" transform="translate(-1066.000000, -79.000000)"> <g id="01.-Unassigned" transform="translate(-1066.000000, -79.000000)">
<g id="Header-Document"> <g id="Header-Document">
<g fill="currentColor" fill-rule="nonzero" id="Group-13" transform="translate(917.000000, 69.000000)"> <g fill="currentColor" fill-rule="nonzero" id="Group-13"
transform="translate(917.000000, 69.000000)">
<g id="Group-6" transform="translate(139.000000, 0.000000)"> <g id="Group-6" transform="translate(139.000000, 0.000000)">
<g id="status" transform="translate(10.000000, 10.000000)"> <g id="status" transform="translate(10.000000, 10.000000)">
<path <path

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg height="100px" version="1.1" viewBox="0 0 100 100" width="100px" xmlns="http://www.w3.org/2000/svg"> <svg height="100px" version="1.1" viewBox="0 0 100 100" width="100px"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd" id="assign" stroke="none" stroke-width="1"> <g fill="none" fill-rule="evenodd" id="assign" stroke="none" stroke-width="1">
<path <path
d="M35,50 C54.5,50 70,65.5 70,85 L70,85 L70,100 L0,100 L0,85 C0,65.5 15.5,50 35,50 Z M35,60 C21,60 10,71 10,85 L10,85 L10,90 L60,90 L60,85 C60,71 49,60 35,60 Z M35,5 C46,5 55,14 55,25 C55,36 46,45 35,45 C24,45 15,36 15,25 C15,14 24,5 35,5 Z M85,0 L85,15 L100,15 L100,25 L85,25 L85,40 L75,40 L75,25 L60,25 L60,15 L75,15 L75,0 L85,0 Z M35,15 C29.5,15 25,19.5 25,25 C25,30.5 29.5,35 35,35 C40.5,35 45,30.5 45,25 C45,19.5 40.5,15 35,15 Z" d="M35,50 C54.5,50 70,65.5 70,85 L70,85 L70,100 L0,100 L0,85 C0,65.5 15.5,50 35,50 Z M35,60 C21,60 10,71 10,85 L10,85 L10,90 L60,90 L60,85 C60,71 49,60 35,60 Z M35,5 C46,5 55,14 55,25 C55,36 46,45 35,45 C24,45 15,36 15,25 C15,14 24,5 35,5 Z M85,0 L85,15 L100,15 L100,25 L85,25 L85,40 L75,40 L75,25 L60,25 L60,15 L75,15 L75,0 L85,0 Z M35,15 C29.5,15 25,19.5 25,25 C25,30.5 29.5,35 35,35 C40.5,35 45,30.5 45,25 C45,19.5 40.5,15 35,15 Z"

Before

Width:  |  Height:  |  Size: 785 B

After

Width:  |  Height:  |  Size: 790 B

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px" xmlns="http://www.w3.org/2000/svg"> <svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd" id="Styleguide" stroke="none" stroke-width="1"> <g fill="none" fill-rule="evenodd" id="Styleguide" stroke="none" stroke-width="1">
<g fill="currentColor" fill-rule="nonzero" id="Styleguide-Actions" <g fill="currentColor" fill-rule="nonzero" id="Styleguide-Actions"
transform="translate(-608.000000, -651.000000)"> transform="translate(-608.000000, -651.000000)">

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg height="100px" version="1.1" viewBox="0 0 100 100" width="100px" xmlns="http://www.w3.org/2000/svg"> <svg height="100px" version="1.1" viewBox="0 0 100 100" width="100px"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd" id="calendar" stroke="none" stroke-width="1"> <g fill="none" fill-rule="evenodd" id="calendar" stroke="none" stroke-width="1">
<path <path
d="M35,70 L35,80 L25,80 L25,70 L35,70 Z M55,70 L55,80 L45,80 L45,70 L55,70 Z M35,55 L35,65 L25,65 L25,55 L35,55 Z M55,55 L55,65 L45,65 L45,55 L55,55 Z M75,55 L75,65 L65,65 L65,55 L75,55 Z M55,40 L55,50 L45,50 L45,40 L55,40 Z M75,40 L75,50 L65,50 L65,40 L75,40 Z" d="M35,70 L35,80 L25,80 L25,70 L35,70 Z M55,70 L55,80 L45,80 L45,70 L55,70 Z M35,55 L35,65 L25,65 L25,55 L35,55 Z M55,55 L55,65 L45,65 L45,55 L55,55 Z M75,55 L75,65 L65,65 L65,55 L75,55 Z M55,40 L55,50 L45,50 L45,40 L55,40 Z M75,40 L75,50 L65,50 L65,40 L75,40 Z"

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

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