From a890e4c5bc59d5997864011a5ecbe20ab2e8cb6e Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Mon, 25 Nov 2024 10:56:37 +0200 Subject: [PATCH] RED-10509: disabled stopPropagation when editing file attribute. --- ...sier-overview-screen-header.component.html | 17 ++++++---- ...ossier-overview-screen-header.component.ts | 33 ++++++++----------- .../dossier-overview/config.service.ts | 7 ++-- .../file-download-btn.component.html | 2 +- .../file-download-btn.component.ts | 7 ++++ libs/common-ui | 2 +- 6 files changed, 38 insertions(+), 30 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/screen-header/dossier-overview-screen-header.component.html b/apps/red-ui/src/app/modules/dossier-overview/components/screen-header/dossier-overview-screen-header.component.html index 5e45b10fa..67479c219 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/screen-header/dossier-overview-screen-header.component.html +++ b/apps/red-ui/src/app/modules/dossier-overview/components/screen-header/dossier-overview-screen-header.component.html @@ -1,6 +1,6 @@ (); @Output() readonly upload = new EventEmitter(); readonly circleButtonTypes = CircleButtonTypes; readonly roles = Roles; - actionConfigs: List; readonly downloadFilesDisabled$: Observable; readonly downloadComponentLogsDisabled$: Observable; readonly isDocumine = getConfig().IS_DOCUMINE; + readonly areSomeSelected = toSignal(this.listingService.areSomeSelected$); + readonly actionConfigs = computed(() => this.configService.actionConfig(this.dossier().id, this.areSomeSelected())); + readonly shouldDisableStopPropagation = computed(() => this._fileAttributesService.isEditingFileAttribute()); constructor( private readonly _toaster: Toaster, @@ -73,6 +69,7 @@ export class DossierOverviewScreenHeaderComponent implements OnInit { private readonly _reanalysisService: ReanalysisService, private readonly _loadingService: LoadingService, private readonly _primaryFileAttributeService: PrimaryFileAttributeService, + private readonly _fileAttributesService: FileAttributesService, ) { const someNotProcessed$ = this.entitiesService.all$.pipe(some(file => !file.lastProcessed)); this.downloadFilesDisabled$ = combineLatest([this.listingService.areSomeSelected$, someNotProcessed$]).pipe( @@ -83,14 +80,10 @@ export class DossierOverviewScreenHeaderComponent implements OnInit { ); } - ngOnInit() { - this.actionConfigs = this.configService.actionConfig(this.dossier.id, this.listingService.areSomeSelected$); - } - async reanalyseDossier() { this._loadingService.start(); try { - await this._reanalysisService.reanalyzeDossier(this.dossier, true); + await this._reanalysisService.reanalyzeDossier(this.dossier(), true); this._toaster.success(_('dossier-overview.reanalyse-dossier.success')); } catch (e) { this._toaster.error(_('dossier-overview.reanalyse-dossier.error')); @@ -101,12 +94,12 @@ export class DossierOverviewScreenHeaderComponent implements OnInit { async downloadDossierAsCSV() { const displayedEntities = await firstValueFrom(this.listingService.displayed$); const entities = this.sortingService.defaultSort(displayedEntities); - const fileName = this.dossier.dossierName + '.export.csv'; + const fileName = this.dossier().dossierName + '.export.csv'; const mapper = (file?: File) => ({ ...file, hasAnnotations: file.hasRedactions, assignee: this._userService.getName(file.assignee) || '-', - primaryAttribute: this._primaryFileAttributeService.getPrimaryFileAttributeValue(file, this.dossier.dossierTemplateId), + primaryAttribute: this._primaryFileAttributeService.getPrimaryFileAttributeValue(file, this.dossier().dossierTemplateId), }); const documineOnlyFields = ['hasAnnotations']; const redactionOnlyFields = ['hasHints', 'hasImages', 'hasUpdates', 'hasRedactions']; diff --git a/apps/red-ui/src/app/modules/dossier-overview/config.service.ts b/apps/red-ui/src/app/modules/dossier-overview/config.service.ts index b74de56a6..1bdc341ad 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/config.service.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/config.service.ts @@ -47,6 +47,7 @@ import { annotationFilterChecker, RedactionFilterSorter, sortArray, sortByName } import { EditDossierDialogComponent } from '../shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-dialog.component'; import { DossiersDialogService } from '../shared-dossiers/services/dossiers-dialog.service'; import { BulkActionsService } from './services/bulk-actions.service'; +import { FileAttributesService } from '@services/entity-services/file-attributes.service'; @Injectable() export class ConfigService { @@ -68,6 +69,7 @@ export class ConfigService { private readonly _userPreferenceService: UserPreferenceService, private readonly _dossiersService: DossiersService, private readonly _iqserPermissionsService: IqserPermissionsService, + private readonly _fileAttributesService: FileAttributesService, ) { const previousListingMode = this._userPreferenceService.getFilesListingMode(); const listingMode = previousListingMode ? previousListingMode : ListingModes.table; @@ -113,7 +115,7 @@ export class ConfigService { }; } - actionConfig(dossierId: string, disabled$: Observable): List { + actionConfig(dossierId: string, disabled: boolean): List { return [ { id: 'editDossier', @@ -122,7 +124,8 @@ export class ConfigService { icon: 'iqser:edit', hide: !this.#currentUser.isManager && !this._iqserPermissionsService.has(Roles.dossiers.edit), helpModeKey: 'edit_dossier', - disabled$, + disableStopPropagation: this._fileAttributesService.isEditingFileAttribute(), + disabled, }, ]; } diff --git a/apps/red-ui/src/app/modules/shared/components/buttons/file-download-btn/file-download-btn.component.html b/apps/red-ui/src/app/modules/shared/components/buttons/file-download-btn/file-download-btn.component.html index 9659eeb5d..c4f2eb198 100644 --- a/apps/red-ui/src/app/modules/shared/components/buttons/file-download-btn/file-download-btn.component.html +++ b/apps/red-ui/src/app/modules/shared/components/buttons/file-download-btn/file-download-btn.component.html @@ -1,6 +1,6 @@ @if (dropdownButton()) { (false); readonly dossierDownload = input(false, { transform: booleanAttribute }); readonly dropdownButton = computed(() => this.isDocumine && (this.dossierDownload() || this.singleFileDownload())); + readonly stopMenuImmediatePropagation = input(false); tooltip: string; canDownloadFiles: boolean; invalidDownload = false; @@ -96,4 +97,10 @@ export class FileDownloadBtnComponent implements OnChanges { const fileToDownload = !this.dossierDownload() ? this.files()[0] : null; return firstValueFrom(this._componentLogService.exportXML(this.dossier().dossierTemplateId, this.dossier().id, fileToDownload)); } + + stopImmediatePropagation($event: MouseEvent) { + if (!this.stopMenuImmediatePropagation()) { + $event.stopImmediatePropagation(); + } + } } diff --git a/libs/common-ui b/libs/common-ui index 24b67f3fb..5e26e217a 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 24b67f3fb4bb2b1a4838b9ff5855247b80b1ae00 +Subproject commit 5e26e217a10e383453d0968adcff8bf893b5efb2