RED-10509: disabled stopPropagation when editing file attribute.
This commit is contained in:
parent
4ec81ed0b3
commit
a890e4c5bc
@ -1,6 +1,6 @@
|
||||
<iqser-page-header
|
||||
(closeAction)="router.navigate([dossier.dossiersListRouterLink])"
|
||||
[actionConfigs]="actionConfigs"
|
||||
(closeAction)="router.navigate([dossier().dossiersListRouterLink])"
|
||||
[actionConfigs]="actionConfigs()"
|
||||
[helpModeKey]="'document'"
|
||||
[showCloseButton]="true"
|
||||
[viewModeSelection]="viewModeSelection"
|
||||
@ -10,25 +10,29 @@
|
||||
[attr.help-mode-key]="isDocumine ? 'dossier_download_dossier' : 'download_dossier_in_dossier'"
|
||||
[buttonId]="'download-files-btn'"
|
||||
[disabled]="downloadFilesDisabled$ | async"
|
||||
[dossier]="dossier"
|
||||
[dossier]="dossier()"
|
||||
[files]="entitiesService.all$ | async"
|
||||
[iqserDisableStopPropagation]="shouldDisableStopPropagation()"
|
||||
[stopMenuImmediatePropagation]="shouldDisableStopPropagation()"
|
||||
dossierDownload
|
||||
></redaction-file-download-btn>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="downloadDossierAsCSV()"
|
||||
*ngIf="permissionsService.canDownloadCsvReport(dossier)"
|
||||
*ngIf="permissionsService.canDownloadCsvReport(dossier())"
|
||||
[attr.help-mode-key]="'download_csv'"
|
||||
[disabled]="listingService.areSomeSelected$ | async"
|
||||
[icon]="'iqser:csv'"
|
||||
[iqserDisableStopPropagation]="shouldDisableStopPropagation()"
|
||||
[tooltip]="'dossier-overview.header-actions.download-csv' | translate"
|
||||
></iqser-circle-button>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="reanalyseDossier()"
|
||||
*ngIf="permissionsService.displayReanalyseBtn(dossier)"
|
||||
*ngIf="permissionsService.displayReanalyseBtn(dossier())"
|
||||
[disabled]="listingService.areSomeSelected$ | async"
|
||||
[icon]="'iqser:refresh'"
|
||||
[iqserDisableStopPropagation]="shouldDisableStopPropagation()"
|
||||
[tooltipClass]="'small warn'"
|
||||
[tooltip]="'dossier-overview.new-rule.toast.actions.reanalyse-all' | translate"
|
||||
[type]="circleButtonTypes.warn"
|
||||
@ -36,10 +40,11 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="upload.emit()"
|
||||
*ngIf="permissionsService.canUploadFiles(dossier)"
|
||||
*ngIf="permissionsService.canUploadFiles(dossier())"
|
||||
[attr.help-mode-key]="'upload_document'"
|
||||
[buttonId]="'upload-document-btn'"
|
||||
[icon]="'iqser:upload'"
|
||||
[iqserDisableStopPropagation]="shouldDisableStopPropagation()"
|
||||
[tooltip]="'dossier-overview.header-actions.upload-document' | translate"
|
||||
[type]="circleButtonTypes.primary"
|
||||
class="ml-14"
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, computed, EventEmitter, input, Output } from '@angular/core';
|
||||
import {
|
||||
ActionConfig,
|
||||
CircleButtonComponent,
|
||||
CircleButtonTypes,
|
||||
DisableStopPropagationDirective,
|
||||
EntitiesService,
|
||||
getConfig,
|
||||
IqserAllowDirective,
|
||||
IqserListingModule,
|
||||
ListingService,
|
||||
LoadingService,
|
||||
@ -24,13 +22,13 @@ import { PrimaryFileAttributeService } from '@services/primary-file-attribute.se
|
||||
import { Router } from '@angular/router';
|
||||
import { Roles } from '@users/roles';
|
||||
import { SortingService } from '@iqser/common-ui/lib/sorting';
|
||||
import { List, some } from '@iqser/common-ui/lib/utils';
|
||||
import { ComponentLogService } from '@services/files/component-log.service';
|
||||
import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
||||
import { some } from '@iqser/common-ui/lib/utils';
|
||||
import { AsyncPipe, NgIf } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { FileDownloadBtnComponent } from '@shared/components/buttons/file-download-btn/file-download-btn.component';
|
||||
import { ViewModeSelectionComponent } from '../view-mode-selection/view-mode-selection.component';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-dossier-overview-screen-header [dossier] [upload]',
|
||||
@ -39,27 +37,25 @@ import { ViewModeSelectionComponent } from '../view-mode-selection/view-mode-sel
|
||||
imports: [
|
||||
IqserListingModule,
|
||||
CircleButtonComponent,
|
||||
MatMenuTrigger,
|
||||
IqserAllowDirective,
|
||||
AsyncPipe,
|
||||
TranslateModule,
|
||||
FileDownloadBtnComponent,
|
||||
NgIf,
|
||||
ViewModeSelectionComponent,
|
||||
DisableStopPropagationDirective,
|
||||
MatMenu,
|
||||
MatMenuItem,
|
||||
],
|
||||
})
|
||||
export class DossierOverviewScreenHeaderComponent implements OnInit {
|
||||
@Input() dossier: Dossier;
|
||||
export class DossierOverviewScreenHeaderComponent {
|
||||
readonly dossier = input<Dossier>();
|
||||
@Output() readonly upload = new EventEmitter<void>();
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly roles = Roles;
|
||||
actionConfigs: List<ActionConfig>;
|
||||
readonly downloadFilesDisabled$: Observable<boolean>;
|
||||
readonly downloadComponentLogsDisabled$: Observable<boolean>;
|
||||
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'];
|
||||
|
||||
@ -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<boolean>): List<ActionConfig> {
|
||||
actionConfig(dossierId: string, disabled: boolean): List<ActionConfig> {
|
||||
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,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
@if (dropdownButton()) {
|
||||
<iqser-circle-button
|
||||
(click)="$event.stopImmediatePropagation()"
|
||||
(click)="stopImmediatePropagation($event)"
|
||||
[matMenuTriggerFor]="downloadMenu"
|
||||
[tooltipClass]="tooltipClass()"
|
||||
[tooltipPosition]="tooltipPosition()"
|
||||
|
||||
@ -28,6 +28,7 @@ export class FileDownloadBtnComponent implements OnChanges {
|
||||
readonly singleFileDownload = input<boolean>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 24b67f3fb4bb2b1a4838b9ff5855247b80b1ae00
|
||||
Subproject commit 5e26e217a10e383453d0968adcff8bf893b5efb2
|
||||
Loading…
x
Reference in New Issue
Block a user