reload entity log when file is assigned to current user
This commit is contained in:
parent
0f79f04f52
commit
74b4c1a11f
@ -41,7 +41,7 @@
|
||||
></iqser-circle-button>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="fileAssignService.assignToMe([file])"
|
||||
(action)="assignToMe(file)"
|
||||
*ngIf="_canAssignToSelf()"
|
||||
[icon]="'red:assign-me'"
|
||||
[tooltip]="'file-preview.assign-me' | translate"
|
||||
|
||||
@ -1,21 +1,22 @@
|
||||
import { Component, computed, HostListener, NgZone, OnDestroy, OnInit } from '@angular/core';
|
||||
import { NgIf } from '@angular/common';
|
||||
import { Component, computed, HostListener, inject, NgZone, OnDestroy, OnInit } from '@angular/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { StatusBarComponent } from '@common-ui/shared';
|
||||
import { Bind } from '@common-ui/utils';
|
||||
import { CircleButtonComponent, LoadingService, StopPropagationDirective, Toaster } from '@iqser/common-ui';
|
||||
import { getCurrentUser, InitialsAvatarComponent } from '@iqser/common-ui/lib/users';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { File, User } from '@red/domain';
|
||||
import { FilesService } from '@services/files/files.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { AssignUserDropdownComponent } from '@shared/components/assign-user-dropdown/assign-user-dropdown.component';
|
||||
import { workflowFileStatusTranslations } from '@translations/file-status-translations';
|
||||
import { UserService } from '@users/user.service';
|
||||
import { moveElementInArray } from '@utils/functions';
|
||||
import { FileAssignService } from '../../../shared-dossiers/services/file-assign.service';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
import { PdfViewer } from '../../../pdf-viewer/services/pdf-viewer.service';
|
||||
import { Bind } from '@common-ui/utils';
|
||||
import { AssignUserDropdownComponent } from '@shared/components/assign-user-dropdown/assign-user-dropdown.component';
|
||||
import { NgIf } from '@angular/common';
|
||||
import { StatusBarComponent } from '@common-ui/shared';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { FileAssignService } from '../../../shared-dossiers/services/file-assign.service';
|
||||
import { FileDataService } from '../../services/file-data.service';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-user-management',
|
||||
@ -49,6 +50,7 @@ export class UserManagementComponent implements OnInit, OnDestroy {
|
||||
: this.#customSort([...dossier.memberIds, ...unassignUser]);
|
||||
});
|
||||
protected readonly _currentUserId = getCurrentUser().id;
|
||||
protected readonly fileDataService = inject(FileDataService);
|
||||
readonly translations = workflowFileStatusTranslations;
|
||||
readonly statusBarConfig = computed(() => [{ length: 1, color: this.state.file().workflowStatus }]);
|
||||
readonly assignTooltip = computed(() => {
|
||||
@ -72,6 +74,13 @@ export class UserManagementComponent implements OnInit, OnDestroy {
|
||||
readonly ngZone: NgZone,
|
||||
) {}
|
||||
|
||||
async assignToMe(file: File) {
|
||||
await this.fileAssignService.assignToMe([file]);
|
||||
//TODO: check which one to call
|
||||
// await firstValueFrom(this.fileDataService.updateAnnotations(file, file.numberOfAnalyses));
|
||||
await this.fileDataService.loadEntityLog();
|
||||
}
|
||||
|
||||
async assignReviewer(file: File, user: User | string) {
|
||||
const assigneeId = typeof user === 'string' ? user : user?.id;
|
||||
|
||||
@ -85,6 +94,11 @@ export class UserManagementComponent implements OnInit, OnDestroy {
|
||||
await this.filesService.setUnderApproval(file, assigneeId);
|
||||
}
|
||||
|
||||
if (assigneeId === this._currentUserId) {
|
||||
// await firstValueFrom(this.fileDataService.updateAnnotations(file, file.numberOfAnalyses));
|
||||
await this.fileDataService.loadEntityLog();
|
||||
}
|
||||
|
||||
this.loadingService.stop();
|
||||
|
||||
const translateParams = { reviewerName: this.userService.getName(assigneeId), filename: file.filename };
|
||||
|
||||
@ -450,7 +450,7 @@ export class AnnotationActionsService {
|
||||
isHint,
|
||||
includeUnprocessed,
|
||||
);
|
||||
this.#processObsAndEmit(req$).then(() => this._fileDataService.removeAnnotations(redactions.map(r => r.id)));
|
||||
this.#processObsAndEmit(req$).then();
|
||||
}
|
||||
|
||||
#getRemoveRedactionDialog(data: RemoveRedactionData) {
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { ChangeDetectorRef, Component, HostBinding, Injector, Input, OnChanges, Optional, ViewChild } from '@angular/core';
|
||||
import { NgIf, NgTemplateOutlet } from '@angular/common';
|
||||
import { ChangeDetectorRef, Component, HostBinding, inject, Injector, Input, OnChanges, Optional, ViewChild } from '@angular/core';
|
||||
import { toObservable } from '@angular/core/rxjs-interop';
|
||||
import { Router } from '@angular/router';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { StatusBarComponent } from '@common-ui/shared';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
getConfig,
|
||||
@ -21,6 +23,7 @@ import { FilesService } from '@services/files/files.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { ReanalysisService, ReanalyzeQueryParams } from '@services/reanalysis.service';
|
||||
import { ExpandableFileActionsComponent } from '@shared/components/expandable-file-actions/expandable-file-actions.component';
|
||||
import { ProcessingIndicatorComponent } from '@shared/components/processing-indicator/processing-indicator.component';
|
||||
import { LongPressDirective, LongPressEvent } from '@shared/directives/long-press.directive';
|
||||
import { Roles } from '@users/roles';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
@ -28,14 +31,12 @@ import { setLocalStorageDataByFileId } from '@utils/local-storage';
|
||||
import { firstValueFrom, Observable } from 'rxjs';
|
||||
import { DocumentInfoService } from '../../../file-preview/services/document-info.service';
|
||||
import { ExcludedPagesService } from '../../../file-preview/services/excluded-pages.service';
|
||||
import { FileDataService } from '../../../file-preview/services/file-data.service';
|
||||
import { PageRotationService } from '../../../pdf-viewer/services/page-rotation.service';
|
||||
import { ViewerHeaderService } from '../../../pdf-viewer/services/viewer-header.service';
|
||||
import { AssignReviewerApproverDialogComponent } from '../../dialogs/assign-reviewer-approver-dialog/assign-reviewer-approver-dialog.component';
|
||||
import { DossiersDialogService } from '../../services/dossiers-dialog.service';
|
||||
import { FileAssignService } from '../../services/file-assign.service';
|
||||
import { ProcessingIndicatorComponent } from '@shared/components/processing-indicator/processing-indicator.component';
|
||||
import { StatusBarComponent } from '@common-ui/shared';
|
||||
import { NgIf, NgTemplateOutlet } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-file-actions',
|
||||
@ -45,6 +46,10 @@ import { NgIf, NgTemplateOutlet } from '@angular/common';
|
||||
imports: [ProcessingIndicatorComponent, StatusBarComponent, LongPressDirective, ExpandableFileActionsComponent, NgTemplateOutlet, NgIf],
|
||||
})
|
||||
export class FileActionsComponent implements OnChanges {
|
||||
@ViewChild(ExpandableFileActionsComponent)
|
||||
private readonly _expandableActionsComponent: ExpandableFileActionsComponent;
|
||||
readonly #isDocumine = getConfig().IS_DOCUMINE;
|
||||
readonly #fileDataService = inject(FileDataService, { optional: true });
|
||||
@Input({ required: true }) file: File;
|
||||
@Input({ required: true }) dossier: Dossier;
|
||||
@Input({ required: true }) type: 'file-preview' | 'dossier-overview-list' | 'dossier-overview-workflow';
|
||||
@ -82,9 +87,6 @@ export class FileActionsComponent implements OnChanges {
|
||||
isDossierMember = false;
|
||||
tooltipPosition = IqserTooltipPositions.above;
|
||||
buttons: Action[];
|
||||
@ViewChild(ExpandableFileActionsComponent)
|
||||
private readonly _expandableActionsComponent: ExpandableFileActionsComponent;
|
||||
readonly #isDocumine = getConfig().IS_DOCUMINE;
|
||||
|
||||
constructor(
|
||||
private readonly _injector: Injector,
|
||||
@ -379,6 +381,9 @@ export class FileActionsComponent implements OnChanges {
|
||||
|
||||
async #assignToMe() {
|
||||
await this._fileAssignService.assignToMe([this.file]);
|
||||
// TODO: check which one to call
|
||||
// await firstValueFrom(this.#fileDataService?.updateAnnotations(this.file, this.file.numberOfAnalyses));
|
||||
await this.#fileDataService?.loadEntityLog();
|
||||
}
|
||||
|
||||
async #reanalyseFile() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user