remove file from annotation list

This commit is contained in:
Dan Percic 2022-02-02 11:38:16 +02:00
parent 577bc32417
commit 0ae0931d50
11 changed files with 29 additions and 47 deletions

View File

@ -1,5 +1,5 @@
<div class="details">
<redaction-type-annotation-icon [annotation]="annotation" [file]="file"></redaction-type-annotation-icon>
<redaction-type-annotation-icon [annotation]="annotation"></redaction-type-annotation-icon>
<div class="flex-1">
<div>

View File

@ -1,6 +1,5 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { AnnotationWrapper } from '../../../../../../models/file/annotation.wrapper';
import { File } from '@red/domain';
import { MultiSelectService } from '../../services/multi-select.service';
@Component({
@ -11,7 +10,6 @@ import { MultiSelectService } from '../../services/multi-select.service';
})
export class AnnotationCardComponent {
@Input() annotation: AnnotationWrapper;
@Input() file: File;
@Input() isSelected = false;
constructor(readonly multiSelectService: MultiSelectService) {}

View File

@ -10,7 +10,7 @@
<div *ngIf="annotationReferencesService.annotation$ | async as annotation" class="annotations-container flex">
<div [class.active]="isSelected(annotation.id)" class="annotation-container">
<div class="annotation-card-container flex">
<redaction-annotation-card [annotation]="annotation" [file]="file"></redaction-annotation-card>
<redaction-annotation-card [annotation]="annotation"></redaction-annotation-card>
<redaction-annotation-references-page-indicator
[number]="annotation.pageNumber"
></redaction-annotation-references-page-indicator>
@ -23,7 +23,7 @@
class="annotation-container"
>
<div class="annotation-card-container flex">
<redaction-annotation-card [annotation]="reference" [file]="file"></redaction-annotation-card>
<redaction-annotation-card [annotation]="reference"></redaction-annotation-card>
<redaction-annotation-references-page-indicator
[number]="reference.pageNumber"
></redaction-annotation-references-page-indicator>

View File

@ -1,7 +1,6 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { AnnotationReferencesService } from '../../services/annotation-references.service';
import { File } from '@red/domain';
import { FilePreviewStateService } from '../../services/file-preview-state.service';
import { combineLatest, Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
@ -13,7 +12,6 @@ import { filter, map } from 'rxjs/operators';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationReferencesListComponent {
@Input() file: File;
@Input() selectedAnnotations: AnnotationWrapper[];
@Output() readonly referenceClicked = new EventEmitter<AnnotationWrapper>();
references$ = this._annotationReferences;

View File

@ -13,7 +13,6 @@
<div [class.removed]="annotation.isChangeLogRemoved" class="annotation">
<redaction-annotation-card
[annotation]="annotation"
[file]="file"
[isSelected]="isSelected(annotation.annotationId)"
[matTooltip]="annotation.content"
matTooltipPosition="above"
@ -47,7 +46,6 @@
<ng-container *ngIf="annotationReferencesService.annotation$ | async">
<redaction-annotation-references-list
(referenceClicked)="referenceClicked($event)"
[file]="file"
[selectedAnnotations]="selectedAnnotations"
></redaction-annotation-references-list>
</ng-container>

View File

@ -1,7 +1,6 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, TemplateRef } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { FilterService, HelpModeService, IqserEventTarget } from '@iqser/common-ui';
import { File } from '@red/domain';
import { MultiSelectService } from '../../services/multi-select.service';
import { AnnotationReferencesService } from '../../services/annotation-references.service';
import { ViewModeService } from '../../services/view-mode.service';
@ -13,7 +12,6 @@ import { ViewModeService } from '../../services/view-mode.service';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationsListComponent implements OnChanges {
@Input() file: File;
@Input() annotations: AnnotationWrapper[];
@Input() selectedAnnotations: AnnotationWrapper[];
@Input() annotationActionsTemplate: TemplateRef<unknown>;
@ -39,7 +37,6 @@ export class AnnotationsListComponent implements OnChanges {
}
annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent): void {
console.log(annotation);
if (($event?.target as IqserEventTarget)?.localName === 'input') {
return;
}

View File

@ -201,7 +201,6 @@
[annotationActionsTemplate]="annotationActionsTemplate"
[annotations]="(displayedAnnotations$ | async)?.get(activeViewerPage)"
[canMultiSelect]="!isReadOnly"
[file]="file"
[selectedAnnotations]="selectedAnnotations"
iqserHelpMode="workload-annotations-list"
></redaction-annotations-list>

View File

@ -1,8 +1,7 @@
import { Component, Input, OnChanges } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { AppStateService } from '@state/app-state.service';
import { DossiersService } from '@services/entity-services/dossiers.service';
import { File } from '@red/domain';
import { FilePreviewStateService } from '../../services/file-preview-state.service';
@Component({
selector: 'redaction-type-annotation-icon',
@ -11,39 +10,32 @@ import { File } from '@red/domain';
})
export class TypeAnnotationIconComponent implements OnChanges {
@Input() annotation: AnnotationWrapper;
@Input() file: File;
label: string;
color: string;
type: 'square' | 'rhombus' | 'circle' | 'hexagon';
constructor(private _appStateService: AppStateService, private readonly _dossiersService: DossiersService) {}
constructor(private _appStateService: AppStateService, readonly screenStateService: FilePreviewStateService) {}
private get _dossierTemplateId(): string {
return this._dossiersService.find(this.file.dossierId).dossierTemplateId;
return this.screenStateService.dossierTemplateId;
}
ngOnChanges(): void {
if (this.annotation) {
if (this.annotation.isSuperTypeBasedColor) {
this.color = this._appStateService.getDictionaryColor(this.annotation.superType, this._dossierTemplateId);
} else {
this.color = this._appStateService.getDictionaryColor(this.annotation.type, this._dossierTemplateId);
}
this.type =
this.annotation.isSuggestion || this.annotation.isDeclinedSuggestion
? 'rhombus'
: this.annotation.isHint || this.annotation.isIgnoredHint
? 'circle'
: this.annotation.isRecommendation
? 'hexagon'
: 'square';
this.label =
this.annotation.isSuggestion || this.annotation.isDeclinedSuggestion
? 'S'
: this.annotation.isSkipped
? 'S'
: this.annotation.type[0].toUpperCase();
if (!this.annotation) {
return;
}
const { isSuggestion, isRecommendation, isSkipped, isDeclinedSuggestion, isHint, isIgnoredHint } = this.annotation;
if (this.annotation.isSuperTypeBasedColor) {
this.color = this._appStateService.getDictionaryColor(this.annotation.superType, this._dossierTemplateId);
} else {
this.color = this._appStateService.getDictionaryColor(this.annotation.type, this._dossierTemplateId);
}
this.type =
isSuggestion || isDeclinedSuggestion ? 'rhombus' : isHint || isIgnoredHint ? 'circle' : isRecommendation ? 'hexagon' : 'square';
this.label = isSuggestion || isDeclinedSuggestion ? 'S' : isSkipped ? 'S' : this.annotation.type[0].toUpperCase();
}
}

View File

@ -36,7 +36,7 @@ import { handleFilterDelta } from '@utils/filter-utils';
import { FilesService } from '@services/entity-services/files.service';
import { DossiersService } from '@services/entity-services/dossiers.service';
import { FileManagementService } from '@services/entity-services/file-management.service';
import { catchError, filter, map, switchMap, tap } from 'rxjs/operators';
import { catchError, map, switchMap, tap } from 'rxjs/operators';
import { FilesMapService } from '@services/entity-services/files-map.service';
import { WatermarkService } from '@shared/services/watermark.service';
import { ExcludedPagesService } from './services/excluded-pages.service';
@ -404,7 +404,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
async annotationsChangedByReviewAction(annotation: AnnotationWrapper) {
this.multiSelectService.deactivate();
await this._reloadAnnotationsForPage(annotation?.pageNumber || this.activeViewerPage);
await firstValueFrom(this._filesService.reload(this.dossierId, this.fileId));
}
closeFullScreen() {
@ -518,10 +518,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
private _subscribeToFileUpdates(): void {
this.addActiveScreenSubscription = this._filesMapService
.watch$(this.dossierId, this.fileId)
.pipe(
filter(f => !!f),
switchMap(file => this._fileUpdated(file)),
)
.pipe(switchMap(file => this._fileUpdated(file)))
.subscribe();
this.addActiveScreenSubscription = timer(0, 5000)
@ -579,7 +576,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
private async _reloadAnnotationsForPage(page: number) {
const file = await firstValueFrom(this._filesService.reload(this.dossierId, this.fileId));
const file = await this.stateService.file;
// if this action triggered a re-processing,
// we don't want to redraw for this page since they will get redrawn as soon as processing ends;
if (file.isProcessing) {

View File

@ -12,6 +12,7 @@ export class FilePreviewStateService {
readonly file$: Observable<File>;
readonly dossier$: Observable<Dossier>;
readonly dossierId: string;
readonly dossierTemplateId: string;
readonly fileId: string;
private readonly _fileData$ = new BehaviorSubject<FileDataModel>(undefined);
@ -21,6 +22,7 @@ export class FilePreviewStateService {
activatedRoute: ActivatedRoute,
) {
this.dossierId = activatedRoute.snapshot.paramMap.get('dossierId');
this.dossierTemplateId = this._dossiersService.find(this.dossierId).dossierTemplateId;
this.dossier$ = _dossiersService.getEntityChanged$(this.dossierId);
this.fileId = activatedRoute.snapshot.paramMap.get('fileId');

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { File } from '@red/domain';
import { filter, startWith } from 'rxjs/operators';
import { shareLast } from '@iqser/common-ui';
import { RequiredParam, shareLast, Validate } from '@iqser/common-ui';
@Injectable({ providedIn: 'root' })
export class FilesMapService {
@ -74,7 +74,8 @@ export class FilesMapService {
}
}
watch$(key: string, entityId: string): Observable<File> {
@Validate()
watch$(@RequiredParam() key: string, @RequiredParam() entityId: string): Observable<File> {
return this._entityChanged$.pipe(
filter(entity => entity.id === entityId),
startWith(this.get(key, entityId)),