diff --git a/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.html index 2fbf16500..108794308 100644 --- a/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.html @@ -1,14 +1,4 @@ -
- - - +
- - + + + + + + + + - - - diff --git a/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.scss b/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.scss index cd497bd6b..c7dfd10cf 100644 --- a/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.scss +++ b/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.scss @@ -11,16 +11,7 @@ background-color: $grey-2; } - &.visible { - display: flex; - } - > *:not(:last-child) { margin-right: 2px; } } - -.false-positive-icon { - height: 16px; - width: 16px; -} diff --git a/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.ts index 840377eb7..63e9b72ba 100644 --- a/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.ts @@ -18,7 +18,6 @@ export class AnnotationActionsComponent implements OnInit { @Output() annotationsChanged = new EventEmitter(); - menuOpen: boolean; annotationPermissions: AnnotationPermissions; constructor( diff --git a/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.html b/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.html index 0ccce0758..89cf90056 100644 --- a/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.html @@ -1,60 +1,29 @@ + + + + + + - - - - - -
- -
-
-
- -
-
- -
- -
-
-
diff --git a/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.scss b/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.scss index e69de29bb..6a6a6408d 100644 --- a/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.scss +++ b/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.scss @@ -0,0 +1,7 @@ +:host { + display: flex; + + > *:not(:last-child) { + margin-right: 2px; + } +} diff --git a/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.ts index 582da0c09..fdf89b446 100644 --- a/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/annotation-remove-actions/annotation-remove-actions.component.ts @@ -21,8 +21,6 @@ export class AnnotationRemoveActionsComponent { @ViewChild(MatMenuTrigger) matMenuTrigger: MatMenuTrigger; permissions: { canRemoveOrSuggestToRemoveOnlyHere: boolean; - canPerformMultipleRemoveActions: boolean; - canNotPerformMultipleRemoveActions: boolean; canRemoveOrSuggestToRemoveFromDictionary: boolean; canMarkAsFalsePositive: boolean; }; @@ -45,24 +43,6 @@ export class AnnotationRemoveActionsComponent { this._setPermissions(); } - get dictionaryColor() { - return this.appStateService.getDictionaryColor('suggestion-add-dictionary'); - } - - get suggestionColor() { - return this.appStateService.getDictionaryColor('suggestion'); - } - - openMenu($event: MouseEvent) { - $event.stopPropagation(); - this.matMenuTrigger.openMenu(); - this.menuOpenChange.emit(true); - } - - onMenuClosed() { - this.menuOpenChange.emit(false); - } - suggestRemoveAnnotations($event, removeFromDict: boolean) { $event.stopPropagation(); this._annotationActionsService.suggestRemoveAnnotation( @@ -83,30 +63,20 @@ export class AnnotationRemoveActionsComponent { private _setPermissions() { this.permissions = { - canRemoveOrSuggestToRemoveOnlyHere: this._annotationsPermissions( - ['canRemoveOrSuggestToRemoveOnlyHere'], - true - ), - canPerformMultipleRemoveActions: this._annotationsPermissions( - ['canPerformMultipleRemoveActions'], - true - ), - canNotPerformMultipleRemoveActions: this._annotationsPermissions( - ['canPerformMultipleRemoveActions'], - false - ), - canRemoveOrSuggestToRemoveFromDictionary: this._annotationsPermissions( - ['canRemoveOrSuggestToRemoveFromDictionary'], - true - ), - canMarkAsFalsePositive: this._annotationsPermissions( - ['canMarkAsFalsePositive', 'canMarkTextOnlyAsFalsePositive'], - true - ) + canRemoveOrSuggestToRemoveOnlyHere: this._annotationsPermissions([ + 'canRemoveOrSuggestToRemoveOnlyHere' + ]), + canRemoveOrSuggestToRemoveFromDictionary: this._annotationsPermissions([ + 'canRemoveOrSuggestToRemoveFromDictionary' + ]), + canMarkAsFalsePositive: this._annotationsPermissions([ + 'canMarkAsFalsePositive', + 'canMarkTextOnlyAsFalsePositive' + ]) }; } - private _annotationsPermissions(keys: string[], expectedValue: boolean): boolean { + private _annotationsPermissions(keys: string[]): boolean { return this.annotations.reduce((prevValue, annotation) => { const annotationPermissions = AnnotationPermissions.forUser( this._permissionsService.isApprover(), @@ -114,7 +84,7 @@ export class AnnotationRemoveActionsComponent { annotation ); const hasAtLeastOnePermission = keys.reduce( - (acc, key) => acc || annotationPermissions[key] === expectedValue, + (acc, key) => acc || annotationPermissions[key], false ); return prevValue && hasAtLeastOnePermission; diff --git a/apps/red-ui/src/app/modules/dossier/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/dossier/services/annotation-actions.service.ts index 1d5461d71..be92355cd 100644 --- a/apps/red-ui/src/app/modules/dossier/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/annotation-actions.service.ts @@ -165,23 +165,6 @@ export class AnnotationActionsService { ) })); - const canForceRedaction = annotationPermissions.reduce( - (acc, next) => acc && next.permissions.canForceRedaction, - true - ); - if (canForceRedaction) { - availableActions.push({ - type: 'actionButton', - img: this._convertPath('/assets/icons/general/thumb-up.svg'), - title: this._translateService.instant('annotation-actions.force-redaction.label'), - onClick: () => { - this._ngZone.run(() => { - this.forceRedaction(null, annotations, annotationsChanged); - }); - } - }); - } - const canAcceptRecommendation = annotationPermissions.reduce( (acc, next) => acc && next.permissions.canAcceptRecommendation, true @@ -239,6 +222,45 @@ export class AnnotationActionsService { }); } + const canMarkAsFalsePositive = annotationPermissions.reduce( + (acc, next) => + acc && + (next.permissions.canMarkAsFalsePositive || + next.permissions.canMarkTextOnlyAsFalsePositive), + true + ); + if (canMarkAsFalsePositive) { + availableActions.push({ + type: 'actionButton', + img: this._convertPath('/assets/icons/general/thumb-down.svg'), + title: this._translateService.instant( + 'annotation-actions.remove-annotation.false-positive' + ), + onClick: () => { + this._ngZone.run(() => { + this.markAsFalsePositive(null, annotations, annotationsChanged); + }); + } + }); + } + + const canForceRedaction = annotationPermissions.reduce( + (acc, next) => acc && next.permissions.canForceRedaction, + true + ); + if (canForceRedaction) { + availableActions.push({ + type: 'actionButton', + img: this._convertPath('/assets/icons/general/thumb-up.svg'), + title: this._translateService.instant('annotation-actions.force-redaction.label'), + onClick: () => { + this._ngZone.run(() => { + this.forceRedaction(null, annotations, annotationsChanged); + }); + } + }); + } + const canRejectSuggestion = annotationPermissions.reduce( (acc, next) => acc && next.permissions.canRejectSuggestion, true @@ -246,7 +268,7 @@ export class AnnotationActionsService { if (canRejectSuggestion) { availableActions.push({ type: 'actionButton', - img: this._convertPath('/assets/icons/general/close.svg'), + img: this._convertPath('/assets/icons/general/trash.svg'), title: this._translateService.instant('annotation-actions.reject-suggestion'), onClick: () => { this._ngZone.run(() => { @@ -263,7 +285,7 @@ export class AnnotationActionsService { if (canRemoveOrSuggestToRemoveOnlyHere) { availableActions.push({ type: 'actionButton', - img: this._convertPath('/assets/icons/general/close.svg'), + img: this._convertPath('/assets/icons/general/trash.svg'), title: this._translateService.instant( 'annotation-actions.suggest-remove-annotation' ), @@ -294,28 +316,6 @@ export class AnnotationActionsService { }); } - const canMarkAsFalsePositive = annotationPermissions.reduce( - (acc, next) => - acc && - (next.permissions.canMarkAsFalsePositive || - next.permissions.canMarkTextOnlyAsFalsePositive), - true - ); - if (canMarkAsFalsePositive) { - availableActions.push({ - type: 'actionButton', - img: this._convertPath('/assets/icons/general/thumb-down.svg'), - title: this._translateService.instant( - 'annotation-actions.remove-annotation.false-positive' - ), - onClick: () => { - this._ngZone.run(() => { - this.markAsFalsePositive(null, annotations, annotationsChanged); - }); - } - }); - } - return availableActions; } diff --git a/apps/red-ui/src/app/modules/icons/icons.module.ts b/apps/red-ui/src/app/modules/icons/icons.module.ts index 39b841ab4..b91031400 100644 --- a/apps/red-ui/src/app/modules/icons/icons.module.ts +++ b/apps/red-ui/src/app/modules/icons/icons.module.ts @@ -66,6 +66,7 @@ export class IconsModule { 'read-only', 'ready-for-approval', 'refresh', + 'remove-from-dict', 'report', 'search', 'secret', diff --git a/apps/red-ui/src/app/modules/shared/components/buttons/circle-button/circle-button.component.ts b/apps/red-ui/src/app/modules/shared/components/buttons/circle-button/circle-button.component.ts index 9a6b16916..c3a6a61d6 100644 --- a/apps/red-ui/src/app/modules/shared/components/buttons/circle-button/circle-button.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/buttons/circle-button/circle-button.component.ts @@ -4,6 +4,7 @@ import { ElementRef, EventEmitter, Input, + OnInit, Output, ViewChild } from '@angular/core'; @@ -15,7 +16,7 @@ import { MatTooltip } from '@angular/material/tooltip'; styleUrls: ['./circle-button.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class CircleButtonComponent { +export class CircleButtonComponent implements OnInit { @Input() icon: string; @Input() tooltip: string; @Input() showDot = false; diff --git a/apps/red-ui/src/assets/icons/general/remove-from-dict.svg b/apps/red-ui/src/assets/icons/general/remove-from-dict.svg new file mode 100644 index 000000000..8d471ac32 --- /dev/null +++ b/apps/red-ui/src/assets/icons/general/remove-from-dict.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + +