RED-6377: fix redaction toggle

This commit is contained in:
Dan Percic 2023-03-10 20:12:56 +02:00
parent 2199a149eb
commit eb7816ab72
6 changed files with 31 additions and 28 deletions

View File

@ -48,7 +48,7 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
) {}
private get _buttons(): Action[] {
return [
const actions: Action[] = [
{
id: 'delete-files-btn',
type: ActionTypes.circleBtn,
@ -161,7 +161,9 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
checked: !this.#allFilesAreExcluded,
show: this.#canToggleAnalysis,
},
].filter(btn => btn.show);
];
return actions.filter(btn => btn.show);
}
ngOnChanges() {

View File

@ -1,11 +1,10 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Component, Input } from '@angular/core';
import { Dossier, File, IFileAttributeConfig } from '@red/domain';
@Component({
selector: 'redaction-table-item [file] [dossier] [displayedAttributes] [dossierTemplateId]',
templateUrl: './table-item.component.html',
styleUrls: ['./table-item.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TableItemComponent {
@Input() file: File;

View File

@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
import { ChangeDetectorRef, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
import { Dossier, File, IFileAttributeConfig } from '@red/domain';
import { Debounce } from '@iqser/common-ui';
@ -6,7 +6,6 @@ import { Debounce } from '@iqser/common-ui';
selector: 'redaction-workflow-item [file] [dossier] [displayedAttributes]',
templateUrl: './workflow-item.component.html',
styleUrls: ['./workflow-item.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WorkflowItemComponent implements OnInit {
@Input() file: File;

View File

@ -1,4 +1,4 @@
<div *ngIf="isDossierOverviewList && (this.fileAttributesService.isEditingFileAttribute$ | async) === false" class="action-buttons">
<div *ngIf="isDossierOverviewList && (fileAttributesService.isEditingFileAttribute$ | async) === false" class="action-buttons">
<ng-container *ngTemplateOutlet="actions"></ng-container>
<redaction-processing-indicator *ngIf="showStatusBar" [file]="file"></redaction-processing-indicator>

View File

@ -120,9 +120,10 @@ export class FileActionsComponent implements OnChanges {
}
private get _buttons(): Action[] {
return [
const fileId = this.file.fileId;
const actions: Action[] = [
{
id: 'delete-file-btn',
id: 'delete-file-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._openDeleteFileDialog($event),
tooltip: _('dossier-overview.delete.action'),
@ -130,7 +131,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showDelete,
},
{
id: 'assign-btn',
id: 'assign-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._assign($event),
tooltip: this.assignTooltip,
@ -138,7 +139,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showAssign,
},
{
id: 'assign-to-me-btn',
id: 'assign-to-me-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._assignToMe($event),
tooltip: _('dossier-overview.assign-me'),
@ -146,7 +147,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showAssignToSelf,
},
{
id: 'open-import-redactions-dialog-btn',
id: 'open-import-redactions-dialog-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._openImportRedactionsDialog($event),
tooltip: _('dossier-overview.import-redactions'),
@ -154,7 +155,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showImportRedactions && !this._iqserPermissionsService.has(ROLES.getRss),
},
{
id: 'download-file-btn',
id: 'download-file-btn-' + fileId,
type: ActionTypes.downloadBtn,
files: [this.file],
dossier: this.dossier,
@ -163,7 +164,7 @@ export class FileActionsComponent implements OnChanges {
disabled: this.file.processingStatus === ProcessingFileStatuses.ERROR,
},
{
id: 'toggle-document-info-btn',
id: 'toggle-document-info-btn-' + fileId,
type: ActionTypes.circleBtn,
action: () => this._documentInfoService.toggle(),
tooltip: _('file-preview.document-info'),
@ -172,7 +173,7 @@ export class FileActionsComponent implements OnChanges {
show: !!this._documentInfoService,
},
{
id: 'toggle-exclude-pages-btn',
id: 'toggle-exclude-pages-btn-' + fileId,
type: ActionTypes.circleBtn,
action: () => this._excludedPagesService.toggle(),
tooltip: _('file-preview.exclude-pages'),
@ -185,7 +186,7 @@ export class FileActionsComponent implements OnChanges {
!this._iqserPermissionsService.has(ROLES.getRss),
},
{
id: 'set-file-to-new-btn',
id: 'set-file-to-new-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._setToNew($event),
tooltip: _('dossier-overview.back-to-new'),
@ -193,7 +194,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showSetToNew,
},
{
id: 'set-file-under-approval-btn',
id: 'set-file-under-approval-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._setFileUnderApproval($event),
tooltip: _('dossier-overview.under-approval'),
@ -201,7 +202,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showUnderApproval,
},
{
id: 'set-file-under-review-btn',
id: 'set-file-under-review-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._setFileUnderReview($event),
tooltip: _('dossier-overview.under-review'),
@ -209,7 +210,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showUnderReview,
},
{
id: 'set-file-approved-btn',
id: 'set-file-approved-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this.setFileApproved($event),
tooltip: this.file.canBeApproved ? _('dossier-overview.approve') : _('dossier-overview.approve-disabled'),
@ -218,7 +219,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showApprove,
},
{
id: 'toggle-automatic-analysis-btn',
id: 'toggle-automatic-analysis-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._toggleAutomaticAnalysis($event),
tooltip: _('dossier-overview.stop-auto-analysis'),
@ -226,7 +227,7 @@ export class FileActionsComponent implements OnChanges {
show: this.canDisableAutoAnalysis,
},
{
id: 'reanalyse-file-preview-btn',
id: 'reanalyse-file-preview-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._reanalyseFile($event),
tooltip: _('file-preview.reanalyse-notification'),
@ -236,7 +237,7 @@ export class FileActionsComponent implements OnChanges {
disabled: this.file.isProcessing,
},
{
id: 'toggle-automatic-analysis-btn',
id: 'toggle-automatic-analysis-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._toggleAutomaticAnalysis($event),
tooltip: _('dossier-overview.start-auto-analysis'),
@ -245,7 +246,7 @@ export class FileActionsComponent implements OnChanges {
show: this.canEnableAutoAnalysis,
},
{
id: 'set-under-approval-btn',
id: 'set-under-approval-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._setFileUnderApproval($event),
tooltip: _('dossier-overview.under-approval'),
@ -253,7 +254,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showUndoApproval,
},
{
id: 'ocr-file-btn',
id: 'ocr-file-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._ocrFile($event),
tooltip: _('dossier-overview.ocr-file'),
@ -261,7 +262,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showOCR,
},
{
id: 'reanalyse-file-btn',
id: 'reanalyse-file-btn-' + fileId,
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._reanalyseFile($event),
tooltip: _('dossier-overview.reanalyse.action'),
@ -269,7 +270,7 @@ export class FileActionsComponent implements OnChanges {
show: this.showReanalyseDossierOverview,
},
{
id: 'toggle-analysis-btn',
id: 'toggle-analysis-btn-' + fileId,
type: ActionTypes.toggle,
action: () => this._toggleAnalysis(),
disabled: !this.canToggleAnalysis,
@ -278,7 +279,9 @@ export class FileActionsComponent implements OnChanges {
checked: !this.file.excluded,
show: this.showToggleAnalysis,
},
].filter(btn => btn.show);
];
return actions.filter(btn => btn.show);
}
ngOnChanges(changes: SimpleChanges) {

View File

@ -30,7 +30,7 @@ export class ExpandableFileActionsComponent implements OnChanges {
expanded = false;
@ViewChild(MatMenuTrigger) matMenu: MatMenuTrigger;
trackBy = trackByFactory();
readonly trackBy = trackByFactory();
constructor(
private readonly _fileDownloadService: FileDownloadService,