work in progress performance

This commit is contained in:
Timo Bejan 2020-10-30 21:21:42 +02:00
parent 819df0497c
commit 8b5d3ee0f6
9 changed files with 68 additions and 13 deletions

View File

@ -183,11 +183,9 @@ export class DialogService {
} }
public openAssignFileReviewerDialog( public openAssignFileReviewerDialog(
$event: MouseEvent,
file: FileStatus, file: FileStatus,
cb?: Function cb?: Function
): MatDialogRef<AssignOwnerDialogComponent> { ): MatDialogRef<AssignOwnerDialogComponent> {
$event.stopPropagation();
const ref = this._dialog.open(AssignOwnerDialogComponent, { const ref = this._dialog.open(AssignOwnerDialogComponent, {
...dialogConfig, ...dialogConfig,
data: { type: 'file', file: file } data: { type: 'file', file: file }

View File

@ -24,7 +24,7 @@
</button> </button>
<button <button
mat-icon-button mat-icon-button
(click)="openAssignFileReviewerDialog($event)" (click)="assignReviewer()"
*ngIf="appStateService.isActiveProjectMember" *ngIf="appStateService.isActiveProjectMember"
> >
<mat-icon svgIcon="red:assign"></mat-icon> <mat-icon svgIcon="red:assign"></mat-icon>

View File

@ -28,6 +28,7 @@ import { ManualAnnotationService } from '../service/manual-annotation.service';
import { ManualAnnotationResponse } from '../model/manual-annotation-response'; import { ManualAnnotationResponse } from '../model/manual-annotation-response';
import { FileDataModel } from '../model/file-data.model'; import { FileDataModel } from '../model/file-data.model';
import { AnnotationFilter } from '../../../utils/types'; import { AnnotationFilter } from '../../../utils/types';
import { FileActionService } from '../service/file-action.service';
@Component({ @Component({
selector: 'redaction-file-preview-screen', selector: 'redaction-file-preview-screen',
@ -59,6 +60,7 @@ export class FilePreviewScreenComponent implements OnInit {
private readonly _activatedRoute: ActivatedRoute, private readonly _activatedRoute: ActivatedRoute,
private readonly _dialogService: DialogService, private readonly _dialogService: DialogService,
private readonly _router: Router, private readonly _router: Router,
private readonly _fileActionService: FileActionService,
private readonly _manualAnnotationService: ManualAnnotationService, private readonly _manualAnnotationService: ManualAnnotationService,
private readonly _fileDownloadService: FileDownloadService, private readonly _fileDownloadService: FileDownloadService,
private readonly _reanalysisControllerService: ReanalysisControllerService, private readonly _reanalysisControllerService: ReanalysisControllerService,
@ -132,9 +134,8 @@ export class FilePreviewScreenComponent implements OnInit {
); );
} }
public openAssignFileReviewerDialog($event: MouseEvent) { public assignReviewer() {
const file = this.appStateService.getFileById(this.projectId, this.fileId); this._fileActionService.assignProjectReviewer();
this._dialogRef = this._dialogService.openAssignFileReviewerDialog($event, file);
} }
public get activeViewer() { public get activeViewer() {

View File

@ -27,7 +27,10 @@ export class AnnotationWrapper {
this.firstTopLeftPoint = redactionLogEntry.positions[0]?.topLeft; this.firstTopLeftPoint = redactionLogEntry.positions[0]?.topLeft;
this.pageNumber = redactionLogEntry.positions[0]?.page; this.pageNumber = redactionLogEntry.positions[0]?.page;
this.id = redactionLogEntry.id; this.id = redactionLogEntry.id;
this.content = this.createAnnotationContent(redactionLogEntry); this.content =
this.superType === 'redaction' || this.superType === 'ignore'
? this.createAnnotationContent(redactionLogEntry)
: null;
} }
get manualRedactionOwner() { get manualRedactionOwner() {

View File

@ -0,0 +1,44 @@
import { Injectable } from '@angular/core';
import { DialogService } from '../../../dialogs/dialog.service';
import { AppStateService } from '../../../state/app-state.service';
import { UserService } from '../../../user/user.service';
import { StatusControllerService } from '@redaction/red-ui-http';
import { FileStatus } from '@redaction/red-ui-http';
@Injectable({
providedIn: 'root'
})
export class FileActionService {
constructor(
private readonly _dialogService: DialogService,
private readonly _userService: UserService,
private readonly _statusControllerService: StatusControllerService,
private _appStateService: AppStateService
) {}
// TODO refactor callback to observable or promise
public assignProjectReviewer(file?: FileStatus, callback?: Function) {
if (this._appStateService.isActiveProjectOwnerAndManager) {
this._dialogService.openAssignFileReviewerDialog(
file ? file : this._appStateService.activeFile,
() => {
if (callback) {
callback();
}
}
);
} else {
this._statusControllerService
.assignProjectOwner1(
this._appStateService.activeProjectId,
file ? file.fileId : this._appStateService.activeFileId,
this._userService.userId
)
.subscribe(() => {
if (callback) {
callback();
}
});
}
}
}

View File

@ -245,7 +245,7 @@
<mat-icon svgIcon="red:report"></mat-icon> <mat-icon svgIcon="red:report"></mat-icon>
</button> </button>
<button <button
(click)="openAssignFileReviewerDialog($event, fileStatus)" (click)="assignReviewer($event, fileStatus)"
color="accent" color="accent"
*ngIf="appStateService.isActiveProjectMember" *ngIf="appStateService.isActiveProjectMember"
mat-icon-button mat-icon-button

View File

@ -18,6 +18,7 @@ import { DoughnutChartConfig } from '../../components/simple-doughnut-chart/simp
import { groupBy } from '../../utils/functions'; import { groupBy } from '../../utils/functions';
import { DialogService } from '../../dialogs/dialog.service'; import { DialogService } from '../../dialogs/dialog.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { FileActionService } from '../file/service/file-action.service';
@Component({ @Component({
selector: 'redaction-project-overview-screen', selector: 'redaction-project-overview-screen',
@ -57,6 +58,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
private readonly _statusControllerService: StatusControllerService, private readonly _statusControllerService: StatusControllerService,
private readonly _notificationService: NotificationService, private readonly _notificationService: NotificationService,
private readonly _dialogService: DialogService, private readonly _dialogService: DialogService,
private readonly _fileActionService: FileActionService,
private readonly _fileUploadService: FileUploadService, private readonly _fileUploadService: FileUploadService,
private readonly _uploadStatusOverlayService: UploadStatusOverlayService, private readonly _uploadStatusOverlayService: UploadStatusOverlayService,
private readonly _reanalysisControllerService: ReanalysisControllerService, private readonly _reanalysisControllerService: ReanalysisControllerService,
@ -244,10 +246,9 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
}); });
} }
public openAssignFileReviewerDialog($event: MouseEvent, file: FileStatus) { public assignReviewer($event: MouseEvent, file: FileStatus) {
this._dialogService.openAssignFileReviewerDialog($event, file, () => { $event.stopPropagation();
this._reloadProjects(); this._fileActionService.assignProjectReviewer(file, () => this._reloadProjects());
});
} }
public reanalyseFile($event: MouseEvent, fileStatus: FileStatus) { public reanalyseFile($event: MouseEvent, fileStatus: FileStatus) {

View File

@ -135,6 +135,10 @@ export class AppStateService {
return this._appState.activeFile; return this._appState.activeFile;
} }
get activeFileId(): string {
return this._appState.activeFile.fileId;
}
get totalAnalysedPages() { get totalAnalysedPages() {
return this._appState.totalAnalysedPages; return this._appState.totalAnalysedPages;
} }

View File

@ -39,7 +39,11 @@ export class AnnotationUtils {
if (hasActiveFilters) { if (hasActiveFilters) {
let found = false; let found = false;
for (const filter of flatFilters) { for (const filter of flatFilters) {
if (filter.key === annotation.dictionary && filter.checked) { if (
filter.checked &&
(filter.key === annotation.dictionary ||
filter.key === annotation.superType)
) {
found = true; found = true;
break; break;
} }