@konfuzio/document-validation-ui 0.1.17-dev.1 → 0.1.17-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/package.json +1 -1
- package/src/api.js +4 -1
- package/src/assets/images/TranslateArrows.vue +24 -0
- package/src/assets/scss/document_annotations.scss +37 -0
- package/src/components/App.vue +0 -15
- package/src/components/DocumentAnnotations/AnnotationContent.vue +2 -7
- package/src/components/DocumentAnnotations/AnnotationDetails.vue +5 -28
- package/src/components/DocumentAnnotations/AnnotationRow.vue +71 -18
- package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +3 -3
- package/src/components/DocumentAnnotations/DocumentAnnotations.cy.js +42 -2
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +7 -24
- package/src/components/DocumentEdit/DocumentEdit.cy.js +20 -18
- package/src/components/DocumentPage/DocumentPage.vue +2 -1
- package/src/locales/de.json +4 -1
- package/src/locales/en.json +4 -1
- package/src/locales/es.json +4 -1
- package/src/store/document.js +37 -22
- package/src/store/project.js +19 -1
- package/src/assets/images/UserIcon.vue +0 -8
|
@@ -137,7 +137,7 @@ describe("Document Edit", () => {
|
|
|
137
137
|
const pages = $document.selectedDocument.pages;
|
|
138
138
|
const pagesLength = pages.length;
|
|
139
139
|
|
|
140
|
-
if (!$document.selectedDocument.proposed_split) {
|
|
140
|
+
if (!$document.selectedDocument.proposed_split && $document.pages.length > 1) {
|
|
141
141
|
cy.get("#document-edit")
|
|
142
142
|
.find(".pages-section")
|
|
143
143
|
.find(".image-section")
|
|
@@ -154,27 +154,29 @@ describe("Document Edit", () => {
|
|
|
154
154
|
|
|
155
155
|
it("Clicking splitting lines creates new documents", () => {
|
|
156
156
|
cy.getStore("document").then(($document) => {
|
|
157
|
-
if ($document.
|
|
157
|
+
if ($document.pages.length > 1) {
|
|
158
|
+
if ($document.selectedDocument.proposed_split) {
|
|
159
|
+
cy.get("#document-edit")
|
|
160
|
+
.find(".sidebar")
|
|
161
|
+
.find(".smart-split")
|
|
162
|
+
.find(".split-switch")
|
|
163
|
+
.click();
|
|
164
|
+
|
|
165
|
+
cy.wait(1000);
|
|
166
|
+
}
|
|
167
|
+
|
|
158
168
|
cy.get("#document-edit")
|
|
159
|
-
.find(".
|
|
160
|
-
.find(".
|
|
161
|
-
.find(".
|
|
169
|
+
.find(".pages-section")
|
|
170
|
+
.find(".image-section")
|
|
171
|
+
.find(".splitting-lines")
|
|
172
|
+
.find(".lines")
|
|
173
|
+
.first()
|
|
162
174
|
.click();
|
|
163
175
|
|
|
164
|
-
cy.
|
|
176
|
+
cy.getStore("edit").then(($edit) => {
|
|
177
|
+
expect($edit.updatedDocument).to.have.lengthOf(2);
|
|
178
|
+
});
|
|
165
179
|
}
|
|
166
|
-
|
|
167
|
-
cy.get("#document-edit")
|
|
168
|
-
.find(".pages-section")
|
|
169
|
-
.find(".image-section")
|
|
170
|
-
.find(".splitting-lines")
|
|
171
|
-
.find(".lines")
|
|
172
|
-
.first()
|
|
173
|
-
.click();
|
|
174
|
-
|
|
175
|
-
cy.getStore("edit").then(($edit) => {
|
|
176
|
-
expect($edit.updatedDocument).to.have.lengthOf(2);
|
|
177
|
-
});
|
|
178
180
|
});
|
|
179
181
|
});
|
|
180
182
|
|
|
@@ -154,6 +154,7 @@ export default {
|
|
|
154
154
|
|
|
155
155
|
computed: {
|
|
156
156
|
...mapState("display", ["currentPage", "showAnnSetTable"]),
|
|
157
|
+
...mapGetters("document", ["isNegative"]),
|
|
157
158
|
|
|
158
159
|
isBoxSelection() {
|
|
159
160
|
return this.selection && !this.isSelecting && this.isElementSelected;
|
|
@@ -231,7 +232,7 @@ export default {
|
|
|
231
232
|
if (
|
|
232
233
|
annotation.span.find(
|
|
233
234
|
(span) => span.page_index + 1 === this.page.number
|
|
234
|
-
)
|
|
235
|
+
) && !this.isNegative(annotation)
|
|
235
236
|
) {
|
|
236
237
|
annotations.push(annotation);
|
|
237
238
|
}
|
package/src/locales/de.json
CHANGED
|
@@ -140,5 +140,8 @@
|
|
|
140
140
|
"link_to_add_labels": "Sehen Sie <a href='https://help.konfuzio.com/modules/labels/index.html#add-a-label' target='_blank'>hier</a>, wie Sie sie hinzufügen.",
|
|
141
141
|
"no_annotations_in_annotation_set": "Dieser Annotationssatz enthält keine extrahierten Annotationen für die jeweiligen Beschriftungen.",
|
|
142
142
|
"wait_title": "Bitte warten...",
|
|
143
|
-
"redirecting_to_documents_list": "Wir führen Sie zur Dokumentenliste, sodass Sie Ihre Dokumente weiter überprüfen können, während wir die vorgenommenen Änderungen verarbeiten."
|
|
143
|
+
"redirecting_to_documents_list": "Wir führen Sie zur Dokumentenliste, sodass Sie Ihre Dokumente weiter überprüfen können, während wir die vorgenommenen Änderungen verarbeiten.",
|
|
144
|
+
"translated_string_title": "Übersetzter Text",
|
|
145
|
+
"no_translated_string": "Es existiert noch keine Übersetzung.",
|
|
146
|
+
"add_translation": "Eins hinzufügen"
|
|
144
147
|
}
|
package/src/locales/en.json
CHANGED
|
@@ -140,5 +140,8 @@
|
|
|
140
140
|
"link_to_add_labels": "See how to add them <a href='https://help.konfuzio.com/modules/labels/index.html#add-a-label' target='_blank'>here</a>.",
|
|
141
141
|
"no_annotations_in_annotation_set": "This annotation set has no annotations extracted for its respective labels.",
|
|
142
142
|
"wait_title": "Please wait...",
|
|
143
|
-
"redirecting_to_documents_list": "We are taking you to the documents list, so you can continue reviewing your documents while we process the changes made."
|
|
143
|
+
"redirecting_to_documents_list": "We are taking you to the documents list, so you can continue reviewing your documents while we process the changes made.",
|
|
144
|
+
"translated_string_title": "Translated text",
|
|
145
|
+
"no_translated_string": "No translation exists yet.",
|
|
146
|
+
"add_translation": "Add one"
|
|
144
147
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -140,5 +140,8 @@
|
|
|
140
140
|
"link_to_add_labels": "Para ver cómo agregarlas haga clic <a href='https://help.konfuzio.com/modules/labels/index.html#add-a-label' target='_blank'>aquí</a>.",
|
|
141
141
|
"no_annotations_in_annotation_set": "Este grupo de anotaciones no tiene anotaciones encontradas para sus respectivas etiquetas.",
|
|
142
142
|
"wait_title": "Por favor espere...",
|
|
143
|
-
"redirecting_to_documents_list": "Lo estamos redirigiendo a la lista de documentos, para que pueda continuar la revisión de sus documentos mientras procesamos los cambios realizados."
|
|
143
|
+
"redirecting_to_documents_list": "Lo estamos redirigiendo a la lista de documentos, para que pueda continuar la revisión de sus documentos mientras procesamos los cambios realizados.",
|
|
144
|
+
"translated_string_title": "Texto traducido",
|
|
145
|
+
"no_translated_string": "Aún no existe traducción.",
|
|
146
|
+
"add_translation": "Agregar"
|
|
144
147
|
}
|
package/src/store/document.js
CHANGED
|
@@ -248,6 +248,7 @@ const getters = {
|
|
|
248
248
|
const labels = [];
|
|
249
249
|
const processedAnnotationSets = annotationSets.map((annotationSet) => {
|
|
250
250
|
const annotationSetLabels = annotationSet.labels.map((label) => {
|
|
251
|
+
|
|
251
252
|
// add annotations to the document array
|
|
252
253
|
annotations.push(...label.annotations);
|
|
253
254
|
labels.push(label);
|
|
@@ -367,27 +368,28 @@ const getters = {
|
|
|
367
368
|
/**
|
|
368
369
|
* Get number of empty labels per annotation set
|
|
369
370
|
*/
|
|
370
|
-
|
|
371
|
-
const labels = annotationSet.labels.filter(
|
|
372
|
-
(label) => label.annotations.length === 0
|
|
373
|
-
);
|
|
374
|
-
|
|
371
|
+
emptyLabels: (state, getters) => (annotationSet) => {
|
|
375
372
|
const pendingEmpty = [];
|
|
376
373
|
|
|
377
|
-
labels.map((label) => {
|
|
378
|
-
const
|
|
374
|
+
annotationSet.labels.map((label) => {
|
|
375
|
+
const foundMissing = state.missingAnnotations.find(
|
|
379
376
|
(l) =>
|
|
380
377
|
l.label === label.id &&
|
|
381
378
|
annotationSet.id === l.annotation_set &&
|
|
382
379
|
annotationSet.label_set.id === l.label_set
|
|
383
380
|
);
|
|
384
381
|
|
|
385
|
-
|
|
382
|
+
const foundNegative = label.annotations.find(annotation =>
|
|
383
|
+
getters.isNegative(annotation)
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
if (!foundMissing && (label.annotations.length === 0 || foundNegative)) {
|
|
386
387
|
pendingEmpty.push(label);
|
|
387
388
|
}
|
|
389
|
+
|
|
388
390
|
});
|
|
389
391
|
|
|
390
|
-
return pendingEmpty
|
|
392
|
+
return pendingEmpty;
|
|
391
393
|
},
|
|
392
394
|
|
|
393
395
|
annotationIsNotFound: (state) => (annotationSet, label) => {
|
|
@@ -408,8 +410,8 @@ const getters = {
|
|
|
408
410
|
|
|
409
411
|
// Check if document is ready to be finished
|
|
410
412
|
isDocumentReadyToFinishReview: (state) => {
|
|
411
|
-
// check if all annotations
|
|
412
|
-
let
|
|
413
|
+
// check if all annotations are correct
|
|
414
|
+
let notCorrect;
|
|
413
415
|
|
|
414
416
|
const emptyAnnotations = [];
|
|
415
417
|
|
|
@@ -430,7 +432,7 @@ const getters = {
|
|
|
430
432
|
}
|
|
431
433
|
|
|
432
434
|
if (state.annotations) {
|
|
433
|
-
|
|
435
|
+
notCorrect = state.annotations.filter((a) => !a.is_correct);
|
|
434
436
|
}
|
|
435
437
|
|
|
436
438
|
// if all annotations have been revised
|
|
@@ -440,8 +442,8 @@ const getters = {
|
|
|
440
442
|
if (
|
|
441
443
|
!emptyAnnotations ||
|
|
442
444
|
!state.missingAnnotations ||
|
|
443
|
-
!
|
|
444
|
-
(
|
|
445
|
+
!notCorrect ||
|
|
446
|
+
(notCorrect.length === 0 &&
|
|
445
447
|
state.missingAnnotations.length === emptyAnnotations.length)
|
|
446
448
|
) {
|
|
447
449
|
return true;
|
|
@@ -456,7 +458,7 @@ const getters = {
|
|
|
456
458
|
/**
|
|
457
459
|
* Get number of annotations pending review per annotation set
|
|
458
460
|
*/
|
|
459
|
-
|
|
461
|
+
notCorrectAnnotations: () => (annotationSet) => {
|
|
460
462
|
const labels = annotationSet.labels.filter(
|
|
461
463
|
(label) => label.annotations.length > 0
|
|
462
464
|
);
|
|
@@ -465,7 +467,7 @@ const getters = {
|
|
|
465
467
|
|
|
466
468
|
labels.map((label) => {
|
|
467
469
|
const foundPendingAnnotations = label.annotations.filter(
|
|
468
|
-
(ann) => !ann.revised
|
|
470
|
+
(ann) => !ann.is_correct && !ann.revised
|
|
469
471
|
);
|
|
470
472
|
|
|
471
473
|
if (foundPendingAnnotations && foundPendingAnnotations.length > 0) {
|
|
@@ -480,7 +482,7 @@ const getters = {
|
|
|
480
482
|
}
|
|
481
483
|
});
|
|
482
484
|
|
|
483
|
-
return annotationsWithPendingReview
|
|
485
|
+
return annotationsWithPendingReview;
|
|
484
486
|
},
|
|
485
487
|
|
|
486
488
|
/**
|
|
@@ -577,6 +579,13 @@ const getters = {
|
|
|
577
579
|
return null;
|
|
578
580
|
}
|
|
579
581
|
},
|
|
582
|
+
isNegative: () => (annotation) => {
|
|
583
|
+
if(annotation) {
|
|
584
|
+
return !annotation.is_correct && annotation.revised
|
|
585
|
+
} else {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
},
|
|
580
589
|
|
|
581
590
|
/**
|
|
582
591
|
* Check for user who created or revised the annotation
|
|
@@ -722,11 +731,13 @@ const actions = {
|
|
|
722
731
|
commit("SET_LABELS", labels);
|
|
723
732
|
commit("SET_SELECTED_DOCUMENT", response.data);
|
|
724
733
|
|
|
725
|
-
if
|
|
726
|
-
projectId = rootState.project.projectId;
|
|
727
|
-
} else {
|
|
734
|
+
if(response.data.project) {
|
|
728
735
|
projectId = response.data.project;
|
|
729
|
-
|
|
736
|
+
|
|
737
|
+
dispatch("project/setProjectId", projectId, {
|
|
738
|
+
root: true,
|
|
739
|
+
});
|
|
740
|
+
dispatch("project/fetchProjectDetails", projectId, {
|
|
730
741
|
root: true,
|
|
731
742
|
});
|
|
732
743
|
}
|
|
@@ -829,7 +840,7 @@ const actions = {
|
|
|
829
840
|
commit("SET_DOCUMENT_ANNOTATION_SELECTED", null);
|
|
830
841
|
},
|
|
831
842
|
|
|
832
|
-
createAnnotation: ({ commit, getters, dispatch }, annotation) => {
|
|
843
|
+
createAnnotation: ({ commit, getters, dispatch }, {annotation, negativeAnnotationId}) => {
|
|
833
844
|
return new Promise((resolve, reject) => {
|
|
834
845
|
HTTP.post(`/annotations/`, annotation)
|
|
835
846
|
.then(async (response) => {
|
|
@@ -847,6 +858,9 @@ const actions = {
|
|
|
847
858
|
}
|
|
848
859
|
} else {
|
|
849
860
|
commit("ADD_ANNOTATION", response.data);
|
|
861
|
+
if(negativeAnnotationId) {
|
|
862
|
+
commit("DELETE_ANNOTATION", negativeAnnotationId);
|
|
863
|
+
}
|
|
850
864
|
}
|
|
851
865
|
|
|
852
866
|
resolve(response);
|
|
@@ -1142,6 +1156,7 @@ const mutations = {
|
|
|
1142
1156
|
const exists = label.annotations.find(
|
|
1143
1157
|
(existingAnnotation) => existingAnnotation.id === annotation.id
|
|
1144
1158
|
);
|
|
1159
|
+
|
|
1145
1160
|
if (!exists) {
|
|
1146
1161
|
label.annotations.push(annotation);
|
|
1147
1162
|
return;
|
package/src/store/project.js
CHANGED
|
@@ -2,10 +2,11 @@ import myImports from "../api";
|
|
|
2
2
|
const HTTP = myImports.HTTP;
|
|
3
3
|
|
|
4
4
|
const state = {
|
|
5
|
-
projectId:
|
|
5
|
+
projectId: null,
|
|
6
6
|
currentUser: null,
|
|
7
7
|
documentsListPath: null,
|
|
8
8
|
documentsInProject: null,
|
|
9
|
+
translationsEnabled: false,
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
const getters = {
|
|
@@ -99,6 +100,20 @@ const actions = {
|
|
|
99
100
|
console.log(error, "Could not fetch document list from the backend");
|
|
100
101
|
});
|
|
101
102
|
},
|
|
103
|
+
|
|
104
|
+
fetchProjectDetails: ({commit}, projectId) => {
|
|
105
|
+
return HTTP.get(
|
|
106
|
+
`projects/${projectId}/`
|
|
107
|
+
)
|
|
108
|
+
.then((response) => {
|
|
109
|
+
if (response.data.enable_translated_strings) {
|
|
110
|
+
commit("SET_TRANSLATIONS_ENABLED", true);
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
.catch((error) => {
|
|
114
|
+
console.log(error, "Could not fetch project details from the backend");
|
|
115
|
+
});
|
|
116
|
+
}
|
|
102
117
|
};
|
|
103
118
|
|
|
104
119
|
const mutations = {
|
|
@@ -114,6 +129,9 @@ const mutations = {
|
|
|
114
129
|
SET_DOCUMENTS_IN_PROJECT: (state, documents) => {
|
|
115
130
|
state.documentsInProject = documents;
|
|
116
131
|
},
|
|
132
|
+
SET_TRANSLATIONS_ENABLED: (state, value) => {
|
|
133
|
+
state.translationsEnabled = value;
|
|
134
|
+
}
|
|
117
135
|
};
|
|
118
136
|
|
|
119
137
|
export default {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
3
|
-
<path
|
|
4
|
-
fill="#E1E1E1"
|
|
5
|
-
d="M15.71,12.71a6,6,0,1,0-7.42,0,10,10,0,0,0-6.22,8.18,1,1,0,0,0,2,.22,8,8,0,0,1,15.9,0,1,1,0,0,0,1,.89h.11a1,1,0,0,0,.88-1.1A10,10,0,0,0,15.71,12.71ZM12,12a4,4,0,1,1,4-4A4,4,0,0,1,12,12Z"
|
|
6
|
-
/>
|
|
7
|
-
</svg>
|
|
8
|
-
</template>
|