dossier listing actions don't use methods in templates
This commit is contained in:
parent
bbdfc97490
commit
bc982263c4
@ -1,4 +1,4 @@
|
||||
<iqser-status-bar *ngIf="stats" [configs]="statusConfig(stats)"></iqser-status-bar>
|
||||
<iqser-status-bar *ngIf="stats" [configs]="statusBarConfig"></iqser-status-bar>
|
||||
|
||||
<div (longPress)="forceReanalysisAction($event)" class="action-buttons" redactionLongPress>
|
||||
<iqser-circle-button
|
||||
@ -11,11 +11,11 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="reanalyseDossier($event, dossier.dossierId)"
|
||||
*ngIf="permissionsService.displayReanalyseBtn(dossier) && analysisForced"
|
||||
*ngIf="displayReanalyseBtn"
|
||||
[tooltip]="'dossier-listing.reanalyse.action' | translate"
|
||||
[type]="circleButtonTypes.dark"
|
||||
icon="iqser:refresh"
|
||||
></iqser-circle-button>
|
||||
|
||||
<redaction-file-download-btn [files]="filesMapService.get(dossier.id)" [type]="circleButtonTypes.dark"></redaction-file-download-btn>
|
||||
<redaction-file-download-btn [files]="files" [type]="circleButtonTypes.dark"></redaction-file-download-btn>
|
||||
</div>
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { CircleButtonTypes, StatusBarConfig } from '@iqser/common-ui';
|
||||
import { CircleButtonTypes, List, StatusBarConfig } from '@iqser/common-ui';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { Dossier, DossierStats, StatusSorter } from '@red/domain';
|
||||
import { Dossier, DossierStats, File, StatusSorter } from '@red/domain';
|
||||
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
|
||||
import { LongPressEvent } from '@shared/directives/long-press.directive';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
@ -17,11 +17,14 @@ import { switchMapTo, tap } from 'rxjs/operators';
|
||||
styleUrls: ['./dossiers-listing-actions.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class DossiersListingActionsComponent {
|
||||
export class DossiersListingActionsComponent implements OnChanges {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
analysisForced: boolean;
|
||||
statusBarConfig: List<StatusBarConfig<string>>;
|
||||
files: File[];
|
||||
displayReanalyseBtn = false;
|
||||
|
||||
@Input() dossier: Dossier;
|
||||
@Input() stats: DossierStats;
|
||||
@ -38,10 +41,16 @@ export class DossiersListingActionsComponent {
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
) {}
|
||||
|
||||
statusConfig(stats: DossierStats): readonly StatusBarConfig<string>[] {
|
||||
return Object.keys(stats.fileCountPerWorkflowStatus)
|
||||
.sort(StatusSorter.byStatus)
|
||||
.map(status => ({ length: stats.fileCountPerWorkflowStatus[status], color: status }));
|
||||
private get _statusConfig(): List<StatusBarConfig<string>> {
|
||||
const { fileCountPerWorkflowStatus } = this.stats;
|
||||
const statuses = Object.keys(fileCountPerWorkflowStatus).sort(StatusSorter.byStatus);
|
||||
return statuses.map(status => ({ length: fileCountPerWorkflowStatus[status], color: status }));
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
this.statusBarConfig = this._statusConfig;
|
||||
this.files = this.filesMapService.get(this.dossier.dossierId);
|
||||
this.displayReanalyseBtn = this.permissionsService.displayReanalyseBtn(this.dossier) && this.analysisForced;
|
||||
}
|
||||
|
||||
forceReanalysisAction($event: LongPressEvent) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user