From 5e548798a5e60854a6ebe455642d591234f3f700 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Tue, 2 Apr 2024 22:25:46 +0300 Subject: [PATCH] Merge branch 'master' into VM/RED-8748 --- .../src/app/models/file/annotation-permissions.utils.ts | 3 ++- .../components/file-header/file-header.component.ts | 5 +++++ .../file-workload/file-workload.component.html | 2 ++ .../edit-redaction-dialog.component.ts | 4 +--- .../remove-redaction-dialog.component.html | 2 +- .../remove-redaction-dialog.component.scss | 3 +++ .../remove-redaction-dialog.component.ts | 1 - .../file-preview/file-preview-screen.component.ts | 9 +++++++-- apps/red-ui/src/app/services/notifications.service.ts | 9 +-------- apps/red-ui/src/assets/i18n/redact/de.json | 5 ++++- apps/red-ui/src/assets/i18n/redact/en.json | 5 ++++- apps/red-ui/src/assets/i18n/scm/de.json | 5 ++++- apps/red-ui/src/assets/i18n/scm/en.json | 5 ++++- 13 files changed, 38 insertions(+), 20 deletions(-) diff --git a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts index 168cd371b..ec313b6de 100644 --- a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts +++ b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts @@ -56,6 +56,7 @@ export const canResizeAnnotation = ( export const canEditAnnotation = (annotation: AnnotationWrapper) => (annotation.isRedacted || annotation.isSkipped) && !annotation.isImage; -export const canEditHint = (annotation: AnnotationWrapper) => (annotation.isHint && !annotation.isRuleBased) || annotation.isIgnoredHint; +export const canEditHint = (annotation: AnnotationWrapper) => + ((annotation.isHint && !annotation.isRuleBased) || annotation.isIgnoredHint) && !annotation.isImage; export const canEditImage = (annotation: AnnotationWrapper) => annotation.isImage; diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts b/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts index 864537c77..92a5bc574 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts @@ -40,6 +40,7 @@ import { MatDialog } from '@angular/material/dialog'; import { download } from '@utils/file-download-utils'; import { firstValueFrom } from 'rxjs'; import { FileManagementService } from '@services/files/file-management.service'; +import { MultiSelectService } from '../../services/multi-select.service'; @Component({ selector: 'redaction-file-header', @@ -76,6 +77,7 @@ export class FileHeaderComponent implements OnInit, AfterViewInit, OnDetach, OnD private readonly _annotationManager: REDAnnotationManager, private readonly _dialog: MatDialog, private readonly _fileManagementService: FileManagementService, + private readonly _multiSelectService: MultiSelectService, readonly state: FilePreviewStateService, readonly permissionsService: PermissionsService, ) {} @@ -172,6 +174,9 @@ export class FileHeaderComponent implements OnInit, AfterViewInit, OnDetach, OnD .find(annotation => annotation.id === this._annotationManager.resizingAnnotationId); this._annotationActionsService.cancelResize(resizedAnnotation).then(); } + if (this._multiSelectService.active()) { + this._multiSelectService.deactivate(); + } this.fullScreen = false; this.closeFullScreen(); this._changeRef.markForCheck(); diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html index bd7105d31..b5ed2090a 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html @@ -71,7 +71,9 @@ diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index bfa171555..7c3b94304 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -9,7 +9,6 @@ import { firstValueFrom } from 'rxjs'; import { getEditRedactionOptions, RedactOrHintOption } from '../../utils/dialog-options'; import { EditRedactionData, EditRedactResult } from '../../utils/dialog-types'; import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component'; -import { editRedactionLabelsTranslations } from '@translations/redact-text-translations'; import { Roles } from '@users/roles'; import { DialogHelpModeKeys } from '../../utils/constants'; @@ -31,11 +30,10 @@ export class EditRedactionDialogComponent readonly #applyToAllDossiers = this.data.applyToAllDossiers; readonly annotations = this.data.annotations; readonly iconButtonTypes = IconButtonTypes; - readonly editRedactionLabelsTranslations = editRedactionLabelsTranslations; readonly isModifyDictionary = this.annotations.every(annotation => annotation.isModifyDictionary); readonly isImage = this.annotations.reduce((acc, next) => acc && next.isImage, true); readonly redactedTexts = !this.isImage ? this.annotations.map(annotation => annotation.value).filter(value => !!value) : null; - readonly isManualRedaction = this.annotations.every(annotation => annotation.type === SuperTypes.ManualRedaction); + readonly isManualRedaction = this.annotations.some(annotation => annotation.type === SuperTypes.ManualRedaction); readonly isHint = this.annotations.every(annotation => annotation.HINT || annotation.IMAGE_HINT); readonly isRedacted = this.annotations.every(annotation => annotation.isRedacted); readonly isImported: boolean = this.annotations.every(annotation => annotation.imported); diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html index e7468fd7a..d2bdeca2b 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html @@ -6,7 +6,7 @@ >
-
+
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.scss b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.scss index da4f7c52d..d4f4cecd5 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.scss +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.scss @@ -40,12 +40,15 @@ table { text-overflow: ellipsis; list-style-position: inside; overflow: hidden; + + padding-right: 8px; } th:last-child, td:last-child { max-width: 0; width: 50%; + padding-right: 0; } } } diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts index acc251e7d..f6d556571 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts @@ -28,7 +28,6 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< readonly hint = this.data.redactions[0].HINT; readonly skipped = this.data.redactions.some(annotation => annotation.isSkipped); readonly redactedTexts = this.data.redactions.map(annotation => annotation.value); - readonly isImage = this.data.redactions.every(redaction => redaction.isImage); protected readonly roles = Roles; form: UntypedFormGroup = this._formBuilder.group({ diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 863e75186..d6629c346 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -56,6 +56,7 @@ import { SkippedService } from './services/skipped.service'; import { StampService } from './services/stamp.service'; import { ViewModeService } from './services/view-mode.service'; import { RedactTextData } from './utils/dialog-types'; +import { MultiSelectService } from './services/multi-select.service'; @Component({ templateUrl: './file-preview-screen.component.html', @@ -111,6 +112,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni private readonly _fileManagementService: FileManagementService, private readonly _readableRedactionsService: ReadableRedactionsService, private readonly _dossierTemplatesService: DossierTemplatesService, + private readonly _multiSelectService: MultiSelectService, ) { super(); effect(() => { @@ -262,8 +264,11 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni } @Bind() - handleDeleteRectangleOnEsc($event: KeyboardEvent) { + handleEscInsideViewer($event: KeyboardEvent) { $event.preventDefault(); + if (this._multiSelectService.active()) { + this._multiSelectService.deactivate(); + } if (!!this._annotationManager.selected[0]) { const doesHaveWrapper = this._fileDataService.find(this._annotationManager.selected[0]?.Id); if (!doesHaveWrapper) { @@ -306,7 +311,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni this.pdfProxyService.configureElements(); this.#restoreOldFilters(); - this.pdf.instance.UI.hotkeys.on('esc', this.handleDeleteRectangleOnEsc); + this.pdf.instance.UI.hotkeys.on('esc', this.handleEscInsideViewer); this._viewerHeaderService.resetLayers(); } diff --git a/apps/red-ui/src/app/services/notifications.service.ts b/apps/red-ui/src/app/services/notifications.service.ts index c5658c501..ad596231b 100644 --- a/apps/red-ui/src/app/services/notifications.service.ts +++ b/apps/red-ui/src/app/services/notifications.service.ts @@ -12,8 +12,6 @@ import { DossiersCacheService } from './dossiers/dossiers-cache.service'; import dayjs from 'dayjs'; import { List, mapEach } from '@iqser/common-ui/lib/utils'; import { APP_BASE_HREF } from '@angular/common'; -import { Router } from '@angular/router'; -import { filterEventsOnPages } from '@utils/operators'; const INCLUDE_SEEN = false; @@ -35,7 +33,6 @@ export class NotificationsService extends EntitiesService (this._dossiersCacheService.empty ? this._dossiersCacheService.load() : of(null))), switchMap(() => this.#loadNotificationsIfChanged()), ); // Rebuild notifications when cached dossiers are updated - const changed$ = this._dossiersCacheService.changed$.pipe( - filterEventsOnPages(this._router), - tap(() => this.setEntities(this.all.map(e => this._new(e)))), - ); + const changed$ = this._dossiersCacheService.changed$.pipe(tap(() => this.setEntities(this.all.map(e => this._new(e))))); return merge(timer$, changed$); } diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index 7190b5637..668c31b32 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -1486,7 +1486,10 @@ "highlights": { "label": "Earmarks" }, - "is-excluded": "Schwärzungen für dieses Dokument deaktiviert." + "is-excluded": "Schwärzungen für dieses Dokument deaktiviert.", + "multi-select": { + "close": "" + } }, "text-highlights": "Earmarks", "text-highlights-tooltip": "Shows all text earmarks and allows removing or importing them as redactions", diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 150e91580..4dc4952c1 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -1486,7 +1486,10 @@ "highlights": { "label": "Earmarks" }, - "is-excluded": "Redaction is disabled for this document." + "is-excluded": "Redaction is disabled for this document.", + "multi-select": { + "close": "Deactivate multi select" + } }, "text-highlights": "Earmarks", "text-highlights-tooltip": "Shows all text earmarks and allows removing or importing them as redactions", diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index fa9caf08c..0d2ed27e0 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -1486,7 +1486,10 @@ "highlights": { "label": "Earmarks" }, - "is-excluded": "Schwärzungen für dieses Dokument deaktiviert." + "is-excluded": "Schwärzungen für dieses Dokument deaktiviert.", + "multi-select": { + "close": "" + } }, "text-highlights": "Earmarks", "text-highlights-tooltip": "Shows all text-earmarks and allows removing or importing them as components", diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index 5eef7d43a..d70100934 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -1486,7 +1486,10 @@ "highlights": { "label": "Earmarks" }, - "is-excluded": "Extraction is disabled for this document." + "is-excluded": "Extraction is disabled for this document.", + "multi-select": { + "close": "" + } }, "text-highlights": "Earmarks", "text-highlights-tooltip": "Shows all text-earmarks and allows removing or importing them as components",