manual annotation workflow
This commit is contained in:
parent
241b086601
commit
414d5518dc
@ -176,12 +176,7 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
|
||||
component: FilePreviewScreenComponent,
|
||||
canActivate: [CompositeRouteGuard],
|
||||
data: {
|
||||
routeGuards: [
|
||||
AuthGuard,
|
||||
RedRoleGuard,
|
||||
ProjectMemberGuard,
|
||||
AppStateGuard
|
||||
]
|
||||
routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div
|
||||
[class.hint]="typeValue?.hint"
|
||||
[class.request]="typeValue?.type === 'suggestion'"
|
||||
[style.background-color]="typeValue?.hexColor"
|
||||
[class.request]="isSuggestionRequest"
|
||||
[style.background-color]="color ? color : typeValue?.hexColor"
|
||||
class="icon"
|
||||
>
|
||||
<span>{{ (typeValue?.type)[0] }}</span>
|
||||
|
||||
@ -12,29 +12,14 @@
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
color: $white;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.request {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border: 9px solid transparent;
|
||||
position: relative;
|
||||
top: -9px;
|
||||
background-color: transparent !important;
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -9px;
|
||||
top: 9px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border: 9px solid transparent;
|
||||
}
|
||||
transform: rotate(45deg);
|
||||
|
||||
span {
|
||||
transform: translateY(9px);
|
||||
z-index: 2;
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,24 +6,15 @@ import { TypeValue } from '@redaction/red-ui-http';
|
||||
templateUrl: './annotation-icon.component.html',
|
||||
styleUrls: ['./annotation-icon.component.scss']
|
||||
})
|
||||
export class AnnotationIconComponent implements OnInit {
|
||||
export class AnnotationIconComponent {
|
||||
@Input() typeValue: TypeValue;
|
||||
|
||||
label: string;
|
||||
@Input() color: string;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.typeValue?.type === 'suggestion') {
|
||||
const styleSheet = document.styleSheets[0];
|
||||
styleSheet.insertRule(
|
||||
`.request:after { border-top-color: ${this.typeValue.hexColor} !important; }`,
|
||||
styleSheet.cssRules.length
|
||||
);
|
||||
styleSheet.insertRule(
|
||||
`.request { border-bottom-color: ${this.typeValue.hexColor} !important; }`,
|
||||
styleSheet.cssRules.length
|
||||
);
|
||||
}
|
||||
get isSuggestionRequest() {
|
||||
return (
|
||||
this.typeValue?.type === 'suggestion' || this.typeValue?.type === 'suggestion-remove'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,11 +232,13 @@ export class DialogService {
|
||||
|
||||
ref.afterClosed().subscribe((result) => {
|
||||
if (result) {
|
||||
this._manualAnnotationService.removeAnnotation(annotation).subscribe(() => {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
this._manualAnnotationService
|
||||
.removeOrSuggestRemoveAnnotation(annotation)
|
||||
.subscribe(() => {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -10,19 +10,36 @@
|
||||
<mat-icon svgIcon="red:check-alt"></mat-icon>
|
||||
</button>
|
||||
<mat-menu #menu="matMenu" (closed)="onSuggestionMenuClose()" xPosition="before">
|
||||
<div (click)="acceptSuggestion($event, annotation)" mat-menu-item>
|
||||
<div (click)="acceptSuggestion($event, annotation, true)" mat-menu-item>
|
||||
<redaction-annotation-icon [typeValue]="suggestionType"></redaction-annotation-icon>
|
||||
<div translate="file-preview.tabs.annotations.accept-suggestion.add-to-dict"></div>
|
||||
<div
|
||||
[translate]="
|
||||
annotation.superType === 'suggestion'
|
||||
? 'file-preview.tabs.annotations.accept-suggestion.add-to-dict'
|
||||
: 'file-preview.tabs.annotations.accept-suggestion.remove-from-dict'
|
||||
"
|
||||
></div>
|
||||
</div>
|
||||
<div (click)="acceptSuggestion($event, annotation)" mat-menu-item>
|
||||
<redaction-annotation-icon [typeValue]="suggestionType"></redaction-annotation-icon>
|
||||
<div (click)="acceptSuggestion($event, annotation, false)" mat-menu-item>
|
||||
<redaction-annotation-icon
|
||||
[typeValue]="suggestionType"
|
||||
[color]="'#5B97DB'"
|
||||
></redaction-annotation-icon>
|
||||
<div translate="file-preview.tabs.annotations.accept-suggestion.only-here"></div>
|
||||
</div>
|
||||
</mat-menu>
|
||||
<button
|
||||
(click)="undoDirectAction($event, annotation)"
|
||||
*ngIf="annotation.canUndo"
|
||||
mat-icon-button
|
||||
>
|
||||
<mat-icon svgIcon="red:undo"></mat-icon>
|
||||
</button>
|
||||
<button
|
||||
(click)="rejectSuggestion($event, annotation)"
|
||||
*ngIf="
|
||||
annotation.superType === 'suggestion' || annotation.superType === 'suggestion-remove'
|
||||
!annotation.canUndo &&
|
||||
(annotation.superType === 'suggestion' || annotation.superType === 'suggestion-remove')
|
||||
"
|
||||
mat-icon-button
|
||||
>
|
||||
@ -30,7 +47,10 @@
|
||||
</button>
|
||||
<button
|
||||
(click)="suggestRemoveAnnotation($event, annotation)"
|
||||
*ngIf="annotation.superType === 'redaction' || annotation.superType === 'hint'"
|
||||
*ngIf="
|
||||
!annotation.canUndo &&
|
||||
(annotation.superType === 'redaction' || annotation.superType === 'hint')
|
||||
"
|
||||
mat-icon-button
|
||||
>
|
||||
<mat-icon svgIcon="red:trash"></mat-icon>
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
|
||||
import { AnnotationWrapper } from '../model/annotation.wrapper';
|
||||
import { AppStateService } from '../../../state/app-state.service';
|
||||
import { TypeValue } from '@redaction/red-ui-http';
|
||||
import { ManualAnnotationService } from '../service/manual-annotation.service';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-annotation-actions',
|
||||
@ -12,10 +14,15 @@ export class AnnotationActionsComponent implements OnInit {
|
||||
@Input() annotation: AnnotationWrapper;
|
||||
@Input() canPerformAnnotationActions: boolean;
|
||||
|
||||
@Output() annotationsChanged = new EventEmitter();
|
||||
|
||||
suggestionType: TypeValue;
|
||||
menuOpen: boolean;
|
||||
|
||||
constructor(public appStateService: AppStateService) {}
|
||||
constructor(
|
||||
public appStateService: AppStateService,
|
||||
private readonly _manualAnnotationService: ManualAnnotationService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.suggestionType = this.appStateService.getDictionaryTypeValue('suggestion');
|
||||
@ -29,16 +36,39 @@ export class AnnotationActionsComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
acceptSuggestion($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||
acceptSuggestion($event: MouseEvent, annotation: AnnotationWrapper, addToDictionary: boolean) {
|
||||
$event.stopPropagation();
|
||||
this._processObsAndEmit(
|
||||
this._manualAnnotationService.approveRequest(annotation.id, addToDictionary)
|
||||
);
|
||||
}
|
||||
|
||||
rejectSuggestion($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||
$event.stopPropagation();
|
||||
this._processObsAndEmit(this._manualAnnotationService.declineOrRemoveRequest(annotation));
|
||||
}
|
||||
|
||||
suggestRemoveAnnotation($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||
$event.stopPropagation();
|
||||
this._processObsAndEmit(
|
||||
this._manualAnnotationService.removeOrSuggestRemoveAnnotation(annotation)
|
||||
);
|
||||
}
|
||||
|
||||
undoDirectAction($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||
$event.stopPropagation();
|
||||
this._processObsAndEmit(this._manualAnnotationService.undoRequest(annotation));
|
||||
}
|
||||
|
||||
private _processObsAndEmit(obs: Observable<any>) {
|
||||
obs.subscribe(
|
||||
() => {
|
||||
this.annotationsChanged.emit();
|
||||
},
|
||||
() => {
|
||||
this.annotationsChanged.emit();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public openAcceptSuggestionMenu($event: MouseEvent) {
|
||||
|
||||
@ -225,6 +225,7 @@
|
||||
<redaction-annotation-actions
|
||||
[annotation]="annotation"
|
||||
[canPerformAnnotationActions]="canPerformAnnotationActions"
|
||||
(annotationsChanged)="annotationsChangedByReviewAction()"
|
||||
></redaction-annotation-actions>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -62,9 +62,7 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
public viewReady = false;
|
||||
public filters: FilterModel[];
|
||||
|
||||
private _activeMenuAnnotation: AnnotationWrapper;
|
||||
loadingMessage: string;
|
||||
|
||||
canPerformAnnotationActions: boolean;
|
||||
|
||||
constructor(
|
||||
@ -150,19 +148,20 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
AnnotationWrapper.fromManualRedaction(
|
||||
mr,
|
||||
this.fileData.manualRedactions,
|
||||
this.appStateService.dictionaryData
|
||||
this.appStateService.dictionaryData,
|
||||
this.user
|
||||
)
|
||||
);
|
||||
const redactionLogAnnotations = this.fileData.redactionLog.redactionLogEntry.map((rde) =>
|
||||
AnnotationWrapper.fromRedactionLog(rde, this.fileData.manualRedactions)
|
||||
AnnotationWrapper.fromRedactionLog(rde, this.fileData.manualRedactions, this.user)
|
||||
);
|
||||
|
||||
this.annotations.splice(0, this.annotations.length);
|
||||
//this.annotations.splice(0, this.annotations.length);
|
||||
this.annotations = [];
|
||||
this.annotations.push(...manualRedactionAnnotations);
|
||||
this.annotations.push(...redactionLogAnnotations);
|
||||
this.filters = this._annotationProcessingService.getAnnotationFilter(this.annotations);
|
||||
this.filtersChanged(this.filters);
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
public openFileDetailsDialog($event: MouseEvent) {
|
||||
@ -196,7 +195,6 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
|
||||
public assignReviewer() {
|
||||
this._fileActionService.assignProjectReviewer(null, () => {
|
||||
console.log(this.appStateService.canPerformAnnotationActionsOnCurrentFile());
|
||||
this.canPerformAnnotationActions = this.appStateService.canPerformAnnotationActionsOnCurrentFile();
|
||||
});
|
||||
}
|
||||
@ -279,45 +277,6 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public acceptSuggestion($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||
this.ngZone.run(() => {
|
||||
this._dialogRef = this._dialogService.openAcceptSuggestionModal(
|
||||
$event,
|
||||
annotation,
|
||||
() => {
|
||||
this._cleanupAndRedrawManualAnnotations();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public rejectSuggestion($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||
this.ngZone.run(() => {
|
||||
this._dialogRef = this._dialogService.openRejectSuggestionModal(
|
||||
$event,
|
||||
annotation,
|
||||
() => {
|
||||
this._cleanupAndRedrawManualAnnotations();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
suggestRemoveAnnotation($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||
this.ngZone.run(() => {
|
||||
this._dialogRef = this._dialogService.openRemoveAnnotationModal(
|
||||
$event,
|
||||
annotation,
|
||||
() => {
|
||||
annotation.superType = this.appStateService.isActiveProjectOwnerAndManager
|
||||
? 'ignore'
|
||||
: 'suggestion-remove';
|
||||
this._cleanupAndRedrawManualAnnotations();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public downloadFile(type: FileType | string) {
|
||||
this._fileDownloadService.loadFile(type, this.fileId).subscribe((data) => {
|
||||
saveAs(data, this.appStateService.activeFile.filename);
|
||||
@ -485,7 +444,9 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
viewerReady($event: WebViewerInstance) {
|
||||
this.instance = $event;
|
||||
this.viewReady = true;
|
||||
this._reanalyseTooltip.show();
|
||||
if (this._reanalyseTooltip) {
|
||||
this._reanalyseTooltip.show();
|
||||
}
|
||||
this._cleanupAndRedrawManualAnnotations();
|
||||
}
|
||||
|
||||
@ -494,7 +455,7 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
this.annotations,
|
||||
filters
|
||||
);
|
||||
this._changeDetectorRef.detectChanges();
|
||||
this._changeDetectorRef.markForCheck();
|
||||
}
|
||||
|
||||
preventArrowDefault($event: KeyboardEvent) {
|
||||
@ -507,8 +468,6 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
this._fileDownloadService
|
||||
.loadActiveFileManualAnnotations()
|
||||
.subscribe((manualRedactions) => {
|
||||
this.fileData.manualRedactions = manualRedactions;
|
||||
|
||||
const annotationsToRemove = [];
|
||||
this.fileData.entriesToAdd.forEach((manuallyAddedEntry) => {
|
||||
const annotation = this.activeViewer.annotManager.getAnnotationById(
|
||||
@ -519,6 +478,8 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
this.activeViewer.annotManager.deleteAnnotations(annotationsToRemove, false, true);
|
||||
|
||||
this.fileData.manualRedactions = manualRedactions;
|
||||
this._annotationDrawService.drawAnnotations(
|
||||
this.instance,
|
||||
this.fileData.entriesToAdd
|
||||
@ -558,4 +519,8 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
$event.stopPropagation();
|
||||
this._fileActionService.undoApproveOrUnderApproval().subscribe(() => {});
|
||||
}
|
||||
|
||||
annotationsChangedByReviewAction() {
|
||||
this._cleanupAndRedrawManualAnnotations();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,13 +4,15 @@ import {
|
||||
ManualRedactions,
|
||||
Point,
|
||||
RedactionLogEntry,
|
||||
TypeValue
|
||||
TypeValue,
|
||||
User
|
||||
} from '@redaction/red-ui-http';
|
||||
import { UserWrapper } from '../../../user/user.service';
|
||||
|
||||
export const SuperTypeSorter = {
|
||||
redaction: 1,
|
||||
request: 2,
|
||||
'request-remove': 3,
|
||||
suggestion: 2,
|
||||
'suggestion-remove': 3,
|
||||
hint: 4,
|
||||
ignore: 5
|
||||
};
|
||||
@ -26,11 +28,13 @@ export class AnnotationWrapper {
|
||||
content: string;
|
||||
manual: boolean;
|
||||
userId: string;
|
||||
canUndo: boolean;
|
||||
pageNumber;
|
||||
|
||||
static fromRedactionLog(
|
||||
redactionLogEntry: RedactionLogEntry,
|
||||
manualRedactions: ManualRedactions
|
||||
manualRedactions: ManualRedactions,
|
||||
user: UserWrapper
|
||||
) {
|
||||
const comments: { [key: string]: Array<Comment> } = manualRedactions.comments;
|
||||
const annotationWrapper = new AnnotationWrapper();
|
||||
@ -41,7 +45,6 @@ export class AnnotationWrapper {
|
||||
? 'hint'
|
||||
: 'ignore';
|
||||
|
||||
AnnotationWrapper._handleRemoveSuperType(annotationWrapper, manualRedactions);
|
||||
annotationWrapper.dictionary = redactionLogEntry.type;
|
||||
annotationWrapper.firstTopLeftPoint = redactionLogEntry.positions[0]?.topLeft;
|
||||
annotationWrapper.pageNumber = redactionLogEntry.positions[0]?.page;
|
||||
@ -50,6 +53,8 @@ export class AnnotationWrapper {
|
||||
annotationWrapper.superType === 'redaction' || annotationWrapper.superType === 'ignore'
|
||||
? AnnotationWrapper.createAnnotationContentForRedactionLogEntry(redactionLogEntry)
|
||||
: null;
|
||||
|
||||
AnnotationWrapper._handleRemoveSuperType(annotationWrapper, manualRedactions, user);
|
||||
annotationWrapper.comments = comments[redactionLogEntry.id]
|
||||
? comments[redactionLogEntry.id]
|
||||
: [];
|
||||
@ -59,7 +64,8 @@ export class AnnotationWrapper {
|
||||
static fromManualRedaction(
|
||||
manualRedactionEntry: ManualRedactionEntry,
|
||||
manualRedactions: ManualRedactions,
|
||||
dictionaryData: { [p: string]: TypeValue }
|
||||
dictionaryData: { [p: string]: TypeValue },
|
||||
user: UserWrapper
|
||||
) {
|
||||
const comments: { [key: string]: Array<Comment> } = manualRedactions.comments;
|
||||
const annotationWrapper = new AnnotationWrapper();
|
||||
@ -69,7 +75,7 @@ export class AnnotationWrapper {
|
||||
dictionaryData
|
||||
);
|
||||
|
||||
AnnotationWrapper._handleRemoveSuperType(annotationWrapper, manualRedactions);
|
||||
AnnotationWrapper._handleRemoveSuperType(annotationWrapper, manualRedactions, user);
|
||||
annotationWrapper.dictionary = manualRedactionEntry.type;
|
||||
annotationWrapper.firstTopLeftPoint = manualRedactionEntry.positions[0]?.topLeft;
|
||||
annotationWrapper.pageNumber = manualRedactionEntry.positions[0]?.page;
|
||||
@ -81,12 +87,16 @@ export class AnnotationWrapper {
|
||||
? comments[manualRedactionEntry.id]
|
||||
: [];
|
||||
annotationWrapper.userId = manualRedactionEntry.user;
|
||||
annotationWrapper.canUndo =
|
||||
!manualRedactionEntry.processedDate && manualRedactionEntry.user === user.id;
|
||||
|
||||
return annotationWrapper;
|
||||
}
|
||||
|
||||
private static _handleRemoveSuperType(
|
||||
annotationWrapper: AnnotationWrapper,
|
||||
manualRedactions: ManualRedactions
|
||||
manualRedactions: ManualRedactions,
|
||||
user: UserWrapper
|
||||
) {
|
||||
const toRemove = manualRedactions.idsToRemove.find(
|
||||
(trm) => trm.id === annotationWrapper.id
|
||||
@ -100,6 +110,11 @@ export class AnnotationWrapper {
|
||||
? 'ignore'
|
||||
: annotationWrapper.superType
|
||||
: annotationWrapper.superType;
|
||||
|
||||
if (toRemove) {
|
||||
annotationWrapper.canUndo = !toRemove.processedDate && toRemove.user === user.id;
|
||||
console.log(annotationWrapper.canUndo, toRemove.user, user.id);
|
||||
}
|
||||
}
|
||||
|
||||
static getManualRedactionSuperType(
|
||||
|
||||
@ -17,12 +17,15 @@ export class FileDataModel {
|
||||
) {}
|
||||
|
||||
get entriesToAdd(): ManualRedactionEntry[] {
|
||||
return this.manualRedactions.entriesToAdd.filter(
|
||||
(e) =>
|
||||
e.status !== 'DECLINED' &&
|
||||
!this.redactionLog.redactionLogEntry.find((r) => r.id === e.id) &&
|
||||
return this.manualRedactions.entriesToAdd.filter((e) => {
|
||||
const notDeclined = e.status !== 'DECLINED';
|
||||
const notAlreadyDrawn = !this.redactionLog.redactionLogEntry.find((r) => r.id === e.id);
|
||||
const alreadyProcessed =
|
||||
!!e.processedDate &&
|
||||
new Date(e.processedDate).getTime() <
|
||||
new Date(this.fileStatus.lastProcessed).getTime()
|
||||
);
|
||||
new Date(this.fileStatus.lastProcessed).getTime();
|
||||
|
||||
return notDeclined && notAlreadyDrawn && !alreadyProcessed;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,9 @@ export class AnnotationProcessingService {
|
||||
for (const filter of flatFilters) {
|
||||
if (
|
||||
filter.checked &&
|
||||
(filter.key === annotation.dictionary ||
|
||||
((filter.key === annotation.dictionary &&
|
||||
(annotation.superType === 'hint' ||
|
||||
annotation.superType === 'redaction')) ||
|
||||
filter.key === annotation.superType)
|
||||
) {
|
||||
found = true;
|
||||
|
||||
@ -58,10 +58,11 @@ export class ManualAnnotationService {
|
||||
|
||||
// this wraps
|
||||
// /manualRedaction/approve
|
||||
public approveRequest(annotationId: string) {
|
||||
public approveRequest(annotationId: string, addToDictionary: boolean = false) {
|
||||
// for only here - approve the request
|
||||
return this._manualRedactionControllerService
|
||||
.approveRequest(
|
||||
{ addOrRemoveFromDictionary: addToDictionary },
|
||||
this._appStateService.activeProjectId,
|
||||
this._appStateService.activeFile.fileId,
|
||||
annotationId
|
||||
@ -78,6 +79,26 @@ export class ManualAnnotationService {
|
||||
);
|
||||
}
|
||||
|
||||
undoRequest(annotationWrapper: AnnotationWrapper) {
|
||||
return this._manualRedactionControllerService
|
||||
.undo(
|
||||
this._appStateService.activeProjectId,
|
||||
this._appStateService.activeFileId,
|
||||
annotationWrapper.id
|
||||
)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.undo-request.success'),
|
||||
() => {
|
||||
this._notify(
|
||||
'manual-annotation.undo-request.error',
|
||||
NotificationType.ERROR
|
||||
);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// this wraps
|
||||
// /manualRedaction/decline/remove
|
||||
// /manualRedaction/undo
|
||||
@ -124,7 +145,10 @@ export class ManualAnnotationService {
|
||||
// this wraps
|
||||
// /manualRedaction/redaction/remove/
|
||||
// /manualRedaction/request/remove/
|
||||
removeAnnotation(annotationWrapper: AnnotationWrapper, removeFromDictionary: boolean = false) {
|
||||
removeOrSuggestRemoveAnnotation(
|
||||
annotationWrapper: AnnotationWrapper,
|
||||
removeFromDictionary: boolean = false
|
||||
) {
|
||||
if (this._appStateService.isActiveProjectOwnerAndManager) {
|
||||
return this._manualRedactionControllerService
|
||||
.removeRedaction(
|
||||
|
||||
@ -14,7 +14,7 @@ import { NotificationService, NotificationType } from '../notification/notificat
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { UserService, UserWrapper } from '../user/user.service';
|
||||
import { forkJoin, interval, of } from 'rxjs';
|
||||
import { forkJoin, interval, of, timer } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { download } from '../utils/file-download-utils';
|
||||
import { humanize } from '../utils/functions';
|
||||
@ -128,7 +128,7 @@ export class AppStateService {
|
||||
activeFile: null
|
||||
};
|
||||
|
||||
interval(5000)
|
||||
timer(5000, 5000)
|
||||
.pipe(
|
||||
tap(() => {
|
||||
this.reloadActiveProjectFiles();
|
||||
@ -136,7 +136,7 @@ export class AppStateService {
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
interval(5000)
|
||||
timer(5000, 5000)
|
||||
.pipe(
|
||||
tap(() => {
|
||||
this.updateDictionaryVersion();
|
||||
@ -144,7 +144,7 @@ export class AppStateService {
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
interval(30000)
|
||||
timer(5000, 30000)
|
||||
.pipe(
|
||||
tap(() => {
|
||||
this.loadAllProjects();
|
||||
@ -597,7 +597,7 @@ export class AppStateService {
|
||||
(fileStatus.status === 'UNASSIGNED' ||
|
||||
fileStatus.status === 'UNDER_REVIEW' ||
|
||||
fileStatus.status === 'UNDER_APPROVAL') &&
|
||||
fileStatus.dictionaryVersion !== this.dictionaryVersion
|
||||
(fileStatus.dictionaryVersion !== this.dictionaryVersion || fileStatus.hasRequests)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -257,6 +257,7 @@
|
||||
"label": "Workload",
|
||||
"accept-suggestion": {
|
||||
"add-to-dict": "Approve and add to dictionary",
|
||||
"remove-from-dict": "Approve and remove from dictionary",
|
||||
"only-here": "Approve only here"
|
||||
}
|
||||
}
|
||||
@ -316,8 +317,8 @@
|
||||
"super-type": {
|
||||
"redaction": "Redaction",
|
||||
"hint": "Hint",
|
||||
"request": "Redaction Request",
|
||||
"request-remove": "Remove Redaction Request",
|
||||
"suggestion": "Suggestion",
|
||||
"suggestion-remove": "Suggestion to Remove",
|
||||
"ignore": "Ignored redaction"
|
||||
}
|
||||
},
|
||||
|
||||
@ -17,6 +17,7 @@ import { Observable } from 'rxjs';
|
||||
|
||||
import { AddCommentRequest } from '../model/addCommentRequest';
|
||||
import { AddRedactionRequest } from '../model/addRedactionRequest';
|
||||
import { ApproveRequest } from '../model/approveRequest';
|
||||
import { CommentResponse } from '../model/commentResponse';
|
||||
import { ManualAddResponse } from '../model/manualAddResponse';
|
||||
import { ManualRedactions } from '../model/manualRedactions';
|
||||
@ -27,9 +28,9 @@ import { Configuration } from '../configuration';
|
||||
|
||||
@Injectable()
|
||||
export class ManualRedactionControllerService {
|
||||
protected basePath = '';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
protected basePath = '';
|
||||
|
||||
constructor(
|
||||
protected httpClient: HttpClient,
|
||||
@ -45,6 +46,20 @@ export class ManualRedactionControllerService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param consumes string[] mime-types
|
||||
* @return true: consumes contains 'multipart/form-data', false: otherwise
|
||||
*/
|
||||
private canConsumeForm(consumes: string[]): boolean {
|
||||
const form = 'multipart/form-data';
|
||||
for (const consume of consumes) {
|
||||
if (form === consume) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a comment to a redaction/redaction request
|
||||
* None
|
||||
@ -63,7 +78,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<CommentResponse>;
|
||||
|
||||
public addComment(
|
||||
body: AddCommentRequest,
|
||||
projectId: string,
|
||||
@ -72,7 +86,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<CommentResponse>>;
|
||||
|
||||
public addComment(
|
||||
body: AddCommentRequest,
|
||||
projectId: string,
|
||||
@ -81,7 +94,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<CommentResponse>>;
|
||||
|
||||
public addComment(
|
||||
body: AddCommentRequest,
|
||||
projectId: string,
|
||||
@ -174,7 +186,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<ManualAddResponse>;
|
||||
|
||||
public addRedaction(
|
||||
body: AddRedactionRequest,
|
||||
projectId: string,
|
||||
@ -182,7 +193,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<ManualAddResponse>>;
|
||||
|
||||
public addRedaction(
|
||||
body: AddRedactionRequest,
|
||||
projectId: string,
|
||||
@ -190,7 +200,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<ManualAddResponse>>;
|
||||
|
||||
public addRedaction(
|
||||
body: AddRedactionRequest,
|
||||
projectId: string,
|
||||
@ -263,6 +272,7 @@ export class ManualRedactionControllerService {
|
||||
/**
|
||||
* Approves a redaction request/ remove redaction request
|
||||
* None
|
||||
* @param body approveRequest
|
||||
* @param projectId projectId
|
||||
* @param fileId fileId
|
||||
* @param annotationId annotationId
|
||||
@ -270,36 +280,43 @@ export class ManualRedactionControllerService {
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public approveRequest(
|
||||
body: ApproveRequest,
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
annotationId: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<any>;
|
||||
|
||||
public approveRequest(
|
||||
body: ApproveRequest,
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
annotationId: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<any>>;
|
||||
|
||||
public approveRequest(
|
||||
body: ApproveRequest,
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
annotationId: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<any>>;
|
||||
|
||||
public approveRequest(
|
||||
body: ApproveRequest,
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
annotationId: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false
|
||||
): Observable<any> {
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter body was null or undefined when calling approveRequest.'
|
||||
);
|
||||
}
|
||||
|
||||
if (projectId === null || projectId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter projectId was null or undefined when calling approveRequest.'
|
||||
@ -339,7 +356,13 @@ export class ManualRedactionControllerService {
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [];
|
||||
const consumes: string[] = ['application/json'];
|
||||
const httpContentTypeSelected:
|
||||
| string
|
||||
| undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
headers = headers.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
return this.httpClient.request<any>(
|
||||
'post',
|
||||
@ -347,6 +370,7 @@ export class ManualRedactionControllerService {
|
||||
String(projectId)
|
||||
)}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`,
|
||||
{
|
||||
body: body,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
@ -371,7 +395,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<any>;
|
||||
|
||||
public declineRequest(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -379,7 +402,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<any>>;
|
||||
|
||||
public declineRequest(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -387,7 +409,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<any>>;
|
||||
|
||||
public declineRequest(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -464,21 +485,18 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<ManualRedactions>;
|
||||
|
||||
public getManualRedaction(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<ManualRedactions>>;
|
||||
|
||||
public getManualRedaction(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<ManualRedactions>>;
|
||||
|
||||
public getManualRedaction(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -533,7 +551,6 @@ export class ManualRedactionControllerService {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a redaction
|
||||
* None
|
||||
@ -550,7 +567,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<ManualAddResponse>;
|
||||
|
||||
public removeRedaction(
|
||||
body: RemoveRedactionRequest,
|
||||
projectId: string,
|
||||
@ -558,7 +574,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<ManualAddResponse>>;
|
||||
|
||||
public removeRedaction(
|
||||
body: RemoveRedactionRequest,
|
||||
projectId: string,
|
||||
@ -566,7 +581,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<ManualAddResponse>>;
|
||||
|
||||
public removeRedaction(
|
||||
body: RemoveRedactionRequest,
|
||||
projectId: string,
|
||||
@ -652,7 +666,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<ManualAddResponse>;
|
||||
|
||||
public requestAddRedaction(
|
||||
body: AddRedactionRequest,
|
||||
projectId: string,
|
||||
@ -660,7 +673,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<ManualAddResponse>>;
|
||||
|
||||
public requestAddRedaction(
|
||||
body: AddRedactionRequest,
|
||||
projectId: string,
|
||||
@ -668,7 +680,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<ManualAddResponse>>;
|
||||
|
||||
public requestAddRedaction(
|
||||
body: AddRedactionRequest,
|
||||
projectId: string,
|
||||
@ -754,7 +765,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<ManualAddResponse>;
|
||||
|
||||
public requestRemoveRedaction(
|
||||
body: RemoveRedactionRequest,
|
||||
projectId: string,
|
||||
@ -762,7 +772,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<ManualAddResponse>>;
|
||||
|
||||
public requestRemoveRedaction(
|
||||
body: RemoveRedactionRequest,
|
||||
projectId: string,
|
||||
@ -770,7 +779,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<ManualAddResponse>>;
|
||||
|
||||
public requestRemoveRedaction(
|
||||
body: RemoveRedactionRequest,
|
||||
projectId: string,
|
||||
@ -856,7 +864,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<any>;
|
||||
|
||||
public undo(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -864,7 +871,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<any>>;
|
||||
|
||||
public undo(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -872,7 +878,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<any>>;
|
||||
|
||||
public undo(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -951,7 +956,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<any>;
|
||||
|
||||
public undoComment(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -960,7 +964,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<any>>;
|
||||
|
||||
public undoComment(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -969,7 +972,6 @@ export class ManualRedactionControllerService {
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<any>>;
|
||||
|
||||
public undoComment(
|
||||
projectId: string,
|
||||
fileId: string,
|
||||
@ -1040,18 +1042,4 @@ export class ManualRedactionControllerService {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param consumes string[] mime-types
|
||||
* @return true: consumes contains 'multipart/form-data', false: otherwise
|
||||
*/
|
||||
private canConsumeForm(consumes: string[]): boolean {
|
||||
const form = 'multipart/form-data';
|
||||
for (const consume of consumes) {
|
||||
if (form === consume) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
15
libs/red-ui-http/src/lib/model/approveRequest.ts
Normal file
15
libs/red-ui-http/src/lib/model/approveRequest.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* API Documentation for Redaction Gateway
|
||||
* Description for redaction
|
||||
*
|
||||
* OpenAPI spec version: 1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface ApproveRequest {
|
||||
addOrRemoveFromDictionary?: boolean;
|
||||
}
|
||||
@ -34,3 +34,4 @@ export * from './userResponse';
|
||||
export * from './versionsResponse';
|
||||
export * from './viewedPages';
|
||||
export * from './viewedPagesRequest';
|
||||
export * from './approveRequest';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user