don't use methods in templates for file actions, fix renaming file attrs
This commit is contained in:
parent
a585d6ff81
commit
6fba694252
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnDestroy, Output } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { File } from '@red/domain';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
@ -8,8 +8,8 @@ import {
|
||||
CircleButtonType,
|
||||
CircleButtonTypes,
|
||||
ConfirmationDialogInput,
|
||||
IqserTooltipPosition,
|
||||
LoadingService,
|
||||
OnChange,
|
||||
Required,
|
||||
Toaster,
|
||||
} from '@iqser/common-ui';
|
||||
@ -27,13 +27,11 @@ import { FileManagementService } from '../../services/file-management.service';
|
||||
styleUrls: ['./file-actions.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy {
|
||||
export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy, OnChanges {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
@Input()
|
||||
@OnChange<File, FileActionsComponent>('setup')
|
||||
file: File;
|
||||
@Input() file: File;
|
||||
@Input() activeDocumentInfo: boolean;
|
||||
@Input() activeExcludePages: boolean;
|
||||
@Input() @Required() type: 'file-preview' | 'dossier-overview-list' | 'dossier-overview-workflow';
|
||||
@ -58,6 +56,11 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy {
|
||||
showStatusBar: boolean;
|
||||
showOpenDocument: boolean;
|
||||
analysisForced: boolean;
|
||||
isDossierOverview = false;
|
||||
isDossierOverviewList = false;
|
||||
isDossierOverviewWorkflow = false;
|
||||
isFilePreview = false;
|
||||
tooltipPosition: IqserTooltipPosition;
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
@ -74,26 +77,6 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy {
|
||||
super();
|
||||
}
|
||||
|
||||
get isDossierOverviewList(): boolean {
|
||||
return this.type === 'dossier-overview-list';
|
||||
}
|
||||
|
||||
get isDossierOverviewWorkflow(): boolean {
|
||||
return this.type === 'dossier-overview-workflow';
|
||||
}
|
||||
|
||||
get isFilePreview(): boolean {
|
||||
return this.type === 'file-preview';
|
||||
}
|
||||
|
||||
get tooltipPosition() {
|
||||
return this.isFilePreview ? 'below' : 'above';
|
||||
}
|
||||
|
||||
get isDossierOverview(): boolean {
|
||||
return this.type.startsWith('dossier-overview-list');
|
||||
}
|
||||
|
||||
private get _toggleTooltip(): string {
|
||||
if (!this.currentUser.isManager) {
|
||||
return _('file-preview.toggle-analysis.only-managers');
|
||||
@ -102,6 +85,10 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy {
|
||||
return this.file?.excluded ? _('file-preview.toggle-analysis.enable') : _('file-preview.toggle-analysis.disable');
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
this.setup();
|
||||
}
|
||||
|
||||
toggleViewDocumentInfo() {
|
||||
this.actionPerformed.emit('view-document-info');
|
||||
}
|
||||
@ -220,6 +207,13 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy {
|
||||
}
|
||||
|
||||
setup() {
|
||||
this.isDossierOverview = this.type.startsWith('dossier-overview-list');
|
||||
this.isDossierOverviewList = this.type === 'dossier-overview-list';
|
||||
this.isDossierOverviewWorkflow = this.type === 'dossier-overview-workflow';
|
||||
this.isFilePreview = this.type === 'file-preview';
|
||||
|
||||
this.tooltipPosition = this.isFilePreview ? 'below' : 'above';
|
||||
|
||||
this.assignTooltip = this.file.isUnderApproval ? _('dossier-overview.assign-approver') : _('dossier-overview.assign-reviewer');
|
||||
this.buttonType = this.isFilePreview ? CircleButtonTypes.default : CircleButtonTypes.dark;
|
||||
this.toggleTooltip = this._toggleTooltip;
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 813170555884c193e3eb8d4c06ae55540d266827
|
||||
Subproject commit d3d322d444242ad43c1ac9f7313433cb23f7a87c
|
||||
Loading…
x
Reference in New Issue
Block a user