minor fixes and - RED-1758
This commit is contained in:
parent
e2b3a97723
commit
f26cbbaa1c
@ -34,9 +34,8 @@ export class AnnotationPermissions {
|
||||
const permissions: AnnotationPermissions = new AnnotationPermissions();
|
||||
|
||||
permissions.canUndo =
|
||||
annotation.isUndoableSuperType &&
|
||||
(annotation.userId === user.id ||
|
||||
(annotation.userId && isApprover && !annotation.isSuggestion));
|
||||
(!isApprover && annotation.isSuggestion) ||
|
||||
(isApprover && annotation.isUndoableActionForApprover);
|
||||
|
||||
permissions.canForceRedaction = annotation.isSkipped && !permissions.canUndo;
|
||||
|
||||
|
||||
@ -6,10 +6,10 @@ export class AnnotationWrapper {
|
||||
| 'add-dictionary'
|
||||
| 'remove-dictionary'
|
||||
| 'remove-only-here'
|
||||
| 'change-legal-basis'
|
||||
| 'suggestion-change-legal-basis'
|
||||
| 'suggestion-add-dictionary'
|
||||
| 'suggestion-force-redaction'
|
||||
| 'change-legal-basis'
|
||||
| 'suggestion-remove-dictionary'
|
||||
| 'suggestion-add'
|
||||
| 'suggestion-remove'
|
||||
@ -29,7 +29,6 @@ export class AnnotationWrapper {
|
||||
shortContent: string;
|
||||
content: string;
|
||||
value: string;
|
||||
userId: string;
|
||||
typeLabel: string;
|
||||
pageNumber: number;
|
||||
hint: boolean;
|
||||
@ -41,6 +40,8 @@ export class AnnotationWrapper {
|
||||
legalBasis: string;
|
||||
legalBasisChangeValue?: string;
|
||||
|
||||
manual?: boolean;
|
||||
|
||||
image?: boolean;
|
||||
force?: boolean;
|
||||
|
||||
@ -54,21 +55,8 @@ export class AnnotationWrapper {
|
||||
|
||||
constructor() {}
|
||||
|
||||
get isUndoableSuperType() {
|
||||
return (
|
||||
this.superType === 'add-dictionary' ||
|
||||
this.superType === 'remove-dictionary' ||
|
||||
this.superType === 'suggestion-add-dictionary' ||
|
||||
this.superType === 'suggestion-force-redaction' ||
|
||||
this.superType === 'suggestion-remove-dictionary' ||
|
||||
this.superType === 'suggestion-change-legal-basis' ||
|
||||
this.superType === 'suggestion-add' ||
|
||||
this.superType === 'change-legal-basis' ||
|
||||
this.superType === 'suggestion-remove' ||
|
||||
this.superType === 'skipped' ||
|
||||
this.superType === 'redaction' ||
|
||||
this.superType === 'manual-redaction'
|
||||
);
|
||||
get isUndoableActionForApprover() {
|
||||
return this.manual;
|
||||
}
|
||||
|
||||
get isChangeLogRemoved() {
|
||||
@ -219,7 +207,6 @@ export class AnnotationWrapper {
|
||||
annotationWrapper._origin = redactionLogEntry;
|
||||
|
||||
annotationWrapper.annotationId = redactionLogEntry.id;
|
||||
annotationWrapper.force = redactionLogEntry.force;
|
||||
annotationWrapper.isChangeLogEntry = redactionLogEntry.isChangeLogEntry;
|
||||
annotationWrapper.changeLogType = redactionLogEntry.changeLogType;
|
||||
annotationWrapper.redaction = redactionLogEntry.redacted;
|
||||
@ -233,14 +220,14 @@ export class AnnotationWrapper {
|
||||
annotationWrapper.textBefore = redactionLogEntry.textBefore;
|
||||
annotationWrapper.textAfter = redactionLogEntry.textAfter;
|
||||
annotationWrapper.dictionaryOperation = redactionLogEntry.dictionaryEntry;
|
||||
annotationWrapper.userId = redactionLogEntry.userId;
|
||||
annotationWrapper.image = redactionLogEntry.image;
|
||||
annotationWrapper.legalBasisChangeValue = redactionLogEntry.legalBasisChangeValue;
|
||||
annotationWrapper.comments = redactionLogEntry.comments || [];
|
||||
annotationWrapper.legalBasis = redactionLogEntry.legalBasis;
|
||||
annotationWrapper.manual = redactionLogEntry.manual;
|
||||
|
||||
this._createContent(annotationWrapper, redactionLogEntry);
|
||||
this._setSuperType(annotationWrapper, redactionLogEntry);
|
||||
this._handleSkippedState(annotationWrapper, redactionLogEntry);
|
||||
this._handleRecommendations(annotationWrapper, redactionLogEntry);
|
||||
annotationWrapper.typeLabel = 'annotation-type.' + annotationWrapper.superType;
|
||||
|
||||
@ -262,25 +249,35 @@ export class AnnotationWrapper {
|
||||
annotationWrapper: AnnotationWrapper,
|
||||
redactionLogEntryWrapper: RedactionLogEntryWrapper
|
||||
) {
|
||||
if (redactionLogEntryWrapper.legalBasisChangeValue) {
|
||||
if (redactionLogEntryWrapper.status === 'REQUESTED') {
|
||||
annotationWrapper.superType = 'suggestion-change-legal-basis';
|
||||
} else if (redactionLogEntryWrapper.actionPendingReanalysis) {
|
||||
annotationWrapper.superType = 'change-legal-basis';
|
||||
if (redactionLogEntryWrapper.recommendation) {
|
||||
if (redactionLogEntryWrapper.redacted) {
|
||||
annotationWrapper.superType = 'recommendation';
|
||||
} else {
|
||||
annotationWrapper.superType = 'redaction';
|
||||
annotationWrapper.superType = 'skipped';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (redactionLogEntryWrapper.recommendation) {
|
||||
if (redactionLogEntryWrapper.redacted) {
|
||||
annotationWrapper.superType = 'recommendation';
|
||||
return;
|
||||
if (redactionLogEntryWrapper.manualRedactionType === 'FORCE_REDACT') {
|
||||
annotationWrapper.force = true;
|
||||
|
||||
if (redactionLogEntryWrapper.status === 'REQUESTED') {
|
||||
annotationWrapper.superType = 'suggestion-force-redaction';
|
||||
} else if (redactionLogEntryWrapper.status === 'APPROVED') {
|
||||
annotationWrapper.superType = 'redaction';
|
||||
} else {
|
||||
annotationWrapper.superType = 'skipped';
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (redactionLogEntryWrapper.manualRedactionType === 'LEGAL_BASIS_CHANGE') {
|
||||
if (redactionLogEntryWrapper.status === 'REQUESTED') {
|
||||
annotationWrapper.superType = 'suggestion-change-legal-basis';
|
||||
} else {
|
||||
annotationWrapper.superType = 'redaction';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (redactionLogEntryWrapper.status === 'DECLINED') {
|
||||
@ -295,45 +292,53 @@ export class AnnotationWrapper {
|
||||
if (redactionLogEntryWrapper.status === 'APPROVED') {
|
||||
annotationWrapper.superType = 'add-dictionary';
|
||||
}
|
||||
} else {
|
||||
if (redactionLogEntryWrapper.redacted) {
|
||||
if (redactionLogEntryWrapper.force) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (redactionLogEntryWrapper.manualRedactionType === 'ADD') {
|
||||
if (redactionLogEntryWrapper.dictionaryEntry) {
|
||||
if (redactionLogEntryWrapper.status === 'REQUESTED') {
|
||||
annotationWrapper.superType = 'suggestion-add-dictionary';
|
||||
}
|
||||
if (redactionLogEntryWrapper.status === 'APPROVED') {
|
||||
annotationWrapper.superType = 'add-dictionary';
|
||||
}
|
||||
} else {
|
||||
if (redactionLogEntryWrapper.status === 'REQUESTED') {
|
||||
annotationWrapper.superType = 'suggestion-add';
|
||||
}
|
||||
if (redactionLogEntryWrapper.status === 'APPROVED') {
|
||||
annotationWrapper.superType = 'manual-redaction';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (redactionLogEntryWrapper.redacted) {
|
||||
if (redactionLogEntryWrapper.status === 'REQUESTED') {
|
||||
if (redactionLogEntryWrapper.dictionaryEntry) {
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.status === 'REQUESTED'
|
||||
? 'suggestion-add'
|
||||
: 'redaction';
|
||||
} else if (redactionLogEntryWrapper.type === 'manual') {
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.status === 'REQUESTED'
|
||||
? 'suggestion-add'
|
||||
: 'manual-redaction';
|
||||
redactionLogEntryWrapper.manualRedactionType === 'ADD'
|
||||
? 'suggestion-add-dictionary'
|
||||
: 'suggestion-remove-dictionary';
|
||||
} else {
|
||||
if (redactionLogEntryWrapper.status === 'REQUESTED') {
|
||||
if (redactionLogEntryWrapper.dictionaryEntry) {
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.manualRedactionType === 'ADD'
|
||||
? 'suggestion-add-dictionary'
|
||||
: 'suggestion-remove-dictionary';
|
||||
} else {
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.manualRedactionType === 'ADD'
|
||||
? 'suggestion-add'
|
||||
: 'suggestion-remove';
|
||||
}
|
||||
}
|
||||
if (redactionLogEntryWrapper.status === 'APPROVED') {
|
||||
if (redactionLogEntryWrapper.dictionaryEntry) {
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.manualRedactionType === 'ADD'
|
||||
? 'add-dictionary'
|
||||
: 'remove-dictionary';
|
||||
} else {
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.manualRedactionType === 'ADD'
|
||||
? 'manual-redaction'
|
||||
: 'remove-only-here';
|
||||
}
|
||||
}
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.manualRedactionType === 'ADD'
|
||||
? 'suggestion-add'
|
||||
: 'suggestion-remove';
|
||||
}
|
||||
}
|
||||
|
||||
if (redactionLogEntryWrapper.status === 'APPROVED') {
|
||||
if (redactionLogEntryWrapper.dictionaryEntry) {
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.manualRedactionType === 'ADD'
|
||||
? 'add-dictionary'
|
||||
: 'remove-dictionary';
|
||||
} else {
|
||||
annotationWrapper.superType =
|
||||
redactionLogEntryWrapper.manualRedactionType === 'ADD'
|
||||
? 'manual-redaction'
|
||||
: 'remove-only-here';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -347,30 +352,6 @@ export class AnnotationWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
private static _handleSkippedState(
|
||||
annotationWrapper: AnnotationWrapper,
|
||||
redactionLogEntryWrapper: RedactionLogEntryWrapper
|
||||
) {
|
||||
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) {
|
||||
annotationWrapper.superType = 'pending-analysis';
|
||||
}
|
||||
}
|
||||
|
||||
private static _createContent(
|
||||
annotationWrapper: AnnotationWrapper,
|
||||
entry: RedactionLogEntryWrapper
|
||||
|
||||
@ -64,9 +64,7 @@ export class FileDataModel {
|
||||
return;
|
||||
}
|
||||
|
||||
const redactionLogEntryWrapper: RedactionLogEntryWrapper = {
|
||||
actionPendingReanalysis: false
|
||||
};
|
||||
const redactionLogEntryWrapper: RedactionLogEntryWrapper = {};
|
||||
|
||||
Object.assign(redactionLogEntryWrapper, changeLogEntry);
|
||||
|
||||
@ -94,9 +92,7 @@ export class FileDataModel {
|
||||
);
|
||||
|
||||
// copy the redactionLog Entry
|
||||
const redactionLogEntryWrapper: RedactionLogEntryWrapper = {
|
||||
actionPendingReanalysis: false
|
||||
};
|
||||
const redactionLogEntryWrapper: RedactionLogEntryWrapper = {};
|
||||
Object.assign(redactionLogEntryWrapper, redactionLogEntry);
|
||||
redactionLogEntryWrapper.isChangeLogEntry = !!existingChangeLogEntry;
|
||||
redactionLogEntryWrapper.changeLogType = 'ADDED';
|
||||
|
||||
@ -8,7 +8,7 @@ export interface RedactionLogEntryWrapper {
|
||||
legalBasis?: string;
|
||||
legalBasisMapping?: Array<LegalBasisMapping>;
|
||||
manual?: boolean;
|
||||
manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE';
|
||||
manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE' | 'FORCE_REDACT';
|
||||
matchedRule?: number;
|
||||
positions?: Array<Rectangle>;
|
||||
reason?: string;
|
||||
@ -20,14 +20,11 @@ export interface RedactionLogEntryWrapper {
|
||||
textBefore?: string;
|
||||
type?: string;
|
||||
value?: string;
|
||||
force?: boolean;
|
||||
image?: boolean;
|
||||
|
||||
recommendation?: boolean;
|
||||
recommendationAnnotationId?: string;
|
||||
|
||||
actionPendingReanalysis?: boolean;
|
||||
|
||||
hidden?: boolean;
|
||||
|
||||
userId?: string;
|
||||
|
||||
@ -27,7 +27,10 @@ export class RedRoleGuard implements CanActivate {
|
||||
if (
|
||||
this._userService.user.isUserAdmin &&
|
||||
!this._userService.user.isAdmin &&
|
||||
!state.url.startsWith('/main/admin/users')
|
||||
!(
|
||||
state.url.startsWith('/main/admin/users') ||
|
||||
state.url.startsWith('/main/my-profile')
|
||||
)
|
||||
) {
|
||||
this._router.navigate(['/main/admin/users']);
|
||||
obs.next(false);
|
||||
|
||||
@ -78,7 +78,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
@ViewChild(PdfViewerComponent) viewerComponent: PdfViewerComponent;
|
||||
private _instance: WebViewerInstance;
|
||||
private _lastPage: string;
|
||||
private _reloadFileOnReanalysis: boolean = false;
|
||||
private _reloadFileOnReanalysis = false;
|
||||
|
||||
@ViewChild('fileWorkloadComponent') private _workloadComponent: FileWorkloadComponent;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ import { forkJoin, Observable, of } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import {
|
||||
FileManagementControllerService,
|
||||
ManualRedactionControllerService,
|
||||
RedactionLogControllerService,
|
||||
ViewedPagesControllerService
|
||||
} from '@redaction/red-ui-http';
|
||||
@ -16,6 +17,7 @@ export class PdfViewerDataService {
|
||||
constructor(
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _man: ManualRedactionControllerService,
|
||||
private readonly _fileManagementControllerService: FileManagementControllerService,
|
||||
private readonly _redactionLogControllerService: RedactionLogControllerService,
|
||||
private readonly _viewedPagesControllerService: ViewedPagesControllerService
|
||||
@ -32,6 +34,8 @@ export class PdfViewerDataService {
|
||||
const dossierId = this._appStateService.activeDossierId;
|
||||
const fileId = this._appStateService.activeFileId;
|
||||
|
||||
this._man.getManualRedaction(dossierId, fileId).subscribe();
|
||||
|
||||
const file$ = this.downloadOriginalFile(this._appStateService.activeFile);
|
||||
const reactionLog$ = this._redactionLogControllerService
|
||||
.getRedactionLogPreview(dossierId, fileId)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user