legal basis v1

This commit is contained in:
Timo 2021-06-29 19:22:00 +03:00
parent 975bed7380
commit 5f5e2d772c
8 changed files with 48 additions and 11 deletions

View File

@ -61,7 +61,7 @@ export class AnnotationPermissions {
!permissions.canUndo && !permissions.canUndo &&
annotation.superType !== 'pending-analysis')); annotation.superType !== 'pending-analysis'));
permissions.canChangeLegalBasis = !!annotation.legalBasis; permissions.canChangeLegalBasis = !annotation.isManualRedaction && annotation.isRedacted;
return permissions; return permissions;
} }

View File

@ -9,6 +9,7 @@ export class AnnotationWrapper {
| 'suggestion-change-legal-basis' | 'suggestion-change-legal-basis'
| 'suggestion-add-dictionary' | 'suggestion-add-dictionary'
| 'suggestion-force-redaction' | 'suggestion-force-redaction'
| 'change-legal-basis'
| 'suggestion-remove-dictionary' | 'suggestion-remove-dictionary'
| 'suggestion-add' | 'suggestion-add'
| 'suggestion-remove' | 'suggestion-remove'
@ -48,6 +49,8 @@ export class AnnotationWrapper {
isChangeLogEntry?: boolean; isChangeLogEntry?: boolean;
changeLogType?: 'ADDED' | 'REMOVED'; changeLogType?: 'ADDED' | 'REMOVED';
private _origin: RedactionLogEntryWrapper;
constructor() {} constructor() {}
get isUndoableSuperType() { get isUndoableSuperType() {
@ -59,6 +62,7 @@ export class AnnotationWrapper {
this.superType === 'suggestion-remove-dictionary' || this.superType === 'suggestion-remove-dictionary' ||
this.superType === 'suggestion-change-legal-basis' || this.superType === 'suggestion-change-legal-basis' ||
this.superType === 'suggestion-add' || this.superType === 'suggestion-add' ||
this.superType === 'change-legal-basis' ||
this.superType === 'suggestion-remove' || this.superType === 'suggestion-remove' ||
this.superType === 'skipped' || this.superType === 'skipped' ||
this.superType === 'redaction' || this.superType === 'redaction' ||
@ -141,7 +145,8 @@ export class AnnotationWrapper {
this.superType === 'add-dictionary' || this.superType === 'add-dictionary' ||
this.superType === 'remove-dictionary' || this.superType === 'remove-dictionary' ||
this.superType === 'remove-only-here' || this.superType === 'remove-only-here' ||
this.superType === 'pending-analysis' this.superType === 'pending-analysis' ||
this.superType === 'change-legal-basis'
); );
} }
@ -210,6 +215,8 @@ export class AnnotationWrapper {
static fromData(redactionLogEntry?: RedactionLogEntryWrapper) { static fromData(redactionLogEntry?: RedactionLogEntryWrapper) {
const annotationWrapper = new AnnotationWrapper(); const annotationWrapper = new AnnotationWrapper();
annotationWrapper._origin = redactionLogEntry;
annotationWrapper.annotationId = redactionLogEntry.id; annotationWrapper.annotationId = redactionLogEntry.id;
annotationWrapper.force = redactionLogEntry.force; annotationWrapper.force = redactionLogEntry.force;
annotationWrapper.isChangeLogEntry = redactionLogEntry.isChangeLogEntry; annotationWrapper.isChangeLogEntry = redactionLogEntry.isChangeLogEntry;
@ -253,11 +260,15 @@ export class AnnotationWrapper {
annotationWrapper: AnnotationWrapper, annotationWrapper: AnnotationWrapper,
redactionLogEntryWrapper: RedactionLogEntryWrapper redactionLogEntryWrapper: RedactionLogEntryWrapper
) { ) {
if ( if (redactionLogEntryWrapper.legalBasisChangeValue) {
redactionLogEntryWrapper.legalBasisChangeValue && if (redactionLogEntryWrapper.status === 'REQUESTED') {
redactionLogEntryWrapper.status === 'REQUESTED' annotationWrapper.superType = 'suggestion-change-legal-basis';
) { } else if (redactionLogEntryWrapper.actionPendingReanalysis) {
annotationWrapper.superType = 'suggestion-change-legal-basis'; annotationWrapper.superType = 'change-legal-basis';
} else {
annotationWrapper.superType = 'redaction';
}
return;
} }
if (redactionLogEntryWrapper.recommendation) { if (redactionLogEntryWrapper.recommendation) {

View File

@ -229,11 +229,11 @@ export class FileDataModel {
const relevantRedactionLogEntry = result.find(r => r.id === legalBasisChange.id); const relevantRedactionLogEntry = result.find(r => r.id === legalBasisChange.id);
if (!relevantRedactionLogEntry) { if (!relevantRedactionLogEntry) {
// idRemove for something that doesn't exist - skip // legalBasisChanges for something that doesn't exist - skip
return; return;
} else { } else {
relevantRedactionLogEntry.legalBasisChangeValue = legalBasisChange.legalBasis; relevantRedactionLogEntry.legalBasisChangeValue = legalBasisChange.legalBasis;
relevantRedactionLogEntry.userId = legalBasisChange.user;
// if statuses differ // if statuses differ
if (relevantRedactionLogEntry.status !== legalBasisChange.status) { if (relevantRedactionLogEntry.status !== legalBasisChange.status) {
relevantRedactionLogEntry.actionPendingReanalysis = true; relevantRedactionLogEntry.actionPendingReanalysis = true;
@ -259,6 +259,18 @@ export class FileDataModel {
redactionLogEntry.hidden = true; redactionLogEntry.hidden = true;
} }
} }
if (redactionLogEntry.manualRedactionType === 'LEGAL_BASIS_CHANGE') {
const legalBasisChanges = this.manualRedactions.legalBasisChanges.find(
me => me.id === redactionLogEntry.id
);
// ADD has been undone - not yet processed
if (!legalBasisChanges) {
redactionLogEntry.manual = false;
redactionLogEntry.manualRedactionType = 'UNDO';
redactionLogEntry.status = null;
}
}
if (redactionLogEntry.manualRedactionType === 'REMOVE') { if (redactionLogEntry.manualRedactionType === 'REMOVE') {
const foundManualEntry = this.manualRedactions.idsToRemove.find( const foundManualEntry = this.manualRedactions.idsToRemove.find(
me => me.id === redactionLogEntry.id me => me.id === redactionLogEntry.id

View File

@ -7,7 +7,7 @@ export interface RedactionLogEntryWrapper {
id?: string; id?: string;
legalBasis?: string; legalBasis?: string;
manual?: boolean; manual?: boolean;
manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO'; manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE';
matchedRule?: number; matchedRule?: number;
positions?: Array<Rectangle>; positions?: Array<Rectangle>;
reason?: string; reason?: string;

View File

@ -25,6 +25,7 @@ export class TypeFilterComponent implements OnInit {
'remove-dictionary', 'remove-dictionary',
'remove-only-here', 'remove-only-here',
'pending-analysis', 'pending-analysis',
'change-legal-basis',
'analysis' 'analysis'
]; ];

View File

@ -639,6 +639,15 @@ export class AppStateService {
true true
); );
dictionaryData['change-legal-basis'] = new TypeValueWrapper(
{
hexColor: colors.analysisColor,
type: 'analysis'
},
null,
true
);
dictionaryData['hint'] = new TypeValueWrapper( dictionaryData['hint'] = new TypeValueWrapper(
{ {
hexColor: '#fa98f7', hexColor: '#fa98f7',

View File

@ -2,7 +2,8 @@ export const SuperTypeSorter = {
'add-dictionary': 2, 'add-dictionary': 2,
'remove-dictionary': 3, 'remove-dictionary': 3,
'pending-analysis': 4, 'pending-analysis': 4,
'remove-only-here': 5, 'change-legal-basis': 5,
'remove-only-here': 6,
'suggestion-add-dictionary': 12, 'suggestion-add-dictionary': 12,
'suggestion-remove-dictionary': 13, 'suggestion-remove-dictionary': 13,
'suggestion-add': 10, 'suggestion-add': 10,

View File

@ -577,6 +577,7 @@
"redaction": "Redaction", "redaction": "Redaction",
"comment": "Comment", "comment": "Comment",
"pending-analysis": "Pending Re-Analysis", "pending-analysis": "Pending Re-Analysis",
"change-legal-basis": "Pending Change of Legal Basis",
"suggestion": "Suggestion for redaction", "suggestion": "Suggestion for redaction",
"dictionary": "Dictionary", "dictionary": "Dictionary",
"type": "Type", "type": "Type",
@ -620,10 +621,12 @@
"suggestion-add-dictionary": "Suggested dictionary add", "suggestion-add-dictionary": "Suggested dictionary add",
"suggestion-force-redaction": "Suggestion force redaction", "suggestion-force-redaction": "Suggestion force redaction",
"suggestion-remove-dictionary": "Suggested dictionary removal", "suggestion-remove-dictionary": "Suggested dictionary removal",
"suggestion-change-legal-basis": "Suggested change legal basis",
"suggestion-add": "Suggested redaction", "suggestion-add": "Suggested redaction",
"suggestion-remove": "Suggested redaction removal", "suggestion-remove": "Suggested redaction removal",
"skipped": "Skipped", "skipped": "Skipped",
"pending-analysis": "Pending Re-Analysis", "pending-analysis": "Pending Re-Analysis",
"change-legal-basis": "Pending Change of Legal Basis",
"hint": "Hint", "hint": "Hint",
"redaction": "Redaction", "redaction": "Redaction",
"manual-redaction": "Manual Redaction", "manual-redaction": "Manual Redaction",