messages for annotation actions
This commit is contained in:
parent
4b15682a2d
commit
2c0a6e999a
@ -67,12 +67,8 @@ export class ManualAnnotationService {
|
||||
)
|
||||
.pipe(
|
||||
tap(
|
||||
() => {
|
||||
this._notify('manual-annotation.approve-request.success');
|
||||
},
|
||||
() => {
|
||||
this._notify('manual-annotation.approve-request.error');
|
||||
}
|
||||
() => this._notify(this._getMessage('approve', addToDictionary)),
|
||||
(error) => this._notify(this._getMessage('approve', addToDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -82,10 +78,8 @@ export class ManualAnnotationService {
|
||||
.undo(this._appStateService.activeProjectId, this._appStateService.activeFileId, annotationWrapper.id)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.undo.success'),
|
||||
() => {
|
||||
this._notify('manual-annotation.undo.error', NotificationType.ERROR);
|
||||
}
|
||||
() => this._notify(this._getMessage('undo', annotationWrapper.isModifyDictionary)),
|
||||
(error) => this._notify(this._getMessage('undo', annotationWrapper.isModifyDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -99,10 +93,8 @@ export class ManualAnnotationService {
|
||||
.declineRequest(this._appStateService.activeProjectId, this._appStateService.activeFileId, annotationWrapper.id)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.undo.success'),
|
||||
() => {
|
||||
this._notify('manual-annotation.undo.error', NotificationType.ERROR);
|
||||
}
|
||||
() => this._notify(this._getMessage('decline', annotationWrapper.isModifyDictionary)),
|
||||
(error) => this._notify(this._getMessage('decline', annotationWrapper.isModifyDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
@ -110,10 +102,8 @@ export class ManualAnnotationService {
|
||||
.undo(this._appStateService.activeProjectId, this._appStateService.activeFileId, annotationWrapper.id)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.undo.success'),
|
||||
() => {
|
||||
this._notify('manual-annotation.undo.error', NotificationType.ERROR);
|
||||
}
|
||||
() => this._notify(this._getMessage('undo', annotationWrapper.isModifyDictionary)),
|
||||
(error) => this._notify(this._getMessage('undo', annotationWrapper.isModifyDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -130,10 +120,8 @@ export class ManualAnnotationService {
|
||||
.declineRequest(this._appStateService.activeProjectId, this._appStateService.activeFileId, annotationWrapper.id)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.undo.success'),
|
||||
() => {
|
||||
this._notify('manual-annotation.undo.error', NotificationType.ERROR);
|
||||
}
|
||||
() => this._notify(this._getMessage('decline', removeFromDictionary)),
|
||||
(error) => this._notify(this._getMessage('decline', removeFromDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
@ -142,17 +130,15 @@ export class ManualAnnotationService {
|
||||
{
|
||||
annotationId: annotationWrapper.id,
|
||||
removeFromDictionary: removeFromDictionary,
|
||||
comment: 'Auto'
|
||||
comment: '-'
|
||||
},
|
||||
this._appStateService.activeProjectId,
|
||||
this._appStateService.activeFileId
|
||||
)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.remove-redaction-request.success'),
|
||||
() => {
|
||||
this._notify('manual-annotation.remove-redaction-request.error', NotificationType.ERROR);
|
||||
}
|
||||
() => this._notify(this._getMessage('remove', removeFromDictionary)),
|
||||
(error) => this._notify(this._getMessage('remove', removeFromDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -162,17 +148,15 @@ export class ManualAnnotationService {
|
||||
{
|
||||
annotationId: annotationWrapper.id,
|
||||
removeFromDictionary: removeFromDictionary,
|
||||
comment: 'Auto'
|
||||
comment: '-'
|
||||
},
|
||||
this._appStateService.activeProjectId,
|
||||
this._appStateService.activeFileId
|
||||
)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.remove-redaction-request.success'),
|
||||
() => {
|
||||
this._notify('manual-annotation.remove-redaction-request.error', NotificationType.ERROR);
|
||||
}
|
||||
() => this._notify(this._getMessage('request-remove', removeFromDictionary)),
|
||||
(error) => this._notify(this._getMessage('request-remove', removeFromDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -183,10 +167,8 @@ export class ManualAnnotationService {
|
||||
.requestAddRedaction(manualRedactionEntry, this._appStateService.activeProject.project.projectId, this._appStateService.activeFile.fileId)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.redaction-request.success'),
|
||||
() => {
|
||||
this._notify('manual-annotation.redaction-request.error', NotificationType.ERROR);
|
||||
}
|
||||
() => this._notify(this._getMessage('suggest', manualRedactionEntry.addToDictionary)),
|
||||
(error) => this._notify(this._getMessage('suggest', manualRedactionEntry.addToDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -196,16 +178,14 @@ export class ManualAnnotationService {
|
||||
.addRedaction(manualRedactionEntry, this._appStateService.activeProject.project.projectId, this._appStateService.activeFile.fileId)
|
||||
.pipe(
|
||||
tap(
|
||||
() => this._notify('manual-annotation.redaction-add.success'),
|
||||
() => {
|
||||
this._notify('manual-annotation.redaction-add.error', NotificationType.ERROR);
|
||||
}
|
||||
() => this._notify(this._getMessage('add', manualRedactionEntry.addToDictionary)),
|
||||
(error) => this._notify(this._getMessage('add', manualRedactionEntry.addToDictionary, true), NotificationType.ERROR, error)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private _notify(key: string, type: NotificationType = NotificationType.SUCCESS) {
|
||||
this._notificationService.showToastNotification(this._translateService.instant(key), null, type);
|
||||
private _notify(key: string, type: NotificationType = NotificationType.SUCCESS, data?: any) {
|
||||
this._notificationService.showToastNotification(this._translateService.instant(key, data), null, type);
|
||||
}
|
||||
|
||||
getTitle(type: 'DICTIONARY' | 'REDACTION') {
|
||||
@ -223,4 +203,12 @@ export class ManualAnnotationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _getMessage(
|
||||
mode: 'add' | 'remove' | 'request-remove' | 'suggest' | 'approve' | 'decline' | 'undo',
|
||||
modifyDictionary?: boolean,
|
||||
error: boolean = false
|
||||
) {
|
||||
return 'annotation-actions.message.' + mode + '.' + (modifyDictionary ? 'dictionary.' : 'manual-redaction.') + mode + (error ? '.error' : '.success');
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,6 +240,68 @@
|
||||
"unassigned": "Unassigned"
|
||||
},
|
||||
"annotation-actions": {
|
||||
"message": {
|
||||
"manual-redaction": {
|
||||
"undo": {
|
||||
"success": "Undo successful",
|
||||
"error": "Failed to undo: {{error}}"
|
||||
},
|
||||
"suggest": {
|
||||
"success": "Manual redaction suggestion saved",
|
||||
"error": "Failed to save manual redaction suggestion: {{error}}"
|
||||
},
|
||||
"add": {
|
||||
"success": "Manual redaction added!",
|
||||
"error": "Failed to save manual redaction: {{error}}"
|
||||
},
|
||||
"decline": {
|
||||
"success": "Manual redaction suggestion declined!",
|
||||
"error": "Failed to decline manual redaction: {{error}}"
|
||||
},
|
||||
"approve": {
|
||||
"success": "Manual redaction suggestion approved!",
|
||||
"error": "Failed to approved manual redaction: {{error}}"
|
||||
},
|
||||
"request-remove": {
|
||||
"success": "Requested to remove redaction!",
|
||||
"error": "Failed to request removal of redaction: {{error}}"
|
||||
},
|
||||
"remove": {
|
||||
"success": "Redaction removed!",
|
||||
"error": "Failed to remove manual redaction: {{error}}"
|
||||
}
|
||||
},
|
||||
"dictionary": {
|
||||
"undo": {
|
||||
"success": "Undo successful",
|
||||
"error": "Failed to undo: {{error}}"
|
||||
},
|
||||
"suggest": {
|
||||
"success": "Suggestion for dictionary modification saved!",
|
||||
"error": "Failed to save suggestion for dictionary modification: {{error}}"
|
||||
},
|
||||
"add": {
|
||||
"success": "Entry added to dictionary. Changes will be visible after reanalysis.",
|
||||
"error": "Failed to add entry to dictionary: {{error}}"
|
||||
},
|
||||
"decline": {
|
||||
"success": "Dictionary suggestion declined.",
|
||||
"error": "Failed to decline dictionary suggestion: {{error}}"
|
||||
},
|
||||
"approve": {
|
||||
"success": "Dictionary entry approved. Changes will be visible after reanalysis.",
|
||||
"error": "Failed to approve dictionary entry: {{error}}"
|
||||
},
|
||||
"request-remove": {
|
||||
"success": "Requested to remove dictionary entry!",
|
||||
"error": "Failed to request removal of dictionary entry: {{error}}"
|
||||
},
|
||||
"remove": {
|
||||
"success": "Dictionary entry removed!",
|
||||
"error": "Failed to remove dictionary entry: {{error}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"accept-suggestion": {
|
||||
"label": "Accept Suggestion",
|
||||
"add-to-dict": "Approve and add to dictionary",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user