@konfuzio/document-validation-ui 0.1.22-dev.2 → 0.1.24-dev.0
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/components/DocumentAnnotations/AnnotationSetActionButtons.vue +10 -6
- package/src/components/DocumentAnnotations/DocumentAnnotations.cy.js +101 -76
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +53 -39
- package/src/components/DocumentPage/DocumentPage.vue +2 -16
- package/src/locales/de.json +2 -0
- package/src/locales/en.json +2 -0
- package/src/locales/es.json +2 -0
- package/src/store/document.js +0 -22
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<div class="action-buttons">
|
|
3
3
|
<!-- mark all empty labels as missing -->
|
|
4
4
|
<div
|
|
5
|
-
v-if="!publicView && !isDocumentReviewed"
|
|
6
5
|
class="missing-button-container all-missing"
|
|
7
6
|
@mouseenter="mouseenterAnnotationSet('missing')"
|
|
8
7
|
@mouseleave="mouseleaveAnnotationSet"
|
|
@@ -11,15 +10,16 @@
|
|
|
11
10
|
type="is-ghost"
|
|
12
11
|
class="missing-btn all-missing-btn"
|
|
13
12
|
:disabled="numberOfEmptyLabelsInAnnotationSet === 0"
|
|
14
|
-
@click
|
|
13
|
+
@click="!isPlaceholder && markAllAsMissing"
|
|
15
14
|
>
|
|
16
|
-
{{ $t("mark_all_missing") }} ({{
|
|
15
|
+
{{ isPlaceholder ? $t("missing_counter") : $t("mark_all_missing") }} ({{
|
|
16
|
+
numberOfEmptyLabelsInAnnotationSet
|
|
17
|
+
}})
|
|
17
18
|
</b-button>
|
|
18
19
|
</div>
|
|
19
20
|
|
|
20
21
|
<!-- accept all pending annotations -->
|
|
21
22
|
<div
|
|
22
|
-
v-if="!publicView && !isDocumentReviewed"
|
|
23
23
|
class="accept-all"
|
|
24
24
|
@mouseenter="mouseenterAnnotationSet('accept')"
|
|
25
25
|
@mouseleave="mouseleaveAnnotationSet"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
type="is-primary"
|
|
29
29
|
class="accept-all-btn"
|
|
30
30
|
:disabled="numberOfNotCorrectAnnotationsInAnnotationSet === 0"
|
|
31
|
-
@click
|
|
31
|
+
@click="!isPlaceholder && acceptAllPending"
|
|
32
32
|
>
|
|
33
|
-
{{ $t("accept_group") }} ({{
|
|
33
|
+
{{ isPlaceholder ? $t("pending_counter") : $t("accept_group") }} ({{
|
|
34
34
|
numberOfNotCorrectAnnotationsInAnnotationSet
|
|
35
35
|
}})
|
|
36
36
|
</b-button>
|
|
@@ -45,6 +45,10 @@ import { mapGetters, mapState } from "vuex";
|
|
|
45
45
|
export default {
|
|
46
46
|
name: "AnnotationSetActionButtons",
|
|
47
47
|
props: {
|
|
48
|
+
isPlaceholder: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
48
52
|
numberOfEmptyLabelsInAnnotationSet: {
|
|
49
53
|
type: Number,
|
|
50
54
|
default: 0,
|
|
@@ -5,18 +5,18 @@ describe("Document Annotations", () => {
|
|
|
5
5
|
cy.fetchDocument();
|
|
6
6
|
cy.dispatchAction("document", "setPublicView", false);
|
|
7
7
|
cy.dispatchAction("edit", "disableEditMode");
|
|
8
|
-
cy.mount(DocumentAnnotations)
|
|
8
|
+
cy.mount(DocumentAnnotations).then(({ wrapper, component }) => {
|
|
9
|
+
component.openAllAccordions();
|
|
10
|
+
});
|
|
9
11
|
});
|
|
10
12
|
|
|
11
13
|
it("shows loading when there are no annotation sets loaded yet or when loading the data", () => {
|
|
12
14
|
cy.dispatchAction("document", "setAnnotationSets", null);
|
|
13
|
-
cy.mount(DocumentAnnotations);
|
|
14
15
|
cy.get("#document-annotations")
|
|
15
16
|
.find(".document-annotations-loading")
|
|
16
17
|
.its("length")
|
|
17
18
|
.should("equal", 1);
|
|
18
19
|
|
|
19
|
-
|
|
20
20
|
cy.dispatchAction("document", "startLoading");
|
|
21
21
|
cy.get("#document-annotations")
|
|
22
22
|
.find(".document-annotations-loading")
|
|
@@ -36,10 +36,9 @@ describe("Document Annotations", () => {
|
|
|
36
36
|
cy.get("#document-annotations")
|
|
37
37
|
.find(".annotation-set-group")
|
|
38
38
|
.then(($elements) => {
|
|
39
|
-
cy.getStore("document")
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
});
|
|
39
|
+
cy.getStore("document").then(($document) => {
|
|
40
|
+
expect($document.annotationSets).to.have.lengthOf($elements.length);
|
|
41
|
+
});
|
|
43
42
|
});
|
|
44
43
|
});
|
|
45
44
|
|
|
@@ -50,15 +49,14 @@ describe("Document Annotations", () => {
|
|
|
50
49
|
.find(".empty-annotation-sets")
|
|
51
50
|
.find(".empty-container")
|
|
52
51
|
.find(".title")
|
|
53
|
-
.should(
|
|
52
|
+
.should("be.visible");
|
|
54
53
|
});
|
|
55
54
|
|
|
56
55
|
it("shows no annotation set action buttons if the document is read only", () => {
|
|
57
56
|
cy.dispatchAction("document", "setPublicView", true);
|
|
58
|
-
|
|
59
57
|
cy.get("#document-annotations")
|
|
60
58
|
.find(".labelset-action-buttons")
|
|
61
|
-
.should("not.
|
|
59
|
+
.should("not.exist");
|
|
62
60
|
});
|
|
63
61
|
|
|
64
62
|
it("renders action buttons for the annotation sets and annotations", () => {
|
|
@@ -87,28 +85,23 @@ describe("Document Annotations", () => {
|
|
|
87
85
|
.find(".annotation-row")
|
|
88
86
|
.find(".annotation-value")
|
|
89
87
|
.not(".missing-annotation")
|
|
90
|
-
.each($annotation => {
|
|
91
|
-
cy.wrap($annotation)
|
|
92
|
-
|
|
93
|
-
cy.wrap($annotation)
|
|
94
|
-
.click();
|
|
95
|
-
cy.wrap($annotation)
|
|
96
|
-
.should("have.class", "clicked-ann");
|
|
88
|
+
.each(($annotation) => {
|
|
89
|
+
cy.wrap($annotation).should("not.have.class", "clicked-ann");
|
|
90
|
+
cy.wrap($annotation).click();
|
|
91
|
+
cy.wrap($annotation).should("have.class", "clicked-ann");
|
|
97
92
|
cy.wait(1000);
|
|
98
93
|
});
|
|
99
94
|
});
|
|
100
95
|
|
|
101
96
|
it("clicks each annotation and shows action buttons", () => {
|
|
102
|
-
cy.getStore("document").then($document => {
|
|
97
|
+
cy.getStore("document").then(($document) => {
|
|
103
98
|
if ($document.annotations.length > 0) {
|
|
104
99
|
cy.get("#document-annotations")
|
|
105
100
|
.find(".label")
|
|
106
101
|
.find(".annotation-row")
|
|
107
102
|
.find(".annotation")
|
|
108
103
|
.each(($row) => {
|
|
109
|
-
cy.wrap($row)
|
|
110
|
-
.find(".annotation-value")
|
|
111
|
-
.click();
|
|
104
|
+
cy.wrap($row).find(".annotation-value").click();
|
|
112
105
|
|
|
113
106
|
cy.get("#document-annotations")
|
|
114
107
|
.find(".label")
|
|
@@ -117,7 +110,6 @@ describe("Document Annotations", () => {
|
|
|
117
110
|
.find(".annotation-save-btn")
|
|
118
111
|
.should("be.visible");
|
|
119
112
|
|
|
120
|
-
|
|
121
113
|
cy.get("#document-annotations")
|
|
122
114
|
.find(".label")
|
|
123
115
|
.find(".annotation-row")
|
|
@@ -138,32 +130,60 @@ describe("Document Annotations", () => {
|
|
|
138
130
|
});
|
|
139
131
|
});
|
|
140
132
|
|
|
141
|
-
it("shows
|
|
142
|
-
cy.getStore("document").then($document => {
|
|
133
|
+
it("shows decline button when hovering annotation", () => {
|
|
134
|
+
cy.getStore("document").then(($document) => {
|
|
143
135
|
if ($document.annotations.length > 0) {
|
|
144
136
|
cy.get("#document-annotations")
|
|
145
137
|
.find(".label")
|
|
146
138
|
.find(".annotation-row")
|
|
147
139
|
.find(".annotation")
|
|
148
140
|
.each(($row) => {
|
|
149
|
-
cy.wrap($row)
|
|
150
|
-
.trigger("mouseover");
|
|
151
|
-
|
|
152
|
-
cy.get("#document-annotations")
|
|
153
|
-
.find(".label")
|
|
154
|
-
.find(".annotation-row")
|
|
155
|
-
.find(".action-buttons")
|
|
156
|
-
.find(".decline-button-container")
|
|
157
|
-
.should("be.visible");
|
|
141
|
+
cy.wrap($row).trigger("mouseover");
|
|
158
142
|
|
|
159
143
|
cy.get("#document-annotations")
|
|
160
144
|
.find(".label")
|
|
161
145
|
.find(".annotation-row")
|
|
162
146
|
.find(".action-buttons")
|
|
163
|
-
.find(".
|
|
147
|
+
.find(".decline-btn")
|
|
164
148
|
.should("be.visible");
|
|
149
|
+
cy.wait(500);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
165
154
|
|
|
166
|
-
|
|
155
|
+
it("shows accept button when hovering annotation that is not accepted", () => {
|
|
156
|
+
cy.getStore("document").then(($document) => {
|
|
157
|
+
if ($document.annotations.length > 0) {
|
|
158
|
+
cy.get("#document-annotations")
|
|
159
|
+
.find(".label")
|
|
160
|
+
.find(".annotation-row")
|
|
161
|
+
.find(".annotation")
|
|
162
|
+
.each(($row) => {
|
|
163
|
+
cy.wrap($row).trigger("mouseover");
|
|
164
|
+
|
|
165
|
+
const annotationId = $row.attr("id");
|
|
166
|
+
const annotation = $document.annotations.find(
|
|
167
|
+
(ann) => ann.id === annotationId
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
if (annotation) {
|
|
171
|
+
cy.gettersStore().then(($getters) => {
|
|
172
|
+
if (
|
|
173
|
+
$getters["document/accepted"](annotation) ||
|
|
174
|
+
$getters["document/created"](annotation)
|
|
175
|
+
) {
|
|
176
|
+
cy.get("#document-annotations")
|
|
177
|
+
.find(".label")
|
|
178
|
+
.find(".annotation-row")
|
|
179
|
+
.find(".action-buttons")
|
|
180
|
+
.find(".accept-btn")
|
|
181
|
+
.should("be.visible");
|
|
182
|
+
|
|
183
|
+
cy.wait(500);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
167
187
|
});
|
|
168
188
|
}
|
|
169
189
|
});
|
|
@@ -179,8 +199,7 @@ describe("Document Annotations", () => {
|
|
|
179
199
|
if ($annotation.hasClass("missing-annotation")) {
|
|
180
200
|
return;
|
|
181
201
|
} else {
|
|
182
|
-
cy.wrap($annotation)
|
|
183
|
-
.click();
|
|
202
|
+
cy.wrap($annotation).click();
|
|
184
203
|
|
|
185
204
|
cy.get("#document-annotations")
|
|
186
205
|
.find(".label")
|
|
@@ -209,8 +228,7 @@ describe("Document Annotations", () => {
|
|
|
209
228
|
.find(".annotation-value")
|
|
210
229
|
.not(".missing-annotation")
|
|
211
230
|
.each(($annotation) => {
|
|
212
|
-
cy.wrap($annotation)
|
|
213
|
-
.trigger("mouseover");
|
|
231
|
+
cy.wrap($annotation).trigger("mouseover");
|
|
214
232
|
|
|
215
233
|
cy.get("#document-annotations")
|
|
216
234
|
.find(".label")
|
|
@@ -231,8 +249,7 @@ describe("Document Annotations", () => {
|
|
|
231
249
|
.find(".annotation-value")
|
|
232
250
|
.not(".missing-annotation")
|
|
233
251
|
.each(($annotation) => {
|
|
234
|
-
cy.wrap($annotation)
|
|
235
|
-
.trigger("mouseover");
|
|
252
|
+
cy.wrap($annotation).trigger("mouseover");
|
|
236
253
|
|
|
237
254
|
cy.get("#document-annotations")
|
|
238
255
|
.find(".label")
|
|
@@ -242,8 +259,7 @@ describe("Document Annotations", () => {
|
|
|
242
259
|
.find(".missing-btn")
|
|
243
260
|
.click();
|
|
244
261
|
|
|
245
|
-
cy.wrap($annotation)
|
|
246
|
-
.trigger("mouseleave");
|
|
262
|
+
cy.wrap($annotation).trigger("mouseleave");
|
|
247
263
|
|
|
248
264
|
cy.wait(1000);
|
|
249
265
|
});
|
|
@@ -252,13 +268,12 @@ describe("Document Annotations", () => {
|
|
|
252
268
|
.find(".label")
|
|
253
269
|
.find(".annotation-row")
|
|
254
270
|
.find(".empty-annotation")
|
|
255
|
-
.then($elements => {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
});
|
|
271
|
+
.then(($elements) => {
|
|
272
|
+
cy.getStore("document").then(($document) => {
|
|
273
|
+
expect($document.missingAnnotations).to.have.lengthOf(
|
|
274
|
+
$elements.length
|
|
275
|
+
);
|
|
276
|
+
});
|
|
262
277
|
});
|
|
263
278
|
});
|
|
264
279
|
|
|
@@ -269,8 +284,7 @@ describe("Document Annotations", () => {
|
|
|
269
284
|
.find(".empty-annotation")
|
|
270
285
|
.find(".missing-annotation")
|
|
271
286
|
.each(($annotation) => {
|
|
272
|
-
cy.wrap($annotation)
|
|
273
|
-
.trigger("mouseover");
|
|
287
|
+
cy.wrap($annotation).trigger("mouseover");
|
|
274
288
|
|
|
275
289
|
cy.get("#document-annotations")
|
|
276
290
|
.find(".label")
|
|
@@ -279,8 +293,7 @@ describe("Document Annotations", () => {
|
|
|
279
293
|
.find(".restore-btn")
|
|
280
294
|
.click();
|
|
281
295
|
|
|
282
|
-
cy.wrap($annotation)
|
|
283
|
-
.trigger("mouseleave");
|
|
296
|
+
cy.wrap($annotation).trigger("mouseleave");
|
|
284
297
|
|
|
285
298
|
cy.wait(1000);
|
|
286
299
|
});
|
|
@@ -301,10 +314,11 @@ describe("Document Annotations", () => {
|
|
|
301
314
|
.then(($element) => {
|
|
302
315
|
const annotationId = $element[0].id;
|
|
303
316
|
|
|
304
|
-
cy.intercept(
|
|
317
|
+
cy.intercept("PATCH", `**/annotations/${annotationId}/`).as(
|
|
318
|
+
"updateAnnotation"
|
|
319
|
+
);
|
|
305
320
|
|
|
306
|
-
cy.wrap($element)
|
|
307
|
-
.trigger("mouseover");
|
|
321
|
+
cy.wrap($element).trigger("mouseover");
|
|
308
322
|
|
|
309
323
|
cy.wait(1000);
|
|
310
324
|
|
|
@@ -315,11 +329,13 @@ describe("Document Annotations", () => {
|
|
|
315
329
|
.find(".annotation-accept-btn")
|
|
316
330
|
.click();
|
|
317
331
|
|
|
318
|
-
cy.wait("@updateAnnotation")
|
|
332
|
+
cy.wait("@updateAnnotation")
|
|
333
|
+
.its("response.statusCode")
|
|
334
|
+
.should("eq", 200);
|
|
319
335
|
});
|
|
320
336
|
});
|
|
321
337
|
|
|
322
|
-
it("gets
|
|
338
|
+
it("gets successful response from the API when declining annotation", () => {
|
|
323
339
|
cy.get("#document-annotations")
|
|
324
340
|
.find(".label")
|
|
325
341
|
.find(".annotation-row")
|
|
@@ -328,10 +344,11 @@ describe("Document Annotations", () => {
|
|
|
328
344
|
.then(($element) => {
|
|
329
345
|
const annotationId = $element[0].id;
|
|
330
346
|
|
|
331
|
-
cy.intercept(
|
|
347
|
+
cy.intercept("DELETE", `**/annotations/${annotationId}/`).as(
|
|
348
|
+
"deleteAnnotation"
|
|
349
|
+
);
|
|
332
350
|
|
|
333
|
-
cy.wrap($element)
|
|
334
|
-
.trigger("mouseover");
|
|
351
|
+
cy.wrap($element).trigger("mouseover");
|
|
335
352
|
|
|
336
353
|
cy.wait(1000);
|
|
337
354
|
|
|
@@ -342,7 +359,9 @@ describe("Document Annotations", () => {
|
|
|
342
359
|
.find(".decline-btn")
|
|
343
360
|
.click();
|
|
344
361
|
|
|
345
|
-
cy.wait("@deleteAnnotation")
|
|
362
|
+
cy.wait("@deleteAnnotation")
|
|
363
|
+
.its("response.statusCode")
|
|
364
|
+
.should("eq", 204);
|
|
346
365
|
});
|
|
347
366
|
});
|
|
348
367
|
|
|
@@ -353,10 +372,11 @@ describe("Document Annotations", () => {
|
|
|
353
372
|
.find(".empty-annotation")
|
|
354
373
|
.first()
|
|
355
374
|
.then(($element) => {
|
|
356
|
-
cy.intercept(
|
|
375
|
+
cy.intercept("POST", `**/missing-annotations/`).as(
|
|
376
|
+
"addMissingAnnotations"
|
|
377
|
+
);
|
|
357
378
|
|
|
358
|
-
cy.wrap($element)
|
|
359
|
-
.trigger("mouseover");
|
|
379
|
+
cy.wrap($element).trigger("mouseover");
|
|
360
380
|
|
|
361
381
|
cy.wait(1000);
|
|
362
382
|
|
|
@@ -367,7 +387,9 @@ describe("Document Annotations", () => {
|
|
|
367
387
|
.find(".missing-btn")
|
|
368
388
|
.click();
|
|
369
389
|
|
|
370
|
-
cy.wait("@addMissingAnnotations")
|
|
390
|
+
cy.wait("@addMissingAnnotations")
|
|
391
|
+
.its("response.statusCode")
|
|
392
|
+
.should("eq", 201);
|
|
371
393
|
});
|
|
372
394
|
});
|
|
373
395
|
|
|
@@ -379,13 +401,14 @@ describe("Document Annotations", () => {
|
|
|
379
401
|
.find(".missing-annotation")
|
|
380
402
|
.first()
|
|
381
403
|
.then(($element) => {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
404
|
+
cy.getStore("document").then(($document) => {
|
|
405
|
+
cy.intercept(
|
|
406
|
+
"DELETE",
|
|
407
|
+
`**/missing-annotations/${$document.missingAnnotations[0].id}/`
|
|
408
|
+
).as("deleteMissingAnnotation");
|
|
385
409
|
});
|
|
386
410
|
|
|
387
|
-
cy.wrap($element)
|
|
388
|
-
.trigger("mouseover");
|
|
411
|
+
cy.wrap($element).trigger("mouseover");
|
|
389
412
|
|
|
390
413
|
cy.wait(1000);
|
|
391
414
|
|
|
@@ -396,14 +419,16 @@ describe("Document Annotations", () => {
|
|
|
396
419
|
.find(".restore-btn")
|
|
397
420
|
.click();
|
|
398
421
|
|
|
399
|
-
cy.wait("@deleteMissingAnnotation")
|
|
422
|
+
cy.wait("@deleteMissingAnnotation")
|
|
423
|
+
.its("response.statusCode")
|
|
424
|
+
.should("eq", 204);
|
|
400
425
|
});
|
|
401
426
|
});
|
|
402
427
|
|
|
403
428
|
it("shows details regarding translated strings if they are enabled for the project", () => {
|
|
404
|
-
cy.getStore("project").then($project => {
|
|
429
|
+
cy.getStore("project").then(($project) => {
|
|
405
430
|
if ($project.translationsEnabled) {
|
|
406
|
-
cy.getStore("document").then($document => {
|
|
431
|
+
cy.getStore("document").then(($document) => {
|
|
407
432
|
if ($document.annotations.length > 0) {
|
|
408
433
|
cy.get("#document-annotations")
|
|
409
434
|
.find(".labels")
|
|
@@ -439,4 +464,4 @@ describe("Document Annotations", () => {
|
|
|
439
464
|
}
|
|
440
465
|
});
|
|
441
466
|
});
|
|
442
|
-
});
|
|
467
|
+
});
|
|
@@ -72,11 +72,15 @@
|
|
|
72
72
|
}}
|
|
73
73
|
</div>
|
|
74
74
|
<div
|
|
75
|
-
v-if="
|
|
75
|
+
v-if="
|
|
76
|
+
!publicView &&
|
|
77
|
+
!isDocumentReviewed &&
|
|
78
|
+
annotationSet.labels.length !== 0
|
|
79
|
+
"
|
|
76
80
|
class="labelset-action-buttons"
|
|
77
81
|
>
|
|
78
82
|
<AnnotationSetActionButtons
|
|
79
|
-
|
|
83
|
+
:is-placeholder="annotationSetsAccordion[indexGroup] === false"
|
|
80
84
|
:number-of-empty-labels-in-annotation-set="
|
|
81
85
|
emptyLabels(annotationSet).length
|
|
82
86
|
"
|
|
@@ -213,11 +217,53 @@ export default {
|
|
|
213
217
|
}
|
|
214
218
|
},
|
|
215
219
|
annotationSets(newAnnotationSets, oldAnnotationSets) {
|
|
220
|
+
this.loadAccordions(newAnnotationSets, oldAnnotationSets);
|
|
221
|
+
},
|
|
222
|
+
sidebarAnnotationSelected(annotation) {
|
|
223
|
+
if (annotation) {
|
|
224
|
+
const annotationSet = this.annotationSetOfAnnotation(annotation);
|
|
225
|
+
if (annotationSet) {
|
|
226
|
+
const index = this.annotationSets.findIndex(
|
|
227
|
+
(annotationSetToFind) => annotationSetToFind.id === annotationSet.id
|
|
228
|
+
);
|
|
229
|
+
const newAnnotationSetsAccordion = [...this.annotationSetsAccordion];
|
|
230
|
+
newAnnotationSetsAccordion[index] = true;
|
|
231
|
+
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
created() {
|
|
237
|
+
window.addEventListener("keydown", this.keyDownHandler);
|
|
238
|
+
if (this.annotationSets) {
|
|
239
|
+
this.loadAccordions(this.annotationSets);
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
destroyed() {
|
|
243
|
+
window.removeEventListener("keydown", this.keyDownHandler);
|
|
244
|
+
},
|
|
245
|
+
methods: {
|
|
246
|
+
toggleAccordion(index) {
|
|
247
|
+
const newAnnotationSetsAccordion = [...this.annotationSetsAccordion];
|
|
248
|
+
newAnnotationSetsAccordion[index] = !newAnnotationSetsAccordion[index];
|
|
249
|
+
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
250
|
+
},
|
|
251
|
+
openAllAccordions() {
|
|
252
|
+
const newAnnotationSetsAccordion = [...this.annotationSetsAccordion];
|
|
253
|
+
newAnnotationSetsAccordion.forEach((_, index) => {
|
|
254
|
+
newAnnotationSetsAccordion[index] = true;
|
|
255
|
+
});
|
|
256
|
+
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
257
|
+
},
|
|
258
|
+
loadAccordions(newAnnotationSets, oldAnnotationSets = null) {
|
|
216
259
|
if (newAnnotationSets) {
|
|
217
260
|
const newAnnotationSetsAccordion = [];
|
|
218
261
|
const annotationSetsOpened = [];
|
|
219
262
|
const annotationSetsCreated = [];
|
|
220
|
-
|
|
263
|
+
|
|
264
|
+
const isFirstTime = oldAnnotationSets === null;
|
|
265
|
+
|
|
266
|
+
if (!isFirstTime) {
|
|
221
267
|
// when annotation sets changed, restore old state
|
|
222
268
|
// and check if new ones were created to be open by default
|
|
223
269
|
|
|
@@ -247,8 +293,10 @@ export default {
|
|
|
247
293
|
newAnnotationSet.id &&
|
|
248
294
|
newAnnotationSet.id === annotationSetOpened.id
|
|
249
295
|
);
|
|
250
|
-
|
|
251
|
-
|
|
296
|
+
if (isFirstTime && index === 0) {
|
|
297
|
+
// open first one by default
|
|
298
|
+
newAnnotationSetsAccordion[index] = true;
|
|
299
|
+
} else if (wasOpen) {
|
|
252
300
|
newAnnotationSetsAccordion[index] = wasOpen !== undefined;
|
|
253
301
|
} else {
|
|
254
302
|
const wasCreated = annotationSetsCreated.find(
|
|
@@ -263,44 +311,10 @@ export default {
|
|
|
263
311
|
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
264
312
|
}
|
|
265
313
|
},
|
|
266
|
-
sidebarAnnotationSelected(annotation) {
|
|
267
|
-
if (annotation) {
|
|
268
|
-
const annotationSet = this.annotationSetOfAnnotation(annotation);
|
|
269
|
-
if (annotationSet) {
|
|
270
|
-
const index = this.annotationSets.findIndex(
|
|
271
|
-
(annotationSetToFind) => annotationSetToFind.id === annotationSet.id
|
|
272
|
-
);
|
|
273
|
-
const newAnnotationSetsAccordion = [...this.annotationSetsAccordion];
|
|
274
|
-
newAnnotationSetsAccordion[index] = true;
|
|
275
|
-
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
},
|
|
280
|
-
created() {
|
|
281
|
-
window.addEventListener("keydown", this.keyDownHandler);
|
|
282
|
-
},
|
|
283
|
-
destroyed() {
|
|
284
|
-
window.removeEventListener("keydown", this.keyDownHandler);
|
|
285
|
-
},
|
|
286
|
-
methods: {
|
|
287
|
-
toggleAccordion(index) {
|
|
288
|
-
const newAnnotationSetsAccordion = [...this.annotationSetsAccordion];
|
|
289
|
-
newAnnotationSetsAccordion[index] = !newAnnotationSetsAccordion[index];
|
|
290
|
-
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
291
|
-
},
|
|
292
|
-
openAllAccordions() {
|
|
293
|
-
const newAnnotationSetsAccordion = [...this.annotationSetsAccordion];
|
|
294
|
-
newAnnotationSetsAccordion.forEach((_, index) => {
|
|
295
|
-
newAnnotationSetsAccordion[index] = true;
|
|
296
|
-
});
|
|
297
|
-
this.annotationSetsAccordion = newAnnotationSetsAccordion;
|
|
298
|
-
},
|
|
299
314
|
annotationSetHasAnnotations(annotationSet) {
|
|
300
315
|
const found = annotationSet.labels.find(
|
|
301
316
|
(label) => label.annotations.length > 0
|
|
302
317
|
);
|
|
303
|
-
|
|
304
318
|
return found;
|
|
305
319
|
},
|
|
306
320
|
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
:key="'ann' + annotation.id + '-' + index"
|
|
73
73
|
:config="annotationRect(bbox, annotation.id)"
|
|
74
74
|
@click="handleFocusedAnnotation(annotation)"
|
|
75
|
-
@mouseenter="onElementEnter
|
|
75
|
+
@mouseenter="onElementEnter"
|
|
76
76
|
@mouseleave="onElementLeave"
|
|
77
77
|
/>
|
|
78
78
|
</template>
|
|
@@ -284,7 +284,6 @@ export default {
|
|
|
284
284
|
"isDocumentReadyToBeReviewed",
|
|
285
285
|
"entitiesOnSelection",
|
|
286
286
|
"isDocumentReviewed",
|
|
287
|
-
"labelOfAnnotation",
|
|
288
287
|
]),
|
|
289
288
|
},
|
|
290
289
|
watch: {
|
|
@@ -447,7 +446,7 @@ export default {
|
|
|
447
446
|
}
|
|
448
447
|
},
|
|
449
448
|
|
|
450
|
-
onElementEnter(
|
|
449
|
+
onElementEnter() {
|
|
451
450
|
if (
|
|
452
451
|
!this.categorizeModalIsActive &&
|
|
453
452
|
!this.publicView &&
|
|
@@ -456,23 +455,10 @@ export default {
|
|
|
456
455
|
) {
|
|
457
456
|
this.$refs.stage.$el.style.cursor = "pointer";
|
|
458
457
|
}
|
|
459
|
-
|
|
460
|
-
if (annotation) {
|
|
461
|
-
const label = this.labelOfAnnotation(annotation);
|
|
462
|
-
if (label) {
|
|
463
|
-
this.$store.dispatch("document/setDocumentAnnotationSelected", {
|
|
464
|
-
annotation,
|
|
465
|
-
label,
|
|
466
|
-
span,
|
|
467
|
-
scrollTo: false,
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
458
|
},
|
|
472
459
|
|
|
473
460
|
onElementLeave() {
|
|
474
461
|
this.$refs.stage.$el.style.cursor = "inherit";
|
|
475
|
-
this.$store.dispatch("document/disableDocumentAnnotationSelected");
|
|
476
462
|
},
|
|
477
463
|
|
|
478
464
|
/**
|
package/src/locales/de.json
CHANGED
|
@@ -89,6 +89,8 @@
|
|
|
89
89
|
"annotations_pending": "Ausstehende Annotationen",
|
|
90
90
|
"annotations_accepted": "Akzeptierte Annotationen",
|
|
91
91
|
"mark_all_missing": "Alle leeren als fehlend markieren",
|
|
92
|
+
"missing_counter": "Fehlen",
|
|
93
|
+
"pending_counter": "Ausstehende",
|
|
92
94
|
"no_labels_to_choose": "Keine Labels",
|
|
93
95
|
"accept_group": "Alle akzeptieren",
|
|
94
96
|
"use_your_keyboard": "Benutze deine Tastatur",
|
package/src/locales/en.json
CHANGED
|
@@ -89,6 +89,8 @@
|
|
|
89
89
|
"annotations_pending": "pending",
|
|
90
90
|
"annotations_accepted": "accepted",
|
|
91
91
|
"mark_all_missing": "Mark all empty as Missing",
|
|
92
|
+
"missing_counter": "Missing",
|
|
93
|
+
"pending_counter": "Pending",
|
|
92
94
|
"no_labels_to_choose": "No Labels",
|
|
93
95
|
"accept_group": "Accept all",
|
|
94
96
|
"new_ann_set_title": "New annotation set",
|
package/src/locales/es.json
CHANGED
|
@@ -89,6 +89,8 @@
|
|
|
89
89
|
"annotations_pending": "pendientes",
|
|
90
90
|
"annotations_accepted": "aceptadas",
|
|
91
91
|
"mark_all_missing": "Marcar todas las anotaciones vacías como Faltantes",
|
|
92
|
+
"missing_counter": "Faltantes",
|
|
93
|
+
"pending_counter": "Pendientes",
|
|
92
94
|
"no_labels_to_choose": "Sin etiquetas",
|
|
93
95
|
"accept_group": "Aceptar todas",
|
|
94
96
|
"use_your_keyboard": "Use su teclado",
|
package/src/store/document.js
CHANGED
|
@@ -269,28 +269,6 @@ const getters = {
|
|
|
269
269
|
return foundAnnotationSet;
|
|
270
270
|
},
|
|
271
271
|
|
|
272
|
-
/* Get label for a given annotation */
|
|
273
|
-
labelOfAnnotation: (state) => (annotationToFind) => {
|
|
274
|
-
let foundLabel = null;
|
|
275
|
-
state.annotationSets.forEach((annotationSet) => {
|
|
276
|
-
annotationSet.labels.forEach((label) => {
|
|
277
|
-
label.annotations.forEach((annotation) => {
|
|
278
|
-
if (annotation.id === annotationToFind.id) {
|
|
279
|
-
foundLabel = label;
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
if (foundLabel) {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
if (foundLabel) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
return foundLabel;
|
|
292
|
-
},
|
|
293
|
-
|
|
294
272
|
/* Process annotations and extract labels and sets */
|
|
295
273
|
processAnnotationSets: (state, getters) => (annotationSets) => {
|
|
296
274
|
// group annotations for sidebar
|