reformatt

This commit is contained in:
Timo Bejan 2020-10-29 11:53:58 +02:00
parent 1caf88c48f
commit edb0f253f6
11 changed files with 100 additions and 43 deletions

View File

@ -5,7 +5,7 @@
To regnerate http rune swaagger
```
BASE=http://ingress.redaction-timo-dev-401.178.63.47.73.xip.io/
BASE=https://timo-redaction-dev.iqser.cloud/
URL="$BASE"v2/api-docs?group=redaction-gateway-v1
mkdir -p /tmp/swagger
swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger

View File

@ -108,6 +108,6 @@ export class AssignOwnerDialogComponent {
}
get multiUsersSelectOptions() {
return this.userService.managerUsers.map((m) => m.userId);
return this.userService.allUsers.map((m) => m.userId);
}
}

View File

@ -90,7 +90,6 @@ export class DialogService {
});
ref.afterClosed().subscribe((result) => {
console.log(result);
if (cb) {
cb(result);
}

View File

@ -15,7 +15,7 @@
<button
mat-icon-button
(click)="openDeleteFileDialog($event)"
*ngIf="userService.isManager(this.user) || appStateService.isActiveProjectOwner"
*ngIf="userService.isManager(user)"
>
<mat-icon svgIcon="red:trash"></mat-icon>
</button>
@ -29,8 +29,12 @@
>
<mat-icon svgIcon="red:assign"></mat-icon>
</button>
<button mat-icon-button (click)="reanalyseFile($event)">
<mat-icon svgIcon="red:analyse"></mat-icon>
<button
mat-icon-button
(click)="reanalyseFile($event)"
*ngIf="userService.isManager(user)"
>
<mat-icon svgIcon="red:refresh"></mat-icon>
</button>
<button mat-icon-button (click)="openFileDetailsDialog($event)">
<mat-icon svgIcon="red:info"></mat-icon>
@ -38,7 +42,7 @@
</div>
<button
*ngIf="userService.isManager(user) || appStateService.isActiveProjectOwner"
*ngIf="userService.isManager(user)"
color="primary"
mat-flat-button
class="arrow-button"

View File

@ -492,6 +492,10 @@ export class FilePreviewScreenComponent implements OnInit {
});
AnnotationUtils.addAnnotations(this.annotations, annotations);
this.filters = this._filtersService.getFilters(
this.appStateService.dictionaryData,
this.annotations
);
this.applyFilters();
this._changeDetectorRef.detectChanges();
}

View File

@ -19,6 +19,7 @@ import { FileDownloadService } from '../service/file-download.service';
import { Subject } from 'rxjs';
import { throttleTime } from 'rxjs/operators';
import { ManualRedactionEntryWrapper } from '../model/manual-redaction-entry.wrapper';
import { AppStateService } from '../../../state/app-state.service';
export interface ViewerState {
displayMode?: any;
@ -57,6 +58,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
instance: WebViewerInstance;
constructor(
private readonly _appStateService: AppStateService,
private readonly _translateService: TranslateService,
private readonly _fileDownloadService: FileDownloadService,
private readonly _appConfigService: AppConfigService,
@ -101,7 +103,6 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
this._configureTextPopup();
this._configureHeader();
instance.annotManager.on('annotationChanged', (annotations, action) => {
console.log(action, annotations);
if (action === 'add') {
this._annotationEventDebouncer.next(annotations);
}
@ -180,30 +181,34 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
}, 250);
}
});
this.instance.textPopup.add(<any>{
type: 'actionButton',
img: '/assets/icons/general/add-hint.svg',
title: this._translateService.instant(
'pdf-viewer.text-popup.actions.suggestion-hint.label'
),
onClick: () => {
const mre = this._getManualRedactionEntry();
this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper(mre, 'HINT'));
}
});
this.instance.textPopup.add(<any>{
type: 'actionButton',
img: '/assets/icons/general/add-redaction.svg',
title: this._translateService.instant(
'pdf-viewer.text-popup.actions.suggestion-redaction.label'
),
onClick: () => {
const mre = this._getManualRedactionEntry();
this.manualAnnotationRequested.emit(
new ManualRedactionEntryWrapper(mre, 'REDACTION')
);
}
});
if (this._appStateService.isActiveFileDocumentReviewer) {
this.instance.textPopup.add(<any>{
type: 'actionButton',
img: '/assets/icons/general/add-hint.svg',
title: this._translateService.instant(
'pdf-viewer.text-popup.actions.suggestion-hint.label'
),
onClick: () => {
const mre = this._getManualRedactionEntry();
this.manualAnnotationRequested.emit(
new ManualRedactionEntryWrapper(mre, 'HINT')
);
}
});
this.instance.textPopup.add(<any>{
type: 'actionButton',
img: '/assets/icons/general/add-redaction.svg',
title: this._translateService.instant(
'pdf-viewer.text-popup.actions.suggestion-redaction.label'
),
onClick: () => {
const mre = this._getManualRedactionEntry();
this.manualAnnotationRequested.emit(
new ManualRedactionEntryWrapper(mre, 'REDACTION')
);
}
});
}
}
private _getManualRedactionEntry(): ManualRedactionEntry {

View File

@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { AnnotationFilters } from '../../../utils/types';
import { TypeValue } from '@redaction/red-ui-http';
import { Annotations } from '@pdftron/webviewer';
import { AnnotationUtils } from '../../../utils/annotation-utils';
@Injectable({
providedIn: 'root'
@ -15,17 +17,34 @@ export class FiltersService {
ignore: false
};
public getFilters(dictionaryData: { [key: string]: TypeValue }): AnnotationFilters {
public getFilters(
dictionaryData: { [key: string]: TypeValue },
annotations?: Annotations.Annotation[]
): AnnotationFilters {
const availableAnnotationTypes: Set<string> = new Set<string>();
annotations?.forEach((a) => {
availableAnnotationTypes.add(AnnotationUtils.getType(a));
availableAnnotationTypes.add(AnnotationUtils.getDictionary(a));
});
const filtersCopy = JSON.parse(JSON.stringify(this._filters));
for (const key of Object.keys(dictionaryData)) {
const typeValue = dictionaryData[key];
if (typeValue.hint === true) {
filtersCopy.hint[key] = false;
}
if (typeValue.hint === false) {
filtersCopy.redaction[key] = false;
if (availableAnnotationTypes.has(key)) {
const typeValue = dictionaryData[key];
if (typeValue.hint === true) {
filtersCopy.hint[key] = false;
}
if (typeValue.hint === false) {
filtersCopy.redaction[key] = false;
}
}
}
for (let key of Object.keys(filtersCopy)) {
if (!availableAnnotationTypes.has(key)) {
delete filtersCopy[key];
}
}
return filtersCopy;
}
}

View File

@ -135,6 +135,7 @@
<button
mat-icon-button
(click)="downloadRedactionReport($event, pw.project)"
*ngIf="userService.isManager(user)"
[matTooltip]="'project-listing.report.action.label' | translate"
color="accent"
>
@ -151,6 +152,7 @@
</button>
<button
color="accent"
*ngIf="appStateService.isManagerAndOwner(user, pw.project)"
(click)="reanalyseProject($event, pw.project)"
mat-icon-button
[matTooltip]="'project-listing.reanalyse.action.label' | translate"

View File

@ -167,11 +167,17 @@
<div class="needs-work" *ngIf="!isError(fileStatus)">
<redaction-annotation-icon
*ngIf="fileStatus.hasRedactions"
[typeValue]="appStateService.getDictionaryTypeValue('redaction')"
></redaction-annotation-icon>
<redaction-annotation-icon
*ngIf="fileStatus.hasHints"
[typeValue]="appStateService.getDictionaryTypeValue('hint')"
></redaction-annotation-icon>
<redaction-annotation-icon
*ngIf="fileStatus.hasRequests"
[typeValue]="appStateService.getDictionaryTypeValue('request')"
></redaction-annotation-icon>
</div>
<div class="assigned-to" *ngIf="!isError(fileStatus)">
@ -349,8 +355,7 @@
<div>
<redaction-annotation-icon
[typeValue]="appStateService.getDictionaryTypeValue('hint')"
>></redaction-annotation-icon
>
></redaction-annotation-icon>
{{ 'project-overview.legend.contains-hints.label' | translate }}
</div>
<div>

View File

@ -12,7 +12,7 @@ import {
import { NotificationService, NotificationType } from '../notification/notification.service';
import { TranslateService } from '@ngx-translate/core';
import { Router } from '@angular/router';
import { UserService } from '../user/user.service';
import { UserService, UserWrapper } from '../user/user.service';
import { forkJoin, interval } from 'rxjs';
import { tap } from 'rxjs/operators';
import { download } from '../utils/file-download-utils';
@ -408,4 +408,8 @@ export class AppStateService {
const data = this._dictionaryData[key];
return data ? data : this._dictionaryData['default'];
}
isManagerAndOwner(user: UserWrapper, project: Project) {
return user.isManager && project.ownerId === user.id;
}
}

View File

@ -18,6 +18,10 @@ export interface FileStatus {
* Date and time when the file was added to the system.
*/
added?: string;
/**
* Shows if all manual changes have been applied by a reanalysis.
*/
allManualRedactionsApplied?: boolean;
/**
* The current reviewer's (if any) user id.
*/
@ -30,6 +34,18 @@ export interface FileStatus {
* The file's name.
*/
filename?: string;
/**
* Shows if any hints were found during the analysis.
*/
hasHints?: boolean;
/**
* Shows if any redactions were found during the analysis.
*/
hasRedactions?: boolean;
/**
* Shows if any requests were found during the analysis.
*/
hasRequests?: boolean;
/**
* Date and time when the file was last updated.
*/
@ -51,7 +67,6 @@ export interface FileStatus {
*/
status?: FileStatus.StatusEnum;
}
export namespace FileStatus {
export type StatusEnum =
| 'UNPROCESSED'