RED-4994 & RED-1724: keep hidden annotations hidden
This commit is contained in:
parent
9931acf4eb
commit
7b1a6201eb
@ -54,7 +54,6 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
|
||||
imported?: boolean;
|
||||
image?: boolean;
|
||||
manual?: boolean;
|
||||
hidden?: boolean;
|
||||
pending?: boolean;
|
||||
hintDictionary?: boolean;
|
||||
textAfter?: string;
|
||||
@ -191,10 +190,6 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
|
||||
return !!SuggestionAddSuperTypes[this.superType];
|
||||
}
|
||||
|
||||
get isSuggestionRemove() {
|
||||
return this.superType === SuperTypes.SuggestionRemove || this.superType === SuperTypes.SuggestionRemoveDictionary;
|
||||
}
|
||||
|
||||
get isSuggestionLegalBasisChange() {
|
||||
return this.superType === SuperTypes.SuggestionChangeLegalBasis;
|
||||
}
|
||||
|
||||
@ -37,7 +37,6 @@ export class RedactionLogEntry implements IRedactionLogEntry {
|
||||
redactionLogEntry: IRedactionLogEntry,
|
||||
readonly changeLogType: 'ADDED' | 'REMOVED' | 'CHANGED',
|
||||
readonly isChangeLogEntry: boolean,
|
||||
readonly hidden: boolean,
|
||||
readonly legalBasisList: ILegalBasis[],
|
||||
readonly hintDictionary: boolean,
|
||||
) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectorRef, Component, Input, OnChanges } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { AnnotationPermissions } from '@models/file/annotation.permissions';
|
||||
@ -7,7 +7,6 @@ import { AnnotationReferencesService } from '../../services/annotation-reference
|
||||
import { MultiSelectService } from '../../services/multi-select.service';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
import { HelpModeService } from '@iqser/common-ui';
|
||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||
import { ViewModeService } from '../../services/view-mode.service';
|
||||
import { REDAnnotationManager } from '../../../pdf-viewer/services/annotation-manager.service';
|
||||
|
||||
@ -22,6 +21,7 @@ export type AnnotationButtonType = keyof typeof AnnotationButtonTypes;
|
||||
selector: 'redaction-annotation-actions',
|
||||
templateUrl: './annotation-actions.component.html',
|
||||
styleUrls: ['./annotation-actions.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AnnotationActionsComponent implements OnChanges {
|
||||
@Input() buttonType: AnnotationButtonType = AnnotationButtonTypes.dark;
|
||||
@ -31,16 +31,14 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
annotationPermissions: AnnotationPermissions;
|
||||
|
||||
constructor(
|
||||
readonly multiSelectService: MultiSelectService,
|
||||
readonly viewModeService: ViewModeService,
|
||||
readonly annotationActionsService: AnnotationActionsService,
|
||||
readonly annotationReferencesService: AnnotationReferencesService,
|
||||
readonly helpModeService: HelpModeService,
|
||||
private readonly _changeRef: ChangeDetectorRef,
|
||||
private readonly _annotationManager: REDAnnotationManager,
|
||||
readonly multiSelectService: MultiSelectService,
|
||||
private readonly _state: FilePreviewStateService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _dictionariesMapService: DictionariesMapService,
|
||||
private readonly _annotationManager: REDAnnotationManager,
|
||||
readonly annotationActionsService: AnnotationActionsService,
|
||||
readonly annotationReferencesService: AnnotationReferencesService,
|
||||
) {}
|
||||
|
||||
private _annotations: AnnotationWrapper[];
|
||||
@ -72,7 +70,6 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
|
||||
ngOnChanges(): void {
|
||||
this._setPermissions();
|
||||
this._changeRef.markForCheck();
|
||||
}
|
||||
|
||||
removeOrSuggestRemoveAnnotation($event: MouseEvent, removeFromDict: boolean) {
|
||||
|
||||
@ -188,9 +188,11 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
const wrappers = await this._fileDataService.annotations;
|
||||
const ocrAnnotationIds = wrappers.filter(a => a.isOCR).map(a => a.id);
|
||||
const standardEntries = annotations
|
||||
.filter(a => !bool(a.getCustomData('changeLogRemoved')))
|
||||
.filter(a => !bool(a.getCustomData('changeLogRemoved')) && !this._annotationManager.isHidden(a.Id))
|
||||
.filter(a => !ocrAnnotationIds.includes(a.Id));
|
||||
const nonStandardEntries = annotations.filter(a => bool(a.getCustomData('changeLogRemoved')));
|
||||
const nonStandardEntries = annotations.filter(
|
||||
a => bool(a.getCustomData('changeLogRemoved')) && this._annotationManager.isHidden(a.Id),
|
||||
);
|
||||
this._setAnnotationsOpacity(standardEntries, true);
|
||||
this._annotationManager.show(standardEntries);
|
||||
this._annotationManager.hide(nonStandardEntries);
|
||||
@ -379,7 +381,9 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
tap(annotations => this.deleteAnnotations(...annotations)),
|
||||
);
|
||||
|
||||
const currentPageIfNotHighlightsView$ = combineLatest([this.pdf.currentPage$, this._viewModeService.viewMode$]).pipe(
|
||||
const currentPage$ = this.pdf.currentPage$.pipe(tap(() => this._annotationManager.showHidden()));
|
||||
|
||||
const currentPageIfNotHighlightsView$ = combineLatest([currentPage$, this._viewModeService.viewMode$]).pipe(
|
||||
filter(([, viewMode]) => viewMode !== ViewModes.TEXT_HIGHLIGHTS),
|
||||
map(([page]) => page),
|
||||
);
|
||||
|
||||
@ -182,11 +182,15 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
}
|
||||
|
||||
#convertData(redactionLog: IRedactionLog, file: File): RedactionLogEntry[] {
|
||||
let result: RedactionLogEntry[] = [];
|
||||
const result: RedactionLogEntry[] = [];
|
||||
const sourceIdAnnotationIds: { [key: string]: RedactionLogEntry[] } = {};
|
||||
|
||||
redactionLog.redactionLogEntry?.forEach(redactionLogEntry => {
|
||||
const changeLogValues = this.#getChangeLogValues(redactionLogEntry, file);
|
||||
if (changeLogValues.hidden) {
|
||||
return;
|
||||
}
|
||||
|
||||
const dictionary = this._state.dictionaries.find(dict => dict.type === redactionLogEntry.type);
|
||||
if (!dictionary) {
|
||||
this.missingTypes.add(redactionLogEntry.type);
|
||||
@ -197,7 +201,6 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
redactionLogEntry,
|
||||
changeLogValues.changeLogType,
|
||||
changeLogValues.isChangeLogEntry,
|
||||
changeLogValues.hidden,
|
||||
redactionLog.legalBasis,
|
||||
!!dictionary?.hint,
|
||||
);
|
||||
@ -213,10 +216,7 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
});
|
||||
|
||||
const sourceKeys = Object.keys(sourceIdAnnotationIds);
|
||||
result = result.filter(r => !sourceKeys.includes(r.id));
|
||||
result = result.filter(r => !r.hidden);
|
||||
|
||||
return result;
|
||||
return result.filter(r => !sourceKeys.includes(r.id));
|
||||
}
|
||||
|
||||
#getChangeLogValues(
|
||||
|
||||
@ -106,6 +106,11 @@ export class REDAnnotationManager {
|
||||
}
|
||||
}
|
||||
|
||||
showHidden() {
|
||||
const hidden = this.#getByIds([...this.hidden.values()]);
|
||||
this.show(hidden);
|
||||
}
|
||||
|
||||
#getById(annotation: AnnotationWrapper | string) {
|
||||
return this.#manager.getAnnotationById(getId(annotation));
|
||||
}
|
||||
|
||||
@ -27,6 +27,9 @@ export class Dossier implements IDossier, IListable {
|
||||
readonly dossiersListRouterLink: string;
|
||||
readonly id: string;
|
||||
changedDate?: string;
|
||||
readonly isSoftDeleted: boolean;
|
||||
readonly isArchived: boolean;
|
||||
readonly isActive: boolean;
|
||||
|
||||
constructor(dossier: IDossier) {
|
||||
this.dossierId = dossier.dossierId;
|
||||
@ -49,6 +52,10 @@ export class Dossier implements IDossier, IListable {
|
||||
this.archivedTime = dossier.archivedTime;
|
||||
this.hasReviewers = !!this.memberIds && this.memberIds.length > 1;
|
||||
|
||||
this.isSoftDeleted = this.softDeletedTime !== null;
|
||||
this.isArchived = this.archivedTime !== null;
|
||||
this.isActive = !this.isSoftDeleted && !this.isArchived;
|
||||
|
||||
this.id = this.dossierId;
|
||||
const routerPath = this.isArchived ? ARCHIVE_ROUTE : DOSSIERS_ROUTE;
|
||||
this.dossiersListRouterLink = `/main/${this.dossierTemplateId}/${routerPath}`;
|
||||
@ -59,18 +66,6 @@ export class Dossier implements IDossier, IListable {
|
||||
return this.dossierName;
|
||||
}
|
||||
|
||||
get isActive(): boolean {
|
||||
return !this.isSoftDeleted && !this.isArchived;
|
||||
}
|
||||
|
||||
get isArchived(): boolean {
|
||||
return this.archivedTime !== null;
|
||||
}
|
||||
|
||||
get isSoftDeleted(): boolean {
|
||||
return this.softDeletedTime !== null;
|
||||
}
|
||||
|
||||
hasMember(memberId: string): boolean {
|
||||
return !!this.memberIds && this.memberIds.indexOf(memberId) >= 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user