analysis is no longer possible except in dev-mode

This commit is contained in:
Timo Bejan 2021-10-11 10:54:16 +03:00
parent 1b99b6c499
commit 8a2409361c
9 changed files with 44 additions and 17 deletions

View File

@ -1,4 +1,4 @@
<ng-container *ngIf="areSomeFilesSelected">
<ng-container *ngIf="areSomeFilesSelected" (longPress)="forceReanalysisAction($event)" redactionLongPress>
<iqser-circle-button
(action)="delete()"
*ngIf="canDelete"
@ -70,7 +70,7 @@
<iqser-circle-button
(action)="reanalyse()"
*ngIf="canReanalyse"
*ngIf="canReanalyse && analysisForced"
[tooltip]="'dossier-overview.bulk.reanalyse' | translate"
[type]="circleButtonTypes.dark"
icon="iqser:refresh"

View File

@ -10,6 +10,8 @@ import { CircleButtonTypes, ConfirmationDialogInput, ListingService, LoadingServ
import { TranslateService } from '@ngx-translate/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { Dossier } from '@state/model/dossier';
import { LongPressEvent } from '../../../../../shared/directives/long-press.directive';
import { UserPreferenceService } from '../../../../../../services/user-preference.service';
@Component({
selector: 'redaction-dossier-overview-bulk-actions',
@ -22,6 +24,8 @@ export class DossierOverviewBulkActionsComponent {
@Input() dossier: Dossier;
@Output() readonly reload = new EventEmitter();
analysisForced: boolean;
constructor(
private readonly _appStateService: AppStateService,
private readonly _dialogService: DossiersDialogService,
@ -32,6 +36,7 @@ export class DossierOverviewBulkActionsComponent {
private readonly _loadingService: LoadingService,
private readonly _translateService: TranslateService,
private readonly _listingService: ListingService<File>,
private readonly _userPreferenceService: UserPreferenceService,
) {}
get selectedFiles(): File[] {
@ -115,6 +120,10 @@ export class DossierOverviewBulkActionsComponent {
: this._translateService.instant('dossier-overview.assign-reviewer');
}
forceReanalysisAction($event: LongPressEvent) {
this.analysisForced = !$event.touchEnd && this._userPreferenceService.areDevFeaturesEnabled;
}
delete() {
this._dialogService.openDialog(
'confirm',

View File

@ -1,4 +1,4 @@
<section *ngIf="!!currentDossier">
<section *ngIf="!!currentDossier" (longPress)="forceReanalysisAction($event)" redactionLongPress>
<iqser-page-header
(closeAction)="routerHistoryService.navigateToLastDossiersScreen()"
[actionConfigs]="actionConfigs"
@ -13,7 +13,7 @@
<iqser-circle-button
(action)="reanalyseDossier()"
*ngIf="permissionsService.displayReanalyseBtn(currentDossier)"
*ngIf="permissionsService.displayReanalyseBtn(currentDossier) && analysisForced"
[tooltipClass]="'small ' + ((listingService.areSomeSelected$ | async) ? '' : 'warn')"
[tooltip]="'dossier-overview.new-rule.toast.actions.reanalyse-all' | translate"
[type]="circleButtonTypes.warn"

View File

@ -53,6 +53,8 @@ import { ConfigService as AppConfigService } from '@services/config.service';
import { ConfigService } from '../config.service';
import { DossiersService } from '../../../services/dossiers.service';
import { DossierTemplatesService } from '../../../services/dossier-templates.service';
import { LongPressEvent } from '../../../../shared/directives/long-press.directive';
import { UserPreferenceService } from '../../../../../services/user-preference.service';
@Component({
templateUrl: './dossier-overview-screen.component.html',
@ -64,12 +66,15 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
readonly listingModes = ListingModes;
readonly circleButtonTypes = CircleButtonTypes;
readonly currentUser = this._userService.currentUser;
currentDossier = this._dossiersService.activeDossier;
readonly tableHeaderLabel = _('dossier-overview.table-header.title');
currentDossier = this._dossiersService.activeDossier;
collapsedDetails = false;
dossierAttributes: DossierAttributeWithValue[] = [];
fileAttributeConfigs: IFileAttributeConfig[];
tableColumnConfigs: readonly TableColumnConfig<File>[];
analysisForced: boolean;
readonly workflowConfig: WorkflowConfig<File, FileStatus> = this._configService.workflowConfig(() => this.reloadDossiers());
readonly actionConfigs: readonly ActionConfig[] = this._configService.actionConfig;
@ViewChild(DossierDetailsComponent, { static: false }) private readonly _dossierDetailsComponent: DossierDetailsComponent;
@ -100,6 +105,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
private readonly _dossierAttributesService: DossierAttributesService,
private readonly _fileAttributesService: FileAttributesService,
private readonly _configService: ConfigService,
private readonly _userPreferenceService: UserPreferenceService,
) {
super(_injector);
}
@ -191,6 +197,10 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
this.ngOnDestroy();
}
forceReanalysisAction($event: LongPressEvent) {
this.analysisForced = !$event.touchEnd && this._userPreferenceService.areDevFeaturesEnabled;
}
async reanalyseDossier() {
try {
await this._appStateService.reanalyzeDossier();

View File

@ -1,5 +1,5 @@
<iqser-status-bar [configs]="statusConfig"></iqser-status-bar>
<div class="action-buttons">
<div class="action-buttons" (longPress)="forceReanalysisAction($event)" redactionLongPress>
<iqser-circle-button
(action)="openEditDossierDialog($event, dossier)"
*ngIf="currentUser.isManager"
@ -10,7 +10,7 @@
<iqser-circle-button
(action)="reanalyseDossier($event, dossier)"
*ngIf="permissionsService.displayReanalyseBtn(dossier)"
*ngIf="permissionsService.displayReanalyseBtn(dossier) && analysisForced"
[tooltip]="'dossier-listing.reanalyse.action' | translate"
[type]="circleButtonTypes.dark"
icon="iqser:refresh"

View File

@ -6,6 +6,8 @@ import { UserService } from '@services/user.service';
import { AppStateService } from '@state/app-state.service';
import { Dossier } from '@state/model/dossier';
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
import { LongPressEvent } from '../../../../../shared/directives/long-press.directive';
import { UserPreferenceService } from '../../../../../../services/user-preference.service';
@Component({
selector: 'redaction-dossiers-listing-actions',
@ -17,6 +19,8 @@ export class DossiersListingActionsComponent {
readonly circleButtonTypes = CircleButtonTypes;
readonly currentUser = this._userService.currentUser;
analysisForced: boolean;
@Input() dossier: Dossier;
@Output() readonly actionPerformed = new EventEmitter<Dossier | undefined>();
@ -25,6 +29,7 @@ export class DossiersListingActionsComponent {
readonly appStateService: AppStateService,
private readonly _dialogService: DossiersDialogService,
private readonly _userService: UserService,
private readonly _userPreferenceService: UserPreferenceService,
) {}
get statusConfig(): readonly StatusBarConfig<string>[] {
@ -47,6 +52,10 @@ export class DossiersListingActionsComponent {
.map(status => ({ length: obj[status], color: status }));
}
forceReanalysisAction($event: LongPressEvent) {
this.analysisForced = !$event.touchEnd && this._userPreferenceService.areDevFeaturesEnabled;
}
openEditDossierDialog($event: MouseEvent, dossier: Dossier): void {
this._dialogService.openDialog('editDossier', $event, {
dossier,

View File

@ -126,7 +126,7 @@
<!-- reanalyse file preview -->
<iqser-circle-button
(action)="reanalyseFile($event)"
*ngIf="canReanalyse && isFilePreview"
*ngIf="canReanalyse && isFilePreview && analysisForced"
[tooltip]="'file-preview.reanalyse-notification' | translate"
[type]="circleButtonTypes.warn"
icon="iqser:refresh"
@ -137,7 +137,7 @@
<!-- reanalyse file listing -->
<iqser-circle-button
(action)="reanalyseFile($event)"
*ngIf="canReanalyse && isDossierOverview"
*ngIf="canReanalyse && isDossierOverview && analysisForced"
[tooltipPosition]="tooltipPosition"
[tooltip]="'dossier-overview.reanalyse.action' | translate"
[type]="circleButtonTypes.dark"

View File

@ -57,6 +57,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnD
showDocumentInfo: boolean;
showStatusBar: boolean;
showOpenDocument: boolean;
analysisForced: boolean;
constructor(
readonly permissionsService: PermissionsService,
@ -237,18 +238,16 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnD
}
}
forceReanalysisAction($event: LongPressEvent) {
if (this._userPreferenceService.areDevFeaturesEnabled) {
this.canReanalyse = $event.touchEnd ? this.permissionsService.canReanalyseFile(this.file) : true;
}
}
private _setFileApproved() {
this.addSubscription = this._fileActionService.setFilesApproved([this.file]).subscribe(() => {
this.reloadDossiers('set-approved');
});
}
forceReanalysisAction($event: LongPressEvent) {
this.analysisForced = !$event.touchEnd && this._userPreferenceService.areDevFeaturesEnabled;
}
private _setup() {
this.statusBarConfig = [{ color: this.file.status, length: 1 }];
this.tooltipPosition = this.isFilePreview ? 'below' : 'above';

View File

@ -29,7 +29,7 @@ export class PermissionsService {
}
displayReanalyseBtn(dossier: Dossier): boolean {
return this.isApprover(dossier) && dossier.files.filter(file => file.analysisRequired).length > 0;
return this.isApprover(dossier);
}
canToggleAnalysis(file: File): boolean {
@ -37,7 +37,7 @@ export class PermissionsService {
}
canReanalyseFile(file = this._activeFile): boolean {
return (file.analysisRequired && (this.isReviewerOrApprover(file) || file.isUnassigned)) || (file.isError && file.isUnassigned);
return this.isReviewerOrApprover(file) || file.isUnassigned || (file.isError && file.isUnassigned);
}
isFileReviewer(file = this._activeFile): boolean {