@konfuzio/document-validation-ui 0.1.48 → 0.1.49-dev.1
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 +1 -0
- package/src/components/App.vue +34 -0
- package/src/components/DocumentTopBar/DocumentTopBar.cy.js +192 -220
- package/src/components/DocumentTopBar/DocumentTopBar.vue +9 -7
- package/src/store/category.js +13 -21
- package/src/store/display.js +16 -0
- package/src/store/document.js +23 -33
- package/src/store/project.js +31 -22
package/src/store/document.js
CHANGED
|
@@ -429,7 +429,7 @@ const getters = {
|
|
|
429
429
|
},
|
|
430
430
|
|
|
431
431
|
/* Process annotations and extract labels and sets */
|
|
432
|
-
processAnnotationSets: (
|
|
432
|
+
processAnnotationSets: (state, getters, rootState) => (annotationSets) => {
|
|
433
433
|
// group annotations for sidebar
|
|
434
434
|
let annotations = [];
|
|
435
435
|
let labels = [];
|
|
@@ -437,22 +437,30 @@ const getters = {
|
|
|
437
437
|
let processedLabels = [];
|
|
438
438
|
|
|
439
439
|
annotationSets.forEach((annotationSet) => {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
440
|
+
// check if empty label sets and env variable set as true
|
|
441
|
+
if (
|
|
442
|
+
!(
|
|
443
|
+
(rootState.display.hideEmptyLabelSets || state.publicView) &&
|
|
444
|
+
annotationSet.id === null
|
|
445
|
+
)
|
|
446
|
+
) {
|
|
447
|
+
labels = [];
|
|
448
|
+
annotationSet.labels.forEach((label) => {
|
|
449
|
+
const labelAnnotations = [];
|
|
443
450
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
451
|
+
// add annotations to the document array
|
|
452
|
+
// remove negative annotations
|
|
453
|
+
label.annotations.forEach((ann) => {
|
|
454
|
+
if (!getters.isNegative(ann)) {
|
|
455
|
+
labelAnnotations.push(ann);
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
labels.push({ ...label, annotations: labelAnnotations });
|
|
459
|
+
processedLabels.push(label);
|
|
460
|
+
annotations.push(...labelAnnotations);
|
|
450
461
|
});
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
annotations.push(...labelAnnotations);
|
|
454
|
-
});
|
|
455
|
-
processedAnnotationSets.push({ ...annotationSet, labels });
|
|
462
|
+
processedAnnotationSets.push({ ...annotationSet, labels });
|
|
463
|
+
}
|
|
456
464
|
});
|
|
457
465
|
return {
|
|
458
466
|
annotationSets: processedAnnotationSets,
|
|
@@ -1139,24 +1147,6 @@ const actions = {
|
|
|
1139
1147
|
await dispatch("category/fetchCategories", projectId, {
|
|
1140
1148
|
root: true,
|
|
1141
1149
|
});
|
|
1142
|
-
|
|
1143
|
-
// get list of documents not reviewed
|
|
1144
|
-
await dispatch("project/fetchDocumentList", "is_reviewed=false", {
|
|
1145
|
-
root: true,
|
|
1146
|
-
});
|
|
1147
|
-
}
|
|
1148
|
-
if (categoryId && rootState.category.createAvailableListOfDocuments) {
|
|
1149
|
-
await dispatch(
|
|
1150
|
-
"category/createAvailableDocumentsList",
|
|
1151
|
-
{
|
|
1152
|
-
categoryId,
|
|
1153
|
-
user: rootState.project.currentUser.username,
|
|
1154
|
-
poll: false,
|
|
1155
|
-
},
|
|
1156
|
-
{
|
|
1157
|
-
root: true,
|
|
1158
|
-
}
|
|
1159
|
-
);
|
|
1160
1150
|
}
|
|
1161
1151
|
}
|
|
1162
1152
|
if (isRecalculatingAnnotations) {
|
package/src/store/project.js
CHANGED
|
@@ -6,7 +6,6 @@ const state = {
|
|
|
6
6
|
labelSets: null,
|
|
7
7
|
currentUser: null,
|
|
8
8
|
documentsListPath: null,
|
|
9
|
-
documentsInProject: null,
|
|
10
9
|
showAnnotationTranslations: false,
|
|
11
10
|
};
|
|
12
11
|
|
|
@@ -58,28 +57,41 @@ const actions = {
|
|
|
58
57
|
commit("SET_DOCUMENTS_LIST_PATH", path);
|
|
59
58
|
},
|
|
60
59
|
|
|
61
|
-
setDocumentsInProject: ({ commit }, documents) => {
|
|
62
|
-
commit("SET_DOCUMENTS_IN_PROJECT", documents);
|
|
63
|
-
},
|
|
64
|
-
|
|
65
60
|
setShowAnnotationTranslations: ({ commit }, show) => {
|
|
66
61
|
commit("SET_SHOW_ANNOTATION_TRANSLATIONS", show);
|
|
67
62
|
},
|
|
68
63
|
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
fetchDocumentListWithParameters: ({ commit, state }, parameters) => {
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
myImports
|
|
67
|
+
.makeGetPaginatedRequest(
|
|
68
|
+
`documents/?project=${state.projectId}&${parameters}`,
|
|
69
|
+
true
|
|
70
|
+
)
|
|
71
|
+
.then((results) => {
|
|
72
|
+
resolve(results);
|
|
73
|
+
})
|
|
74
|
+
.catch((error) => {
|
|
75
|
+
reject();
|
|
76
|
+
console.log(error, "Could not fetch document list from the backend");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
fetchDocumentListForNavigation: ({ commit, state }) => {
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
myImports
|
|
83
|
+
.makeGetPaginatedRequest(
|
|
84
|
+
`documents/?project=${state.projectId}&is_reviewed=false&fields=id`,
|
|
85
|
+
true
|
|
86
|
+
)
|
|
87
|
+
.then((results) => {
|
|
88
|
+
resolve(results);
|
|
89
|
+
})
|
|
90
|
+
.catch((error) => {
|
|
91
|
+
reject();
|
|
92
|
+
console.log(error, "Could not fetch document list from the backend");
|
|
93
|
+
});
|
|
94
|
+
});
|
|
83
95
|
},
|
|
84
96
|
};
|
|
85
97
|
|
|
@@ -96,9 +108,6 @@ const mutations = {
|
|
|
96
108
|
SET_DOCUMENTS_LIST_PATH: (state, path) => {
|
|
97
109
|
state.documentsListPath = path;
|
|
98
110
|
},
|
|
99
|
-
SET_DOCUMENTS_IN_PROJECT: (state, documents) => {
|
|
100
|
-
state.documentsInProject = documents;
|
|
101
|
-
},
|
|
102
111
|
SET_SHOW_ANNOTATION_TRANSLATIONS: (state, show) => {
|
|
103
112
|
state.showAnnotationTranslations = show;
|
|
104
113
|
},
|