tri-state file view
This commit is contained in:
parent
84a77e7de2
commit
f5ca60b036
@ -205,6 +205,7 @@ export class PermissionsService {
|
||||
}
|
||||
return (
|
||||
this.isProjectMember() &&
|
||||
!fileStatus.isProcessing &&
|
||||
!fileStatus.isError &&
|
||||
!fileStatus.isApprovedOrUnderApproval &&
|
||||
(this.isManagerAndOwner() || !this.isFileReviewer(fileStatus))
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
<div (click)="toggleAddingComment($event)" *ngIf="!addingComment" translate="comments.add-comment"></div>
|
||||
<div (click)="toggleAddingComment($event)" *ngIf="!addingComment && canAddComment" translate="comments.add-comment"></div>
|
||||
</div>
|
||||
|
||||
<form (submit)="addComment()" *ngIf="addingComment" [formGroup]="commentForm">
|
||||
|
||||
@ -6,6 +6,7 @@ import { AnnotationWrapper } from '../../screens/file/model/annotation.wrapper';
|
||||
import { UserService } from '../../user/user.service';
|
||||
import { AppStateService } from '../../state/app-state.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-comments',
|
||||
templateUrl: './comments.component.html',
|
||||
@ -30,6 +31,10 @@ export class CommentsComponent {
|
||||
});
|
||||
}
|
||||
|
||||
get canAddComment() {
|
||||
return !this.annotation.isChangeLogRemoved;
|
||||
}
|
||||
|
||||
public toggleExpandComments($event: MouseEvent): void {
|
||||
$event.stopPropagation();
|
||||
if (!this.annotation.comments.length) {
|
||||
|
||||
@ -243,6 +243,7 @@
|
||||
attr.annotation-id="{{ annotation.id }}"
|
||||
attr.annotation-page="{{ activeViewerPage }}"
|
||||
class="annotation"
|
||||
[class.removed]="annotation.isChangeLogRemoved"
|
||||
>
|
||||
<div class="details">
|
||||
<redaction-type-annotation-icon [annotation]="annotation"></redaction-type-annotation-icon>
|
||||
|
||||
@ -99,6 +99,11 @@
|
||||
flex-direction: column;
|
||||
border-left: 4px solid transparent;
|
||||
|
||||
&.removed {
|
||||
text-decoration: line-through;
|
||||
color: $grey-7;
|
||||
}
|
||||
|
||||
.details {
|
||||
display: flex;
|
||||
position: relative;
|
||||
|
||||
@ -11,7 +11,7 @@ import { ManualRedactionEntryWrapper } from '../model/manual-redaction-entry.wra
|
||||
import { AnnotationWrapper } from '../model/annotation.wrapper';
|
||||
import { ManualAnnotationService } from '../service/manual-annotation.service';
|
||||
import { ManualAnnotationResponse } from '../model/manual-annotation-response';
|
||||
import { FileDataModel } from '../model/file-data.model';
|
||||
import { AnnotationData, FileDataModel } from '../model/file-data.model';
|
||||
import { FileActionService } from '../service/file-action.service';
|
||||
import { AnnotationDrawService } from '../service/annotation-draw.service';
|
||||
import { AnnotationProcessingService } from '../service/annotation-processing.service';
|
||||
@ -57,7 +57,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
|
||||
|
||||
fileData: FileDataModel;
|
||||
fileId: string;
|
||||
annotations: AnnotationWrapper[] = [];
|
||||
annotationData: AnnotationData;
|
||||
|
||||
displayedAnnotations: { [key: number]: { annotations: AnnotationWrapper[] } } = {};
|
||||
selectedAnnotation: AnnotationWrapper;
|
||||
pagesPanelActive = true;
|
||||
@ -101,6 +102,10 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
get annotations() {
|
||||
return this.annotationData ? this.annotationData.visibleAnnotations : [];
|
||||
}
|
||||
|
||||
updateViewMode() {
|
||||
const allAnnotations = this._instance.annotManager.getAnnotationsList();
|
||||
|
||||
@ -228,7 +233,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
|
||||
const existingAnnotations = this.annotations.map((a) => this.activeViewer.annotManager.getAnnotationById(a.id));
|
||||
this.activeViewer.annotManager.deleteAnnotations(existingAnnotations, true, true);
|
||||
}
|
||||
this.annotations = this.fileData.getAnnotations(
|
||||
this.annotationData = this.fileData.getAnnotations(
|
||||
this.appStateService.dictionaryData[this.appStateService.activeProject.ruleSetId],
|
||||
this.permissionsService.currentUser,
|
||||
this.viewMode,
|
||||
@ -528,7 +533,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
|
||||
this._fileDownloadService.loadActiveFileManualAnnotations().subscribe((manualRedactions) => {
|
||||
this.fileData.manualRedactions = manualRedactions;
|
||||
this._rebuildFilters();
|
||||
this._annotationDrawService.drawAnnotations(this._instance, this.annotations);
|
||||
this._annotationDrawService.drawAnnotations(this._instance, this.annotationData.allAnnotations);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,11 @@ import { AnnotationWrapper } from './annotation.wrapper';
|
||||
import { RedactionLogEntryWrapper } from './redaction-log-entry.wrapper';
|
||||
import { ViewMode } from './view-mode';
|
||||
|
||||
export class AnnotationData {
|
||||
visibleAnnotations: AnnotationWrapper[];
|
||||
allAnnotations: AnnotationWrapper[];
|
||||
}
|
||||
|
||||
export class FileDataModel {
|
||||
constructor(
|
||||
public fileStatus: FileStatusWrapper,
|
||||
@ -28,28 +33,19 @@ export class FileDataModel {
|
||||
return this.redactionLog.redactionLogEntry;
|
||||
}
|
||||
|
||||
getAnnotations(
|
||||
dictionaryData: { [p: string]: TypeValue },
|
||||
currentUser: UserWrapper,
|
||||
viewMode: ViewMode,
|
||||
areDevFeaturesEnabled: boolean
|
||||
): AnnotationWrapper[] {
|
||||
getAnnotations(dictionaryData: { [p: string]: TypeValue }, currentUser: UserWrapper, viewMode: ViewMode, areDevFeaturesEnabled: boolean): AnnotationData {
|
||||
const entries: RedactionLogEntryWrapper[] = this._convertData(dictionaryData);
|
||||
let allAnnotations = entries.map((entry) => AnnotationWrapper.fromData(entry));
|
||||
|
||||
let annotations = entries.map((entry) => AnnotationWrapper.fromData(entry));
|
||||
if (!areDevFeaturesEnabled) {
|
||||
allAnnotations = allAnnotations.filter((annotation) => {
|
||||
return !annotation.isIgnored && !annotation.isFalsePositive;
|
||||
});
|
||||
}
|
||||
|
||||
// filter based on dev-mode
|
||||
annotations = annotations.filter((annotation) => {
|
||||
let visibleAnnotations = allAnnotations.filter((annotation) => {
|
||||
if (viewMode === 'STANDARD') {
|
||||
if (annotation.isChangeLogRemoved) {
|
||||
return false;
|
||||
} else {
|
||||
if (!areDevFeaturesEnabled) {
|
||||
return !annotation.isIgnored && !annotation.isFalsePositive;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return !annotation.isChangeLogRemoved;
|
||||
} else if (viewMode === 'DELTA') {
|
||||
return annotation.isChangeLogEntry;
|
||||
} else {
|
||||
@ -57,13 +53,20 @@ export class FileDataModel {
|
||||
}
|
||||
});
|
||||
|
||||
return annotations;
|
||||
return {
|
||||
visibleAnnotations: visibleAnnotations,
|
||||
allAnnotations: allAnnotations
|
||||
};
|
||||
}
|
||||
|
||||
private _convertData(dictionaryData: { [p: string]: TypeValue }): RedactionLogEntryWrapper[] {
|
||||
let result: RedactionLogEntryWrapper[] = [];
|
||||
|
||||
this.redactionChangeLog?.redactionLogEntry?.forEach((changeLogEntry) => {
|
||||
if (changeLogEntry.id === '48a8c973d0ef86bda58bf9722b931fc2') {
|
||||
console.log(changeLogEntry);
|
||||
// const existingChangeLogEntry = this.redactionChangeLog.redactionLogEntry.find((rle) => rle.id === redactionLogEntry.id);
|
||||
}
|
||||
if (changeLogEntry.changeType === 'REMOVED') {
|
||||
const redactionLogEntryWrapper: RedactionLogEntryWrapper = { actionPendingReanalysis: false };
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user