added back "reanalyse" button when automatic analysis is disabled

This commit is contained in:
Valentin 2022-02-03 12:06:05 +02:00
parent 71ed8c23b1
commit dc5d898ec9
5 changed files with 15 additions and 22 deletions

View File

@ -114,7 +114,7 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
action: () => this._bulkActionsService.reanalyse(this.selectedFiles),
tooltip: _('dossier-overview.bulk.reanalyse'),
icon: 'iqser:refresh',
show: this.canReanalyse && this.analysisForced,
show: this.canReanalyse && (this.analysisForced || this.canEnableAutoAnalysis),
},
{
type: ActionTypes.circleBtn,
@ -165,9 +165,9 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
this.canReanalyse = this._permissionsService.canReanalyseFile(this.selectedFiles);
this.canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis(this.selectedFiles);
this.canDisableAutoAnalysis = this._permissionsService.canEnableDisableAutoAnalysis(this.selectedFiles, 'disable');
this.canEnableAutoAnalysis = this._permissionsService.canEnableAutoAnalysis(this.selectedFiles);
this.canEnableAutoAnalysis = this._permissionsService.canEnableDisableAutoAnalysis(this.selectedFiles, 'enable');
this.canOcr = this.selectedFiles.reduce((acc, file) => acc && file.canBeOCRed, true);

View File

@ -372,8 +372,8 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
this.showDelete = this._permissionsService.canDeleteFile(this.file);
this.showOCR = this.file.canBeOCRed;
this.canReanalyse = this._permissionsService.canReanalyseFile(this.file);
this.canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis(this.file);
this.canEnableAutoAnalysis = this._permissionsService.canEnableAutoAnalysis(this.file);
this.canDisableAutoAnalysis = this._permissionsService.canEnableDisableAutoAnalysis(this.file, 'disable');
this.canEnableAutoAnalysis = this._permissionsService.canEnableDisableAutoAnalysis(this.file, 'enable');
this.showStatusBar = !this.file.isError && !this.file.isPending && this.isDossierOverviewList;
@ -382,8 +382,9 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
(this._permissionsService.canAssignUser(this.file) || this._permissionsService.canUnassignUser(this.file)) &&
this.isDossierOverview;
this.showReanalyseFilePreview = this.canReanalyse && this.isFilePreview && this.analysisForced;
this.showReanalyseDossierOverview = this.canReanalyse && this.isDossierOverview && this.analysisForced;
this.showReanalyseFilePreview = this.canReanalyse && this.isFilePreview && (this.analysisForced || this.canEnableAutoAnalysis);
this.showReanalyseDossierOverview =
this.canReanalyse && this.isDossierOverview && (this.analysisForced || this.canEnableAutoAnalysis);
this.buttons = this._buttons;

View File

@ -32,14 +32,9 @@ export class PermissionsService {
return files.reduce((acc, _file) => this._canReanalyseFile(_file) && acc, true);
}
canDisableAutoAnalysis(file: File | File[]): boolean {
canEnableDisableAutoAnalysis(file: File | File[], value: 'enable' | 'disable'): boolean {
const files = file instanceof File ? [file] : file;
return files.reduce((acc, _file) => this._canDisableAutoAnalysis(_file) && acc, true);
}
canEnableAutoAnalysis(file: File | File[]): boolean {
const files = file instanceof File ? [file] : file;
return files.reduce((acc, _file) => this._canEnableAutoAnalysis(_file) && acc, true);
return files.reduce((acc, _file) => this._canEnableDisableAutoAnalysis(_file, value) && acc, true);
}
isFileAssignee(file: File): boolean {
@ -168,12 +163,9 @@ export class PermissionsService {
return this.isReviewerOrApprover(file) || file.isNew || (file.isError && file.isNew);
}
private _canDisableAutoAnalysis(file: File): boolean {
return !file.excludedFromAutomaticAnalysis && file.assignee === this._userService.currentUser.id;
}
private _canEnableAutoAnalysis(file: File): boolean {
return file.excludedFromAutomaticAnalysis && file.assignee === this._userService.currentUser.id;
private _canEnableDisableAutoAnalysis(file: File, value: 'enable' | 'disable'): boolean {
const enableOrDisable = value === 'enable' ? file.excludedFromAutomaticAnalysis : !file.excludedFromAutomaticAnalysis;
return enableOrDisable && file.assignee === this._userService.currentUser.id;
}
private _canAssignToSelf(file: File, dossier: Dossier): boolean {

@ -1 +1 @@
Subproject commit 31b60ff117a8d8ecb9617be3b0c9e1822d437034
Subproject commit b808e4661e56aa93baca96c57f910443437112d4

View File

@ -69,7 +69,7 @@ export class File extends Entity<IFile> implements IFile {
this.dossierDictionaryVersion = file.dossierDictionaryVersion;
this.dossierId = file.dossierId;
this.excluded = !!file.excluded;
this.excludedFromAutomaticAnalysis = Math.random() < 0.5; //!!file.excludedFromAutomaticAnalysis;
this.excludedFromAutomaticAnalysis = !!file.excludedFromAutomaticAnalysis;
this.fileAttributes = file.fileAttributes;
this.fileId = file.fileId;
this.filename = file.filename;