From 2a8642efbd8f6f079be4b9ed7e58dcd608e0b490 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Fri, 23 Jun 2023 15:31:13 +0300 Subject: [PATCH] RED-6774 - removed old code for annotation remove --- .../annotation-actions.component.html | 27 --------- .../annotation-actions.component.ts | 8 --- .../false-positive-dialog.component.html | 31 ----------- .../false-positive-dialog.component.ts | 30 ---------- .../remove-annotations-dialog.component.html | 49 ----------------- .../remove-annotations-dialog.component.scss | 21 ------- .../remove-annotations-dialog.component.ts | 55 ------------------- .../file-preview/file-preview.module.ts | 4 -- .../services/annotation-actions.service.ts | 41 -------------- .../services/file-preview-dialog.service.ts | 12 +--- 10 files changed, 1 insertion(+), 277 deletions(-) delete mode 100644 apps/red-ui/src/app/modules/file-preview/dialogs/false-positive-dialog/false-positive-dialog.component.html delete mode 100644 apps/red-ui/src/app/modules/file-preview/dialogs/false-positive-dialog/false-positive-dialog.component.ts delete mode 100644 apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.html delete mode 100644 apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.scss delete mode 100644 apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.ts diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html index bec5289bf..fe9b4f66d 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html @@ -150,33 +150,6 @@ icon="red:visibility" > - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
    -
  • -
-
- - -
-
- -
- - -
-
-
- - - diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/false-positive-dialog/false-positive-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/false-positive-dialog/false-positive-dialog.component.ts deleted file mode 100644 index d25da3c8e..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/false-positive-dialog/false-positive-dialog.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component, Inject, OnInit } from '@angular/core'; -import { BaseDialogComponent } from '@iqser/common-ui'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; - -export interface FalsePositiveDialogInput { - text: string; - context: string; -} - -@Component({ - templateUrl: './false-positive-dialog.component.html', -}) -export class FalsePositiveDialogComponent extends BaseDialogComponent implements OnInit { - constructor( - protected readonly _dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) readonly data: FalsePositiveDialogInput[], - ) { - super(_dialogRef); - } - - ngOnInit() { - const controlsConfig = { comment: [null] }; - this.form = this._formBuilder.group(controlsConfig); - this.initialFormValue = this.form.getRawValue(); - } - - save(): void { - this._dialogRef.close(this.form.getRawValue()); - } -} diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.html deleted file mode 100644 index 387651e5e..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.html +++ /dev/null @@ -1,49 +0,0 @@ -
-
-
-
- - -
- - - - - - - - - - - - - -
{{ 'remove-annotations-dialog.dictionary' | translate }}{{ 'remove-annotations-dialog.value' | translate }}
{{ annotation.type }}{{ annotation.value }}
-
- -
    -
  • - {{ printable(annotation) }} -
  • -
- -
- - -
-
- -
- - -
-
-
- - -
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.scss b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.scss deleted file mode 100644 index 676104d29..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.scss +++ /dev/null @@ -1,21 +0,0 @@ -.content-wrapper { - padding-top: 20px; - padding-bottom: 8px; -} - -ul { - li { - padding-top: 4px; - } -} - -.default-table { - border-collapse: collapse; - - th, - td { - padding: 8px; - text-align: left; - border: 1px solid var(--iqser-separator); - } -} diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.ts deleted file mode 100644 index c35182ab6..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Component, Inject } from '@angular/core'; -import { AnnotationWrapper } from '@models/file/annotation.wrapper'; -import { TranslateService } from '@ngx-translate/core'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { BaseDialogComponent, humanize } from '@iqser/common-ui'; -import { Dossier } from '@red/domain'; - -export interface RemoveAnnotationsDialogInput { - annotationsToRemove: AnnotationWrapper[]; - removeFromDictionary: boolean; - hint: boolean; - dossier: Dossier; -} - -@Component({ - templateUrl: './remove-annotations-dialog.component.html', - styleUrls: ['./remove-annotations-dialog.component.scss'], -}) -export class RemoveAnnotationsDialogComponent extends BaseDialogComponent { - protected readonly _headerTitle = this.data.removeFromDictionary - ? this._translateService.instant('remove-annotations-dialog.remove-from-dictionary.title', { hint: this.data.hint }) - : this._translateService.instant('remove-annotations-dialog.remove-only-here.title', { hint: this.data.hint }); - protected readonly _contentTitle = this.data.removeFromDictionary - ? this._translateService.instant('remove-annotations-dialog.remove-from-dictionary.question', { hint: this.data.hint }) - : this._translateService.instant('remove-annotations-dialog.remove-only-here.question', { hint: this.data.hint }); - - constructor( - private readonly _translateService: TranslateService, - protected readonly _dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) readonly data: RemoveAnnotationsDialogInput, - ) { - super(_dialogRef); - this.form = this._formBuilder.group({ - comment: [null], - }); - this.initialFormValue = this.form.getRawValue(); - } - - get disabled(): boolean { - return !this.valid; - } - - save() { - this._dialogRef.close({ comment: this.form.getRawValue().comment }); - } - - printable(annotation: AnnotationWrapper) { - if (annotation.isImage) { - return this._translateService.instant('remove-annotations-dialog.image-type', { - typeLabel: humanize(annotation.type), - }); - } - return annotation.value; - } -} diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts b/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts index 1dbaf9ceb..d731442ba 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts @@ -45,7 +45,6 @@ import { HighlightsSeparatorComponent } from './components/highlights-separator/ import { PendingChangesGuard } from '@guards/can-deactivate.guard'; import { ManualAnnotationDialogComponent } from './dialogs/manual-redaction-dialog/manual-annotation-dialog.component'; import { ForceAnnotationDialogComponent } from './dialogs/force-redaction-dialog/force-annotation-dialog.component'; -import { RemoveAnnotationsDialogComponent } from './dialogs/remove-annotations-dialog/remove-annotations-dialog.component'; import { ResizeAnnotationDialogComponent } from './dialogs/resize-annotation-dialog/resize-annotation-dialog.component'; import { ChangeLegalBasisDialogComponent } from './dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component'; import { RecategorizeImageDialogComponent } from './dialogs/recategorize-image-dialog/recategorize-image-dialog.component'; @@ -64,7 +63,6 @@ import { SuggestionsService } from './services/suggestions.service'; import { PagesComponent } from './components/pages/pages.component'; import { SharedModule } from '@shared/shared.module'; import { SharedDossiersModule } from '../shared-dossiers/shared-dossiers.module'; -import { FalsePositiveDialogComponent } from './dialogs/false-positive-dialog/false-positive-dialog.component'; import { RedactTextDialogComponent } from './dialogs/redact-text-dialog/redact-text-dialog.component'; import { RemoveRedactionDialogComponent } from './dialogs/remove-redaction-dialog/remove-redaction-dialog.component'; @@ -81,7 +79,6 @@ const routes: IqserRoutes = [ const dialogs = [ ManualAnnotationDialogComponent, ForceAnnotationDialogComponent, - RemoveAnnotationsDialogComponent, ResizeAnnotationDialogComponent, ChangeLegalBasisDialogComponent, RecategorizeImageDialogComponent, @@ -90,7 +87,6 @@ const dialogs = [ DocumentInfoDialogComponent, ImportRedactionsDialogComponent, RssDialogComponent, - FalsePositiveDialogComponent, RedactTextDialogComponent, RemoveRedactionDialogComponent, ]; diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index 17d76a25d..61dca0e0d 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -119,26 +119,6 @@ export class AnnotationActionsService { ); } - removeOrSuggestRemoveAnnotation(annotations: AnnotationWrapper[], removeFromDictionary: boolean) { - const data = { - annotationsToRemove: annotations, - removeFromDictionary, - dossier: this._state.dossier(), - hint: annotations[0].hintDictionary, - }; - const { dossierId, fileId } = this._state; - this._dialogService.openDialog('removeAnnotations', data, (result: { comment: string }) => { - const body = annotations.map(annotation => ({ - annotationId: annotation.id, - removeFromDictionary, - comment: result.comment, - })); - this.#processObsAndEmit( - this._manualRedactionService.removeOrSuggestRemove(body, dossierId, fileId, removeFromDictionary, annotations[0].isHint), - ).then(); - }); - } - async removeOrSuggestRemoveRedaction(redaction: AnnotationWrapper, permissions) { const removePermissions: RemoveRedactionPermissions = { canRemoveOrSuggestToRemoveOnlyHere: permissions.canRemoveOrSuggestToRemoveOnlyHere, @@ -274,27 +254,6 @@ export class AnnotationActionsService { await this._fileDataService.annotationsChanged(); } - markAsFalsePositive(annotations: AnnotationWrapper[]) { - const data = annotations.map(annotation => ({ text: annotation.value, context: this._getFalsePositiveText(annotation) })); - this._dialogService.openDialog('falsePositive', data, (result: { comment: string }) => { - const requests: List = annotations.map(annotation => ({ - sourceId: annotation.id, - value: this._getFalsePositiveText(annotation), - type: annotation.type, - positions: annotation.positions, - addToDictionary: true, - reason: 'False Positive', - dictionaryEntryType: annotation.isRecommendation - ? DictionaryEntryTypes.FALSE_RECOMMENDATION - : DictionaryEntryTypes.FALSE_POSITIVE, - comment: result.comment ? { text: result.comment } : null, - })); - const { dossierId, fileId } = this._state; - - this.#processObsAndEmit(this._manualRedactionService.addAnnotation(requests, dossierId, fileId)).then(); - }); - } - #generateRectangle(annotationWrapper: AnnotationWrapper) { const annotation = this._pdf.rectangle(); const pageHeight = this._documentViewer.getHeight(annotationWrapper.pageNumber); diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-preview-dialog.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-preview-dialog.service.ts index e8abdb76b..d25300155 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-preview-dialog.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-preview-dialog.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component'; import { ForceAnnotationDialogComponent } from '../dialogs/force-redaction-dialog/force-annotation-dialog.component'; import { DocumentInfoDialogComponent } from '../dialogs/document-info-dialog/document-info-dialog.component'; import { ManualAnnotationDialogComponent } from '../dialogs/manual-redaction-dialog/manual-annotation-dialog.component'; @@ -10,7 +9,6 @@ import { ConfirmationDialogComponent, DialogConfig, DialogService } from '@iqser import { ResizeAnnotationDialogComponent } from '../dialogs/resize-annotation-dialog/resize-annotation-dialog.component'; import { HighlightActionDialogComponent } from '../dialogs/highlight-action-dialog/highlight-action-dialog.component'; import { RssDialogComponent } from '../dialogs/rss-dialog/rss-dialog.component'; -import { FalsePositiveDialogComponent } from '../dialogs/false-positive-dialog/false-positive-dialog.component'; type DialogType = | 'confirm' @@ -18,12 +16,10 @@ type DialogType = | 'rss' | 'recategorizeImage' | 'changeLegalBasis' - | 'removeAnnotations' | 'resizeAnnotation' | 'forceAnnotation' | 'manualAnnotation' - | 'highlightAction' - | 'falsePositive'; + | 'highlightAction'; @Injectable() export class FilePreviewDialogService extends DialogService { @@ -42,9 +38,6 @@ export class FilePreviewDialogService extends DialogService { changeLegalBasis: { component: ChangeLegalBasisDialogComponent, }, - removeAnnotations: { - component: RemoveAnnotationsDialogComponent, - }, resizeAnnotation: { component: ResizeAnnotationDialogComponent, }, @@ -62,9 +55,6 @@ export class FilePreviewDialogService extends DialogService { component: RssDialogComponent, dialogConfig: { width: '90vw' }, }, - falsePositive: { - component: FalsePositiveDialogComponent, - }, }; constructor(protected readonly _dialog: MatDialog) {