@konfuzio/document-validation-ui 0.1.14-dev.1 → 0.1.14-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/assets/scss/document_annotations.scss +3 -3
- package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +4 -4
- package/src/components/DocumentAnnotations/AnnotationContent.vue +1 -0
- package/src/components/DocumentAnnotations/AnnotationDetails.vue +1 -1
- package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +2 -2
- package/src/components/DocumentAnnotations/DocumentAnnotations.cy.js +295 -0
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +6 -6
- package/src/components/DocumentAnnotations/DocumentLabel.vue +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import "./imports.scss";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
#labels-sidebar {
|
|
4
4
|
font-family: $font-family;
|
|
5
5
|
flex: 1;
|
|
6
6
|
background-color: $background;
|
|
@@ -426,10 +426,10 @@
|
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
.missing-decline-button-container {
|
|
429
|
+
.missing-button-container, .decline-button-container {
|
|
430
430
|
background-color: transparent;
|
|
431
431
|
|
|
432
|
-
.missing-decline-btn {
|
|
432
|
+
.missing-btn, .decline-btn {
|
|
433
433
|
color: $grey-blue !important;
|
|
434
434
|
font-size: 14px !important;
|
|
435
435
|
font-weight: 500;
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
!publicView &&
|
|
42
42
|
!isDocumentReviewed
|
|
43
43
|
"
|
|
44
|
-
class="
|
|
44
|
+
class="decline-button-container"
|
|
45
45
|
>
|
|
46
46
|
<b-button
|
|
47
47
|
type="is-ghost"
|
|
48
|
-
class="
|
|
48
|
+
class="decline-btn"
|
|
49
49
|
@click.stop="decline"
|
|
50
50
|
>
|
|
51
51
|
{{ $t("decline") }}
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
!publicView &&
|
|
80
80
|
!isDocumentReviewed
|
|
81
81
|
"
|
|
82
|
-
class="missing-
|
|
82
|
+
class="missing-button-container"
|
|
83
83
|
>
|
|
84
84
|
<b-button
|
|
85
85
|
type="is-ghost"
|
|
86
|
-
class="missing-
|
|
86
|
+
class="missing-btn"
|
|
87
87
|
@click.stop="markAsMissing"
|
|
88
88
|
>
|
|
89
89
|
{{ $t("missing_annotation") }}
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
>{{ Math.floor(confidence(annotation) * 100) / 100 }}</span
|
|
85
85
|
>
|
|
86
86
|
</div>
|
|
87
|
-
<div v-if="!publicView" class="revision"
|
|
87
|
+
<div v-if="!publicView" class="revision">
|
|
88
88
|
<div class="detail-icons">
|
|
89
89
|
<div v-if="created(annotation) || edited(annotation)">
|
|
90
90
|
<div
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
<!-- mark all empty labels as missing -->
|
|
4
4
|
<div
|
|
5
5
|
v-if="!publicView && !isDocumentReviewed"
|
|
6
|
-
class="missing-
|
|
6
|
+
class="missing-button-container all-missing"
|
|
7
7
|
@mouseenter="mouseenterAnnotationSet('missing')"
|
|
8
8
|
@mouseleave="mouseleaveAnnotationSet"
|
|
9
9
|
>
|
|
10
10
|
<b-button
|
|
11
11
|
type="is-ghost"
|
|
12
|
-
class="missing-
|
|
12
|
+
class="missing-btn all-missing-btn"
|
|
13
13
|
:disabled="numberOfEmptyLabelsInAnnotationSet === 0"
|
|
14
14
|
@click.stop="markAllAsMissing"
|
|
15
15
|
>
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import DocumentAnnotations from "./DocumentAnnotations.vue";
|
|
2
|
+
|
|
3
|
+
describe("Document Annotations", () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cy.fetchDocument();
|
|
6
|
+
cy.dispatchAction("document", "setPublicView", false);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("shows loading when there are no annotation sets loaded yet or when loading the data", () => {
|
|
10
|
+
cy.mount(DocumentAnnotations);
|
|
11
|
+
cy.dispatchAction("document", "setAnnotationSets", null);
|
|
12
|
+
cy.get("#labels-sidebar")
|
|
13
|
+
.find(".document-annotations-loading")
|
|
14
|
+
.its("length")
|
|
15
|
+
.should("equal", 1);
|
|
16
|
+
|
|
17
|
+
cy.mount(DocumentAnnotations);
|
|
18
|
+
cy.dispatchAction("document", "startLoading");
|
|
19
|
+
cy.get("#labels-sidebar")
|
|
20
|
+
.find(".document-annotations-loading")
|
|
21
|
+
.its("length")
|
|
22
|
+
.should("equal", 1);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("shows 3 rows of loading annotation sets", () => {
|
|
26
|
+
cy.mount(DocumentAnnotations);
|
|
27
|
+
cy.dispatchAction("document", "startLoading");
|
|
28
|
+
cy.get("#labels-sidebar")
|
|
29
|
+
.find(".loading-annotation-set")
|
|
30
|
+
.its("length")
|
|
31
|
+
.should("equal", 3);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("shows all annotation sets", () => {
|
|
35
|
+
cy.mount(DocumentAnnotations);
|
|
36
|
+
cy.get("#labels-sidebar")
|
|
37
|
+
.find(".annotation-set-group")
|
|
38
|
+
.then((elements) => {
|
|
39
|
+
cy.storeState("document", "annotationSets")
|
|
40
|
+
.its("length")
|
|
41
|
+
.should("equal", elements.length);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("shows the empty state if there are no annotation sets", () => {
|
|
46
|
+
cy.mount(DocumentAnnotations);
|
|
47
|
+
cy.dispatchAction("document", "setAnnotationSets", []);
|
|
48
|
+
|
|
49
|
+
cy.get("#labels-sidebar")
|
|
50
|
+
.find(".empty-annotation-sets")
|
|
51
|
+
.find(".empty-container")
|
|
52
|
+
.find(".title")
|
|
53
|
+
.should('be.visible')
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("shows no annotation set action buttons if the document is read only", () => {
|
|
57
|
+
cy.mount(DocumentAnnotations);
|
|
58
|
+
cy.dispatchAction("document", "setPublicView", true);
|
|
59
|
+
|
|
60
|
+
cy.get("#labels-sidebar")
|
|
61
|
+
.find(".labelset-action-buttons")
|
|
62
|
+
.should("not.be.visible");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("renders action buttons for the annotation sets and annotations", () => {
|
|
66
|
+
cy.mount(DocumentAnnotations);
|
|
67
|
+
|
|
68
|
+
cy.get("#labels-sidebar")
|
|
69
|
+
.find(".labelset-action-buttons")
|
|
70
|
+
.should("be.visible");
|
|
71
|
+
|
|
72
|
+
cy.get("#labels-sidebar")
|
|
73
|
+
.find(".label")
|
|
74
|
+
.find(".annotation-row")
|
|
75
|
+
.find(".buttons-container")
|
|
76
|
+
.should("exist");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("does not show annotations action buttons by default", () => {
|
|
80
|
+
cy.mount(DocumentAnnotations);
|
|
81
|
+
|
|
82
|
+
cy.get("#labels-sidebar")
|
|
83
|
+
.find(".label")
|
|
84
|
+
.find(".annotation-row")
|
|
85
|
+
.find(".buttons-container")
|
|
86
|
+
.should("not.be.visible");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("clicks each annotation and empty annotation and checks that it is in edit mode", () => {
|
|
90
|
+
cy.mount(DocumentAnnotations);
|
|
91
|
+
|
|
92
|
+
cy.get("#labels-sidebar")
|
|
93
|
+
.find(".label")
|
|
94
|
+
.find(".annotation-row")
|
|
95
|
+
.find(".annotation-value")
|
|
96
|
+
.not(".missing-annotation")
|
|
97
|
+
.each($annotation => {
|
|
98
|
+
cy.wrap($annotation)
|
|
99
|
+
.should("not.have.class", "clicked-ann")
|
|
100
|
+
cy.wrap($annotation)
|
|
101
|
+
.click();
|
|
102
|
+
cy.wrap($annotation)
|
|
103
|
+
.should("have.class", "clicked-ann")
|
|
104
|
+
cy.wait(1000);
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("clicks each annotation and shows action buttons", () => {
|
|
109
|
+
cy.mount(DocumentAnnotations);
|
|
110
|
+
|
|
111
|
+
cy.get("#labels-sidebar")
|
|
112
|
+
.find(".label")
|
|
113
|
+
.find(".annotation-row")
|
|
114
|
+
.find(".annotation")
|
|
115
|
+
.each(($row) => {
|
|
116
|
+
cy.wrap($row)
|
|
117
|
+
.find(".annotation-value")
|
|
118
|
+
.click();
|
|
119
|
+
|
|
120
|
+
cy.get("#labels-sidebar")
|
|
121
|
+
.find(".label")
|
|
122
|
+
.find(".annotation-row")
|
|
123
|
+
.find(".action-buttons")
|
|
124
|
+
.find(".annotation-save-btn")
|
|
125
|
+
.should("be.visible")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
cy.get("#labels-sidebar")
|
|
129
|
+
.find(".label")
|
|
130
|
+
.find(".annotation-row")
|
|
131
|
+
.find(".action-buttons")
|
|
132
|
+
.find(".annotation-cancel-btn")
|
|
133
|
+
.should("be.visible")
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
cy.get("#labels-sidebar")
|
|
137
|
+
.find(".label")
|
|
138
|
+
.find(".annotation-row")
|
|
139
|
+
.find(".action-buttons")
|
|
140
|
+
.find(".annotation-cancel-btn")
|
|
141
|
+
.click();
|
|
142
|
+
|
|
143
|
+
cy.wait(1000);
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("shows accept and decline buttons when hovering annotation", () => {
|
|
148
|
+
cy.mount(DocumentAnnotations);
|
|
149
|
+
|
|
150
|
+
cy.get("#labels-sidebar")
|
|
151
|
+
.find(".label")
|
|
152
|
+
.find(".annotation-row")
|
|
153
|
+
.find(".not-revised")
|
|
154
|
+
.each(($row) => {
|
|
155
|
+
cy.wrap($row)
|
|
156
|
+
.trigger("mouseover");
|
|
157
|
+
|
|
158
|
+
cy.get("#labels-sidebar")
|
|
159
|
+
.find(".label")
|
|
160
|
+
.find(".annotation-row")
|
|
161
|
+
.find(".action-buttons")
|
|
162
|
+
.find(".decline-button-container")
|
|
163
|
+
.should("be.visible");
|
|
164
|
+
|
|
165
|
+
cy.get("#labels-sidebar")
|
|
166
|
+
.find(".label")
|
|
167
|
+
.find(".annotation-row")
|
|
168
|
+
.find(".action-buttons")
|
|
169
|
+
.find(".annotation-accept-btn")
|
|
170
|
+
.should("be.visible");
|
|
171
|
+
|
|
172
|
+
cy.wait(1000);
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("clicks each empty annotation and shows action buttons", () => {
|
|
177
|
+
cy.mount(DocumentAnnotations);
|
|
178
|
+
|
|
179
|
+
cy.get("#labels-sidebar")
|
|
180
|
+
.find(".label")
|
|
181
|
+
.find(".annotation-row")
|
|
182
|
+
.find(".empty-annotation")
|
|
183
|
+
.find(".annotation-value")
|
|
184
|
+
.each(($annotation) => {
|
|
185
|
+
if ($annotation.hasClass("missing-annotation")) {
|
|
186
|
+
return;
|
|
187
|
+
} else {
|
|
188
|
+
cy.wrap($annotation)
|
|
189
|
+
.click();
|
|
190
|
+
|
|
191
|
+
cy.get("#labels-sidebar")
|
|
192
|
+
.find(".label")
|
|
193
|
+
.find(".annotation-row")
|
|
194
|
+
.find(".action-buttons")
|
|
195
|
+
.find(".annotation-cancel-btn")
|
|
196
|
+
.should("be.visible")
|
|
197
|
+
|
|
198
|
+
cy.get("#labels-sidebar")
|
|
199
|
+
.find(".label")
|
|
200
|
+
.find(".annotation-row")
|
|
201
|
+
.find(".action-buttons")
|
|
202
|
+
.find(".annotation-cancel-btn")
|
|
203
|
+
.click();
|
|
204
|
+
|
|
205
|
+
cy.wait(1000);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("shows mark as missing button when hovering empty annotation", () => {
|
|
211
|
+
cy.mount(DocumentAnnotations);
|
|
212
|
+
|
|
213
|
+
cy.get("#labels-sidebar")
|
|
214
|
+
.find(".label")
|
|
215
|
+
.find(".annotation-row")
|
|
216
|
+
.find(".empty-annotation")
|
|
217
|
+
.find(".annotation-value")
|
|
218
|
+
.not(".missing-annotation")
|
|
219
|
+
.each(($annotation) => {
|
|
220
|
+
cy.wrap($annotation)
|
|
221
|
+
.trigger("mouseover");
|
|
222
|
+
|
|
223
|
+
cy.get("#labels-sidebar")
|
|
224
|
+
.find(".label")
|
|
225
|
+
.find(".annotation-row")
|
|
226
|
+
.find(".action-buttons")
|
|
227
|
+
.find(".missing-button-container")
|
|
228
|
+
.should("be.visible");
|
|
229
|
+
|
|
230
|
+
cy.wait(1000);
|
|
231
|
+
})
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it("marks empty annotation as missing", () => {
|
|
235
|
+
cy.mount(DocumentAnnotations);
|
|
236
|
+
|
|
237
|
+
cy.get("#labels-sidebar")
|
|
238
|
+
.find(".label")
|
|
239
|
+
.find(".annotation-row")
|
|
240
|
+
.find(".empty-annotation")
|
|
241
|
+
.find(".annotation-value")
|
|
242
|
+
.not(".missing-annotation")
|
|
243
|
+
.each(($annotation, index) => {
|
|
244
|
+
cy.wrap($annotation)
|
|
245
|
+
.trigger("mouseover");
|
|
246
|
+
|
|
247
|
+
cy.get("#labels-sidebar")
|
|
248
|
+
.find(".label")
|
|
249
|
+
.find(".annotation-row")
|
|
250
|
+
.find(".action-buttons")
|
|
251
|
+
.find(".missing-button-container")
|
|
252
|
+
.find(".missing-btn")
|
|
253
|
+
.click();
|
|
254
|
+
|
|
255
|
+
cy.storeState("document", "missingAnnotations").its("length").should("not.eq", 0);
|
|
256
|
+
|
|
257
|
+
cy.wrap($annotation)
|
|
258
|
+
.trigger("mouseleave");
|
|
259
|
+
|
|
260
|
+
cy.wait(1000);
|
|
261
|
+
})
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
it("restores empty annotation", () => {
|
|
265
|
+
cy.mount(DocumentAnnotations);
|
|
266
|
+
|
|
267
|
+
cy.get("#labels-sidebar")
|
|
268
|
+
.find(".label")
|
|
269
|
+
.find(".annotation-row")
|
|
270
|
+
.find(".empty-annotation")
|
|
271
|
+
.find(".missing-annotation")
|
|
272
|
+
.each(($annotation) => {
|
|
273
|
+
cy.wrap($annotation)
|
|
274
|
+
.trigger("mouseover");
|
|
275
|
+
|
|
276
|
+
cy.get("#labels-sidebar")
|
|
277
|
+
.find(".label")
|
|
278
|
+
.find(".annotation-row")
|
|
279
|
+
.find(".action-buttons")
|
|
280
|
+
.find(".restore-btn")
|
|
281
|
+
.click();
|
|
282
|
+
|
|
283
|
+
cy.wrap($annotation)
|
|
284
|
+
.trigger("mouseleave");
|
|
285
|
+
|
|
286
|
+
cy.wait(1000);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
cy.get("#labels-sidebar")
|
|
290
|
+
.find(".label")
|
|
291
|
+
.find(".annotation-row")
|
|
292
|
+
.find(".empty-annotation")
|
|
293
|
+
.should("not.have.class", "missing-annotation");
|
|
294
|
+
});
|
|
295
|
+
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div id="labels-sidebar">
|
|
3
3
|
<!-- When extracting annotations after editing -->
|
|
4
|
-
<div v-if="recalculatingAnnotations">
|
|
4
|
+
<div v-if="recalculatingAnnotations" class="extracting-data">
|
|
5
5
|
<ExtractingData />
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
8
|
<!-- When document data is still loading -->
|
|
9
|
-
<div v-else-if="!annotationSets || loading">
|
|
10
|
-
<div v-for="n in numberOfLoadingAnnotations" :key="n">
|
|
9
|
+
<div v-else-if="!annotationSets || loading" class="document-annotations-loading">
|
|
10
|
+
<div v-for="n in numberOfLoadingAnnotations" :key="n" class="loading-annotation-set">
|
|
11
11
|
<LoadingAnnotations />
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
<!-- When there's no annotations in the label -->
|
|
16
|
-
<div v-else-if="annotationSets.length === 0">
|
|
16
|
+
<div v-else-if="annotationSets.length === 0" class="empty-annotation-sets">
|
|
17
17
|
<EmptyState />
|
|
18
18
|
</div>
|
|
19
19
|
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}}
|
|
56
56
|
</div>
|
|
57
57
|
<div
|
|
58
|
-
|
|
58
|
+
v-if="annotationSet.labels.length !== 0"
|
|
59
59
|
class="labelset-action-buttons"
|
|
60
60
|
>
|
|
61
61
|
<AnnotationSetActionButtons
|