@konfuzio/document-validation-ui 0.1.30-dev.0 → 0.1.30-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/dist/js/chunk-vendors.js +2 -2
- package/dist/js/chunk-vendors.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/scss/document_annotations.scss +11 -2
- package/src/assets/scss/theme.scss +6 -0
- package/src/components/App.vue +37 -1
- package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +30 -0
- package/src/components/DocumentAnnotations/AnnotationRow.vue +70 -54
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +20 -6
- package/src/components/DocumentAnnotations/DocumentLabel.vue +28 -32
- package/src/components/DocumentDashboard.vue +5 -0
- package/src/components/DocumentModals/AnnotationDeletedModal.vue +38 -0
- package/src/components/DocumentPage/DocumentPage.vue +1 -1
- package/src/icons.js +3 -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 +56 -12
- package/src/utils/utils.js +17 -0
package/package.json
CHANGED
|
@@ -341,7 +341,9 @@
|
|
|
341
341
|
justify-content: space-between;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
&:hover
|
|
344
|
+
&:hover {
|
|
345
|
+
background-color: $grey-hover !important;
|
|
346
|
+
}
|
|
345
347
|
&.selected {
|
|
346
348
|
background-color: $grey-lightest;
|
|
347
349
|
}
|
|
@@ -435,10 +437,17 @@
|
|
|
435
437
|
.action-buttons {
|
|
436
438
|
display: flex;
|
|
437
439
|
gap: 6px;
|
|
438
|
-
|
|
439
440
|
button {
|
|
440
441
|
height: 32px;
|
|
441
442
|
|
|
443
|
+
&.link-button {
|
|
444
|
+
color: $grey-blue;
|
|
445
|
+
padding: 8px;
|
|
446
|
+
.icon {
|
|
447
|
+
vertical-align: middle;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
442
451
|
&.annotation-save-btn {
|
|
443
452
|
cursor: pointer;
|
|
444
453
|
padding: 6px 14px 6px 14px;
|
package/src/components/App.vue
CHANGED
|
@@ -12,7 +12,11 @@ import * as Sentry from "@sentry/vue";
|
|
|
12
12
|
import DocumentDashboard from "./DocumentDashboard";
|
|
13
13
|
import ErrorPage from "./ErrorPage";
|
|
14
14
|
import { DocumentsList } from "./DocumentsList";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
getURLQueryParam,
|
|
17
|
+
getURLPath,
|
|
18
|
+
getURLValueFromHash,
|
|
19
|
+
} from "../utils/utils";
|
|
16
20
|
import { Integrations } from "@sentry/tracing";
|
|
17
21
|
import API from "../api";
|
|
18
22
|
|
|
@@ -88,6 +92,18 @@ export default {
|
|
|
88
92
|
required: false,
|
|
89
93
|
default: false,
|
|
90
94
|
},
|
|
95
|
+
// eslint-disable-next-line vue/prop-name-casing
|
|
96
|
+
annotation: {
|
|
97
|
+
type: String,
|
|
98
|
+
required: false,
|
|
99
|
+
default: "",
|
|
100
|
+
},
|
|
101
|
+
// eslint-disable-next-line vue/prop-name-casing
|
|
102
|
+
annotationSet: {
|
|
103
|
+
type: String,
|
|
104
|
+
required: false,
|
|
105
|
+
default: "",
|
|
106
|
+
},
|
|
91
107
|
},
|
|
92
108
|
computed: {
|
|
93
109
|
...mapState("display", ["pageError"]),
|
|
@@ -150,6 +166,24 @@ export default {
|
|
|
150
166
|
return null;
|
|
151
167
|
}
|
|
152
168
|
},
|
|
169
|
+
annotationId() {
|
|
170
|
+
if (getURLValueFromHash("ann")) {
|
|
171
|
+
return getURLValueFromHash("ann");
|
|
172
|
+
} else if (this.annotation) {
|
|
173
|
+
return this.annotation;
|
|
174
|
+
} else {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
annotationSetId() {
|
|
179
|
+
if (getURLValueFromHash("templ")) {
|
|
180
|
+
return getURLValueFromHash("templ");
|
|
181
|
+
} else if (this.annotationSet) {
|
|
182
|
+
return this.annotationSet;
|
|
183
|
+
} else {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
},
|
|
153
187
|
},
|
|
154
188
|
created() {
|
|
155
189
|
// Sentry config
|
|
@@ -195,6 +229,8 @@ export default {
|
|
|
195
229
|
this.$store.dispatch("display/setReviewFilter", this.reviewFilter),
|
|
196
230
|
this.$store.dispatch("document/setDocId", this.documentId),
|
|
197
231
|
this.$store.dispatch("document/setPublicView", this.isPublicView),
|
|
232
|
+
this.$store.dispatch("document/setAnnotationId", this.annotationId),
|
|
233
|
+
this.$store.dispatch("document/setAnnotationSetId", this.annotationSetId),
|
|
198
234
|
this.$store.dispatch(
|
|
199
235
|
"project/setDocumentsListPath",
|
|
200
236
|
this.documentsListPath
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="action-buttons">
|
|
3
3
|
<!-- loading -->
|
|
4
|
+
<b-button
|
|
5
|
+
v-if="linkBtn"
|
|
6
|
+
type="is-ghost"
|
|
7
|
+
class="link-button"
|
|
8
|
+
@click="copyAnnotationLink"
|
|
9
|
+
>
|
|
10
|
+
<b-tooltip position="is-left" :label="$t('annotation_link')">
|
|
11
|
+
<b-icon size="is-20" icon="link" />
|
|
12
|
+
</b-tooltip>
|
|
13
|
+
</b-button>
|
|
4
14
|
<div v-if="isLoading">
|
|
5
15
|
<b-notification :closable="false" class="loading-background">
|
|
6
16
|
<b-loading :active="isLoading" :is-full-page="false">
|
|
@@ -96,12 +106,17 @@
|
|
|
96
106
|
import { mapGetters, mapState } from "vuex";
|
|
97
107
|
import AcceptedCheckMark from "../../assets/images/AcceptedCheckMark";
|
|
98
108
|
import { TEXT_BREAKPOINT_WIDTH } from "../../constants";
|
|
109
|
+
import { setURLAnnotationHash } from "../../utils/utils";
|
|
99
110
|
export default {
|
|
100
111
|
name: "AnnotationActionButtons",
|
|
101
112
|
components: {
|
|
102
113
|
AcceptedCheckMark,
|
|
103
114
|
},
|
|
104
115
|
props: {
|
|
116
|
+
annotation: {
|
|
117
|
+
type: Object,
|
|
118
|
+
default: null,
|
|
119
|
+
},
|
|
105
120
|
saveBtn: {
|
|
106
121
|
type: Boolean,
|
|
107
122
|
},
|
|
@@ -128,6 +143,10 @@ export default {
|
|
|
128
143
|
type: Boolean,
|
|
129
144
|
required: false,
|
|
130
145
|
},
|
|
146
|
+
linkBtn: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
required: false,
|
|
149
|
+
},
|
|
131
150
|
},
|
|
132
151
|
data() {
|
|
133
152
|
return {
|
|
@@ -155,6 +174,17 @@ export default {
|
|
|
155
174
|
window.removeEventListener("resize", this.resize);
|
|
156
175
|
},
|
|
157
176
|
methods: {
|
|
177
|
+
copyAnnotationLink(event) {
|
|
178
|
+
if (this.annotation) {
|
|
179
|
+
event.stopPropagation();
|
|
180
|
+
this.$store.dispatch("document/setAnnotationId", this.annotation.id);
|
|
181
|
+
navigator.clipboard.writeText(window.location.href);
|
|
182
|
+
this.$buefy.toast.open({
|
|
183
|
+
container: "#app .dv-ui-app-container",
|
|
184
|
+
message: this.$t("copied"),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
},
|
|
158
188
|
resize() {
|
|
159
189
|
this.showText = window.innerWidth > TEXT_BREAKPOINT_WIDTH;
|
|
160
190
|
},
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
hoverEmptyLabelRows && 'hovered-empty-labels',
|
|
7
7
|
hoverPendingAnnotationRows && 'hovered-pending-annotations',
|
|
8
8
|
annotationIsNotFound(annotationSet, label) && 'missing',
|
|
9
|
-
isAnnotationInEditMode(
|
|
9
|
+
isAnnotationInEditMode(currentAnnotationId()) && 'editing',
|
|
10
10
|
publicView && 'clickable-cursor',
|
|
11
11
|
]"
|
|
12
12
|
@click="onAnnotationClick"
|
|
13
|
-
@mouseover="hoveredAnnotation =
|
|
13
|
+
@mouseover="hoveredAnnotation = currentAnnotationId()"
|
|
14
14
|
@mouseleave="hoveredAnnotation = null"
|
|
15
15
|
>
|
|
16
16
|
<div
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
annotationIsNotFound(annotationSet, label) && 'not-found-text',
|
|
36
36
|
]"
|
|
37
37
|
>
|
|
38
|
-
<span>{{ label.name }} </span>
|
|
38
|
+
<span @click="selectAnnotation">{{ label.name }} </span>
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
41
|
<div
|
|
@@ -103,7 +103,11 @@
|
|
|
103
103
|
</div>
|
|
104
104
|
</div>
|
|
105
105
|
<div v-else>
|
|
106
|
-
<div
|
|
106
|
+
<div
|
|
107
|
+
v-if="
|
|
108
|
+
spanSelection && isAnnotationInEditMode(currentAnnotationId())
|
|
109
|
+
"
|
|
110
|
+
>
|
|
107
111
|
<EmptyAnnotation
|
|
108
112
|
v-for="(span, index) in spanSelection"
|
|
109
113
|
:key="index"
|
|
@@ -130,12 +134,14 @@
|
|
|
130
134
|
</div>
|
|
131
135
|
<div class="buttons-container">
|
|
132
136
|
<AnnotationActionButtons
|
|
137
|
+
:annotation="annotation"
|
|
133
138
|
:cancel-btn="showCancelButton()"
|
|
134
139
|
:accept-btn="showAcceptButton()"
|
|
135
140
|
:decline-btn="showDeclineButton()"
|
|
136
141
|
:show-missing-btn="showMissingButton()"
|
|
137
142
|
:save-btn="showSaveButton()"
|
|
138
143
|
:restore-btn="showRestoreButton()"
|
|
144
|
+
:link-btn="showLinkButton()"
|
|
139
145
|
:is-loading="isLoading"
|
|
140
146
|
@mark-as-missing="handleMissingAnnotation"
|
|
141
147
|
@save="handleSaveChanges"
|
|
@@ -195,14 +201,14 @@ export default {
|
|
|
195
201
|
return {
|
|
196
202
|
isLoading: false,
|
|
197
203
|
isSelected: false,
|
|
198
|
-
annotationAnimationTimeout: null,
|
|
204
|
+
// annotationAnimationTimeout: null,
|
|
199
205
|
hoveredAnnotation: null,
|
|
200
206
|
};
|
|
201
207
|
},
|
|
202
208
|
computed: {
|
|
203
209
|
...mapState("document", [
|
|
204
210
|
"editAnnotation",
|
|
205
|
-
"
|
|
211
|
+
"annotationId",
|
|
206
212
|
"hoveredAnnotationSet",
|
|
207
213
|
"enableGroupingFeature",
|
|
208
214
|
"publicView",
|
|
@@ -239,7 +245,7 @@ export default {
|
|
|
239
245
|
return (
|
|
240
246
|
this.spanSelection &&
|
|
241
247
|
isElementArray(this.spanSelection) &&
|
|
242
|
-
this.isAnnotationInEditMode(this.
|
|
248
|
+
this.isAnnotationInEditMode(this.currentAnnotationId())
|
|
243
249
|
);
|
|
244
250
|
},
|
|
245
251
|
isAnnotation() {
|
|
@@ -247,7 +253,7 @@ export default {
|
|
|
247
253
|
this.annotation &&
|
|
248
254
|
!this.isNegative(this.annotation) &&
|
|
249
255
|
this.isAnnotationInEditMode(
|
|
250
|
-
this.
|
|
256
|
+
this.currentAnnotationId(),
|
|
251
257
|
this.editAnnotation.index
|
|
252
258
|
)
|
|
253
259
|
);
|
|
@@ -283,41 +289,8 @@ export default {
|
|
|
283
289
|
},
|
|
284
290
|
},
|
|
285
291
|
watch: {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
let annotationSelected;
|
|
290
|
-
|
|
291
|
-
if (newSidebarAnnotationSelected.annotation) {
|
|
292
|
-
annotationSelected = newSidebarAnnotationSelected.annotation;
|
|
293
|
-
} else {
|
|
294
|
-
annotationSelected = newSidebarAnnotationSelected;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (
|
|
298
|
-
this.annotation &&
|
|
299
|
-
!this.isNegative(this.annotation) &&
|
|
300
|
-
this.annotation.id === annotationSelected.id
|
|
301
|
-
) {
|
|
302
|
-
clearTimeout(this.annotationAnimationTimeout);
|
|
303
|
-
|
|
304
|
-
this.isSelected = true;
|
|
305
|
-
// remove annotation selection after some time
|
|
306
|
-
this.annotationAnimationTimeout = setTimeout(() => {
|
|
307
|
-
this.$store.dispatch("document/setSidebarAnnotationSelected", null);
|
|
308
|
-
this.isSelected = false;
|
|
309
|
-
}, 1200);
|
|
310
|
-
|
|
311
|
-
// Check if sidebarAnnotationSelected changed from a click or hover
|
|
312
|
-
const runAnimation = () => {
|
|
313
|
-
this.$el.scrollIntoView({
|
|
314
|
-
behavior: "smooth",
|
|
315
|
-
block: "center",
|
|
316
|
-
inline: "nearest",
|
|
317
|
-
});
|
|
318
|
-
};
|
|
319
|
-
runAnimation();
|
|
320
|
-
}
|
|
292
|
+
annotationId(newAnnotationId) {
|
|
293
|
+
this.checkAnnotationSelection(newAnnotationId);
|
|
321
294
|
},
|
|
322
295
|
editAnnotation(newValue) {
|
|
323
296
|
if (!newValue) {
|
|
@@ -346,7 +319,7 @@ export default {
|
|
|
346
319
|
selectedEntities(newValue) {
|
|
347
320
|
if (!newValue) return;
|
|
348
321
|
|
|
349
|
-
if (this.isAnnotationInEditMode(this.
|
|
322
|
+
if (this.isAnnotationInEditMode(this.currentAnnotationId())) {
|
|
350
323
|
this.isLoading = true;
|
|
351
324
|
}
|
|
352
325
|
},
|
|
@@ -358,8 +331,38 @@ export default {
|
|
|
358
331
|
}
|
|
359
332
|
},
|
|
360
333
|
},
|
|
334
|
+
mounted() {
|
|
335
|
+
this.checkAnnotationSelection(this.annotationId);
|
|
336
|
+
},
|
|
361
337
|
methods: {
|
|
362
|
-
|
|
338
|
+
checkAnnotationSelection(newAnnotationId) {
|
|
339
|
+
if (
|
|
340
|
+
newAnnotationId &&
|
|
341
|
+
this.annotation &&
|
|
342
|
+
!this.isNegative(this.annotation) &&
|
|
343
|
+
this.annotation.id == newAnnotationId
|
|
344
|
+
) {
|
|
345
|
+
this.isSelected = true;
|
|
346
|
+
// remove annotation selection after some time
|
|
347
|
+
// this.annotationAnimationTimeout = setTimeout(() => {
|
|
348
|
+
// this.$store.dispatch("document/setSidebarAnnotationSelected", null);
|
|
349
|
+
// this.isSelected = false;
|
|
350
|
+
// }, 1200);
|
|
351
|
+
|
|
352
|
+
// Check if sidebarAnnotationSelected changed from a click or hover
|
|
353
|
+
const runAnimation = () => {
|
|
354
|
+
this.$el.scrollIntoView({
|
|
355
|
+
behavior: "smooth",
|
|
356
|
+
block: "center",
|
|
357
|
+
inline: "nearest",
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
runAnimation();
|
|
361
|
+
} else {
|
|
362
|
+
this.isSelected = false;
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
currentAnnotationId() {
|
|
363
366
|
if (!this.annotationSet || !this.label) return;
|
|
364
367
|
|
|
365
368
|
if (
|
|
@@ -439,10 +442,17 @@ export default {
|
|
|
439
442
|
return null;
|
|
440
443
|
}
|
|
441
444
|
},
|
|
445
|
+
showLinkButton() {
|
|
446
|
+
return (
|
|
447
|
+
!this.editAnnotation &&
|
|
448
|
+
this.annotation &&
|
|
449
|
+
this.hoveredAnnotation === this.annotation.id
|
|
450
|
+
);
|
|
451
|
+
},
|
|
442
452
|
showAcceptButton() {
|
|
443
453
|
return (
|
|
444
454
|
!this.editAnnotation &&
|
|
445
|
-
!this.isAnnotationInEditMode(this.
|
|
455
|
+
!this.isAnnotationInEditMode(this.currentAnnotationId()) &&
|
|
446
456
|
this.annotation &&
|
|
447
457
|
!this.isNegative(this.annotation) &&
|
|
448
458
|
!this.annotation.is_correct &&
|
|
@@ -452,7 +462,7 @@ export default {
|
|
|
452
462
|
showDeclineButton() {
|
|
453
463
|
return (
|
|
454
464
|
!this.editAnnotation &&
|
|
455
|
-
!this.isAnnotationInEditMode(this.
|
|
465
|
+
!this.isAnnotationInEditMode(this.currentAnnotationId()) &&
|
|
456
466
|
this.annotation &&
|
|
457
467
|
!this.isNegative(this.annotation) &&
|
|
458
468
|
this.hoveredAnnotation === this.annotation.id
|
|
@@ -462,7 +472,7 @@ export default {
|
|
|
462
472
|
return (
|
|
463
473
|
!this.editAnnotation &&
|
|
464
474
|
this.hoveredAnnotation &&
|
|
465
|
-
!this.isAnnotationInEditMode(this.
|
|
475
|
+
!this.isAnnotationInEditMode(this.currentAnnotationId()) &&
|
|
466
476
|
(!this.annotation || this.isNegative(this.annotation)) &&
|
|
467
477
|
!this.annotationIsNotFound(this.annotationSet, this.label)
|
|
468
478
|
);
|
|
@@ -471,13 +481,13 @@ export default {
|
|
|
471
481
|
return (
|
|
472
482
|
!this.editAnnotation &&
|
|
473
483
|
this.hoveredAnnotation &&
|
|
474
|
-
!this.isAnnotationInEditMode(this.
|
|
484
|
+
!this.isAnnotationInEditMode(this.currentAnnotationId()) &&
|
|
475
485
|
this.annotationIsNotFound(this.annotationSet, this.label)
|
|
476
486
|
);
|
|
477
487
|
},
|
|
478
488
|
showCancelButton() {
|
|
479
489
|
if (!this.editAnnotation || this.isLoading) return;
|
|
480
|
-
if (this.isAnnotationInEditMode(this.
|
|
490
|
+
if (this.isAnnotationInEditMode(this.currentAnnotationId())) {
|
|
481
491
|
return true;
|
|
482
492
|
}
|
|
483
493
|
},
|
|
@@ -488,10 +498,10 @@ export default {
|
|
|
488
498
|
if (this.isAnnotation) {
|
|
489
499
|
return true;
|
|
490
500
|
} else {
|
|
491
|
-
if (!this.isAnnotationInEditMode(this.
|
|
501
|
+
if (!this.isAnnotationInEditMode(this.currentAnnotationId())) return;
|
|
492
502
|
|
|
493
503
|
return (
|
|
494
|
-
this.elementSelected === this.
|
|
504
|
+
this.elementSelected === this.currentAnnotationId() &&
|
|
495
505
|
this.spanSelection &&
|
|
496
506
|
Array.isArray(this.spanSelection)
|
|
497
507
|
);
|
|
@@ -522,7 +532,7 @@ export default {
|
|
|
522
532
|
(this.showAcceptButton() ||
|
|
523
533
|
this.showDeclineButton() ||
|
|
524
534
|
this.isAnnotationInEditMode(
|
|
525
|
-
this.
|
|
535
|
+
this.currentAnnotationId(),
|
|
526
536
|
this.editAnnotation.index
|
|
527
537
|
))
|
|
528
538
|
) {
|
|
@@ -560,7 +570,7 @@ export default {
|
|
|
560
570
|
}
|
|
561
571
|
} else if (
|
|
562
572
|
(!this.annotation || this.isNegative(this.annotation)) &&
|
|
563
|
-
this.isAnnotationInEditMode(this.
|
|
573
|
+
this.isAnnotationInEditMode(this.currentAnnotationId())
|
|
564
574
|
) {
|
|
565
575
|
this.saveEmptyAnnotationChanges();
|
|
566
576
|
}
|
|
@@ -749,6 +759,12 @@ export default {
|
|
|
749
759
|
this.$store.dispatch("display/enableSearch", true);
|
|
750
760
|
this.$store.dispatch("display/setCurrentSearch", this.label.name);
|
|
751
761
|
},
|
|
762
|
+
selectAnnotation(event) {
|
|
763
|
+
event.stopPropagation();
|
|
764
|
+
if (this.annotation) {
|
|
765
|
+
this.$store.dispatch("document/setAnnotationId", this.annotation.id);
|
|
766
|
+
}
|
|
767
|
+
},
|
|
752
768
|
},
|
|
753
769
|
};
|
|
754
770
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div id="document-annotations">
|
|
2
|
+
<div id="document-annotations" @click="cleanSelection">
|
|
3
3
|
<!-- When extracting annotations after editing -->
|
|
4
4
|
<div v-if="recalculatingAnnotations" class="extracting-data">
|
|
5
5
|
<ExtractingData />
|
|
@@ -186,6 +186,8 @@ export default {
|
|
|
186
186
|
...mapState("document", [
|
|
187
187
|
"annotationSets",
|
|
188
188
|
"documentId",
|
|
189
|
+
"annotationId",
|
|
190
|
+
"annotationSetId",
|
|
189
191
|
"recalculatingAnnotations",
|
|
190
192
|
"publicView",
|
|
191
193
|
"editAnnotation",
|
|
@@ -193,7 +195,6 @@ export default {
|
|
|
193
195
|
"labels",
|
|
194
196
|
"selectedDocument",
|
|
195
197
|
"splittingSuggestions",
|
|
196
|
-
"sidebarAnnotationSelected",
|
|
197
198
|
]),
|
|
198
199
|
...mapGetters("document", [
|
|
199
200
|
"numberOfAnnotationSetGroup",
|
|
@@ -203,6 +204,7 @@ export default {
|
|
|
203
204
|
"annotationSetsInTable",
|
|
204
205
|
"isDocumentReviewed",
|
|
205
206
|
"annotationSetOfAnnotation",
|
|
207
|
+
"isAnnotationInAnnotationSet",
|
|
206
208
|
]),
|
|
207
209
|
isAnnotationBeingEdited() {
|
|
208
210
|
return this.editAnnotation && this.editAnnotation.id;
|
|
@@ -229,9 +231,9 @@ export default {
|
|
|
229
231
|
oldAnnotationSets
|
|
230
232
|
);
|
|
231
233
|
},
|
|
232
|
-
|
|
233
|
-
if (
|
|
234
|
-
const annotationSet = this.annotationSetOfAnnotation(
|
|
234
|
+
annotationId(newAnnotationId) {
|
|
235
|
+
if (newAnnotationId) {
|
|
236
|
+
const annotationSet = this.annotationSetOfAnnotation(newAnnotationId);
|
|
235
237
|
if (annotationSet) {
|
|
236
238
|
const index = this.annotationSets.findIndex(
|
|
237
239
|
(annotationSetToFind) => annotationSetToFind.id === annotationSet.id
|
|
@@ -303,7 +305,16 @@ export default {
|
|
|
303
305
|
newAnnotationSet.id &&
|
|
304
306
|
newAnnotationSet.id === annotationSetOpened.id
|
|
305
307
|
);
|
|
306
|
-
if (isFirstTime &&
|
|
308
|
+
if (isFirstTime && this.annotationSetId) {
|
|
309
|
+
newAnnotationSetsAccordion[index] =
|
|
310
|
+
newAnnotationSet.id == this.annotationSetId;
|
|
311
|
+
} else if (isFirstTime && this.annotationId) {
|
|
312
|
+
newAnnotationSetsAccordion[index] =
|
|
313
|
+
this.isAnnotationInAnnotationSet(
|
|
314
|
+
newAnnotationSet,
|
|
315
|
+
this.annotationId
|
|
316
|
+
);
|
|
317
|
+
} else if (isFirstTime && index === 0) {
|
|
307
318
|
// open first one by default
|
|
308
319
|
newAnnotationSetsAccordion[index] = true;
|
|
309
320
|
} else if (wasOpen) {
|
|
@@ -647,6 +658,9 @@ export default {
|
|
|
647
658
|
this.$store.dispatch("display/showAnnSetTable", tableSet);
|
|
648
659
|
}
|
|
649
660
|
},
|
|
661
|
+
cleanSelection() {
|
|
662
|
+
this.$store.dispatch("document/setAnnotationId", null);
|
|
663
|
+
},
|
|
650
664
|
},
|
|
651
665
|
};
|
|
652
666
|
</script>
|
|
@@ -86,7 +86,7 @@ export default {
|
|
|
86
86
|
},
|
|
87
87
|
computed: {
|
|
88
88
|
...mapState("document", [
|
|
89
|
-
"
|
|
89
|
+
"annotationId",
|
|
90
90
|
"enableGroupingFeature",
|
|
91
91
|
"hoveredAnnotationSet",
|
|
92
92
|
"publicView",
|
|
@@ -103,37 +103,8 @@ export default {
|
|
|
103
103
|
},
|
|
104
104
|
},
|
|
105
105
|
watch: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
this.enableGroupingFeature &&
|
|
110
|
-
!this.showAnnotationsGroup &&
|
|
111
|
-
newSidebarAnnotationSelected
|
|
112
|
-
) {
|
|
113
|
-
let annotationSelected;
|
|
114
|
-
|
|
115
|
-
if (newSidebarAnnotationSelected.annotation) {
|
|
116
|
-
annotationSelected = newSidebarAnnotationSelected.annotation;
|
|
117
|
-
} else {
|
|
118
|
-
annotationSelected = newSidebarAnnotationSelected;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const annotation = this.label.annotations.find(
|
|
122
|
-
(ann) => ann.id === annotationSelected.id
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
if (annotation) {
|
|
126
|
-
this.showAnnotationsGroup = true;
|
|
127
|
-
this.$store.dispatch("document/setSidebarAnnotationSelected", null);
|
|
128
|
-
// run in next render because we need to open the group first
|
|
129
|
-
this.$nextTick(() => {
|
|
130
|
-
this.$store.dispatch(
|
|
131
|
-
"document/setSidebarAnnotationSelected",
|
|
132
|
-
annotation
|
|
133
|
-
);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
106
|
+
annotationId(newAnnotationId) {
|
|
107
|
+
this.checkAnnotationSelected(newAnnotationId);
|
|
137
108
|
},
|
|
138
109
|
hoveredAnnotationSet(newValue) {
|
|
139
110
|
// Check if there are some unrevised Annotations within the group
|
|
@@ -148,6 +119,7 @@ export default {
|
|
|
148
119
|
},
|
|
149
120
|
mounted() {
|
|
150
121
|
this.updateValues();
|
|
122
|
+
this.checkAnnotationSelected(this.annotationId);
|
|
151
123
|
|
|
152
124
|
if (this.publicView) {
|
|
153
125
|
this.showAnnotationsGroup = true;
|
|
@@ -157,6 +129,30 @@ export default {
|
|
|
157
129
|
this.updateValues();
|
|
158
130
|
},
|
|
159
131
|
methods: {
|
|
132
|
+
checkAnnotationSelected(newAnnotationId) {
|
|
133
|
+
// check if annotation is inside a label group and open it
|
|
134
|
+
if (
|
|
135
|
+
this.enableGroupingFeature &&
|
|
136
|
+
!this.showAnnotationsGroup &&
|
|
137
|
+
newAnnotationId
|
|
138
|
+
) {
|
|
139
|
+
const annotation = this.label.annotations.find(
|
|
140
|
+
(ann) => ann.id == newAnnotationId
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
if (annotation) {
|
|
144
|
+
this.showAnnotationsGroup = true;
|
|
145
|
+
// this.$store.dispatch("document/setSidebarAnnotationSelected", null);
|
|
146
|
+
// // run in next render because we need to open the group first
|
|
147
|
+
// this.$nextTick(() => {
|
|
148
|
+
// this.$store.dispatch(
|
|
149
|
+
// "document/setSidebarAnnotationSelected",
|
|
150
|
+
// annotation
|
|
151
|
+
// );
|
|
152
|
+
// });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
160
156
|
toggleGroup() {
|
|
161
157
|
this.showAnnotationsGroup = !this.showAnnotationsGroup;
|
|
162
158
|
},
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
<div v-if="!optimalResolution" class="not-optimized">
|
|
35
35
|
<NotOptimizedViewportModal />
|
|
36
36
|
</div>
|
|
37
|
+
<div>
|
|
38
|
+
<AnnotationDeletedModal />
|
|
39
|
+
</div>
|
|
37
40
|
<div v-if="!isMinimumWidth" class="not-supported">
|
|
38
41
|
<div class="text">
|
|
39
42
|
{{ $t("resolution_not_supported") }}
|
|
@@ -54,6 +57,7 @@ import {
|
|
|
54
57
|
import { DocumentEdit } from "./DocumentEdit";
|
|
55
58
|
import ErrorMessage from "./ErrorMessage";
|
|
56
59
|
import NotOptimizedViewportModal from "../components/DocumentModals/NotOptimizedViewportModal";
|
|
60
|
+
import AnnotationDeletedModal from "../components/DocumentModals/AnnotationDeletedModal";
|
|
57
61
|
import DocumentErrorModal from "../components/DocumentModals/DocumentErrorModal";
|
|
58
62
|
import ChooseLabelSetModal from "../components/DocumentAnnotations/ChooseLabelSetModal";
|
|
59
63
|
|
|
@@ -74,6 +78,7 @@ export default {
|
|
|
74
78
|
DocumentErrorModal,
|
|
75
79
|
MultiAnnotationTableOverlay,
|
|
76
80
|
ChooseLabelSetModal,
|
|
81
|
+
AnnotationDeletedModal,
|
|
77
82
|
},
|
|
78
83
|
data() {
|
|
79
84
|
return {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="viewport-modal">
|
|
3
|
+
<b-modal
|
|
4
|
+
v-model="isModalActive"
|
|
5
|
+
class="modal-text-center"
|
|
6
|
+
:width="500"
|
|
7
|
+
:can-cancel="false"
|
|
8
|
+
>
|
|
9
|
+
<section class="modal-card-body">
|
|
10
|
+
<div class="content">
|
|
11
|
+
<h3>{{ $t("annotation_deleted") }}</h3>
|
|
12
|
+
</div>
|
|
13
|
+
</section>
|
|
14
|
+
<footer class="modal-card-foot" style="padding-top: 0">
|
|
15
|
+
<b-button type="is-primary" class="primary-button" @click="closeModal">
|
|
16
|
+
{{ $t("ok") }}
|
|
17
|
+
</b-button>
|
|
18
|
+
</footer>
|
|
19
|
+
</b-modal>
|
|
20
|
+
</section>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
name: "AnnotationDeletedModal",
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
isModalActive: window.location.hash === "#deleted",
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
closeModal() {
|
|
33
|
+
window.location.hash = "";
|
|
34
|
+
this.isModalActive = false;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
@@ -429,7 +429,7 @@ export default {
|
|
|
429
429
|
},
|
|
430
430
|
|
|
431
431
|
handleFocusedAnnotation(annotation) {
|
|
432
|
-
this.$store.dispatch("document/
|
|
432
|
+
this.$store.dispatch("document/setAnnotationId", annotation.id);
|
|
433
433
|
this.closePopups(true);
|
|
434
434
|
},
|
|
435
435
|
|