Merge branch 'master' into VM/RED-7761
This commit is contained in:
commit
9fafc203f5
@ -13,7 +13,7 @@ export const canForceRedaction = (annotation: AnnotationWrapper, canAddRedaction
|
|||||||
export const canAcceptRecommendation = (annotation: AnnotationWrapper) => annotation.isRecommendation && !annotation.pending;
|
export const canAcceptRecommendation = (annotation: AnnotationWrapper) => annotation.isRecommendation && !annotation.pending;
|
||||||
|
|
||||||
export const canMarkAsFalsePositive = (annotation: AnnotationWrapper, annotationEntity: Dictionary) =>
|
export const canMarkAsFalsePositive = (annotation: AnnotationWrapper, annotationEntity: Dictionary) =>
|
||||||
annotation.canBeMarkedAsFalsePositive && annotationEntity.hasDictionary;
|
annotation.canBeMarkedAsFalsePositive && annotationEntity?.hasDictionary;
|
||||||
|
|
||||||
export const canRemoveOnlyHere = (annotation: AnnotationWrapper, canAddRedaction: boolean) =>
|
export const canRemoveOnlyHere = (annotation: AnnotationWrapper, canAddRedaction: boolean) =>
|
||||||
canAddRedaction && !annotation.pending && (annotation.isRedacted || (annotation.isHint && !annotation.isImage));
|
canAddRedaction && !annotation.pending && (annotation.isRedacted || (annotation.isHint && !annotation.isImage));
|
||||||
|
|||||||
@ -62,7 +62,7 @@ export class AnnotationPermissions {
|
|||||||
permissions.canRemoveRedaction = canRemoveRedaction(annotation, permissions);
|
permissions.canRemoveRedaction = canRemoveRedaction(annotation, permissions);
|
||||||
permissions.canChangeLegalBasis = canChangeLegalBasis(annotation, canAddRedaction);
|
permissions.canChangeLegalBasis = canChangeLegalBasis(annotation, canAddRedaction);
|
||||||
permissions.canRecategorizeAnnotation = canRecategorizeAnnotation(annotation, canAddRedaction);
|
permissions.canRecategorizeAnnotation = canRecategorizeAnnotation(annotation, canAddRedaction);
|
||||||
permissions.canResizeAnnotation = canResizeAnnotation(annotation, canAddRedaction, annotationEntity.hasDictionary);
|
permissions.canResizeAnnotation = canResizeAnnotation(annotation, canAddRedaction, annotationEntity?.hasDictionary);
|
||||||
permissions.canEditAnnotations = canEditAnnotation(annotation);
|
permissions.canEditAnnotations = canEditAnnotation(annotation);
|
||||||
permissions.canEditHints = canEditHint(annotation);
|
permissions.canEditHints = canEditHint(annotation);
|
||||||
permissions.canEditImages = canEditImage(annotation);
|
permissions.canEditImages = canEditImage(annotation);
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { IListable } from '@iqser/common-ui';
|
import { IListable } from '@iqser/common-ui';
|
||||||
import {
|
import {
|
||||||
|
annotationDefaultColorConfig,
|
||||||
annotationEntityColorConfig,
|
annotationEntityColorConfig,
|
||||||
AnnotationIconType,
|
AnnotationIconType,
|
||||||
ChangeType,
|
ChangeType,
|
||||||
|
DefaultColors,
|
||||||
Dictionary,
|
Dictionary,
|
||||||
Earmark,
|
Earmark,
|
||||||
EntityTypes,
|
EntityTypes,
|
||||||
@ -213,6 +215,7 @@ export class AnnotationWrapper implements IListable {
|
|||||||
changeLogType: ChangeType,
|
changeLogType: ChangeType,
|
||||||
legalBasisList: ILegalBasis[],
|
legalBasisList: ILegalBasis[],
|
||||||
isDocumine: boolean,
|
isDocumine: boolean,
|
||||||
|
defaultColors: DefaultColors,
|
||||||
) {
|
) {
|
||||||
const annotationWrapper = new AnnotationWrapper();
|
const annotationWrapper = new AnnotationWrapper();
|
||||||
|
|
||||||
@ -273,10 +276,11 @@ export class AnnotationWrapper implements IListable {
|
|||||||
annotationWrapper.isRemoved = logEntry.state === EntryStates.REMOVED;
|
annotationWrapper.isRemoved = logEntry.state === EntryStates.REMOVED;
|
||||||
annotationWrapper.isRemovedLocally = lastRelevantManualChange?.manualRedactionType === ManualRedactionTypes.REMOVE_LOCALLY;
|
annotationWrapper.isRemovedLocally = lastRelevantManualChange?.manualRedactionType === ManualRedactionTypes.REMOVE_LOCALLY;
|
||||||
|
|
||||||
annotationWrapper.typeLabel = dictionary.virtual ? undefined : dictionary.label;
|
annotationWrapper.typeLabel = dictionary?.virtual ? undefined : dictionary?.label;
|
||||||
|
|
||||||
const colorKey = annotationEntityColorConfig[annotationWrapper.superType];
|
const colorKey = annotationEntityColorConfig[annotationWrapper.superType];
|
||||||
annotationWrapper.color = dictionary[colorKey] as string;
|
const defaultColor = annotationDefaultColorConfig[annotationWrapper.superType];
|
||||||
|
annotationWrapper.color = dictionary ? (dictionary[colorKey] as string) : (defaultColors[defaultColor] as string);
|
||||||
annotationWrapper['entry'] = logEntry;
|
annotationWrapper['entry'] = logEntry;
|
||||||
|
|
||||||
return annotationWrapper;
|
return annotationWrapper;
|
||||||
|
|||||||
@ -26,8 +26,8 @@ export class ResizeAnnotationDialogComponent extends IqserDialogComponent<
|
|||||||
|
|
||||||
this.close({
|
this.close({
|
||||||
comment: formValue.comment,
|
comment: formValue.comment,
|
||||||
updateDictionary: this.entity.hasDictionary,
|
updateDictionary: this.entity?.hasDictionary,
|
||||||
addToAllDossiers: this.entity.hasDictionary,
|
addToAllDossiers: this.entity?.hasDictionary,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import { firstValueFrom, Observable } from 'rxjs';
|
|||||||
import { FilePreviewStateService } from './file-preview-state.service';
|
import { FilePreviewStateService } from './file-preview-state.service';
|
||||||
import { MultiSelectService } from './multi-select.service';
|
import { MultiSelectService } from './multi-select.service';
|
||||||
import { ViewModeService } from './view-mode.service';
|
import { ViewModeService } from './view-mode.service';
|
||||||
|
import { DefaultColorsService } from '@services/entity-services/default-colors.service';
|
||||||
|
|
||||||
const DELTA_VIEW_TIME = 10 * 60 * 1000; // 10 minutes;
|
const DELTA_VIEW_TIME = 10 * 60 * 1000; // 10 minutes;
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
|||||||
private readonly _earmarksService: EarmarksService,
|
private readonly _earmarksService: EarmarksService,
|
||||||
private readonly _multiSelectService: MultiSelectService,
|
private readonly _multiSelectService: MultiSelectService,
|
||||||
private readonly _filesService: FilesService,
|
private readonly _filesService: FilesService,
|
||||||
|
private readonly _defaultColorsService: DefaultColorsService,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.annotations$ = toObservable(this.#annotations);
|
this.annotations$ = toObservable(this.#annotations);
|
||||||
@ -167,6 +169,7 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
|||||||
const file = this._state.file();
|
const file = this._state.file();
|
||||||
const annotations: AnnotationWrapper[] = [];
|
const annotations: AnnotationWrapper[] = [];
|
||||||
const dictionaries = this._state.dictionaries;
|
const dictionaries = this._state.dictionaries;
|
||||||
|
const defaultColors = this._defaultColorsService.find(this._state.dossierTemplateId);
|
||||||
let checkDictionary = true;
|
let checkDictionary = true;
|
||||||
|
|
||||||
for (const entry of entityLog.entityLogEntry) {
|
for (const entry of entityLog.entityLogEntry) {
|
||||||
@ -207,11 +210,17 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
|||||||
|
|
||||||
if (!dictionary) {
|
if (!dictionary) {
|
||||||
this.missingTypes.add(entry.type);
|
this.missingTypes.add(entry.type);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeType = this.#getChangeLogType(entry, file);
|
const changeType = this.#getChangeLogType(entry, file);
|
||||||
const annotation = AnnotationWrapper.fromData(entry, dictionary, changeType, entityLog.legalBasis ?? [], this.#isDocumine);
|
const annotation = AnnotationWrapper.fromData(
|
||||||
|
entry,
|
||||||
|
dictionary,
|
||||||
|
changeType,
|
||||||
|
entityLog.legalBasis ?? [],
|
||||||
|
this.#isDocumine,
|
||||||
|
defaultColors,
|
||||||
|
);
|
||||||
|
|
||||||
annotations.push(annotation);
|
annotations.push(annotation);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,8 @@ import type {
|
|||||||
import { dictionaryActionsTranslations, manualRedactionActionsTranslations } from '@translations/annotation-actions-translations';
|
import { dictionaryActionsTranslations, manualRedactionActionsTranslations } from '@translations/annotation-actions-translations';
|
||||||
import { Roles } from '@users/roles';
|
import { Roles } from '@users/roles';
|
||||||
import { NGXLogger } from 'ngx-logger';
|
import { NGXLogger } from 'ngx-logger';
|
||||||
import { of } from 'rxjs';
|
import { EMPTY, of, OperatorFunction, pipe } from 'rxjs';
|
||||||
import { tap } from 'rxjs/operators';
|
import { catchError, tap } from 'rxjs/operators';
|
||||||
|
|
||||||
function getResponseType(error: boolean, isConflict: boolean) {
|
function getResponseType(error: boolean, isConflict: boolean) {
|
||||||
const isConflictError = isConflict ? 'conflictError' : 'error';
|
const isConflictError = isConflict ? 'conflictError' : 'error';
|
||||||
@ -150,22 +150,22 @@ export class ManualRedactionService extends GenericService<IManualAddResponse> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#showToast(action: ManualRedactionActions | DictionaryActions, isDictionary = false) {
|
#showToast(action: ManualRedactionActions | DictionaryActions, isDictionary = false) {
|
||||||
return tap({
|
return pipe(
|
||||||
next: () => this._toaster.success(getMessage(action, isDictionary), { positionClass: 'toast-file-preview' }),
|
catchError((error: unknown) => {
|
||||||
error: (error: unknown) => {
|
|
||||||
const isConflict = (error as HttpErrorResponse).status === HttpStatusCode.Conflict;
|
const isConflict = (error as HttpErrorResponse).status === HttpStatusCode.Conflict;
|
||||||
this._toaster.error(getMessage(action, isDictionary, true, isConflict), {
|
this._toaster.error(getMessage(action, isDictionary, true, isConflict), {
|
||||||
error: error as HttpErrorResponse,
|
error: error as HttpErrorResponse,
|
||||||
positionClass: 'toast-file-preview',
|
positionClass: 'toast-file-preview',
|
||||||
});
|
});
|
||||||
},
|
return EMPTY;
|
||||||
});
|
}),
|
||||||
|
tap(() => this._toaster.success(getMessage(action, isDictionary), { positionClass: 'toast-file-preview' })),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#showAddToDictionaryToast(body: List<IAddRedactionRequest>, dictionaryLabel?: string) {
|
#showAddToDictionaryToast(body: List<IAddRedactionRequest>, dictionaryLabel?: string) {
|
||||||
return tap({
|
return pipe(
|
||||||
next: () => this._toaster.success(getDictionaryMessage('add'), { positionClass: 'toast-file-preview' }),
|
catchError((error: unknown) => {
|
||||||
error: (error: unknown) => {
|
|
||||||
const isConflict = (error as HttpErrorResponse).status === HttpStatusCode.Conflict;
|
const isConflict = (error as HttpErrorResponse).status === HttpStatusCode.Conflict;
|
||||||
this._toaster.error(getDictionaryMessage('add', true, isConflict), {
|
this._toaster.error(getDictionaryMessage('add', true, isConflict), {
|
||||||
error: error as HttpErrorResponse,
|
error: error as HttpErrorResponse,
|
||||||
@ -175,7 +175,9 @@ export class ManualRedactionService extends GenericService<IManualAddResponse> {
|
|||||||
},
|
},
|
||||||
positionClass: 'toast-file-preview',
|
positionClass: 'toast-file-preview',
|
||||||
});
|
});
|
||||||
},
|
return EMPTY;
|
||||||
});
|
}),
|
||||||
|
tap(() => this._toaster.success(getDictionaryMessage('add'), { positionClass: 'toast-file-preview' })),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,21 +73,21 @@ export class PdfAnnotationActionsService {
|
|||||||
availableActions.push(editButton);
|
availableActions.push(editButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permissions.canAcceptRecommendation) {
|
if (permissions.canAcceptRecommendation && annotationChangesAllowed) {
|
||||||
const acceptRecommendationButton = this.#getButton('check', _('annotation-actions.accept-recommendation.label'), () =>
|
const acceptRecommendationButton = this.#getButton('check', _('annotation-actions.accept-recommendation.label'), () =>
|
||||||
this.#annotationActionsService.convertRecommendationToAnnotation(annotations),
|
this.#annotationActionsService.convertRecommendationToAnnotation(annotations),
|
||||||
);
|
);
|
||||||
availableActions.push(acceptRecommendationButton);
|
availableActions.push(acceptRecommendationButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permissions.canForceRedaction) {
|
if (permissions.canForceRedaction && annotationChangesAllowed) {
|
||||||
const forceRedactionButton = this.#getButton('thumb-up', _('annotation-actions.force-redaction.label'), () =>
|
const forceRedactionButton = this.#getButton('thumb-up', _('annotation-actions.force-redaction.label'), () =>
|
||||||
this.#annotationActionsService.forceAnnotation(annotations),
|
this.#annotationActionsService.forceAnnotation(annotations),
|
||||||
);
|
);
|
||||||
availableActions.push(forceRedactionButton);
|
availableActions.push(forceRedactionButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permissions.canForceHint) {
|
if (permissions.canForceHint && annotationChangesAllowed) {
|
||||||
const forceHintButton = this.#getButton('thumb-up', _('annotation-actions.force-hint.label'), () =>
|
const forceHintButton = this.#getButton('thumb-up', _('annotation-actions.force-hint.label'), () =>
|
||||||
this.#annotationActionsService.forceAnnotation(annotations, true),
|
this.#annotationActionsService.forceAnnotation(annotations, true),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -21,11 +21,11 @@ export class TypeFilterComponent implements OnChanges {
|
|||||||
this.filter.metadata?.shortLabel === ''
|
this.filter.metadata?.shortLabel === ''
|
||||||
? ''
|
? ''
|
||||||
: this.filter.id === 'none'
|
: this.filter.id === 'none'
|
||||||
? '-'
|
? '-'
|
||||||
: this._needsAnalysisKeys.includes(this.filter.id)
|
: this._needsAnalysisKeys.includes(this.filter.id)
|
||||||
? 'A'
|
? 'A'
|
||||||
: this.filter.skipTranslation
|
: this.filter.skipTranslation
|
||||||
? this.filter.label.charAt(0)
|
? this.filter.label?.charAt(0)
|
||||||
: this._translateService.instant(this.filter.label).charAt(0);
|
: this._translateService.instant(this.filter.label).charAt(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user