@konfuzio/document-validation-ui 0.1.50-dev.0 → 0.1.50
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/README.md +0 -4
- 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_category.scss +5 -0
- package/src/assets/scss/document_set_chooser.scss +6 -0
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +50 -57
- package/src/components/DocumentCategory.vue +19 -13
- package/src/components/DocumentEdit/RenameAndCategorize.vue +3 -1
- package/src/components/DocumentTopBar/DocumentSetChooser.vue +15 -8
- package/src/components/DocumentTopBar/DocumentTopBar.vue +1 -4
- package/src/components/DocumentsList/DocumentsList.vue +1 -1
- package/src/store/category.js +9 -3
- package/src/store/document.js +91 -96
package/package.json
CHANGED
|
@@ -51,17 +51,14 @@
|
|
|
51
51
|
:key="indexGroup"
|
|
52
52
|
:class="[
|
|
53
53
|
'annotation-set-group',
|
|
54
|
-
!
|
|
55
|
-
'annotation-set-collapsed',
|
|
54
|
+
!isAccordionOpen(annotationSet) && 'annotation-set-collapsed',
|
|
56
55
|
]"
|
|
57
56
|
>
|
|
58
|
-
<div class="label-set-header" @click="toggleAccordion(
|
|
57
|
+
<div class="label-set-header" @click="toggleAccordion(annotationSet)">
|
|
59
58
|
<div class="label-set-name">
|
|
60
59
|
<b-icon
|
|
61
60
|
:icon="
|
|
62
|
-
|
|
63
|
-
? 'angle-up'
|
|
64
|
-
: 'angle-down'
|
|
61
|
+
isAccordionOpen(annotationSet) ? 'angle-up' : 'angle-down'
|
|
65
62
|
"
|
|
66
63
|
size="is-12"
|
|
67
64
|
/>
|
|
@@ -80,7 +77,7 @@
|
|
|
80
77
|
class="labelset-action-buttons"
|
|
81
78
|
>
|
|
82
79
|
<AnnotationSetActionButtons
|
|
83
|
-
:is-placeholder="
|
|
80
|
+
:is-placeholder="!isAccordionOpen(annotationSet)"
|
|
84
81
|
:number-of-empty-labels-in-annotation-set="
|
|
85
82
|
emptyLabels(annotationSet).length
|
|
86
83
|
"
|
|
@@ -107,7 +104,7 @@
|
|
|
107
104
|
</div>
|
|
108
105
|
</div>
|
|
109
106
|
|
|
110
|
-
<b-collapse :open="
|
|
107
|
+
<b-collapse :open="isAccordionOpen(annotationSet)">
|
|
111
108
|
<div v-if="annotationSet.labels.length > 0">
|
|
112
109
|
<div v-for="label in annotationSet.labels" :key="label.id">
|
|
113
110
|
<div
|
|
@@ -242,11 +239,12 @@ export default {
|
|
|
242
239
|
if (newAnnotationId) {
|
|
243
240
|
const annotationSet = this.annotationSetOfAnnotation(newAnnotationId);
|
|
244
241
|
if (annotationSet) {
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
242
|
+
const newAnnotationSetsAccordion = {
|
|
243
|
+
...this.annotationSetsAccordion,
|
|
244
|
+
};
|
|
245
|
+
newAnnotationSetsAccordion[
|
|
246
|
+
annotationSet.id || annotationSet.label_set.id
|
|
247
|
+
] = true;
|
|
250
248
|
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
251
249
|
}
|
|
252
250
|
}
|
|
@@ -272,51 +270,38 @@ export default {
|
|
|
272
270
|
annotationSet.labels.length === 0 && this.isSearchingAnnotationList
|
|
273
271
|
);
|
|
274
272
|
},
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
isAccordionOpen(annotationSet) {
|
|
274
|
+
return (
|
|
275
|
+
this.isSearchingAnnotationList ||
|
|
276
|
+
this.annotationSetsAccordion[
|
|
277
|
+
annotationSet.id || annotationSet.label_set.id
|
|
278
|
+
] === true
|
|
279
|
+
);
|
|
280
|
+
},
|
|
281
|
+
toggleAccordion(annotationSet) {
|
|
282
|
+
const newAnnotationSetsAccordion = { ...this.annotationSetsAccordion };
|
|
283
|
+
newAnnotationSetsAccordion[
|
|
284
|
+
annotationSet.id || annotationSet.label_set.id
|
|
285
|
+
] =
|
|
286
|
+
!newAnnotationSetsAccordion[
|
|
287
|
+
annotationSet.id || annotationSet.label_set.id
|
|
288
|
+
];
|
|
279
289
|
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
280
290
|
},
|
|
281
291
|
openAllAccordions() {
|
|
282
|
-
const newAnnotationSetsAccordion =
|
|
283
|
-
|
|
284
|
-
newAnnotationSetsAccordion[
|
|
285
|
-
}
|
|
292
|
+
const newAnnotationSetsAccordion = { ...this.annotationSetsAccordion };
|
|
293
|
+
for (var key in newAnnotationSetsAccordion) {
|
|
294
|
+
newAnnotationSetsAccordion[key] = true;
|
|
295
|
+
}
|
|
286
296
|
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
287
297
|
},
|
|
288
298
|
loadAccordions(newAnnotationSets, oldAnnotationSets = null) {
|
|
289
299
|
if (newAnnotationSets) {
|
|
290
300
|
const isFirstTime = this.annotationSetsAccordion === null;
|
|
291
|
-
const newAnnotationSetsAccordion =
|
|
301
|
+
const newAnnotationSetsAccordion = {};
|
|
292
302
|
const annotationSetsOpened = [];
|
|
293
303
|
const annotationSetsCreated = [];
|
|
294
304
|
|
|
295
|
-
if (!isFirstTime) {
|
|
296
|
-
// when annotation sets changed, restore old state
|
|
297
|
-
// and check if new ones were created to be open by default
|
|
298
|
-
|
|
299
|
-
this.annotationSetsAccordion.forEach((isOpen, index) => {
|
|
300
|
-
if (isOpen) {
|
|
301
|
-
annotationSetsOpened.push(oldAnnotationSets[index]);
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
newAnnotationSets.forEach((newAnnotationSet) => {
|
|
306
|
-
const existed = oldAnnotationSets.find(
|
|
307
|
-
(oldAnnotationSet) =>
|
|
308
|
-
oldAnnotationSet &&
|
|
309
|
-
newAnnotationSet &&
|
|
310
|
-
oldAnnotationSet.id &&
|
|
311
|
-
newAnnotationSet.id &&
|
|
312
|
-
oldAnnotationSet.id === newAnnotationSet.id
|
|
313
|
-
);
|
|
314
|
-
if (!existed && newAnnotationSet && newAnnotationSet.id !== null) {
|
|
315
|
-
annotationSetsCreated.push(newAnnotationSet);
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
|
|
320
305
|
newAnnotationSets.forEach((newAnnotationSet, index) => {
|
|
321
306
|
const wasOpen = annotationSetsOpened.find(
|
|
322
307
|
(annotationSetOpened) =>
|
|
@@ -326,19 +311,25 @@ export default {
|
|
|
326
311
|
newAnnotationSet.id === annotationSetOpened.id
|
|
327
312
|
);
|
|
328
313
|
if (isFirstTime && this.annotationSetId) {
|
|
329
|
-
newAnnotationSetsAccordion[
|
|
330
|
-
newAnnotationSet.id
|
|
314
|
+
newAnnotationSetsAccordion[
|
|
315
|
+
newAnnotationSet.id || newAnnotationSet.label_set.id
|
|
316
|
+
] = newAnnotationSet.id == this.annotationSetId;
|
|
331
317
|
} else if (isFirstTime && this.annotationId) {
|
|
332
|
-
newAnnotationSetsAccordion[
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
318
|
+
newAnnotationSetsAccordion[
|
|
319
|
+
newAnnotationSet.id || newAnnotationSet.label_set.id
|
|
320
|
+
] = this.isAnnotationInAnnotationSet(
|
|
321
|
+
newAnnotationSet,
|
|
322
|
+
this.annotationId
|
|
323
|
+
);
|
|
337
324
|
} else if (isFirstTime && index === 0) {
|
|
338
325
|
// open first one by default
|
|
339
|
-
newAnnotationSetsAccordion[
|
|
326
|
+
newAnnotationSetsAccordion[
|
|
327
|
+
newAnnotationSet.id || newAnnotationSet.label_set.id
|
|
328
|
+
] = true;
|
|
340
329
|
} else if (wasOpen) {
|
|
341
|
-
newAnnotationSetsAccordion[
|
|
330
|
+
newAnnotationSetsAccordion[
|
|
331
|
+
newAnnotationSet.id || newAnnotationSet.label_set.id
|
|
332
|
+
] = wasOpen !== undefined;
|
|
342
333
|
} else {
|
|
343
334
|
const wasCreated = annotationSetsCreated.find(
|
|
344
335
|
(annotationSetCreated) =>
|
|
@@ -346,7 +337,9 @@ export default {
|
|
|
346
337
|
newAnnotationSet.id &&
|
|
347
338
|
newAnnotationSet.id === annotationSetCreated.id
|
|
348
339
|
);
|
|
349
|
-
newAnnotationSetsAccordion[
|
|
340
|
+
newAnnotationSetsAccordion[
|
|
341
|
+
newAnnotationSet.id || newAnnotationSet.label_set.id
|
|
342
|
+
] = wasCreated !== undefined;
|
|
350
343
|
}
|
|
351
344
|
});
|
|
352
345
|
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<b-tooltip
|
|
3
|
+
v-if="categories"
|
|
3
4
|
multilined
|
|
4
5
|
:active="tooltipIsShown || dropdownIsDisabled"
|
|
5
6
|
size="is-large"
|
|
@@ -67,6 +68,9 @@
|
|
|
67
68
|
</b-dropdown-item>
|
|
68
69
|
</b-dropdown>
|
|
69
70
|
</b-tooltip>
|
|
71
|
+
<div v-else class="loading-bar">
|
|
72
|
+
<b-skeleton width="auto" height="100%" />
|
|
73
|
+
</div>
|
|
70
74
|
</template>
|
|
71
75
|
|
|
72
76
|
<script>
|
|
@@ -258,21 +262,23 @@ export default {
|
|
|
258
262
|
this.$emit("category-change", this.page, category.id);
|
|
259
263
|
},
|
|
260
264
|
setTooltipText() {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
265
|
+
if (this.categories) {
|
|
266
|
+
// Text set from innerHTML vs 'label' due to html tag in locales file string
|
|
267
|
+
let tooltipText;
|
|
268
|
+
let tooltipDelay = 0;
|
|
264
269
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
if (this.documentCannotBeEdited(this.selectedDocument)) {
|
|
271
|
+
tooltipText = this.$t("edit_not_available");
|
|
272
|
+
} else if (this.documentHasCorrectAnnotations) {
|
|
273
|
+
tooltipText = this.$t("approved_annotations");
|
|
274
|
+
} else if (this.projectHasSingleCategory) {
|
|
275
|
+
tooltipText = this.$t("single_category_in_project");
|
|
276
|
+
tooltipDelay = 5000;
|
|
277
|
+
}
|
|
273
278
|
|
|
274
|
-
|
|
275
|
-
|
|
279
|
+
this.tooltipCloseDelay = tooltipDelay;
|
|
280
|
+
this.$refs.tooltipContent.innerHTML = tooltipText;
|
|
281
|
+
}
|
|
276
282
|
},
|
|
277
283
|
},
|
|
278
284
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<b-dropdown
|
|
3
3
|
v-if="
|
|
4
|
-
documentSet &&
|
|
4
|
+
documentSet &&
|
|
5
|
+
documentSet.documents &&
|
|
6
|
+
documentSet.documents.length > 1 &&
|
|
7
|
+
categories
|
|
5
8
|
"
|
|
6
9
|
v-model="selectedDocId"
|
|
7
10
|
class="document-set-dropdown dropdown-full-width"
|
|
@@ -19,9 +22,9 @@
|
|
|
19
22
|
</div>
|
|
20
23
|
<div class="bottom-part">
|
|
21
24
|
{{
|
|
22
|
-
`${
|
|
25
|
+
`${categoryName(
|
|
23
26
|
selectedDocument.category
|
|
24
|
-
)}`
|
|
27
|
+
)} ${numberOfDocumentInSet(selectedDocument)}`
|
|
25
28
|
}}
|
|
26
29
|
</div>
|
|
27
30
|
</div>
|
|
@@ -41,11 +44,17 @@
|
|
|
41
44
|
>
|
|
42
45
|
<span>
|
|
43
46
|
{{
|
|
44
|
-
`${
|
|
47
|
+
`${categoryName(doc.category)} ${numberOfDocumentInSet(doc)}`
|
|
45
48
|
}}</span
|
|
46
49
|
>
|
|
47
50
|
</b-dropdown-item>
|
|
48
51
|
</b-dropdown>
|
|
52
|
+
<div
|
|
53
|
+
v-else-if="selectedDocument.documentSet !== null && documentSet === null"
|
|
54
|
+
class="loading-bar"
|
|
55
|
+
>
|
|
56
|
+
<b-skeleton width="100px" height="60%" />
|
|
57
|
+
</div>
|
|
49
58
|
</template>
|
|
50
59
|
|
|
51
60
|
<script>
|
|
@@ -66,16 +75,14 @@ export default {
|
|
|
66
75
|
...mapGetters("document", ["numberOfDocumentInSet"]),
|
|
67
76
|
...mapGetters("category", ["categoryName"]),
|
|
68
77
|
...mapState("document", ["documentSet", "selectedDocument"]),
|
|
78
|
+
...mapState("category", ["categories"]),
|
|
69
79
|
},
|
|
70
80
|
mounted() {
|
|
71
81
|
this.selectedDocId = this.selectedDocument.id;
|
|
72
82
|
},
|
|
73
83
|
methods: {
|
|
74
84
|
handleDocumentClick(document) {
|
|
75
|
-
this.$store.dispatch("document/changeCurrentDocument",
|
|
76
|
-
document,
|
|
77
|
-
documentId: document.id,
|
|
78
|
-
});
|
|
85
|
+
this.$store.dispatch("document/changeCurrentDocument", document.id);
|
|
79
86
|
},
|
|
80
87
|
},
|
|
81
88
|
};
|
|
@@ -181,10 +181,7 @@ export default {
|
|
|
181
181
|
},
|
|
182
182
|
navigateToDocument(document) {
|
|
183
183
|
if (!document) return;
|
|
184
|
-
|
|
185
|
-
this.$store.dispatch("document/changeCurrentDocument", {
|
|
186
|
-
documentId: document.id,
|
|
187
|
-
});
|
|
184
|
+
this.$store.dispatch("document/changeCurrentDocument", document.id);
|
|
188
185
|
},
|
|
189
186
|
},
|
|
190
187
|
};
|
|
@@ -110,7 +110,7 @@ export default {
|
|
|
110
110
|
},
|
|
111
111
|
methods: {
|
|
112
112
|
changeDocument(documentId) {
|
|
113
|
-
this.$store.dispatch("document/changeCurrentDocument",
|
|
113
|
+
this.$store.dispatch("document/changeCurrentDocument", documentId);
|
|
114
114
|
},
|
|
115
115
|
requestTrialAccess() {
|
|
116
116
|
window.open("https://konfuzio.com", "_blank");
|
package/src/store/category.js
CHANGED
|
@@ -13,9 +13,12 @@ const getters = {
|
|
|
13
13
|
*/
|
|
14
14
|
categoryName: (state) => (categoryId) => {
|
|
15
15
|
if (categoryId && state.categories) {
|
|
16
|
-
|
|
16
|
+
const category = state.categories.find(
|
|
17
17
|
(tempCategory) => tempCategory.id == categoryId
|
|
18
|
-
)
|
|
18
|
+
);
|
|
19
|
+
if (category) {
|
|
20
|
+
return category.name;
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
return "";
|
|
21
24
|
},
|
|
@@ -35,9 +38,12 @@ const getters = {
|
|
|
35
38
|
*/
|
|
36
39
|
category: (state) => (categoryId) => {
|
|
37
40
|
if (categoryId && state.categories) {
|
|
38
|
-
|
|
41
|
+
const category = state.categories.find(
|
|
39
42
|
(tempCategory) => tempCategory.id == categoryId
|
|
40
43
|
);
|
|
44
|
+
if (category) {
|
|
45
|
+
return category;
|
|
46
|
+
}
|
|
41
47
|
}
|
|
42
48
|
return null;
|
|
43
49
|
},
|
package/src/store/document.js
CHANGED
|
@@ -441,7 +441,7 @@ const getters = {
|
|
|
441
441
|
if (
|
|
442
442
|
!(
|
|
443
443
|
(rootState.display.hideEmptyLabelSets || state.publicView) &&
|
|
444
|
-
annotationSet.
|
|
444
|
+
annotationSet.labels.length === 0
|
|
445
445
|
)
|
|
446
446
|
) {
|
|
447
447
|
labels = [];
|
|
@@ -523,18 +523,25 @@ const getters = {
|
|
|
523
523
|
/**
|
|
524
524
|
* Checks the number of current document in the document set
|
|
525
525
|
*/
|
|
526
|
-
numberOfDocumentInSet: (state) => (
|
|
527
|
-
|
|
528
|
-
let
|
|
526
|
+
numberOfDocumentInSet: (state) => (document) => {
|
|
527
|
+
let found = false;
|
|
528
|
+
let value = 0;
|
|
529
|
+
let index = 0;
|
|
529
530
|
if (state.documentSet && state.documentSet.documents) {
|
|
530
|
-
state.documentSet.documents.
|
|
531
|
-
if (
|
|
532
|
-
|
|
533
|
-
|
|
531
|
+
state.documentSet.documents.map((documentSetTemp) => {
|
|
532
|
+
if (
|
|
533
|
+
documentSetTemp.id !== document.id &&
|
|
534
|
+
documentSetTemp.category === document.category
|
|
535
|
+
) {
|
|
536
|
+
found = true;
|
|
537
|
+
index++;
|
|
538
|
+
} else if (documentSetTemp.id === document.id) {
|
|
539
|
+
value = index;
|
|
534
540
|
}
|
|
535
541
|
});
|
|
542
|
+
return found ? `${value + 1}` : "";
|
|
536
543
|
}
|
|
537
|
-
return
|
|
544
|
+
return "";
|
|
538
545
|
},
|
|
539
546
|
|
|
540
547
|
/**
|
|
@@ -1054,105 +1061,96 @@ const actions = {
|
|
|
1054
1061
|
* Actions that use HTTP requests always return the axios promise,
|
|
1055
1062
|
* so they can be `await`ed (useful to set the `loading` status).
|
|
1056
1063
|
*/
|
|
1057
|
-
fetchDocument: async (
|
|
1058
|
-
{ commit, state, dispatch, rootState, getters },
|
|
1059
|
-
fetchedDocument = null
|
|
1060
|
-
) => {
|
|
1061
|
-
let projectId = null;
|
|
1062
|
-
let documentSetId = null;
|
|
1063
|
-
let categoryId = null;
|
|
1064
|
+
fetchDocument: async ({ commit, state, dispatch, rootState, getters }) => {
|
|
1064
1065
|
let isRecalculatingAnnotations = false;
|
|
1065
|
-
|
|
1066
1066
|
const initialPage = 1;
|
|
1067
1067
|
|
|
1068
1068
|
dispatch("startLoading");
|
|
1069
1069
|
dispatch("display/updateCurrentPage", initialPage, {
|
|
1070
1070
|
root: true,
|
|
1071
1071
|
});
|
|
1072
|
-
try {
|
|
1073
|
-
if (!fetchedDocument) {
|
|
1074
|
-
const response = await HTTP.get(`documents/${state.documentId}/`);
|
|
1075
|
-
fetchedDocument = response.data;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
const { labels, annotations, annotationSets } =
|
|
1079
|
-
getters.processAnnotationSets(fetchedDocument.annotation_sets);
|
|
1080
1072
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1073
|
+
await HTTP.get(`documents/${state.documentId}/`)
|
|
1074
|
+
.then((response) => {
|
|
1075
|
+
if (response.data) {
|
|
1076
|
+
const fetchedDocument = response.data;
|
|
1077
|
+
|
|
1078
|
+
const { labels, annotations, annotationSets } =
|
|
1079
|
+
getters.processAnnotationSets(fetchedDocument.annotation_sets);
|
|
1080
|
+
|
|
1081
|
+
// load first page
|
|
1082
|
+
// if (fetchedDocument.pages.length > 0) {
|
|
1083
|
+
// dispatch("fetchDocumentPage", initialPage);
|
|
1084
|
+
// }
|
|
1085
|
+
|
|
1086
|
+
// set information on the store
|
|
1087
|
+
commit("SET_ANNOTATION_SETS", annotationSets);
|
|
1088
|
+
commit("SET_ANNOTATIONS", annotations);
|
|
1089
|
+
commit("SET_LABELS", labels);
|
|
1090
|
+
commit("SET_SELECTED_DOCUMENT", fetchedDocument);
|
|
1091
|
+
|
|
1092
|
+
// project
|
|
1093
|
+
if (fetchedDocument.project) {
|
|
1094
|
+
dispatch("project/setProjectId", fetchedDocument.project, {
|
|
1095
|
+
root: true,
|
|
1096
|
+
});
|
|
1085
1097
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1098
|
+
dispatch(
|
|
1099
|
+
"project/setShowAnnotationTranslations",
|
|
1100
|
+
fetchedDocument.enable_translated_strings,
|
|
1101
|
+
{
|
|
1102
|
+
root: true,
|
|
1103
|
+
}
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1091
1106
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1107
|
+
if (!state.publicView) {
|
|
1108
|
+
dispatch("fetchMissingAnnotations");
|
|
1094
1109
|
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1110
|
+
dispatch("project/fetchCurrentUser", null, {
|
|
1111
|
+
root: true,
|
|
1112
|
+
});
|
|
1098
1113
|
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1114
|
+
if (fetchedDocument.project) {
|
|
1115
|
+
dispatch("category/fetchCategories", fetchedDocument.project, {
|
|
1116
|
+
root: true,
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
if (fetchedDocument.document_set) {
|
|
1120
|
+
dispatch("fetchDocumentSet", fetchedDocument.document_set);
|
|
1121
|
+
}
|
|
1104
1122
|
}
|
|
1105
|
-
);
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
if (getters.documentHasProposedSplit(fetchedDocument)) {
|
|
1109
|
-
commit("SET_SPLITTING_SUGGESTIONS", fetchedDocument.proposed_split);
|
|
1110
|
-
}
|
|
1111
1123
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
} catch (error) {
|
|
1116
|
-
console.log(error, "Could not fetch document details from the backend");
|
|
1117
|
-
dispatch("display/setPageError", error.response.data.detail, {
|
|
1118
|
-
root: true,
|
|
1119
|
-
});
|
|
1120
|
-
return;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
if (!state.publicView) {
|
|
1124
|
-
await dispatch("fetchMissingAnnotations");
|
|
1124
|
+
if (getters.documentHasProposedSplit(fetchedDocument)) {
|
|
1125
|
+
dispatch("setSplittingSuggestions", fetchedDocument.proposed_split);
|
|
1126
|
+
}
|
|
1125
1127
|
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
+
if (fetchedDocument.labeling_available !== 1) {
|
|
1129
|
+
commit("SET_RECALCULATING_ANNOTATIONS", true);
|
|
1130
|
+
dispatch("pollDocumentEndpoint");
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
})
|
|
1134
|
+
.catch((error) => {
|
|
1135
|
+
console.log(error, "Could not fetch document details from the backend");
|
|
1136
|
+
dispatch("display/setPageError", error.response.data.detail, {
|
|
1137
|
+
root: true,
|
|
1138
|
+
});
|
|
1139
|
+
return;
|
|
1128
1140
|
});
|
|
1129
1141
|
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1142
|
+
// Check if we first open the document dashboard or the edit mode
|
|
1143
|
+
if (
|
|
1144
|
+
!state.publicView &&
|
|
1145
|
+
(!state.selectedDocument.category ||
|
|
1133
1146
|
(!state.selectedDocument.category_is_revised &&
|
|
1134
1147
|
!getters.documentHasCorrectAnnotations &&
|
|
1135
|
-
state.missingAnnotations.length === 0)
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
if (documentSetId) {
|
|
1144
|
-
await dispatch("fetchDocumentSet", documentSetId);
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
if (projectId) {
|
|
1148
|
-
await dispatch("category/fetchCategories", projectId, {
|
|
1149
|
-
root: true,
|
|
1150
|
-
});
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
if (isRecalculatingAnnotations) {
|
|
1154
|
-
commit("SET_RECALCULATING_ANNOTATIONS", true);
|
|
1155
|
-
dispatch("pollDocumentEndpoint");
|
|
1148
|
+
state.missingAnnotations.length === 0))
|
|
1149
|
+
) {
|
|
1150
|
+
dispatch("edit/enableEditMode", null, {
|
|
1151
|
+
root: true,
|
|
1152
|
+
});
|
|
1153
|
+
dispatch("edit/setRenameAndCategorize", true, { root: true });
|
|
1156
1154
|
}
|
|
1157
1155
|
dispatch("endLoading");
|
|
1158
1156
|
},
|
|
@@ -1226,11 +1224,11 @@ const actions = {
|
|
|
1226
1224
|
}
|
|
1227
1225
|
} else {
|
|
1228
1226
|
commit("ADD_ANNOTATION", response.data);
|
|
1229
|
-
if (response.data && response.data.id) {
|
|
1230
|
-
dispatch("setAnnotationId", response.data.id);
|
|
1231
|
-
}
|
|
1232
1227
|
}
|
|
1233
1228
|
|
|
1229
|
+
if (response.data && response.data.id) {
|
|
1230
|
+
dispatch("setAnnotationId", response.data.id);
|
|
1231
|
+
}
|
|
1234
1232
|
resolve(response);
|
|
1235
1233
|
}
|
|
1236
1234
|
})
|
|
@@ -1506,7 +1504,7 @@ const actions = {
|
|
|
1506
1504
|
|
|
1507
1505
|
changeCurrentDocument: (
|
|
1508
1506
|
{ commit, state, dispatch, rootState },
|
|
1509
|
-
|
|
1507
|
+
documentId
|
|
1510
1508
|
) => {
|
|
1511
1509
|
// reset splitting suggestions
|
|
1512
1510
|
if (state.splittingSuggestions) {
|
|
@@ -1526,9 +1524,6 @@ const actions = {
|
|
|
1526
1524
|
|
|
1527
1525
|
if (getURLQueryParam("document") || getURLPath("d")) {
|
|
1528
1526
|
navigateToNewDocumentURL(state.selectedDocument.id, documentId);
|
|
1529
|
-
} else if (document) {
|
|
1530
|
-
commit("SET_DOC_ID", document.id);
|
|
1531
|
-
dispatch("fetchDocument", document);
|
|
1532
1527
|
} else {
|
|
1533
1528
|
commit("SET_DOC_ID", documentId);
|
|
1534
1529
|
dispatch("fetchDocument");
|