fix pr comments

This commit is contained in:
Edi Cziszter 2022-01-27 13:39:03 +02:00
parent d688a73291
commit acc67cade4
12 changed files with 27 additions and 54 deletions

View File

@ -46,7 +46,7 @@ export class AnnotationWrapper {
rectangle?: boolean;
hintDictionary?: boolean;
section?: string;
reference?: Array<string>;
reference: Array<string>;
manual?: boolean;
@ -260,7 +260,7 @@ export class AnnotationWrapper {
annotationWrapper.manual = redactionLogEntry.manual;
annotationWrapper.engines = redactionLogEntry.engines;
annotationWrapper.section = redactionLogEntry.section;
annotationWrapper.reference = redactionLogEntry.reference;
annotationWrapper.reference = redactionLogEntry.reference || [];
annotationWrapper.rectangle = redactionLogEntry.rectangle;
annotationWrapper.hasBeenResized = redactionLogEntry.hasBeenResized;
annotationWrapper.hasBeenRecategorized = redactionLogEntry.hasBeenRecategorized;

View File

@ -88,8 +88,8 @@
></iqser-circle-button>
<iqser-circle-button
(action)="this.annotationReferencesService.show(annotations)"
*ngIf="hasReferences && !multiSelectService.isActive"
(action)="this.annotationReferencesService.show(annotations[0])"
*ngIf="annotations[0].reference.length !== 0 && !multiSelectService.isActive"
[tooltipPosition]="tooltipPosition"
[tooltip]="'annotation-actions.see-references.label' | translate"
[type]="buttonType"

View File

@ -16,7 +16,6 @@ import {
} from '../../dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component';
import { filter } from 'rxjs/operators';
import { ManualAnnotationService } from '../../../../services/manual-annotation.service';
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
import { AnnotationReferencesService } from '../../services/annotation-references.service';
import { MultiSelectService } from '../../services/multi-select.service';
@ -51,7 +50,6 @@ export class AnnotationActionsComponent implements OnChanges {
private readonly _dossiersService: DossiersService,
private readonly _userService: UserService,
private readonly _dialog: MatDialog,
private readonly _dialogService: DossiersDialogService,
) {}
private _annotations: AnnotationWrapper[];
@ -65,10 +63,6 @@ export class AnnotationActionsComponent implements OnChanges {
this._annotations = value.filter(a => a !== undefined);
}
get hasReferences(): boolean {
return !!this.annotations[0].reference && this.annotations[0].reference.length !== 0;
}
get viewerAnnotations() {
if (this.viewer?.Core.annotationManager) {
return this._annotations.map(a => this.viewer?.Core.annotationManager?.getAnnotationById(a.id));

View File

@ -5,18 +5,15 @@ import { File } from '@red/domain';
import { FileDataModel } from '@models/file/file-data.model';
@Component({
selector: 'redaction-annotation-references-dialog',
templateUrl: './annotation-references-dialog.component.html',
styleUrls: ['./annotation-references-dialog.component.scss'],
selector: 'redaction-annotation-references-list',
templateUrl: './annotation-references-list.component.html',
styleUrls: ['./annotation-references-list.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationReferencesDialogComponent implements OnChanges {
@Input()
annotation: AnnotationWrapper;
@Input()
file: File;
@Input()
fileData: FileDataModel;
export class AnnotationReferencesListComponent implements OnChanges {
@Input() annotation: AnnotationWrapper;
@Input() file: File;
@Input() fileData: FileDataModel;
@Output()
readonly referenceClicked = new EventEmitter<AnnotationWrapper>();
annotationReferences: AnnotationWrapper[];

View File

@ -7,5 +7,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationReferencesPageIndicatorComponent {
@Input() number;
@Input() number: number;
}

View File

@ -45,11 +45,10 @@
</div>
<ng-container *ngIf="annotationReferencesService.annotation$ | async as annotation">
<redaction-annotation-references-dialog
<redaction-annotation-references-list
(referenceClicked)="referenceClicked($event)"
*ngIf="annotationReferencesService.showReferences$ | async"
[annotation]="annotation"
[fileData]="fileData"
[file]="file"
></redaction-annotation-references-dialog>
></redaction-annotation-references-list>
</ng-container>

View File

@ -155,18 +155,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return this._stateService.fileData;
}
private get _viewDocumentInfo$() {
return this.documentInfoService.shown$.pipe(
tap(value => {
if (value) {
this.multiSelectService.deactivate();
this.excludedPagesService.hide();
}
}),
shareDistinctLast(),
);
}
private get _canPerformAnnotationActions$() {
return combineLatest([
this._stateService.fileData$.pipe(switchMap(fileData => fileData.file$)),

View File

@ -19,7 +19,7 @@ import { TypeAnnotationIconComponent } from './components/type-annotation-icon/t
import { OverlayModule } from '@angular/cdk/overlay';
import { ViewSwitchComponent } from './components/view-switch/view-switch.component';
import { UserManagementComponent } from './components/user-management/user-management.component';
import { AnnotationReferencesDialogComponent } from './components/annotation-references-dialog/annotation-references-dialog.component';
import { AnnotationReferencesListComponent } from './components/annotation-references-list/annotation-references-list.component';
import { AcceptRecommendationDialogComponent } from './dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component';
import { AnnotationCardComponent } from './components/annotation-card/annotation-card.component';
import { AnnotationReferencesPageIndicatorComponent } from './components/annotation-references-page-indicator/annotation-references-page-indicator.component';
@ -49,7 +49,7 @@ const routes: Routes = [
ViewSwitchComponent,
UserManagementComponent,
AcceptRecommendationDialogComponent,
AnnotationReferencesDialogComponent,
AnnotationReferencesListComponent,
AnnotationCardComponent,
AnnotationReferencesPageIndicatorComponent,
],

View File

@ -6,22 +6,17 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
@Injectable()
export class AnnotationReferencesService {
readonly annotation$: Observable<AnnotationWrapper>;
readonly showReferences$: Observable<boolean>;
private readonly _annotation$: BehaviorSubject<AnnotationWrapper> = new BehaviorSubject<AnnotationWrapper>(null);
private readonly _showReferences$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
private readonly _annotation$ = new BehaviorSubject<AnnotationWrapper | undefined>(undefined);
constructor() {
this.annotation$ = this._annotation$.asObservable().pipe(shareDistinctLast());
this.showReferences$ = this._showReferences$.asObservable().pipe(shareDistinctLast());
}
show(annotations: AnnotationWrapper[]) {
this._annotation$.next(annotations[0]);
this._showReferences$.next(true);
show(annotation: AnnotationWrapper) {
this._annotation$.next(annotation);
}
hide() {
this._annotation$.next(null);
this._showReferences$.next(false);
this._annotation$.next(undefined);
}
}

View File

@ -39,7 +39,7 @@
"@materia-ui/ngx-monaco-editor": "^6.0.0",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@nrwl/angular": "13.4.5",
"@nrwl/angular": "13.5.3",
"@pdftron/webviewer": "8.2.0",
"@swimlane/ngx-charts": "^20.0.1",
"file-saver": "^2.0.5",
@ -70,12 +70,12 @@
"@angular/compiler-cli": "13.1.2",
"@angular/language-service": "13.1.2",
"@bartholomej/ngx-translate-extract": "^8.0.2",
"@nrwl/cli": "13.4.5",
"@nrwl/eslint-plugin-nx": "13.4.5",
"@nrwl/jest": "13.4.5",
"@nrwl/linter": "13.4.5",
"@nrwl/tao": "13.4.5",
"@nrwl/workspace": "13.4.5",
"@nrwl/cli": "13.5.3",
"@nrwl/eslint-plugin-nx": "13.5.3",
"@nrwl/jest": "13.5.3",
"@nrwl/linter": "13.5.3",
"@nrwl/tao": "13.5.3",
"@nrwl/workspace": "13.5.3",
"@types/jest": "27.4.0",
"@types/lodash": "^4.14.178",
"@types/node": "17.0.9",