temporary dictionary add workaround

This commit is contained in:
Timo Bejan 2020-11-03 22:30:08 +02:00
parent 24bb32edfa
commit 31eacd1f31
3 changed files with 16 additions and 31 deletions

View File

@ -1,7 +1,7 @@
import { FilterModel } from '../model/filter.model';
export function handleCheckedValue(filter: FilterModel) {
if (filter.filters) {
if (filter.filters && filter.filters.length) {
filter.checked = filter.filters.reduce((acc, next) => acc && next.checked, true);
if (filter.checked) {
filter.indeterminate = false;

View File

@ -110,7 +110,7 @@ export class DialogService {
ref.afterClosed().subscribe((result) => {
if (result) {
this._manualAnnotationService
.acceptSuggestion(annotation)
.acceptSuggestion(annotation.id)
.subscribe((acceptResult) => {
if (callback) {
callback(acceptResult);

View File

@ -44,28 +44,33 @@ export class ManualAnnotationService {
}
public makeDictionaryEntry(manualRedactionEntry: ManualRedactionEntry) {
// if (this._appStateService.isActiveProjectOwner) {
// return this._makeDictionaryEntry(manualRedactionEntry);
// } else {
return this._makeDictionaryRequest(manualRedactionEntry);
// }
manualRedactionEntry.addToDictionary = true;
return this.makeRedaction(manualRedactionEntry);
}
public makeRedaction(manualRedactionEntry: ManualRedactionEntry) {
if (this._appStateService.isActiveProjectOwner) {
return this._makeRedaction(manualRedactionEntry);
if (this._appStateService.isActiveProjectOwnerAndManager) {
if (!manualRedactionEntry.addToDictionary) {
return this._makeRedaction(manualRedactionEntry);
} else {
return this._makeRedactionRequest(manualRedactionEntry).pipe(
mergeMap((response) => {
return this.acceptSuggestion(response.annotationId);
})
);
}
} else {
return this._makeRedactionRequest(manualRedactionEntry);
}
}
public acceptSuggestion(annotationWrapper: AnnotationWrapper) {
public acceptSuggestion(annotationId: string) {
// for only here - approve the request
return this._manualRedactionControllerService
.approveRequest(
this._appStateService.activeProjectId,
this._appStateService.activeFile.fileId,
annotationWrapper.id
annotationId
)
.pipe(
tap(
@ -108,26 +113,6 @@ export class ManualAnnotationService {
public removeRedaction(annotationWrapper: AnnotationWrapper) {}
private _makeDictionaryRequest(manualRedactionEntry: ManualRedactionEntry) {
return this._makeRedactionRequest(manualRedactionEntry);
}
private _makeDictionaryEntry(manualRedactionEntry: ManualRedactionEntry) {
return this._dictionaryControllerService
.addEntry([manualRedactionEntry.value], manualRedactionEntry.type)
.pipe(
tap(
() => this._notify('manual-annotation.dictionary-add.success'),
() => {
this._notify(
'manual-annotation.dictionary-add.error',
NotificationType.ERROR
);
}
)
);
}
private _makeRedactionRequest(manualRedactionEntry: ManualRedactionEntry) {
return this._manualRedactionControllerService
.requestAddRedaction(