show short reason in file workload

This commit is contained in:
Dan Percic 2021-06-30 14:29:21 +03:00 committed by Adina Țeudan
parent 954e74abcc
commit abbf8fd417
7 changed files with 55 additions and 49 deletions

View File

@ -238,10 +238,10 @@ export class AnnotationWrapper {
annotationWrapper.legalBasisChangeValue = redactionLogEntry.legalBasisChangeValue; annotationWrapper.legalBasisChangeValue = redactionLogEntry.legalBasisChangeValue;
annotationWrapper.comments = redactionLogEntry.comments || []; annotationWrapper.comments = redactionLogEntry.comments || [];
annotationWrapper.legalBasis = redactionLogEntry.legalBasis; annotationWrapper.legalBasis = redactionLogEntry.legalBasis;
AnnotationWrapper._createContent(annotationWrapper, redactionLogEntry); this._createContent(annotationWrapper, redactionLogEntry);
AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry); this._setSuperType(annotationWrapper, redactionLogEntry);
AnnotationWrapper._handleSkippedState(annotationWrapper, redactionLogEntry); this._handleSkippedState(annotationWrapper, redactionLogEntry);
AnnotationWrapper._handleRecommendations(annotationWrapper, redactionLogEntry); this._handleRecommendations(annotationWrapper, redactionLogEntry);
annotationWrapper.typeLabel = 'annotation-type.' + annotationWrapper.superType; annotationWrapper.typeLabel = 'annotation-type.' + annotationWrapper.superType;
return annotationWrapper; return annotationWrapper;
@ -351,25 +351,23 @@ export class AnnotationWrapper {
annotationWrapper: AnnotationWrapper, annotationWrapper: AnnotationWrapper,
redactionLogEntryWrapper: RedactionLogEntryWrapper redactionLogEntryWrapper: RedactionLogEntryWrapper
) { ) {
if (annotationWrapper.superType === 'skipped') { if (annotationWrapper.superType !== 'skipped') return;
if (!annotationWrapper.userId) {
if (
redactionLogEntryWrapper.manualRedactionType === 'REMOVE' ||
redactionLogEntryWrapper.manualRedactionType === 'UNDO'
) {
annotationWrapper.superType = 'pending-analysis';
return;
}
} else {
if (redactionLogEntryWrapper.status === 'REQUESTED') {
annotationWrapper.superType = 'suggestion-force-redaction';
return;
}
}
if (redactionLogEntryWrapper.actionPendingReanalysis) { if (!annotationWrapper.userId) {
if (
redactionLogEntryWrapper.manualRedactionType === 'REMOVE' ||
redactionLogEntryWrapper.manualRedactionType === 'UNDO'
) {
annotationWrapper.superType = 'pending-analysis'; annotationWrapper.superType = 'pending-analysis';
return;
} }
} else if (redactionLogEntryWrapper.status === 'REQUESTED') {
annotationWrapper.superType = 'suggestion-force-redaction';
return;
}
if (redactionLogEntryWrapper.actionPendingReanalysis) {
annotationWrapper.superType = 'pending-analysis';
} }
} }
@ -381,18 +379,29 @@ export class AnnotationWrapper {
if (entry.matchedRule) { if (entry.matchedRule) {
content += 'Rule ' + entry.matchedRule + ' matched \n\n'; content += 'Rule ' + entry.matchedRule + ' matched \n\n';
} }
if (entry.reason) { if (entry.reason) {
content += entry.reason + '\n\n'; content += entry.reason + '\n\n';
} }
if (entry.legalBasisChangeValue) {
content += 'Legal basis:' + entry.legalBasis + '\n\n'; if (entry.legalBasisChangeValue || entry.legalBasis) {
} else if (entry.legalBasis) { content += 'Legal basis: ' + entry.legalBasis + '\n\n';
content += 'Legal basis:' + entry.legalBasis + '\n\n';
} }
if (entry.section) { if (entry.section) {
content += 'In section: "' + entry.section + '"'; content += 'In section: "' + entry.section + '"';
} }
annotationWrapper.shortContent = entry.reason || content;
annotationWrapper.shortContent = this._getShortContent(entry) || content;
annotationWrapper.content = content; annotationWrapper.content = content;
} }
private static _getShortContent(entry: RedactionLogEntryWrapper) {
if (entry.legalBasis) {
const lb = entry.legalBasisMapping?.find(lbm => lbm.description === entry.reason);
if (lb) return lb.name;
}
return entry.reason;
}
} }

View File

@ -251,11 +251,14 @@ export class FileDataModel {
}); });
result.forEach(redactionLogEntry => { result.forEach(redactionLogEntry => {
redactionLogEntry.legalBasisMapping = this.redactionLog.legalBasis;
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) {
redactionLogEntry.hidden = true; redactionLogEntry.hidden = true;

View File

@ -1,4 +1,4 @@
import { Comment, Rectangle } from '@redaction/red-ui-http'; import { Comment, LegalBasisMapping, Rectangle } from '@redaction/red-ui-http';
export interface RedactionLogEntryWrapper { export interface RedactionLogEntryWrapper {
color?: Array<number>; color?: Array<number>;
@ -6,6 +6,7 @@ export interface RedactionLogEntryWrapper {
hint?: boolean; hint?: boolean;
id?: string; id?: string;
legalBasis?: string; legalBasis?: string;
legalBasisMapping?: Array<LegalBasisMapping>;
manual?: boolean; manual?: boolean;
manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE'; manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE';
matchedRule?: number; matchedRule?: number;

View File

@ -175,7 +175,7 @@
*ngFor=" *ngFor="
let annotation of displayedAnnotations[activeViewerPage]?.annotations let annotation of displayedAnnotations[activeViewerPage]?.annotations
" "
[class.active]="annotationIsSelected(annotation)" [class.active]="isSelected(annotation)"
[class.multi-select-active]="multiSelectActive" [class.multi-select-active]="multiSelectActive"
attr.annotation-id="{{ annotation.id }}" attr.annotation-id="{{ annotation.id }}"
attr.annotation-page="{{ activeViewerPage }}" attr.annotation-page="{{ activeViewerPage }}"
@ -213,10 +213,7 @@
<div class="active-icon-marker-container"> <div class="active-icon-marker-container">
<redaction-round-checkbox <redaction-round-checkbox
*ngIf=" *ngIf="multiSelectActive && isSelected(annotation)"
multiSelectActive &&
annotationIsSelected(annotation)
"
[active]="true" [active]="true"
></redaction-round-checkbox> ></redaction-round-checkbox>
</div> </div>
@ -269,11 +266,10 @@
</ng-template> </ng-template>
<ng-template #annotationFilterActionTemplate let-filter="filter"> <ng-template #annotationFilterActionTemplate let-filter="filter">
<ng-container *ngIf="filter.key === 'skipped'"> <redaction-circle-button
<redaction-circle-button *ngIf="filter.key === 'skipped'"
(action)="toggleSkipped.emit($event)" (action)="toggleSkipped.emit($event)"
[icon]="hideSkipped ? 'red:visibility-off' : 'red:visibility'" [icon]="hideSkipped ? 'red:visibility-off' : 'red:visibility'"
type="dark-bg" type="dark-bg"
></redaction-circle-button> ></redaction-circle-button>
</ng-container>
</ng-template> </ng-template>

View File

@ -123,7 +123,7 @@ export class FileWorkloadComponent {
return this._translateService.instant(i18nString, { count: comments.length }); return this._translateService.instant(i18nString, { count: comments.length });
} }
annotationIsSelected(annotation: AnnotationWrapper) { isSelected(annotation: AnnotationWrapper) {
return this.selectedAnnotations?.find(a => a?.id === annotation.id); return this.selectedAnnotations?.find(a => a?.id === annotation.id);
} }
@ -167,7 +167,7 @@ export class FileWorkloadComponent {
annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) { annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) {
this.pagesPanelActive = false; this.pagesPanelActive = false;
if (this.annotationIsSelected(annotation)) { if (this.isSelected(annotation)) {
this.deselectAnnotations.emit([annotation]); this.deselectAnnotations.emit([annotation]);
} else { } else {
if (($event.ctrlKey || $event.metaKey) && this.selectedAnnotations.length > 0) { if (($event.ctrlKey || $event.metaKey) && this.selectedAnnotations.length > 0) {

View File

@ -69,7 +69,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
private readonly _annotationDrawService: AnnotationDrawService, private readonly _annotationDrawService: AnnotationDrawService,
private readonly _annotationActionsService: AnnotationActionsService, private readonly _annotationActionsService: AnnotationActionsService,
private readonly _appConfigService: AppConfigService, private readonly _appConfigService: AppConfigService,
private readonly _appLoadStateService: LoadingService private readonly _loadingService: LoadingService
) {} ) {}
ngOnInit() { ngOnInit() {
@ -660,7 +660,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
const compareDocumentPageCount = await compareDocument.getPageCount(); const compareDocumentPageCount = await compareDocument.getPageCount();
const loadCompareDocument = async () => { const loadCompareDocument = async () => {
this._appLoadStateService.start(); this._loadingService.start();
try { try {
const maxPageCount = Math.max( const maxPageCount = Math.max(
@ -746,7 +746,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
this.navigateToPage(1); this.navigateToPage(1);
} catch (e) {} } catch (e) {}
this._appLoadStateService.stop(); this._loadingService.stop();
}; };
if (currentDocumentPageCount !== compareDocumentPageCount) { if (currentDocumentPageCount !== compareDocumentPageCount) {

View File

@ -105,14 +105,11 @@ 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)
); ),
}, () => this.dialogRef.close()
() => {
this.dialogRef.close();
}
); );
} }