-
@@ -88,14 +87,10 @@
@@ -147,7 +142,7 @@
(click)="$event.stopPropagation()"
[checked]="!fileStatus?.isExcluded"
[class.mr-24]="screen === 'dossier-overview'"
- [disabled]="!permissionsService.canToggleAnalysis(fileStatus)"
+ [disabled]="!canToggleAnalysis"
[matTooltipPosition]="tooltipPosition"
[matTooltip]="toggleTooltip | translate"
color="primary"
diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.scss b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.scss
index d98d4d2d1..600b5345d 100644
--- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.scss
+++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.scss
@@ -17,7 +17,7 @@
font-weight: bold;
}
-redaction-status-bar {
+iqser-status-bar {
margin-left: 2px;
}
diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts
index 7e1657a6b..135159bb0 100644
--- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { PermissionsService } from '@services/permissions.service';
import { FileStatusWrapper } from '@models/file/file-status.wrapper';
import { AppStateService } from '@state/app-state.service';
@@ -6,18 +6,18 @@ import { FileActionService } from '../../services/file-action.service';
import { DossiersDialogService } from '../../services/dossiers-dialog.service';
import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
import { LoadingService } from '@services/loading.service';
-import { FileManagementControllerService } from '@redaction/red-ui-http';
-import { TranslateService } from '@ngx-translate/core';
+import { FileManagementControllerService, FileStatus } from '@redaction/red-ui-http';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
-import { CircleButtonTypes } from '@iqser/common-ui';
+import { AutoUnsubscribe, CircleButtonType, CircleButtonTypes, StatusBarConfig } from '@iqser/common-ui';
import { UserService } from '@services/user.service';
+import { filter } from 'rxjs/operators';
@Component({
selector: 'redaction-file-actions',
templateUrl: './file-actions.component.html',
styleUrls: ['./file-actions.component.scss']
})
-export class FileActionsComponent implements OnInit {
+export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnDestroy {
readonly circleButtonTypes = CircleButtonTypes;
readonly currentUser = this._userService.currentUser;
@@ -27,6 +27,24 @@ export class FileActionsComponent implements OnInit {
@Output() actionPerformed = new EventEmitter();
screen: 'file-preview' | 'dossier-overview';
+ statusBarConfig?: readonly StatusBarConfig[];
+ tooltipPosition?: 'below' | 'above';
+ toggleTooltip?: string;
+ assignTooltip?: string;
+ buttonType?: CircleButtonType;
+ isWorkable: boolean;
+
+ canUndoApproval: boolean;
+ canAssignToSelf: boolean;
+ canAssign: boolean;
+ canDelete: boolean;
+ canReanalyse: boolean;
+ canOcr: boolean;
+ canSetToUnderReview: boolean;
+ canSetToUnderApproval: boolean;
+ canApprove: boolean;
+ readyForApproval: boolean;
+ canToggleAnalysis: boolean;
constructor(
readonly permissionsService: PermissionsService,
@@ -35,23 +53,12 @@ export class FileActionsComponent implements OnInit {
private readonly _fileActionService: FileActionService,
private readonly _loadingService: LoadingService,
private readonly _fileManagementControllerService: FileManagementControllerService,
- private readonly _translateService: TranslateService,
private readonly _userService: UserService
- ) {}
-
- get statusBarConfig() {
- return [{ color: this.fileStatus.status, length: 1 }];
+ ) {
+ super();
}
- get tooltipPosition() {
- return this.screen === 'file-preview' ? 'below' : 'above';
- }
-
- get buttonType() {
- return this.screen === 'file-preview' ? CircleButtonTypes.default : CircleButtonTypes.dark;
- }
-
- get toggleTooltip(): string {
+ private get _toggleTooltip(): string {
if (!this.currentUser.isManager) {
return _('file-preview.toggle-analysis.only-managers');
}
@@ -59,57 +66,46 @@ export class FileActionsComponent implements OnInit {
return this.fileStatus?.isExcluded ? _('file-preview.toggle-analysis.enable') : _('file-preview.toggle-analysis.disable');
}
- get canAssignToSelf() {
- return this.permissionsService.canAssignToSelf(this.fileStatus);
- }
+ private _setup() {
+ this.statusBarConfig = [{ color: this.fileStatus.status, length: 1 }];
+ this.tooltipPosition = this.screen === 'file-preview' ? 'below' : 'above';
+ this.assignTooltip = this.fileStatus.isUnderApproval
+ ? _('dossier-overview.assign-approver')
+ : _('dossier-overview.assign-reviewer');
+ this.buttonType = this.screen === 'file-preview' ? CircleButtonTypes.default : CircleButtonTypes.dark;
+ this.isWorkable = this.fileStatus.isWorkable;
+ this.toggleTooltip = this._toggleTooltip;
- get canAssign() {
- return this.permissionsService.canAssignUser(this.fileStatus);
- }
-
- get canDelete() {
- return this.permissionsService.canDeleteFile(this.fileStatus);
- }
-
- get canReanalyse() {
- return this.permissionsService.canReanalyseFile(this.fileStatus);
- }
-
- get canOcr() {
- return this.permissionsService.canOcrFile(this.fileStatus);
- }
-
- get canSetToUnderReview() {
- return this.permissionsService.canSetUnderReview(this.fileStatus);
- }
-
- get canSetToUnderApproval() {
- return this.permissionsService.canSetUnderApproval(this.fileStatus);
- }
-
- get canUndoApproval() {
- return this.permissionsService.canUndoApproval(this.fileStatus);
- }
-
- get assignTooltip() {
- return this.fileStatus.isUnderApproval
- ? this._translateService.instant('dossier-overview.assign-approver')
- : this._translateService.instant('dossier-overview.assign-reviewer');
+ this.canUndoApproval = this.permissionsService.canUndoApproval(this.fileStatus);
+ this.canAssignToSelf = this.permissionsService.canAssignToSelf(this.fileStatus);
+ this.canAssign = this.permissionsService.canAssignUser(this.fileStatus);
+ this.canDelete = this.permissionsService.canDeleteFile(this.fileStatus);
+ this.canReanalyse = this.permissionsService.canReanalyseFile(this.fileStatus);
+ this.canOcr = this.permissionsService.canOcrFile(this.fileStatus);
+ this.canSetToUnderReview = this.permissionsService.canSetUnderReview(this.fileStatus);
+ this.canSetToUnderApproval = this.permissionsService.canSetUnderApproval(this.fileStatus);
+ this.canApprove = this.permissionsService.canApprove(this.fileStatus);
+ this.readyForApproval = this.permissionsService.isReadyForApproval(this.fileStatus);
+ this.canToggleAnalysis = this.permissionsService.canToggleAnalysis(this.fileStatus);
}
ngOnInit(): void {
if (this.fileStatus) {
this.screen = 'dossier-overview';
+ this._setup();
return;
}
this.fileStatus = this.appStateService.activeFile;
this.screen = 'file-preview';
- this.appStateService.fileChanged.subscribe(fileStatus => {
- if (fileStatus.fileId === this.fileStatus?.fileId) {
- this.fileStatus = this.appStateService.activeFile;
- }
- });
+ this._setup();
+
+ this.addSubscription = this.appStateService.fileChanged
+ .pipe(filter(file => file.fileId === this.fileStatus?.fileId))
+ .subscribe(fileStatus => {
+ this.fileStatus = fileStatus;
+ this._setup();
+ });
}
toggleViewDocumentInfo() {
@@ -156,7 +152,7 @@ export class FileActionsComponent implements OnInit {
reanalyseFile($event: MouseEvent) {
$event.stopPropagation();
- this._fileActionService.reanalyseFile(this.fileStatus).subscribe(() => {
+ this.addSubscription = this._fileActionService.reanalyseFile(this.fileStatus).subscribe(() => {
this.reloadDossiers('reanalyse');
});
}
@@ -171,7 +167,7 @@ export class FileActionsComponent implements OnInit {
true
);
} else {
- this._fileActionService.setFileUnderApproval(this.fileStatus).subscribe(() => {
+ this.addSubscription = this._fileActionService.setFileUnderApproval(this.fileStatus).subscribe(() => {
this.reloadDossiers('set-under-approval');
});
}
@@ -179,14 +175,14 @@ export class FileActionsComponent implements OnInit {
setFileApproved($event: MouseEvent) {
$event.stopPropagation();
- this._fileActionService.setFileApproved(this.fileStatus).subscribe(() => {
+ this.addSubscription = this._fileActionService.setFileApproved(this.fileStatus).subscribe(() => {
this.reloadDossiers('set-approved');
});
}
ocrFile($event: MouseEvent) {
$event.stopPropagation();
- this._fileActionService.ocrFile(this.fileStatus).subscribe(() => {
+ this.addSubscription = this._fileActionService.ocrFile(this.fileStatus).subscribe(() => {
this.reloadDossiers('ocr-file');
});
}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html
index cb1c6c5be..06ac1f075 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html
+++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html
@@ -147,15 +147,15 @@
class="small-label loading"
translate="dossier-overview.file-listing.file-entry.file-processing"
>
-
+ >
-
+
{{ translations[status] | translate }}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.html
index c646b14e8..ba1fc56ce 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.html
+++ b/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.html
@@ -59,8 +59,8 @@
-
+ >
diff --git a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html
index 09e4aa6af..5c0ed8df1 100644
--- a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html
+++ b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html
@@ -30,8 +30,8 @@
[class.active]="filterChecked$(val.key) | async"
[class.filter-disabled]="(statusFilters$ | async)?.length === 0"
>
-
-
+