fix removed annotation click
This commit is contained in:
parent
f74f48f7b2
commit
8c2d75e873
@ -34,7 +34,6 @@
|
|||||||
&.removed {
|
&.removed {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
color: variables.$grey-7;
|
color: variables.$grey-7;
|
||||||
cursor: default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.actions-wrapper {
|
.actions-wrapper {
|
||||||
|
|||||||
@ -41,10 +41,6 @@ export class AnnotationsListComponent implements OnChanges {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (annotation.isChangeLogRemoved) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.pagesPanelActive.emit(false);
|
this.pagesPanelActive.emit(false);
|
||||||
|
|
||||||
if (this.isSelected(annotation.annotationId)) {
|
if (this.isSelected(annotation.annotationId)) {
|
||||||
|
|||||||
@ -5,11 +5,10 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
|||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { AutoUnsubscribe, InputWithActionComponent, LoadingService, trackByFactory } from '@iqser/common-ui';
|
import { AutoUnsubscribe, InputWithActionComponent, LoadingService, trackByFactory } from '@iqser/common-ui';
|
||||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
|
||||||
import { ActivatedRoute } from '@angular/router';
|
|
||||||
import { firstValueFrom, Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { CommentingService } from '../../services/commenting.service';
|
import { CommentingService } from '../../services/commenting.service';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
|
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-comments',
|
selector: 'redaction-comments',
|
||||||
@ -23,8 +22,6 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
|||||||
readonly file$: Observable<File>;
|
readonly file$: Observable<File>;
|
||||||
@HostBinding('class.hidden') _hidden = true;
|
@HostBinding('class.hidden') _hidden = true;
|
||||||
@ViewChild(InputWithActionComponent) private readonly _input: InputWithActionComponent;
|
@ViewChild(InputWithActionComponent) private readonly _input: InputWithActionComponent;
|
||||||
private readonly _fileId: string;
|
|
||||||
private readonly _dossierId: string;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly permissionsService: PermissionsService,
|
readonly permissionsService: PermissionsService,
|
||||||
@ -33,13 +30,10 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
|||||||
private readonly _commentingService: CommentingService,
|
private readonly _commentingService: CommentingService,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _changeRef: ChangeDetectorRef,
|
private readonly _changeRef: ChangeDetectorRef,
|
||||||
readonly filesMapService: FilesMapService,
|
private readonly _stateService: FilePreviewStateService,
|
||||||
activatedRoute: ActivatedRoute,
|
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._fileId = activatedRoute.snapshot.paramMap.get('fileId');
|
this.file$ = _stateService.file$;
|
||||||
this._dossierId = activatedRoute.snapshot.paramMap.get('dossierId');
|
|
||||||
this.file$ = filesMapService.watch$(this._dossierId, this._fileId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
@ -58,9 +52,8 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const commentId = await firstValueFrom(
|
const { dossierId, fileId } = this._stateService;
|
||||||
this._manualAnnotationService.addComment(value, this.annotation.id, this._dossierId, this._fileId),
|
const commentId = await firstValueFrom(this._manualAnnotationService.addComment(value, this.annotation.id, dossierId, fileId));
|
||||||
);
|
|
||||||
this.annotation.comments.push({
|
this.annotation.comments.push({
|
||||||
text: value,
|
text: value,
|
||||||
id: commentId,
|
id: commentId,
|
||||||
@ -80,7 +73,8 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
|||||||
async deleteComment($event: MouseEvent, comment: IComment): Promise<void> {
|
async deleteComment($event: MouseEvent, comment: IComment): Promise<void> {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await firstValueFrom(this._manualAnnotationService.deleteComment(comment.id, this.annotation.id, this._dossierId, this._fileId));
|
const { dossierId, fileId } = this._stateService;
|
||||||
|
await firstValueFrom(this._manualAnnotationService.deleteComment(comment.id, this.annotation.id, dossierId, fileId));
|
||||||
this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1);
|
this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1);
|
||||||
this._changeRef.markForCheck();
|
this._changeRef.markForCheck();
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
|
|||||||
@ -56,7 +56,6 @@ export class FilesMapService {
|
|||||||
this._map.get(key).next(newEntities);
|
this._map.get(key).next(newEntities);
|
||||||
|
|
||||||
// Emit observables only after entities have been updated
|
// Emit observables only after entities have been updated
|
||||||
|
|
||||||
for (const file of changedEntities) {
|
for (const file of changedEntities) {
|
||||||
this._entityChanged$.next(file);
|
this._entityChanged$.next(file);
|
||||||
}
|
}
|
||||||
@ -69,9 +68,9 @@ export class FilesMapService {
|
|||||||
replace(entities: File[]) {
|
replace(entities: File[]) {
|
||||||
const dossierId = entities[0].dossierId;
|
const dossierId = entities[0].dossierId;
|
||||||
const entityIds = entities.map(entity => entity.id);
|
const entityIds = entities.map(entity => entity.id);
|
||||||
let existingFiles = this.get(dossierId).filter(file => entityIds.includes(file.fileId));
|
const existingFiles = this.get(dossierId).filter(file => entityIds.includes(file.fileId));
|
||||||
entities = entities.filter(entity => {
|
entities = entities.filter(entity => {
|
||||||
const existingFile = existingFiles.find(existingFile => existingFile.id === entity.id);
|
const existingFile = existingFiles.find(file => file.id === entity.id);
|
||||||
return existingFile.lastUpdated !== entity.lastUpdated;
|
return existingFile.lastUpdated !== entity.lastUpdated;
|
||||||
});
|
});
|
||||||
if (entities.length) {
|
if (entities.length) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user