@konfuzio/document-validation-ui 0.1.6-pre-release-1 → 0.1.6-pre-release-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.
Files changed (53) hide show
  1. package/dist/css/app.css +1 -1
  2. package/dist/index.html +1 -1
  3. package/dist/js/app.js +1 -1
  4. package/dist/js/app.js.map +1 -1
  5. package/dist/js/chunk-vendors.js +2 -2
  6. package/dist/js/chunk-vendors.js.map +1 -1
  7. package/package.json +2 -1
  8. package/src/.DS_Store +0 -0
  9. package/src/assets/images/DraggableIcon.vue +14 -0
  10. package/src/assets/images/GridIcon.vue +16 -0
  11. package/src/assets/images/ServerImage.vue +11 -5
  12. package/src/assets/images/SettingsIcon.vue +14 -0
  13. package/src/assets/scss/ann_set_table_options.scss +26 -0
  14. package/src/assets/scss/annotation_details.scss +85 -73
  15. package/src/assets/scss/document_annotations.scss +47 -0
  16. package/src/assets/scss/document_dashboard.scss +1 -2
  17. package/src/assets/scss/document_edit.scss +2 -3
  18. package/src/assets/scss/main.scss +49 -12
  19. package/src/assets/scss/multi_ann_table_overlay.scss +38 -0
  20. package/src/assets/scss/variables.scss +2 -0
  21. package/src/components/App.vue +7 -2
  22. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +31 -13
  23. package/src/components/DocumentAnnotations/AnnotationContent.vue +5 -3
  24. package/src/components/DocumentAnnotations/AnnotationDetails.vue +7 -3
  25. package/src/components/DocumentAnnotations/AnnotationRow.vue +31 -10
  26. package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +3 -3
  27. package/src/components/DocumentAnnotations/CategorizeModal.vue +5 -1
  28. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +47 -17
  29. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +5 -2
  30. package/src/components/DocumentEdit/DocumentEdit.vue +1 -1
  31. package/src/components/DocumentEdit/EditSidebar.vue +6 -6
  32. package/src/components/DocumentPage/AnnSetTableOptions.vue +109 -0
  33. package/src/components/DocumentPage/DocumentPage.vue +39 -10
  34. package/src/components/DocumentPage/DocumentToolbar.vue +6 -2
  35. package/src/components/DocumentPage/MultiAnnSelection.vue +92 -2
  36. package/src/components/DocumentPage/MultiAnnotationTableOverlay.vue +286 -0
  37. package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +19 -46
  38. package/src/components/DocumentPage/NewAnnotation.vue +1 -1
  39. package/src/components/DocumentPage/ScrollingDocument.vue +6 -1
  40. package/src/components/DocumentTopBar/DocumentName.vue +6 -1
  41. package/src/components/DocumentTopBar/DocumentTopBar.vue +9 -9
  42. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +4 -3
  43. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +6 -2
  44. package/src/components/DocumentsList/DocumentsList.vue +11 -2
  45. package/src/locales/de.json +5 -1
  46. package/src/locales/en.json +5 -1
  47. package/src/locales/es.json +5 -1
  48. package/src/main.js +3 -0
  49. package/src/store/category.js +1 -1
  50. package/src/store/display.js +44 -0
  51. package/src/store/document.js +100 -7
  52. package/src/store/edit.js +6 -2
  53. package/src/utils/utils.js +13 -0
@@ -3,7 +3,11 @@
3
3
  ref="pdfContainer"
4
4
  :class="[
5
5
  'pdf-page-container',
6
- (categorizeModalIsActive || editMode || publicView) && 'default-cursor',
6
+ (categorizeModalIsActive ||
7
+ editMode ||
8
+ publicView ||
9
+ documentIsReviewed) &&
10
+ 'default-cursor',
7
11
  page.number === currentPage && 'current-page',
8
12
  ]"
9
13
  >
@@ -23,6 +27,8 @@
23
27
  @close="closePopups"
24
28
  />
25
29
 
30
+ <AnnSetTableOptions v-if="showAnnSetTable" :page="page" />
31
+
26
32
  <v-stage
27
33
  v-if="image && scale"
28
34
  ref="stage"
@@ -42,7 +48,7 @@
42
48
  }"
43
49
  />
44
50
  <template v-if="pageInVisibleRange && !editMode">
45
- <v-group v-if="!publicView" ref="entities">
51
+ <v-group v-if="!publicView || !documentIsReviewed" ref="entities">
46
52
  <v-rect
47
53
  v-for="(entity, index) in scaledEntities"
48
54
  :key="index"
@@ -70,7 +76,13 @@
70
76
  </template>
71
77
  </template>
72
78
  </v-layer>
73
- <v-layer v-if="showFocusedAnnotation && !isSelecting">
79
+ <v-layer
80
+ v-if="
81
+ showFocusedAnnotation &&
82
+ !isSelecting &&
83
+ documentAnnotationSelected.labelName !== ''
84
+ "
85
+ >
74
86
  <v-label
75
87
  :key="`label${documentAnnotationSelected.id}`"
76
88
  :config="{
@@ -125,6 +137,7 @@ import BoxSelection from "./BoxSelection";
125
137
  import MultiAnnSelection from "./MultiAnnSelection";
126
138
  import NewAnnotation from "./NewAnnotation";
127
139
  import MultiAnnotationTablePopup from "./MultiAnnotationTablePopup";
140
+ import AnnSetTableOptions from "./AnnSetTableOptions";
128
141
 
129
142
  export default {
130
143
  name: "DocumentPage",
@@ -133,6 +146,7 @@ export default {
133
146
  MultiAnnSelection,
134
147
  NewAnnotation,
135
148
  MultiAnnotationTablePopup,
149
+ AnnSetTableOptions,
136
150
  },
137
151
 
138
152
  props: {
@@ -151,7 +165,7 @@ export default {
151
165
  },
152
166
 
153
167
  computed: {
154
- ...mapState("display", ["currentPage"]),
168
+ ...mapState("display", ["currentPage", "showAnnSetTable"]),
155
169
 
156
170
  showFocusedAnnotation() {
157
171
  return (
@@ -258,6 +272,7 @@ export default {
258
272
  "selectedDocument",
259
273
  "publicView",
260
274
  "selectedEntities",
275
+ "documentIsReviewed",
261
276
  ]),
262
277
  ...mapState("edit", ["editMode"]),
263
278
  ...mapGetters("display", ["visiblePageRange", "bboxToRect"]),
@@ -311,7 +326,13 @@ export default {
311
326
  },
312
327
 
313
328
  onMouseDown(event) {
314
- if (this.categorizeModalIsActive || this.editMode) return;
329
+ if (
330
+ this.categorizeModalIsActive ||
331
+ this.editMode ||
332
+ this.publicView ||
333
+ this.documentIsReviewed
334
+ )
335
+ return;
315
336
 
316
337
  this.closePopups();
317
338
 
@@ -329,9 +350,6 @@ export default {
329
350
  ) {
330
351
  return;
331
352
  }
332
- if (this.publicView) {
333
- return;
334
- }
335
353
 
336
354
  // anything else, we start selecting
337
355
 
@@ -379,7 +397,13 @@ export default {
379
397
  },
380
398
 
381
399
  handleClickedEntity(entity) {
382
- if (!entity || this.categorizeModalIsActive) return;
400
+ if (
401
+ !entity ||
402
+ this.categorizeModalIsActive ||
403
+ this.publicView ||
404
+ this.documentIsReviewed
405
+ )
406
+ return;
383
407
 
384
408
  // Check if we are creating a new Annotation
385
409
  // or if we are editing an existing or empty one
@@ -417,7 +441,12 @@ export default {
417
441
  },
418
442
 
419
443
  onElementEnter() {
420
- if (!this.categorizeModalIsActive) {
444
+ if (
445
+ !this.categorizeModalIsActive &&
446
+ !this.publicView &&
447
+ !this.editMode &&
448
+ !this.documentIsReviewed
449
+ ) {
421
450
  this.$refs.stage.$el.style.cursor = "pointer";
422
451
  }
423
452
  },
@@ -9,7 +9,7 @@
9
9
  class="top-aligned"
10
10
  >
11
11
  <div
12
- v-if="!editMode && !publicView"
12
+ v-if="!editMode && !publicView && !documentIsReviewed"
13
13
  :class="[
14
14
  'icons icons-left',
15
15
  editModeDisabled && 'edit-mode-disabled',
@@ -22,7 +22,10 @@
22
22
  <span class="edit-text">{{ $t("edit") }}</span>
23
23
  </div>
24
24
  </b-tooltip>
25
- <div v-if="!editMode && !publicView" class="toolbar-divider" />
25
+ <div
26
+ v-if="!editMode && !publicView && !documentIsReviewed"
27
+ class="toolbar-divider"
28
+ />
26
29
  <div class="icons icons-right">
27
30
  <div class="fit-zoom icon" @click.prevent.stop="fitAuto">
28
31
  <FitZoomIcon />
@@ -74,6 +77,7 @@ export default {
74
77
  "selectedDocument",
75
78
  "recalculatingAnnotations",
76
79
  "publicView",
80
+ "documentIsReviewed",
77
81
  ]),
78
82
  ...mapGetters("document", ["documentCannotBeEdited"]),
79
83
  },
@@ -45,6 +45,7 @@
45
45
  <script>
46
46
  import { mapGetters, mapState, mapActions } from "vuex";
47
47
  import { ChooseLabelSetModal } from "../DocumentAnnotations";
48
+ import { table_reference_api } from "../../store/document";
48
49
 
49
50
  export default {
50
51
  props: {
@@ -114,6 +115,7 @@ export default {
114
115
  };
115
116
  },
116
117
  ...mapState("selection", ["selection", "isSelecting"]),
118
+ ...mapState("document", ["documentId"]),
117
119
  ...mapGetters("display", ["clientToBbox"]),
118
120
  ...mapGetters("document", ["entitiesOnSelection"]),
119
121
  },
@@ -134,14 +136,15 @@ export default {
134
136
  hasModalCard: true,
135
137
  trapFocus: true,
136
138
  canCancel: false,
137
- customClass: "invisible-parent-modal",
139
+ customClass: "dv-ui-theme invisible-parent-modal",
138
140
  props: { isMultipleAnnotations: true },
139
141
  events: {
140
- labelSet: this.chooseLabelSet,
142
+ labelSet: this.submitAnnotations,
141
143
  },
142
144
  });
143
145
  },
144
146
  chooseLabelSet(labelSet) {
147
+ // TODO: deprecated with new multi ann set table
145
148
  const tableSelection = {
146
149
  labelSet,
147
150
  position: {
@@ -156,6 +159,49 @@ export default {
156
159
  this.$emit("finished", tableSelection);
157
160
  },
158
161
 
162
+ async submitAnnotations(labelSet) {
163
+ const columns = labelSet.labels.map((label) => {
164
+ return {
165
+ field: `${label.id}`,
166
+ label: label.name,
167
+ centered: true,
168
+ };
169
+ });
170
+
171
+ const orderedEntities = this.processRows(columns);
172
+
173
+ const annotations = [];
174
+
175
+ orderedEntities.forEach((orderedEntity) => {
176
+ annotations.push({
177
+ document: this.documentId,
178
+ span: orderedEntity.spans,
179
+ label: orderedEntity.label_id,
180
+ is_correct: true,
181
+ revised: false,
182
+ label_set: labelSet.id,
183
+ set_reference: orderedEntity.row_index,
184
+ origin: table_reference_api,
185
+ });
186
+ });
187
+
188
+ this.$store
189
+ .dispatch("document/createAnnotation", annotations)
190
+ .then(() => {
191
+ this.$store.dispatch("selection/disableSelection");
192
+ this.$emit("finished");
193
+ })
194
+ .catch((error) => {
195
+ this.$store.dispatch("document/createErrorMessage", {
196
+ error,
197
+ serverErrorMessage: this.$t("server_error"),
198
+ defaultErrorMessage: this.$t("error_creating_multi_ann"),
199
+ });
200
+ this.$store.dispatch("selection/disableSelection");
201
+ this.$emit("finished");
202
+ });
203
+ },
204
+
159
205
  onButtonEnter() {
160
206
  this.$emit("buttonEnter");
161
207
  },
@@ -296,6 +342,50 @@ export default {
296
342
 
297
343
  this.entities = cols;
298
344
  },
345
+
346
+ processRows(columns) {
347
+ const orderedEntities = []; // this will match the order of entities in the table so we have a way of tracking them once we submit
348
+ let rowIndex = 0;
349
+
350
+ Object.entries(this.entities).forEach(([key, groupedEntity]) => {
351
+ let row = null;
352
+ columns.forEach((column, index) => {
353
+ let spans = [];
354
+ if (
355
+ Object.entries(groupedEntity)[index] &&
356
+ Object.entries(groupedEntity)[index].length > 0
357
+ ) {
358
+ spans = Object.entries(groupedEntity)[index][1];
359
+ }
360
+ const entityExists = spans.length > 0;
361
+
362
+ let textContent = "";
363
+
364
+ spans.forEach((entity) => {
365
+ textContent = `${textContent} ${entity.offset_string}`;
366
+ });
367
+
368
+ row = {
369
+ ...row,
370
+ [column.field]: textContent,
371
+ };
372
+ if (entityExists) {
373
+ const customEntity = {
374
+ spans: [...spans],
375
+ label_id: column.field,
376
+ row_index: rowIndex,
377
+ };
378
+
379
+ orderedEntities.push(customEntity);
380
+ }
381
+ });
382
+ if (row !== null) {
383
+ rowIndex++;
384
+ }
385
+ });
386
+ return orderedEntities;
387
+ },
388
+
299
389
  ...mapActions("selection", ["moveSelection"]),
300
390
  },
301
391
  };
@@ -0,0 +1,286 @@
1
+ <template>
2
+ <div class="multi-ann-table-overlay">
3
+ <b-table
4
+ ref="table"
5
+ class="multi-ann-set-table dark-header header-32"
6
+ detail-icon="faScissors"
7
+ :data="rows"
8
+ :sticky-header="true"
9
+ :narrowed="true"
10
+ :bordered="false"
11
+ draggable-column
12
+ @columndragstart="columndragstart"
13
+ @columndrop="columndrop"
14
+ @columndragover="columndragover"
15
+ @columndragleave="columndragleave"
16
+ >
17
+ <b-table-column
18
+ v-for="(item, index) in columns"
19
+ :key="index"
20
+ :field="item.field"
21
+ :label="item.label.name"
22
+ >
23
+ <template #header="{ column }">
24
+ <b-dropdown
25
+ :ref="getDropdownReference(item)"
26
+ aria-role="list"
27
+ class="header-dropdown"
28
+ position="is-top-left"
29
+ :close-on-click="false"
30
+ @active-change="(e) => onDropdownChange(item, e)"
31
+ >
32
+ <template #trigger="{ active }">
33
+ <DraggableIcon class="draggable" />
34
+ <span :class="active ? 'active' : ''">{{ column.label }} </span>
35
+ <b-icon
36
+ :icon="active ? 'angle-up' : 'angle-down'"
37
+ size="is-small"
38
+ class="arrow"
39
+ />
40
+ </template>
41
+
42
+ <div v-if="editingLabels.length === 0">
43
+ <b-dropdown-item aria-role="listitem" @click="editLabel(item)"
44
+ ><span>{{ $t("edit_label") }}</span></b-dropdown-item
45
+ >
46
+ <b-dropdown-item
47
+ aria-role="listitem"
48
+ class="delete-action"
49
+ @click="deleteColumn(item)"
50
+ >
51
+ <span>{{ $t("delete_label") }}</span></b-dropdown-item
52
+ >
53
+ </div>
54
+ <div v-else>
55
+ <b-dropdown-item
56
+ v-for="label in editingLabels"
57
+ :key="label.id"
58
+ aria-role="listitem"
59
+ :disabled="label.disabled"
60
+ ><span @click="changeLabel(item, label)">{{
61
+ label.name
62
+ }}</span></b-dropdown-item
63
+ >
64
+ </div>
65
+ </b-dropdown>
66
+ </template>
67
+
68
+ <template #default="props">
69
+ <div class="annotations-table">
70
+ <AnnotationRow
71
+ :annotation="props.row[item.field]"
72
+ :label="item.label"
73
+ :annotation-set="item.annotationSet"
74
+ :show-label="false"
75
+ :show-buttons="false"
76
+ :is-small="true"
77
+ :from-table="true"
78
+ />
79
+ </div>
80
+ </template>
81
+ </b-table-column>
82
+ </b-table>
83
+ </div>
84
+ </template>
85
+
86
+ <script>
87
+ import { mapState } from "vuex";
88
+ import AnnotationRow from "../DocumentAnnotations/AnnotationRow";
89
+ import DraggableIcon from "../../assets/images/DraggableIcon";
90
+
91
+ export default {
92
+ name: "MultiAnnotationTablePopup",
93
+ components: {
94
+ AnnotationRow,
95
+ DraggableIcon,
96
+ },
97
+ data() {
98
+ return {
99
+ rows: [],
100
+ columns: [],
101
+ orderedAnnotations: [],
102
+ editingLabels: [],
103
+ openDropdown: null,
104
+ draggingColumnIndex: null,
105
+ };
106
+ },
107
+ computed: {
108
+ ...mapState("display", ["showAnnSetTable"]),
109
+ ...mapState("document", ["annotations"]),
110
+ },
111
+ watch: {
112
+ showAnnSetTable() {
113
+ this.handleColumns();
114
+ this.handleRows();
115
+ },
116
+ annotations() {
117
+ // if there's a change in the annotations content, we update the table
118
+ this.handleColumns();
119
+ this.handleRows();
120
+ },
121
+ },
122
+ mounted() {
123
+ this.handleColumns();
124
+ this.handleRows();
125
+ },
126
+ methods: {
127
+ getDropdownReference(column) {
128
+ return `editDropdown_${column.field}`;
129
+ },
130
+ handleColumns() {
131
+ this.columns = [];
132
+ const labelAlreadyExists = (label) => {
133
+ return (
134
+ this.columns.length > 0 &&
135
+ this.columns.find((a) => a.field === `${label.id}`) != undefined
136
+ );
137
+ };
138
+
139
+ this.showAnnSetTable.forEach((annotationSet) => {
140
+ annotationSet.labels.forEach((label) => {
141
+ if (!labelAlreadyExists(label) && label.annotations.length > 0) {
142
+ const column = {
143
+ field: `${label.id}`,
144
+ label: label,
145
+ annotationSet,
146
+ centered: false,
147
+ };
148
+ this.columns.push(column);
149
+ }
150
+ });
151
+ });
152
+ },
153
+
154
+ handleRows() {
155
+ this.rows = [];
156
+ this.orderedAnnotations = [];
157
+
158
+ this.showAnnSetTable.forEach((annotationSet) => {
159
+ let row = {};
160
+ let toAdd = false; // to not push empty labels
161
+
162
+ annotationSet.labels.forEach((label) => {
163
+ if (label.annotations.length > 0) {
164
+ row[label.id] = label.annotations[0];
165
+ this.orderedAnnotations.push(label.annotations[0]);
166
+ toAdd = true;
167
+ }
168
+ });
169
+ if (toAdd) {
170
+ this.rows.push(row);
171
+ }
172
+ });
173
+ },
174
+
175
+ async editLabel(column) {
176
+ this.$store
177
+ .dispatch(
178
+ "project/fetchLabelSetDetails",
179
+ column.annotationSet.label_set.id
180
+ )
181
+ .then(async (labelSet) => {
182
+ this.editingLabels = [];
183
+
184
+ labelSet.labels.forEach((label) => {
185
+ const dropdownLabel = {
186
+ ...label,
187
+ disabled:
188
+ this.columns.find((column) => column.label.id === label.id) !==
189
+ undefined,
190
+ };
191
+ this.editingLabels.push(dropdownLabel);
192
+ });
193
+ });
194
+ },
195
+
196
+ async changeLabel(column, label) {
197
+ for (let i = 0; i < this.rows.length; i++) {
198
+ const annotationToUpdate = this.rows[i][column.label.id];
199
+ await this.$store
200
+ .dispatch("document/updateAnnotation", {
201
+ annotationId: annotationToUpdate.id,
202
+ updatedValues: { label: label.id },
203
+ })
204
+ .catch((error) => {
205
+ this.$store.dispatch("document/createErrorMessage", {
206
+ error,
207
+ serverErrorMessage: this.$t("server_error"),
208
+ defaultErrorMessage: this.$t("edit_error"),
209
+ });
210
+ });
211
+ }
212
+ this.closeDropdown(column);
213
+ },
214
+
215
+ async deleteColumn(column) {
216
+ for (let i = 0; i < this.rows.length; i++) {
217
+ const annotationToDelete = this.rows[i][column.label.id];
218
+ await this.$store
219
+ .dispatch("document/deleteAnnotation", {
220
+ annotationId: annotationToDelete.id,
221
+ })
222
+ .catch((error) => {
223
+ this.$store.dispatch("document/createErrorMessage", {
224
+ error,
225
+ serverErrorMessage: this.$t("server_error"),
226
+ defaultErrorMessage: this.$t("edit_error"),
227
+ });
228
+ });
229
+ }
230
+ this.closeDropdown(column);
231
+ },
232
+
233
+ onDropdownChange(column, open) {
234
+ this.editingLabels = [];
235
+ this.$store.dispatch("selection/disableSelection");
236
+ this.$store.dispatch("document/resetEditAnnotation");
237
+ if (open) {
238
+ if (this.openDropdown) {
239
+ this.$refs[this.openDropdown][0].toggle();
240
+ }
241
+ this.openDropdown = this.getDropdownReference(column);
242
+ } else {
243
+ if (this.openDropdown === this.getDropdownReference(column)) {
244
+ this.openDropdown = null;
245
+ }
246
+ }
247
+ },
248
+
249
+ closeDropdown(column) {
250
+ if (this.openDropdown) {
251
+ this.$refs[this.getDropdownReference(column)][0].toggle();
252
+ this.openDropdown = null;
253
+ }
254
+ },
255
+
256
+ columndragstart(payload) {
257
+ this.draggingColumnIndex = payload.index;
258
+ payload.event.dataTransfer.effectAllowed = "copy";
259
+ },
260
+ columndragover(payload) {
261
+ payload.event.dataTransfer.dropEffect = "copy";
262
+ payload.event.target.closest("th").classList.add("is-selected");
263
+ payload.event.preventDefault();
264
+ },
265
+ columndragleave(payload) {
266
+ payload.event.target.closest("th").classList.remove("is-selected");
267
+ payload.event.preventDefault();
268
+ },
269
+ async columndrop(payload) {
270
+ payload.event.target.closest("th").classList.remove("is-selected");
271
+ const droppedOnColumnIndex = payload.index;
272
+
273
+ const draggingColumn = this.columns[this.draggingColumnIndex];
274
+ const droppedColumn = this.columns[droppedOnColumnIndex];
275
+
276
+ await this.changeLabel(draggingColumn, droppedColumn.label);
277
+ await this.changeLabel(droppedColumn, draggingColumn.label);
278
+ },
279
+ },
280
+ };
281
+ </script>
282
+ <style
283
+ scoped
284
+ lang="scss"
285
+ src="../../assets/scss/multi_ann_table_overlay.scss"
286
+ ></style>
@@ -156,63 +156,36 @@ export default {
156
156
  }
157
157
  },
158
158
  async submitAnnotations() {
159
- let errorMessageShown = false;
160
- let previousAnnotationSetId = null;
161
- let previousRowIndex = 0;
162
-
163
159
  this.$store.dispatch("display/showDocumentActionBar", {
164
160
  show: true,
165
161
  loading: false,
166
162
  action: true,
167
163
  });
168
164
 
169
- // traditional for to await for every request
170
- for (let i = 0; i < this.orderedEntities.length; i++) {
171
- const groupedEntity = this.orderedEntities[i];
172
-
173
- const annotationToCreate = {
165
+ this.orderedEntities.forEach((orderedEntity) => {
166
+ annotations.push({
174
167
  document: this.documentId,
175
- span: groupedEntity.spans,
176
- label: groupedEntity.label_id,
168
+ span: orderedEntity.spans,
169
+ label: orderedEntity.label_id,
177
170
  is_correct: true,
178
171
  revised: false,
179
- };
180
-
181
- if (groupedEntity.row_index !== previousRowIndex) {
182
- // if line changed then reset annotation set
183
- previousAnnotationSetId = null;
184
- }
185
- previousRowIndex = groupedEntity.row_index;
186
-
187
- if (previousAnnotationSetId) {
188
- annotationToCreate.annotation_set = previousAnnotationSetId;
189
- } else {
190
- annotationToCreate.label_set = this.labelSet.id;
191
- }
192
-
193
- await this.$store
194
- .dispatch("document/createAnnotation", annotationToCreate)
195
- .then((response) => {
196
- if (response) {
197
- // set ann set id to use on the next labels on the same row
198
- previousAnnotationSetId = response.data.annotation_set;
199
- }
200
- })
201
- .catch((error) => {
202
- if (!errorMessageShown) {
203
- this.$store.dispatch("document/createErrorMessage", {
204
- error,
205
- serverErrorMessage: this.$t("server_error"),
206
- defaultErrorMessage: this.$t("error_creating_multi_ann"),
207
- });
172
+ label_set: labelSet.id,
173
+ set_reference: orderedEntity.row_index,
174
+ });
175
+ });
208
176
 
209
- // set to true to only show 1 error
210
- // the first time it appears
211
- errorMessageShown = true;
212
- }
177
+ this.$store
178
+ .dispatch("document/createAnnotation", annotations)
179
+ .then(() => {
180
+ this.$emit("close");
181
+ })
182
+ .catch((error) => {
183
+ this.$store.dispatch("document/createErrorMessage", {
184
+ error,
185
+ serverErrorMessage: this.$t("server_error"),
186
+ defaultErrorMessage: this.$t("error_creating_multi_ann"),
213
187
  });
214
- }
215
- this.$emit("close");
188
+ });
216
189
  },
217
190
  deleteRow(index) {
218
191
  this.rows.splice(index, 1);
@@ -274,7 +274,7 @@ export default {
274
274
  trapFocus: true,
275
275
  canCancel: false,
276
276
  onCancel: this.disableLabelSetModalShowing,
277
- customClass: "invisible-parent-modal",
277
+ customClass: "dv-ui-theme invisible-parent-modal",
278
278
  events: {
279
279
  labelSet: this.chooseLabelSet,
280
280
  close: this.disableLabelSetModalShowing,