temporary dictionary add workaround
This commit is contained in:
parent
24bb32edfa
commit
31eacd1f31
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user