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.comments = redactionLogEntry.comments || [];
annotationWrapper.legalBasis = redactionLogEntry.legalBasis;
AnnotationWrapper._createContent(annotationWrapper, redactionLogEntry);
AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry);
AnnotationWrapper._handleSkippedState(annotationWrapper, redactionLogEntry);
AnnotationWrapper._handleRecommendations(annotationWrapper, redactionLogEntry);
this._createContent(annotationWrapper, redactionLogEntry);
this._setSuperType(annotationWrapper, redactionLogEntry);
this._handleSkippedState(annotationWrapper, redactionLogEntry);
this._handleRecommendations(annotationWrapper, redactionLogEntry);
annotationWrapper.typeLabel = 'annotation-type.' + annotationWrapper.superType;
return annotationWrapper;
@ -351,25 +351,23 @@ export class AnnotationWrapper {
annotationWrapper: AnnotationWrapper,
redactionLogEntryWrapper: RedactionLogEntryWrapper
) {
if (annotationWrapper.superType === 'skipped') {
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 (annotationWrapper.superType !== 'skipped') return;
if (redactionLogEntryWrapper.actionPendingReanalysis) {
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) {
annotationWrapper.superType = 'pending-analysis';
}
}
@ -381,18 +379,29 @@ export class AnnotationWrapper {
if (entry.matchedRule) {
content += 'Rule ' + entry.matchedRule + ' matched \n\n';
}
if (entry.reason) {
content += entry.reason + '\n\n';
}
if (entry.legalBasisChangeValue) {
content += 'Legal basis:' + entry.legalBasis + '\n\n';
} else if (entry.legalBasis) {
content += 'Legal basis:' + entry.legalBasis + '\n\n';
if (entry.legalBasisChangeValue || entry.legalBasis) {
content += 'Legal basis: ' + entry.legalBasis + '\n\n';
}
if (entry.section) {
content += 'In section: "' + entry.section + '"';
}
annotationWrapper.shortContent = entry.reason || content;
annotationWrapper.shortContent = this._getShortContent(entry) || 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 => {
redactionLogEntry.legalBasisMapping = this.redactionLog.legalBasis;
if (redactionLogEntry.manual) {
if (redactionLogEntry.manualRedactionType === 'ADD') {
const foundManualEntry = this.manualRedactions.entriesToAdd.find(
me => me.id === redactionLogEntry.id
);
// ADD has been undone - not yet processed
if (!foundManualEntry) {
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 {
color?: Array<number>;
@ -6,6 +6,7 @@ export interface RedactionLogEntryWrapper {
hint?: boolean;
id?: string;
legalBasis?: string;
legalBasisMapping?: Array<LegalBasisMapping>;
manual?: boolean;
manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE';
matchedRule?: number;

View File

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

View File

@ -123,7 +123,7 @@ export class FileWorkloadComponent {
return this._translateService.instant(i18nString, { count: comments.length });
}
annotationIsSelected(annotation: AnnotationWrapper) {
isSelected(annotation: AnnotationWrapper) {
return this.selectedAnnotations?.find(a => a?.id === annotation.id);
}
@ -167,7 +167,7 @@ export class FileWorkloadComponent {
annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent) {
this.pagesPanelActive = false;
if (this.annotationIsSelected(annotation)) {
if (this.isSelected(annotation)) {
this.deselectAnnotations.emit([annotation]);
} else {
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 _annotationActionsService: AnnotationActionsService,
private readonly _appConfigService: AppConfigService,
private readonly _appLoadStateService: LoadingService
private readonly _loadingService: LoadingService
) {}
ngOnInit() {
@ -660,7 +660,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
const compareDocumentPageCount = await compareDocument.getPageCount();
const loadCompareDocument = async () => {
this._appLoadStateService.start();
this._loadingService.start();
try {
const maxPageCount = Math.max(
@ -746,7 +746,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
this.navigateToPage(1);
} catch (e) {}
this._appLoadStateService.stop();
this._loadingService.stop();
};
if (currentDocumentPageCount !== compareDocumentPageCount) {

View File

@ -105,14 +105,11 @@ export class ManualAnnotationDialogComponent implements OnInit {
this._manualAnnotationService
.addAnnotation(this.manualRedactionEntryWrapper.manualRedactionEntry)
.subscribe(
response => {
response =>
this.dialogRef.close(
new ManualAnnotationResponse(this.manualRedactionEntryWrapper, response)
);
},
() => {
this.dialogRef.close();
}
),
() => this.dialogRef.close()
);
}