manual redaction fixes
This commit is contained in:
parent
5a3f6852ea
commit
e4c3b6bcdb
@ -27,7 +27,24 @@ export class FilterComponent implements OnChanges {
|
|||||||
constructor(public readonly appStateService: AppStateService) {}
|
constructor(public readonly appStateService: AppStateService) {}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
// this.filtersChanged.emit(this.filters);
|
if (changes.filters) {
|
||||||
|
const oldFilters = changes.filters.previousValue;
|
||||||
|
this._copySettings(oldFilters, this.filters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _copySettings(oldFilters: FilterModel[], newFilters: FilterModel[]) {
|
||||||
|
if (oldFilters && newFilters) {
|
||||||
|
for (let oldFilter of oldFilters) {
|
||||||
|
const newFilter = newFilters.find((f) => f.key === oldFilter.key);
|
||||||
|
if (newFilter) {
|
||||||
|
newFilter.checked = oldFilter.checked;
|
||||||
|
newFilter.indeterminate = oldFilter.indeterminate;
|
||||||
|
this._copySettings(oldFilter.filters, newFilter.filters);
|
||||||
|
handleCheckedValue(newFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filterCheckboxClicked($event: any, filter: FilterModel, parent?: FilterModel) {
|
filterCheckboxClicked($event: any, filter: FilterModel, parent?: FilterModel) {
|
||||||
|
|||||||
@ -92,7 +92,6 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
@ViewChild(PdfViewerComponent) private _viewerComponent: PdfViewerComponent;
|
@ViewChild(PdfViewerComponent) private _viewerComponent: PdfViewerComponent;
|
||||||
@ViewChild('annotationsElement') private _annotationsElement: ElementRef;
|
@ViewChild('annotationsElement') private _annotationsElement: ElementRef;
|
||||||
@ViewChild('quickNavigation') private _quickNavigationElement: ElementRef;
|
@ViewChild('quickNavigation') private _quickNavigationElement: ElementRef;
|
||||||
@ViewChild('menu') private _matMenuTrigger: MatMenuTrigger;
|
|
||||||
|
|
||||||
public fileData: FileDataModel;
|
public fileData: FileDataModel;
|
||||||
public fileId: string;
|
public fileId: string;
|
||||||
@ -118,23 +117,30 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
private _loadFileData() {
|
private _loadFileData() {
|
||||||
this._fileDownloadService.loadActiveFileData().subscribe((fileDataModel) => {
|
this._fileDownloadService.loadActiveFileData().subscribe((fileDataModel) => {
|
||||||
this.fileData = fileDataModel;
|
this.fileData = fileDataModel;
|
||||||
|
this._rebuildFilters();
|
||||||
const manualRedactionAnnotations = fileDataModel.entriesToAdd.map((mr) =>
|
|
||||||
AnnotationWrapper.fromManualRedaction(mr, fileDataModel.manualRedactions.comments)
|
|
||||||
);
|
|
||||||
const redactionLogAnnotations = fileDataModel.redactionLog.redactionLogEntry.map(
|
|
||||||
(rde) =>
|
|
||||||
AnnotationWrapper.fromRedactionLog(rde, fileDataModel.manualRedactions.comments)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.annotations.push(...manualRedactionAnnotations);
|
|
||||||
this.annotations.push(...redactionLogAnnotations);
|
|
||||||
this.filters = this._annotationProcessingService.getAnnotationFilter(this.annotations);
|
|
||||||
this.filtersChanged(this.filters);
|
|
||||||
this._changeDetectorRef.detectChanges();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _rebuildFilters() {
|
||||||
|
const manualRedactionAnnotations = this.fileData.entriesToAdd.map((mr) =>
|
||||||
|
AnnotationWrapper.fromManualRedaction(
|
||||||
|
mr,
|
||||||
|
this.fileData.manualRedactions.comments,
|
||||||
|
this.appStateService.dictionaryData
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const redactionLogAnnotations = this.fileData.redactionLog.redactionLogEntry.map((rde) =>
|
||||||
|
AnnotationWrapper.fromRedactionLog(rde, this.fileData.manualRedactions.comments)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.annotations.splice(0, this.annotations.length);
|
||||||
|
this.annotations.push(...manualRedactionAnnotations);
|
||||||
|
this.annotations.push(...redactionLogAnnotations);
|
||||||
|
this.filters = this._annotationProcessingService.getAnnotationFilter(this.annotations);
|
||||||
|
this.filtersChanged(this.filters);
|
||||||
|
this._changeDetectorRef.detectChanges();
|
||||||
|
}
|
||||||
|
|
||||||
public openFileDetailsDialog($event: MouseEvent) {
|
public openFileDetailsDialog($event: MouseEvent) {
|
||||||
this._dialogRef = this._dialogService.openFileDetailsDialog(
|
this._dialogRef = this._dialogService.openFileDetailsDialog(
|
||||||
$event,
|
$event,
|
||||||
@ -257,7 +263,6 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
public openAcceptSuggestionMenu($event: MouseEvent, annotation: AnnotationWrapper) {
|
public openAcceptSuggestionMenu($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
this._activeSuggestion = annotation;
|
this._activeSuggestion = annotation;
|
||||||
this._matMenuTrigger.openMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onSuggestionMenuClose() {
|
public onSuggestionMenuClose() {
|
||||||
@ -459,6 +464,7 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
this.instance,
|
this.instance,
|
||||||
this.fileData.entriesToAdd
|
this.fileData.entriesToAdd
|
||||||
);
|
);
|
||||||
|
this._rebuildFilters();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,10 @@
|
|||||||
import { Comment, ManualRedactionEntry, Point, RedactionLogEntry } from '@redaction/red-ui-http';
|
import {
|
||||||
|
Comment,
|
||||||
|
ManualRedactionEntry,
|
||||||
|
Point,
|
||||||
|
RedactionLogEntry,
|
||||||
|
TypeValue
|
||||||
|
} from '@redaction/red-ui-http';
|
||||||
|
|
||||||
export class AnnotationWrapper {
|
export class AnnotationWrapper {
|
||||||
superType: 'request' | 'redaction' | 'hint' | 'ignore';
|
superType: 'request' | 'redaction' | 'hint' | 'ignore';
|
||||||
@ -39,11 +45,16 @@ export class AnnotationWrapper {
|
|||||||
|
|
||||||
static fromManualRedaction(
|
static fromManualRedaction(
|
||||||
manualRedactionEntry: ManualRedactionEntry,
|
manualRedactionEntry: ManualRedactionEntry,
|
||||||
comments: { [key: string]: Array<Comment> }
|
comments: { [p: string]: Array<Comment> },
|
||||||
|
dictionaryData: { [p: string]: TypeValue }
|
||||||
) {
|
) {
|
||||||
console.log(manualRedactionEntry);
|
console.log(manualRedactionEntry);
|
||||||
const annotationWrapper = new AnnotationWrapper();
|
const annotationWrapper = new AnnotationWrapper();
|
||||||
annotationWrapper.superType = !manualRedactionEntry.addToDictionary ? 'request' : 'request';
|
|
||||||
|
annotationWrapper.superType = AnnotationWrapper.getManualRedactionSuperType(
|
||||||
|
manualRedactionEntry,
|
||||||
|
dictionaryData
|
||||||
|
);
|
||||||
annotationWrapper.dictionary = manualRedactionEntry.type;
|
annotationWrapper.dictionary = manualRedactionEntry.type;
|
||||||
annotationWrapper.firstTopLeftPoint = manualRedactionEntry.positions[0]?.topLeft;
|
annotationWrapper.firstTopLeftPoint = manualRedactionEntry.positions[0]?.topLeft;
|
||||||
annotationWrapper.pageNumber = manualRedactionEntry.positions[0]?.page;
|
annotationWrapper.pageNumber = manualRedactionEntry.positions[0]?.page;
|
||||||
@ -58,6 +69,18 @@ export class AnnotationWrapper {
|
|||||||
return annotationWrapper;
|
return annotationWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getManualRedactionSuperType(
|
||||||
|
manualRedactionEntry: ManualRedactionEntry,
|
||||||
|
dictionaryData: { [p: string]: TypeValue }
|
||||||
|
) {
|
||||||
|
const dictionary = dictionaryData[manualRedactionEntry.type];
|
||||||
|
return manualRedactionEntry.status === 'REQUESTED'
|
||||||
|
? 'request'
|
||||||
|
: dictionary.hint
|
||||||
|
? 'hint'
|
||||||
|
: 'redaction';
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
get manualRedactionOwner() {
|
get manualRedactionOwner() {
|
||||||
|
|||||||
@ -10,7 +10,9 @@ export class FileDataModel {
|
|||||||
|
|
||||||
get entriesToAdd(): ManualRedactionEntry[] {
|
get entriesToAdd(): ManualRedactionEntry[] {
|
||||||
return this.manualRedactions.entriesToAdd.filter(
|
return this.manualRedactions.entriesToAdd.filter(
|
||||||
(e) => !this.redactionLog.redactionLogEntry.find((r) => r.id === e.id)
|
(e) =>
|
||||||
|
e.status !== 'DECLINED' &&
|
||||||
|
!this.redactionLog.redactionLogEntry.find((r) => r.id === e.id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { WebViewerInstance } from '@pdftron/webviewer';
|
|||||||
import { ManualRedactionEntry, Rectangle } from '@redaction/red-ui-http';
|
import { ManualRedactionEntry, Rectangle } from '@redaction/red-ui-http';
|
||||||
import { hexToRgb } from '../../../utils/functions';
|
import { hexToRgb } from '../../../utils/functions';
|
||||||
import { AppStateService } from '../../../state/app-state.service';
|
import { AppStateService } from '../../../state/app-state.service';
|
||||||
|
import { AnnotationWrapper } from '../model/annotation.wrapper';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -32,9 +33,14 @@ export class AnnotationDrawService {
|
|||||||
|
|
||||||
private _getColor(activeViewer: WebViewerInstance, manualRedactionEntry: ManualRedactionEntry) {
|
private _getColor(activeViewer: WebViewerInstance, manualRedactionEntry: ManualRedactionEntry) {
|
||||||
// if you're the owner, use the request color, otherwise use the actual dict color
|
// if you're the owner, use the request color, otherwise use the actual dict color
|
||||||
const color = this._appStateService.isActiveProjectOwner
|
const superType = AnnotationWrapper.getManualRedactionSuperType(
|
||||||
? this._appStateService.getDictionaryColor(manualRedactionEntry.type)
|
manualRedactionEntry,
|
||||||
: this._appStateService.getDictionaryColor('request');
|
this._appStateService.dictionaryData
|
||||||
|
);
|
||||||
|
const color =
|
||||||
|
superType === 'request'
|
||||||
|
? this._appStateService.getDictionaryColor('request')
|
||||||
|
: this._appStateService.getDictionaryColor(manualRedactionEntry.type);
|
||||||
|
|
||||||
const rgbColor = hexToRgb(color);
|
const rgbColor = hexToRgb(color);
|
||||||
return new activeViewer.Annotations.Color(rgbColor.r, rgbColor.g, rgbColor.b);
|
return new activeViewer.Annotations.Color(rgbColor.r, rgbColor.g, rgbColor.b);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user