RED-2188
This commit is contained in:
parent
ad49745a6e
commit
03fb69f4d0
@ -8,6 +8,7 @@ import {
|
||||
ListingComponent,
|
||||
LoadingService,
|
||||
TableColumnConfig,
|
||||
Toaster,
|
||||
} from '@iqser/common-ui';
|
||||
import { fileAttributeTypesTranslations } from '../../translations/file-attribute-types-translations';
|
||||
import { UserService } from '@services/user.service';
|
||||
@ -50,6 +51,7 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
||||
|
||||
constructor(
|
||||
protected readonly _injector: Injector,
|
||||
private readonly _toaster: Toaster,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
@ -69,13 +71,8 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
||||
'addEditFileAttribute',
|
||||
$event,
|
||||
{ fileAttribute, dossierTemplateId: this._dossierTemplatesService.activeDossierTemplateId },
|
||||
async (newValue: IFileAttributeConfig) => {
|
||||
this._loadingService.start();
|
||||
await this._fileAttributesService
|
||||
.setFileAttributesConfig(newValue, this._dossierTemplatesService.activeDossierTemplateId)
|
||||
.toPromise();
|
||||
await this._appStateService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId);
|
||||
await this._loadData();
|
||||
(newValue: IFileAttributeConfig) => {
|
||||
this._loadingService.loadWhile(this._createNewFileAttributeAndRefreshView(newValue));
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -115,6 +112,22 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
||||
);
|
||||
}
|
||||
|
||||
private async _createNewFileAttributeAndRefreshView(newValue: IFileAttributeConfig): Promise<void> {
|
||||
await this._fileAttributesService
|
||||
.setFileAttributesConfig(newValue, this._dossierTemplatesService.activeDossierTemplateId)
|
||||
.toPromise()
|
||||
.catch(error => {
|
||||
if (error.status === 409) {
|
||||
this._toaster.error(_('file-attributes-listing.error.conflict'));
|
||||
} else {
|
||||
this._toaster.error(_('file-attributes-listing.error.generic'));
|
||||
}
|
||||
this._loadingService.stop();
|
||||
});
|
||||
await this._appStateService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId);
|
||||
await this._loadData();
|
||||
}
|
||||
|
||||
private async _loadData() {
|
||||
this._loadingService.start();
|
||||
|
||||
|
||||
@ -28,17 +28,20 @@
|
||||
</div>
|
||||
|
||||
<div class="right-content">
|
||||
<div *ngIf="isReadOnly" [class.justify-center]="!file.isProcessing" class="read-only d-flex">
|
||||
<div *ngIf="file.isProcessing" class="flex-align-items-center">
|
||||
<span [translate]="'file-status.processing'" class="read-only-text"></span>
|
||||
<mat-progress-bar [mode]="'indeterminate'" class="w-100"></mat-progress-bar>
|
||||
</div>
|
||||
<div *ngIf="isReadOnly" class="justify-center read-only d-flex">
|
||||
<div class="flex-center">
|
||||
<mat-icon class="primary-white" svgIcon="red:read-only"></mat-icon>
|
||||
<span class="read-only-text" translate="readonly"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="!isReadOnly && file.isProcessing" class="justify-center read-only d-flex">
|
||||
<div class="flex-align-items-center">
|
||||
<span [translate]="'file-status.processing'" class="read-only-text"></span>
|
||||
<mat-progress-bar [mode]="'indeterminate'" class="w-100"></mat-progress-bar>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="multiSelectActive" class="multi-select">
|
||||
<div class="selected-wrapper">
|
||||
<iqser-round-checkbox
|
||||
|
||||
@ -36,29 +36,25 @@
|
||||
</div>
|
||||
|
||||
<div class="flex-1 actions-container">
|
||||
<ng-container *ngIf="!file.excluded">
|
||||
<ng-container *ngIf="!file.isProcessing">
|
||||
<iqser-status-bar [configs]="statusBarConfig(file)" [small]="true"></iqser-status-bar>
|
||||
<iqser-status-bar [configs]="statusBarConfig(file)" [small]="true"></iqser-status-bar>
|
||||
|
||||
<div class="all-caps-label mr-16 ml-8">
|
||||
{{ translations[file.workflowStatus] | translate }}
|
||||
<span *ngIf="isUnderReviewOrApproval(file)">{{ 'by' | translate }}:</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="all-caps-label mr-16 ml-8">
|
||||
{{ translations[file.workflowStatus] | translate }}
|
||||
<span *ngIf="isUnderReviewOrApproval(file)">{{ 'by' | translate }}:</span>
|
||||
</div>
|
||||
|
||||
<redaction-initials-avatar
|
||||
*ngIf="!editingReviewer"
|
||||
[user]="file.currentReviewer"
|
||||
[withName]="!!file.currentReviewer"
|
||||
tooltipPosition="below"
|
||||
></redaction-initials-avatar>
|
||||
<div
|
||||
(click)="editingReviewer = true"
|
||||
*ngIf="!editingReviewer && canAssignReviewer(file, dossier)"
|
||||
class="assign-reviewer pointer"
|
||||
translate="file-preview.assign-reviewer"
|
||||
></div>
|
||||
</ng-container>
|
||||
<redaction-initials-avatar
|
||||
*ngIf="!editingReviewer"
|
||||
[user]="file.currentReviewer"
|
||||
[withName]="!!file.currentReviewer"
|
||||
tooltipPosition="below"
|
||||
></redaction-initials-avatar>
|
||||
<div
|
||||
(click)="editingReviewer = true"
|
||||
*ngIf="!editingReviewer && canAssignReviewer(file, dossier)"
|
||||
class="assign-reviewer pointer"
|
||||
translate="file-preview.assign-reviewer"
|
||||
></div>
|
||||
|
||||
<redaction-assign-user-dropdown
|
||||
(cancel)="editingReviewer = false"
|
||||
|
||||
@ -51,11 +51,11 @@ import { FileActionsComponent } from '../../shared/components/file-actions/file-
|
||||
import { FilesService } from '@services/entity-services/files.service';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { FileManagementService } from '../../shared/services/file-management.service';
|
||||
import { filter, switchMapTo, tap } from 'rxjs/operators';
|
||||
import { filter, switchMap, switchMapTo, tap } from 'rxjs/operators';
|
||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||
import { WatermarkService } from '../../../shared/services/watermark.service';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
import PDFNet = Core.PDFNet;
|
||||
import { WatermarkService } from '../../../shared/services/watermark.service';
|
||||
|
||||
const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f'];
|
||||
|
||||
@ -618,8 +618,8 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
}
|
||||
|
||||
private _subscribeToFileUpdates(): void {
|
||||
this.addSubscription = timer(0, 10000)
|
||||
.pipe(switchMapTo(this.appStateService.reloadFile(this.dossierId, this.fileId)))
|
||||
this.addSubscription = timer(0, 5000)
|
||||
.pipe(switchMap(() => this.appStateService.reloadFile(this.dossierId, this.fileId)))
|
||||
.subscribe();
|
||||
this.addSubscription = this._filesMapService.fileReanalysed$
|
||||
.pipe(filter(file => file.fileId === this.fileId))
|
||||
|
||||
@ -115,7 +115,7 @@ export class AppStateService {
|
||||
this._dossiersService.replace(dossiers.map(dossier => new Dossier(dossier)));
|
||||
}
|
||||
|
||||
async reloadFile(dossierId: string, fileId: string) {
|
||||
async reloadFile(dossierId: string, fileId: string): Promise<File> {
|
||||
const dossier = this._dossiersService.find(dossierId);
|
||||
const oldFile = this._filesMapService.get(dossierId, fileId);
|
||||
|
||||
|
||||
@ -997,6 +997,10 @@
|
||||
"total-rows": "{rows} Zeilen insgesamt"
|
||||
},
|
||||
"file-attributes-listing": {
|
||||
"error": {
|
||||
"generic": "Attribute konnte nicht erstellt werden!",
|
||||
"conflict": "Es gibt bereits ein Attribute mit diesem Name!"
|
||||
},
|
||||
"action": {
|
||||
"delete": "Attribut löschen",
|
||||
"edit": "Attribute bearbeiten"
|
||||
|
||||
@ -985,6 +985,10 @@
|
||||
"total-rows": "{rows} rows in total"
|
||||
},
|
||||
"file-attributes-listing": {
|
||||
"error": {
|
||||
"generic": "Failed to add File-Attribute",
|
||||
"conflict": "File-Attribute with this name already exists!"
|
||||
},
|
||||
"action": {
|
||||
"delete": "Delete Attribute",
|
||||
"edit": "Edit Attribute"
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit d3d322d444242ad43c1ac9f7313433cb23f7a87c
|
||||
Subproject commit 17c65675b934698a61a2c80435f532e5a77f0c97
|
||||
Loading…
x
Reference in New Issue
Block a user