@konfuzio/document-validation-ui 0.1.24-dev.2 → 0.1.24-dev.4
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/assets/scss/document_annotations.scss +11 -0
- package/src/components/DocumentAnnotations/AnnotationFilters.vue +62 -0
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +5 -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 +66 -21
package/package.json
CHANGED
|
@@ -49,6 +49,17 @@
|
|
|
49
49
|
overflow: auto;
|
|
50
50
|
max-height: 100%;
|
|
51
51
|
|
|
52
|
+
#annotation-filters {
|
|
53
|
+
padding: 16px 16px 0px 16px;
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: row;
|
|
56
|
+
justify-content: space-around;
|
|
57
|
+
gap: 12px;
|
|
58
|
+
span {
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
52
63
|
.annotation-set-group {
|
|
53
64
|
.label-set-header {
|
|
54
65
|
cursor: pointer;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="annotation-filters">
|
|
3
|
+
<b-switch v-model="feedbackNeeded" class="is-small">{{
|
|
4
|
+
$t("human_feedback_needed")
|
|
5
|
+
}}</b-switch>
|
|
6
|
+
<b-switch v-model="missingAnnotations" class="is-small">{{
|
|
7
|
+
$t("label_missing_annotations")
|
|
8
|
+
}}</b-switch>
|
|
9
|
+
<b-switch v-model="acceptedAnnotations" class="is-small">{{
|
|
10
|
+
$t("accepted_annotations")
|
|
11
|
+
}}</b-switch>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
import { mapState } from "vuex";
|
|
16
|
+
export default {
|
|
17
|
+
name: "AnnotationFilters",
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
feedbackNeeded: true,
|
|
21
|
+
missingAnnotations: true,
|
|
22
|
+
acceptedAnnotations: true,
|
|
23
|
+
originalAnnotationSets: [],
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
...mapState("document", ["annotationSets"]),
|
|
28
|
+
},
|
|
29
|
+
watch: {
|
|
30
|
+
feedbackNeeded() {
|
|
31
|
+
this.filterAnnotations();
|
|
32
|
+
},
|
|
33
|
+
missingAnnotations() {
|
|
34
|
+
this.filterAnnotations();
|
|
35
|
+
},
|
|
36
|
+
acceptedAnnotations() {
|
|
37
|
+
this.filterAnnotations();
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
mounted() {
|
|
41
|
+
this.originalAnnotationSets = JSON.parse(
|
|
42
|
+
JSON.stringify(this.annotationSets)
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
filterAnnotations() {
|
|
47
|
+
this.$store.dispatch("document/filterAnnotations", {
|
|
48
|
+
originalAnnotationSets: this.originalAnnotationSets,
|
|
49
|
+
showEmpty: this.missingAnnotations,
|
|
50
|
+
showFeedbackNeeded: this.feedbackNeeded,
|
|
51
|
+
showAccepted: this.acceptedAnnotations,
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style
|
|
59
|
+
scoped
|
|
60
|
+
lang="scss"
|
|
61
|
+
src="../../assets/scss/document_annotations.scss"
|
|
62
|
+
></style>
|
|
@@ -19,12 +19,14 @@
|
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
|
-
<!-- When there's no
|
|
22
|
+
<!-- When there's no annotation sets -->
|
|
23
23
|
<div v-else-if="annotationSets.length === 0" class="empty-annotation-sets">
|
|
24
24
|
<EmptyState />
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
27
|
<div v-else ref="annotationList" :class="['annotation-set-list']">
|
|
28
|
+
<AnnotationFilters v-if="isDocumentEditable" />
|
|
29
|
+
|
|
28
30
|
<div
|
|
29
31
|
v-if="Object.entries(annotationSetsInTable()).length > 0"
|
|
30
32
|
class="annotation-set-group"
|
|
@@ -148,6 +150,7 @@ import EmptyState from "./EmptyState";
|
|
|
148
150
|
import ExtractingData from "./ExtractingData";
|
|
149
151
|
import AnnotationSetActionButtons from "./AnnotationSetActionButtons";
|
|
150
152
|
import DocumentLabel from "./DocumentLabel";
|
|
153
|
+
import AnnotationFilters from "./AnnotationFilters";
|
|
151
154
|
import LoadingAnnotations from "./LoadingAnnotations";
|
|
152
155
|
import GridIcon from "../../assets/images/GridIcon";
|
|
153
156
|
|
|
@@ -162,6 +165,7 @@ export default {
|
|
|
162
165
|
DocumentLabel,
|
|
163
166
|
LoadingAnnotations,
|
|
164
167
|
GridIcon,
|
|
168
|
+
AnnotationFilters,
|
|
165
169
|
},
|
|
166
170
|
data() {
|
|
167
171
|
return {
|
package/src/locales/de.json
CHANGED
|
@@ -152,5 +152,8 @@
|
|
|
152
152
|
"no_results": "Keine Ergebnisse",
|
|
153
153
|
"search_below_minimum": "Mindestens 3 Zeichen",
|
|
154
154
|
"search_in_document": "Suche im Dokument",
|
|
155
|
-
"document_details": "Einzelheiten"
|
|
155
|
+
"document_details": "Einzelheiten",
|
|
156
|
+
"human_feedback_needed": "Menschliches Feedback erforderlich",
|
|
157
|
+
"label_missing_annotations": "Fehlende Annotationen",
|
|
158
|
+
"accepted_annotations": "Akzeptierte Annotationen"
|
|
156
159
|
}
|
package/src/locales/en.json
CHANGED
|
@@ -153,5 +153,8 @@
|
|
|
153
153
|
"no_results": "No results",
|
|
154
154
|
"search_below_minimum": "Minimum 3 characters",
|
|
155
155
|
"search_in_document": "Search document",
|
|
156
|
-
"document_details": "Details"
|
|
156
|
+
"document_details": "Details",
|
|
157
|
+
"human_feedback_needed": "Human Feedback needed",
|
|
158
|
+
"label_missing_annotations": "Missing Annotations",
|
|
159
|
+
"accepted_annotations": "Accepted Annotations"
|
|
157
160
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -152,5 +152,8 @@
|
|
|
152
152
|
"no_results": "Sin resultados",
|
|
153
153
|
"search_below_minimum": "Mínimo 3 caracteres",
|
|
154
154
|
"search_in_document": "Buscar en documento",
|
|
155
|
-
"document_details": "Detalles"
|
|
155
|
+
"document_details": "Detalles",
|
|
156
|
+
"human_feedback_needed": "Necesita feedback humano",
|
|
157
|
+
"label_missing_annotations": "Anotaciones faltantes",
|
|
158
|
+
"accepted_annotations": "Anotaciones aceptadas"
|
|
156
159
|
}
|
package/src/store/document.js
CHANGED
|
@@ -270,28 +270,59 @@ const getters = {
|
|
|
270
270
|
},
|
|
271
271
|
|
|
272
272
|
/* Process annotations and extract labels and sets */
|
|
273
|
-
processAnnotationSets:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
273
|
+
processAnnotationSets:
|
|
274
|
+
(state, getters) =>
|
|
275
|
+
(
|
|
276
|
+
annotationSets,
|
|
277
|
+
showEmpty = true,
|
|
278
|
+
showFeedbackNeeded = true,
|
|
279
|
+
showAccepted = true
|
|
280
|
+
) => {
|
|
281
|
+
// group annotations for sidebar
|
|
282
|
+
let annotations = [];
|
|
283
|
+
let labels = [];
|
|
284
|
+
let processedAnnotationSets = [];
|
|
285
|
+
annotationSets.forEach((annotationSet) => {
|
|
286
|
+
labels = [];
|
|
287
|
+
annotationSet.labels.forEach((label) => {
|
|
288
|
+
const labelAnnotations = [];
|
|
289
|
+
let addLabel = false;
|
|
290
|
+
if (!showEmpty || !showFeedbackNeeded || !showAccepted) {
|
|
291
|
+
if (!label.annotations || label.annotations.length === 0) {
|
|
292
|
+
if (showEmpty) {
|
|
293
|
+
addLabel = true;
|
|
294
|
+
}
|
|
295
|
+
} else {
|
|
296
|
+
label.annotations.forEach((annotation) => {
|
|
297
|
+
if (showFeedbackNeeded && annotation.revised === false) {
|
|
298
|
+
labelAnnotations.push(annotation);
|
|
299
|
+
addLabel = true;
|
|
300
|
+
}
|
|
301
|
+
if (showAccepted && annotation.revised === true) {
|
|
302
|
+
labelAnnotations.push(annotation);
|
|
303
|
+
addLabel = true;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
} else {
|
|
308
|
+
// add annotations to the document array
|
|
309
|
+
labelAnnotations.push(...label.annotations);
|
|
310
|
+
addLabel = true;
|
|
311
|
+
}
|
|
312
|
+
if (addLabel) {
|
|
313
|
+
labels.push({ ...label, annotations: labelAnnotations });
|
|
314
|
+
}
|
|
315
|
+
annotations.push(...labelAnnotations);
|
|
316
|
+
});
|
|
317
|
+
processedAnnotationSets.push({ ...annotationSet, labels });
|
|
284
318
|
});
|
|
285
|
-
annotationSet.labels = annotationSetLabels;
|
|
286
|
-
return annotationSet;
|
|
287
|
-
});
|
|
288
319
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
320
|
+
return {
|
|
321
|
+
annotationSets: processedAnnotationSets,
|
|
322
|
+
labels,
|
|
323
|
+
annotations,
|
|
324
|
+
};
|
|
325
|
+
},
|
|
295
326
|
|
|
296
327
|
/* Checks if there are annotations correct in the document */
|
|
297
328
|
documentHasCorrectAnnotations: (state) => {
|
|
@@ -755,6 +786,21 @@ const actions = {
|
|
|
755
786
|
setSplittingSuggestions: ({ commit }, value) => {
|
|
756
787
|
commit("SET_SPLITTING_SUGGESTIONS", value);
|
|
757
788
|
},
|
|
789
|
+
filterAnnotations: (
|
|
790
|
+
{ commit, getters },
|
|
791
|
+
{ originalAnnotationSets, showEmpty, showFeedbackNeeded, showAccepted }
|
|
792
|
+
) => {
|
|
793
|
+
const { labels, annotations, annotationSets } =
|
|
794
|
+
getters.processAnnotationSets(
|
|
795
|
+
originalAnnotationSets,
|
|
796
|
+
showEmpty,
|
|
797
|
+
showFeedbackNeeded,
|
|
798
|
+
showAccepted
|
|
799
|
+
);
|
|
800
|
+
commit("SET_ANNOTATION_SETS", annotationSets);
|
|
801
|
+
commit("SET_ANNOTATIONS", annotations);
|
|
802
|
+
commit("SET_LABELS", labels);
|
|
803
|
+
},
|
|
758
804
|
|
|
759
805
|
/**
|
|
760
806
|
* Actions that use HTTP requests always return the axios promise,
|
|
@@ -1448,7 +1494,6 @@ const mutations = {
|
|
|
1448
1494
|
SET_SERVER_ERROR: (state, value) => {
|
|
1449
1495
|
state.serverError = value;
|
|
1450
1496
|
},
|
|
1451
|
-
|
|
1452
1497
|
UPDATE_FILE_NAME: (state, value) => {
|
|
1453
1498
|
state.selectedDocument.data_file_name = value;
|
|
1454
1499
|
},
|