@konfuzio/document-validation-ui 0.1.5 → 0.1.6-pre-release-1

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/package.json +1 -1
  6. package/src/assets/images/MagicWandIcon.vue +16 -0
  7. package/src/assets/images/NotFoundIcon.vue +16 -0
  8. package/src/assets/images/SplitZigZag.vue +47 -14
  9. package/src/assets/images/StarIcon.vue +16 -0
  10. package/src/assets/scss/document_annotations.scss +9 -59
  11. package/src/assets/scss/document_category.scss +0 -1
  12. package/src/assets/scss/document_dashboard.scss +6 -0
  13. package/src/assets/scss/document_edit.scss +90 -46
  14. package/src/assets/scss/main.scss +689 -7
  15. package/src/assets/scss/splitting_confirmation_modal.scss +41 -0
  16. package/src/assets/scss/variables.scss +0 -657
  17. package/src/components/App.vue +3 -2
  18. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +153 -0
  19. package/src/components/DocumentAnnotations/AnnotationDetails.vue +21 -4
  20. package/src/components/DocumentAnnotations/AnnotationRow.vue +97 -34
  21. package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +86 -0
  22. package/src/components/DocumentAnnotations/CategorizeModal.vue +24 -2
  23. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +77 -81
  24. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +16 -3
  25. package/src/components/DocumentAnnotations/ExtractingData.vue +3 -3
  26. package/src/components/DocumentAnnotations/index.js +0 -1
  27. package/src/components/DocumentCategory.vue +13 -5
  28. package/src/components/DocumentDashboard.vue +17 -6
  29. package/src/components/DocumentEdit/DocumentEdit.vue +208 -68
  30. package/src/components/DocumentEdit/EditConfirmationModal.vue +54 -0
  31. package/src/components/DocumentEdit/EditPages.vue +29 -18
  32. package/src/components/DocumentEdit/EditSidebar.vue +92 -45
  33. package/src/components/DocumentEdit/SidebarButtons.vue +53 -0
  34. package/src/components/DocumentEdit/SplitInfoBar.vue +19 -0
  35. package/src/components/DocumentEdit/SplitOverview.vue +4 -5
  36. package/src/components/{DocumentError.vue → DocumentModals/DocumentErrorModal.vue} +3 -4
  37. package/src/components/{NotOptimizedViewportModal.vue → DocumentModals/NotOptimizedViewportModal.vue} +2 -2
  38. package/src/components/DocumentModals/SplittingSuggestionsModal.vue +120 -0
  39. package/src/components/DocumentPage/ActionBar.vue +3 -3
  40. package/src/components/DocumentPage/ScrollingDocument.vue +38 -4
  41. package/src/components/DocumentPage/ScrollingPage.vue +4 -5
  42. package/src/components/DocumentThumbnails/DocumentThumbnails.vue +14 -11
  43. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +35 -30
  44. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +3 -1
  45. package/src/locales/de.json +19 -6
  46. package/src/locales/en.json +20 -6
  47. package/src/locales/es.json +19 -6
  48. package/src/store/display.js +7 -0
  49. package/src/store/document.js +81 -17
  50. package/src/store/edit.js +67 -48
  51. package/src/store/project.js +14 -14
  52. package/src/components/DocumentAnnotations/ActionButtons.vue +0 -257
  53. package/src/components/DocumentAnnotations/RejectedLabels.vue +0 -96
@@ -27,28 +27,47 @@
27
27
  v-if="!editMode && !selectedDocument.is_reviewed && !publicView"
28
28
  class="finish-review-button-container"
29
29
  >
30
- <ActionButtons
31
- :finish-review-btn="annotationSets && annotationSets.length > 0"
32
- :finish-disabled="finishDisabled"
33
- :is-loading="isLoading"
34
- @finish-review="handleFinishReview"
35
- />
30
+ <b-tooltip
31
+ :active="finishDisabled"
32
+ position="is-bottom"
33
+ multilined
34
+ class="right-aligned finish-review"
35
+ >
36
+ <b-button
37
+ :class="['finish-review-btn', 'text-btn', 'primary-button']"
38
+ type="is-primary"
39
+ :disabled="finishDisabled"
40
+ @click.stop="handleFinishReview"
41
+ >
42
+ <span v-if="!isLoading">
43
+ {{ $t("finish_review") }}
44
+ </span>
45
+
46
+ <div v-else>
47
+ <b-notification :closable="false" :class="['loading-background']">
48
+ <b-loading :active="isLoading" :is-full-page="loadingOnFullPage">
49
+ <b-icon
50
+ icon="spinner"
51
+ class="fa-spin loading-icon-size spinner"
52
+ />
53
+ </b-loading>
54
+ </b-notification>
55
+ </div>
56
+ </b-button>
57
+
58
+ <template #content> {{ $t("disabled_finish_review") }} </template>
59
+ </b-tooltip>
36
60
  </div>
37
61
  </div>
38
62
  </template>
39
63
 
40
64
  <script>
41
65
  import { mapState } from "vuex";
42
- import ActionButtons from "../DocumentAnnotations/ActionButtons";
43
66
 
44
67
  export default {
45
68
  name: "DocumentTopBarButtons",
46
- components: {
47
- ActionButtons,
48
- },
49
69
  data() {
50
70
  return {
51
- finishReviewBtn: true,
52
71
  finishDisabled: true,
53
72
  emptyLabels: null,
54
73
  isLoading: false,
@@ -83,7 +102,6 @@ export default {
83
102
  this.finishDisabled = !this.finishedReview;
84
103
  },
85
104
  methods: {
86
- /** EDIT MODE */
87
105
  closeEditMode() {
88
106
  this.$store.dispatch("edit/disableEditMode");
89
107
  this.$store.dispatch("edit/setSplitOverview", false);
@@ -105,24 +123,11 @@ export default {
105
123
  // Enable the "next" button to go to the overview
106
124
  this.$store.dispatch("edit/setSplitOverview", true);
107
125
  this.$store.dispatch("edit/setSelectedPages", null);
108
- }
109
-
110
- // If we are in the overview (so more than 1 doc)
111
- // or in the edit mode (only 1 doc)
112
- else if (this.updatedDocument) {
113
- // Send update request to the backend
114
- this.$store
115
- .dispatch("edit/editDocument", this.updatedDocument)
116
- .catch((error) => {
117
- this.$store.dispatch("document/createErrorMessage", {
118
- error,
119
- serverErrorMessage: this.$t("server_error"),
120
- defaultErrorMessage: this.$t("edit_error"),
121
- });
122
- });
123
-
124
- // Close edit mode
125
- this.closeEditMode();
126
+ } else {
127
+ // If we are in the overview (so more than 1 doc)
128
+ // or in the edit mode (only 1 doc)
129
+ // Show confirmation modal to user
130
+ this.$store.dispatch("edit/setShowEditConfirmationModal", true);
126
131
  }
127
132
  },
128
133
  handleFinishReview() {
@@ -38,7 +38,9 @@
38
38
 
39
39
  <div class="action-item">
40
40
  <div class="key">{{ "DELETE" }}</div>
41
- <div class="keyboard-action-text">{{ $t("delete_key") }}</div>
41
+ <div class="keyboard-action-text">
42
+ {{ $t("missing_annotation") }}
43
+ </div>
42
44
  </div>
43
45
  </div>
44
46
  </div>
@@ -49,8 +49,7 @@
49
49
  "data_being_extracted": "Neue Daten werden extrahiert",
50
50
  "analysing_document": "Wir analysieren Ihr Dokument.",
51
51
  "few_minutes": "Dies könnte ein paar Minuten dauern.",
52
- "reject_label": "Ablehnen",
53
- "rejected": "Abgelehnt",
52
+ "missing_annotation": "Als fehlend markieren",
54
53
  "ann_exists": "Eine Annotation für dieses Label und Label-Set existiert bereits.",
55
54
  "lite_mode": "Schreibgeschützt",
56
55
  "limited_functionalities": "Sie verwenden die schreibgeschützte Version mit begrenzten Funktionalitäten.",
@@ -88,14 +87,13 @@
88
87
  "categorize_document_no_category_description": "Bitten Sie den Projektmanager, eine Beschreibung dieser Kategorie hinzuzufügen, um mehr über diese Kategorie zu erfahren.",
89
88
  "annotations_pending": "Ausstehende Annotationen",
90
89
  "annotations_accepted": "Akzeptierte Annotationen",
91
- "reject_all_empty": "Alle fehlenden Annotationen ablehnen",
90
+ "mark_all_missing": "Alle leeren als fehlend markieren",
92
91
  "no_labels_to_choose": "Keine Labels",
93
92
  "accept_group": "Alle akzeptieren",
94
93
  "use_your_keyboard": "Benutze deine Tastatur",
95
94
  "arrow_keys": "Navigieren",
96
95
  "esc_key": "Exit",
97
96
  "enter_key": "Akzeptieren oder Speichern",
98
- "delete_key": "Ablehnen",
99
97
  "decline": "Decline",
100
98
  "server_error": "Wir haben derzeit ein Serverproblem. Bitte versuchen Sie es später noch einmal oder",
101
99
  "get_support": "Hole dir Unterstützung",
@@ -110,8 +108,23 @@
110
108
  "new_multi_ann_description": "Wählen Sie ein Datenmodell aus den vorhandenen aus und deaktivieren Sie dann die Labels, die in diesem Dokument nicht vorhanden sind.",
111
109
  "drag_drop_columns_multi_ann": "Drag and Drop, um die Reihenfolge der Labels zu ändern",
112
110
  "error_creating_multi_ann": "Nicht alle Annotationen wurden erfolgreich erstellt.",
113
- "disabled_finish_review": "Der Abschluss der Dokumentenprüfung ist erst möglich, nachdem alle Annotationen überarbeitet wurden, unabhängig davon, ob sie akzeptiert oder abgelehnt wurden.",
114
111
  "no_multi_ann_labelset_model": "Es gibt keine verfügbaren Label Sets, die mehrfach in diesem Dokument zu finden sind. Weitere Informationen finden Sie unter <a href='https://help.konfuzio.com/tutorials/advanced-document-extraction/index.html#multiple-annotation-sets' target='_blank'>diesem Link</a>.",
115
112
  "single_category_in_project": "Das aktuelle Projekt hat nur eine Kategorie. Um sie ändern zu können, sollte die neue zuerst dem Projekt hinzugefügt werden. Einzelheiten dazu finden Sie unter <a href='https://help.konfuzio.com/modules/categories/index.html#add-a-category' target='_blank'>diesem Link</a>.",
116
- "approved_annotations": "Die Kategorie kann nicht geändert werden, da bereits akzeptierte Annotationen oder manuell erstellte Annotationen zu diesem Dokument vorhanden sind."
113
+ "approved_annotations": "Die Kategorie kann nicht geändert werden, da bereits akzeptierte Annotationen oder manuell erstellte Annotationen zu diesem Dokument vorhanden sind.",
114
+ "restore": "Restore",
115
+ "disabled_finish_review": "Das Beenden der Dokumentenprüfung ist erst möglich, nachdem alle Annotationen überarbeitet wurden, unabhängig davon, ob sie akzeptiert oder als fehlend markiert wurden.",
116
+ "split_modal_title": "Dokument aufteilen",
117
+ "split_modal_body": "Wir haben Ihre Datei gescannt und <strong>{number_of_split_documents}</strong> verschiedene Dokumente gefunde. <strong>Wir empfehlen dringend,</strong> sie zu diesem Zeitpunkt aufzuteilen, da sonst alle Fortschritte, die Sie gemacht haben, aufgrund der erneuten Extraktion der Dokumentdaten verloren gehen.",
118
+ "do_it_later": "Ich werde es später machen",
119
+ "review_now": "Jetzt reviewen",
120
+ "recommended": "Empfohlen",
121
+ "smart_split": "Smart Split",
122
+ "smart_split_suggestions": "Unsere Smart Split-Vorschläge sind grün hervorgehoben",
123
+ "no_splitting_suggestions": "Dieses Dokument enthält keine Split-Vorschläge",
124
+ "confirm_splitting": "Sind Sie sicher, dass Sie die Änderungen bestätigen möchten?",
125
+ "splitting_warning": "Beachten Sie bitte, dass alle Annotationen, die Sie in diesem Dokument gemacht haben, nicht gespeichert werden, wenn Sie fortfahren.",
126
+ "no": "Nein",
127
+ "yes": "Ja",
128
+ "split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
129
+ "missing_from_document": "Fehlt im Dokument"
117
130
  }
@@ -51,8 +51,7 @@
51
51
  "data_being_extracted": "New data is being extracted",
52
52
  "analysing_document": "We are analysing your document.",
53
53
  "few_minutes": "This might take a few minutes.",
54
- "reject_label": "Reject",
55
- "rejected": "Rejected",
54
+ "missing_annotation": "Mark as Missing",
56
55
  "ann_exists": "An annotation for this label and label set already exists.",
57
56
  "lite_mode": "Read Only",
58
57
  "limited_functionalities": "You are using the Read Only version with limited functionalities.",
@@ -89,7 +88,7 @@
89
88
  "categorize_document_no_category_description": "Ask the Project Manager to add a description of this Category to know more about this category.",
90
89
  "annotations_pending": "pending",
91
90
  "annotations_accepted": "accepted",
92
- "reject_all_empty": "Reject all empty",
91
+ "mark_all_missing": "Mark all empty as Missing",
93
92
  "no_labels_to_choose": "No Labels",
94
93
  "accept_group": "Accept all",
95
94
  "new_ann_set_title": "New annotation set",
@@ -102,7 +101,6 @@
102
101
  "arrow_keys": "to Navigate",
103
102
  "esc_key": "Exit",
104
103
  "enter_key": "Accept or Save",
105
- "delete_key": "Reject",
106
104
  "decline": "Decline",
107
105
  "server_error": "We are currently experiencing a server issue. Please try again later or",
108
106
  "get_support": "Get Support",
@@ -111,8 +109,24 @@
111
109
  "new_multi_ann_description": "Select a data model from the existing ones, then deselect the labels that don't exist in this document.",
112
110
  "drag_drop_columns_multi_ann": "Drag and drop to change the order of the labels",
113
111
  "error_creating_multi_ann": "Not all annotation sets were created successfully.",
114
- "disabled_finish_review": "Finishing the document review is only possible after all annotations have been revised, whether they are accepted or rejected.",
112
+ "disabled_finish_review": "Finishing the document review is only possible after all annotations have been revised, whether they are accepted or marked as missing.",
115
113
  "no_multi_ann_labelset_model": "There are no available label sets that can be found multiple times in this document. For more details, you can visit <a href='https://help.konfuzio.com/tutorials/advanced-document-extraction/index.html#multiple-annotation-sets' target='_blank'>this link</a>.",
116
114
  "single_category_in_project": "The current project has only one category. To be able to change it, the new one should be first added to the project. For details on how to do this, visit <a href='https://help.konfuzio.com/modules/categories/index.html#add-a-category' target='_blank'>this link</a>.",
117
- "approved_annotations": "It is not possible to change the current category since the document has approved or manually created annotations."
115
+ "approved_annotations": "It is not possible to change the current category since the document has approved or manually created annotations.",
116
+ "restore": "Restore",
117
+ "split_modal_title": "Split the document",
118
+ "split_modal_body": "We've scanned your file and found <strong>{number_of_split_documents}</strong> different documents. <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost due to document data re-extraction.",
119
+ "do_it_later": "I'll do it later",
120
+ "review_now": "Review now",
121
+ "recommended": "Recommended",
122
+ "smart_split": "Smart Split",
123
+ "smart_split_suggestions": "Our Smart Split suggestions are highlighted in green",
124
+ "no_splitting_suggestions": "This document does not have splitting suggestions",
125
+ "confirm_splitting": "Are you sure you want to confirm the changes?",
126
+ "splitting_warning": "Be aware that any annotations you have made in this document will not be saved if you proceed.",
127
+ "no": "No",
128
+ "yes": "Yes",
129
+ "prepare_document": "Prepare the document",
130
+ "split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
131
+ "missing_from_document": "Missing from the document"
118
132
  }
@@ -51,8 +51,7 @@
51
51
  "data_being_extracted": "Se están extrayendo nuevos datos",
52
52
  "analysing_document": "Estamos analizando el documento.",
53
53
  "few_minutes": "Esto puede tardar unos minutos.",
54
- "reject_label": "Rechazar",
55
- "rejected": "Rechazadas",
54
+ "missing_annotation": "Marcar como Faltante",
56
55
  "ann_exists": "Ya existe una anotación para esta etiqueta y grupo de etiquetas.",
57
56
  "lite_mode": "Sólo lectura",
58
57
  "limited_functionalities": "Está utilizando la versión de sólo lectura con funcionalidad limitada.",
@@ -89,14 +88,13 @@
89
88
  "categorize_document_no_category_description": "Solicite a su Gestor de Proyecto que agregue una descripción a esta Categoría para saber más sobre ella.",
90
89
  "annotations_pending": "pendientes",
91
90
  "annotations_accepted": "aceptadas",
92
- "reject_all_empty": "Rechazar todas las anotaciones vacías",
91
+ "mark_all_missing": "Marcas todas las anotaciones vacías como Faltantes",
93
92
  "no_labels_to_choose": "Sin etiquetas",
94
93
  "accept_group": "Aceptar todas",
95
94
  "use_your_keyboard": "Use su teclado",
96
95
  "arrow_keys": "para Navegar",
97
96
  "esc_key": "Salir del modo de edición",
98
97
  "enter_key": "Aceptar o Guardar",
99
- "delete_key": "Rechazar",
100
98
  "decline": "Declinar",
101
99
  "server_error": "Estamos experimentando problemas con el servidor. Por favor, repita la operación o ",
102
100
  "get_support": "Contacte al Soporte",
@@ -109,8 +107,23 @@
109
107
  "continue": "Continuar",
110
108
  "drag_drop_columns_multi_ann": "Arrastre y suelte las columnas para ordenar las etiquetas",
111
109
  "error_creating_multi_ann": "No todos los grupos de anotaciones fueron creados de manera exitosa.",
112
- "disabled_finish_review": "Solo es posible finalizar la revisión del documento si todas las anotaciones han sido revisadas, ya sea aceptadas o rechazadas.",
110
+ "disabled_finish_review": "Solo es posible finalizar la revisión del documento si todas las anotaciones han sido revisadas, ya sea aceptadas o marcadas como faltantes.",
113
111
  "no_multi_ann_labelset_model": "En este documento no hay grupos de etiquetas múltiples disponibles. Para más información, haz clic en <a href='https://help.konfuzio.com/tutorials/advanced-document-extraction/index.html#multiple-annotation-sets' target='_blank'>este enlace</a>.",
114
112
  "single_category_in_project": "Este proyecto solo tiene una categoría. Para poder modificarla, es necesario agregar esta nueva categoría al proyecto. Para más información, visita <a href='https://help.konfuzio.com/modules/categories/index.html#add-a-category' target='_blank'>este enlace</a>.",
115
- "approved_annotations": "No es posible cambiar la categoría, ya que existen anotaciones aceptadas o creadas manualmente en este documento."
113
+ "approved_annotations": "No es posible cambiar la categoría, ya que existen anotaciones aceptadas o creadas manualmente en este documento.",
114
+ "restore": "Restore",
115
+ "split_modal_title": "Dividir el documento",
116
+ "split_modal_body": "Hemos escaneado tu documento y hemos encontrado <strong>{number_of_split_documents}</strong> documentos diferentes. <strong>Te recomendamos</strong> dividir el documento en esta etapa, ya que de lo contrario se perderá el progreso logrado debido a una nueva extracción de los datos del documento.",
117
+ "do_it_later": "Lo haré luego",
118
+ "review_now": "Revisar ahora",
119
+ "recommended": "Recomendado",
120
+ "smart_split": "División Inteligente",
121
+ "smart_split_suggestions": "Nuestras sugerencias de División Inteligente están marcadas en color verde",
122
+ "no_splitting_suggestions": "Este documento no tiene sugerencias de división",
123
+ "confirm_splitting": "¿Seguro que quieres confirmar los cambios?",
124
+ "splitting_warning": "Ten en cuenta que se perderán las anotaciones que hayas confirmado en el documento.",
125
+ "no": "No",
126
+ "yes": "Sí",
127
+ "split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
128
+ "missing_from_document": "Falta en el documento"
116
129
  }
@@ -29,6 +29,7 @@ const state = {
29
29
  interactionBlocked: false,
30
30
  documentActionBar: null, // document action bar properties
31
31
  categorizeModalIsActive: false,
32
+ pageChangedFromThumbnail: false,
32
33
  };
33
34
 
34
35
  const getters = {
@@ -209,6 +210,9 @@ const actions = {
209
210
  setCategorizeModalIsActive: ({ commit }, value) => {
210
211
  commit("SET_CATEGORIZE_MODAL_IS_ACTIVE", value);
211
212
  },
213
+ setPageChangedFromThumbnail: ({ commit }, value) => {
214
+ commit("SET_PAGE_CHANGED_FROM_THUMBNAIL", value);
215
+ },
212
216
  };
213
217
 
214
218
  const mutations = {
@@ -235,6 +239,9 @@ const mutations = {
235
239
  SET_CATEGORIZE_MODAL_IS_ACTIVE: (state, value) => {
236
240
  state.categorizeModalIsActive = value;
237
241
  },
242
+ SET_PAGE_CHANGED_FROM_THUMBNAIL: (state, value) => {
243
+ state.pageChangedFromThumbnail = value;
244
+ },
238
245
  };
239
246
 
240
247
  export default {
@@ -21,13 +21,14 @@ const state = {
21
21
  showActionError: false,
22
22
  errorMessage: null,
23
23
  showDocumentError: false,
24
- rejectedMissingAnnotations: null,
24
+ annotationsMarkedAsMissing: null,
25
25
  errorMessageWidth: null,
26
26
  hoveredAnnotationSet: null,
27
27
  finishedReview: false,
28
28
  newAcceptedAnnotations: null,
29
29
  selectedEntities: null,
30
30
  serverError: false,
31
+ splittingSuggestions: null,
31
32
  };
32
33
 
33
34
  const getters = {
@@ -308,6 +309,27 @@ const getters = {
308
309
  return pendingEmpty.length;
309
310
  },
310
311
 
312
+ annotationIsNotFound: (state) => (annotationSet, label) => {
313
+ // Check if the combined label and label set have been marked as missing
314
+ // or if the document is in public mode
315
+ if (state.missingAnnotations.length === 0) {
316
+ return false;
317
+ } else {
318
+ const found = state.missingAnnotations.filter(
319
+ (el) =>
320
+ el.label === label.id &&
321
+ el.annotation_set === annotationSet.id &&
322
+ el.label_set === annotationSet.label_set.id
323
+ );
324
+
325
+ if (found.length !== 0) {
326
+ return true;
327
+ } else {
328
+ return false;
329
+ }
330
+ }
331
+ },
332
+
311
333
  // Check if document is ready to be finished
312
334
  isDocumentReviewFinished: (state) => () => {
313
335
  // check if all annotations have been revised
@@ -335,7 +357,7 @@ const getters = {
335
357
 
336
358
  // if all annotations have been revised
337
359
  // and if there are no empty annotations or
338
- // all empty annotations were rejected,
360
+ // all empty annotations were marked as missing,
339
361
  // we can finish the review
340
362
  if (
341
363
  !emptyAnnotations ||
@@ -419,6 +441,20 @@ const getters = {
419
441
  }
420
442
  },
421
443
 
444
+ /**
445
+ * If automatic splitting is enabled for the project
446
+ */
447
+ waitingForSplittingConfirmation: () => (document) => {
448
+ return document && document.status_data === 41;
449
+ },
450
+
451
+ /**
452
+ * Show the Smart Split switch or not
453
+ */
454
+ documentHasProposedSplit: () => (document) => {
455
+ return document.proposed_split && document.proposed_split.length > 0;
456
+ },
457
+
422
458
  /**
423
459
  * Joins all strings in a multi-entity Annotation array
424
460
  * to look like a single string
@@ -445,7 +481,7 @@ const getters = {
445
481
  /**
446
482
  * Check status of annotation
447
483
  */
448
- notFound: () => (annotation) => {
484
+ notExtracted: () => (annotation) => {
449
485
  if (annotation) {
450
486
  return !annotation.span;
451
487
  } else {
@@ -574,8 +610,8 @@ const actions = {
574
610
  setDocumentError: ({ commit }, value) => {
575
611
  commit("SET_DOCUMENT_ERROR", value);
576
612
  },
577
- setRejectedMissingAnnotations: ({ commit }, annotations) => {
578
- commit("SET_REJECTED_MISSING_ANNOTATIONS", annotations);
613
+ setAnnotationsMarkedAsMissing: ({ commit }, annotations) => {
614
+ commit("SET_ANNOTATIONS_MARKED_AS_MISSING", annotations);
579
615
  },
580
616
  setErrorMessageWidth: ({ commit }, width) => {
581
617
  commit("SET_ERROR_MESSAGE_WIDTH", width);
@@ -589,6 +625,9 @@ const actions = {
589
625
  setSelectedEntities: ({ commit }, entities) => {
590
626
  commit("SET_SELECTED_ENTITIES", entities);
591
627
  },
628
+ setSplittingSuggestions: ({ commit }, value) => {
629
+ commit("SET_SPLITTING_SUGGESTIONS", value);
630
+ },
592
631
 
593
632
  /**
594
633
  * Actions that use HTTP requests always return the axios promise,
@@ -635,6 +674,10 @@ const actions = {
635
674
  });
636
675
  }
637
676
 
677
+ if (getters.documentHasProposedSplit(response.data)) {
678
+ commit("SET_SPLITTING_SUGGESTIONS", response.data.proposed_split);
679
+ }
680
+
638
681
  categoryId = response.data.category;
639
682
  // TODO: add this validation to a method
640
683
  isRecalculatingAnnotations = response.data.labeling_available !== 1;
@@ -716,7 +759,7 @@ const actions = {
716
759
  HTTP.post(`/annotations/`, annotation)
717
760
  .then(async (response) => {
718
761
  if (response.status === 201) {
719
- dispatch("fetchMissingAnnotations");
762
+ await dispatch("fetchMissingAnnotations");
720
763
  commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
721
764
 
722
765
  if (!getters.annotationSetExists(response.data.annotation_set)) {
@@ -827,13 +870,14 @@ const actions = {
827
870
  });
828
871
  },
829
872
 
830
- addMissingAnnotations: ({ commit, dispatch }, missingAnnotations) => {
873
+ addMissingAnnotations: ({ commit, getters }, missingAnnotations) => {
831
874
  return new Promise((resolve, reject) => {
832
- return HTTP.post(`/missing-annotations/`, missingAnnotations)
833
- .then((response) => {
875
+ HTTP.post(`/missing-annotations/`, missingAnnotations)
876
+ .then(async (response) => {
834
877
  if (response.status === 201) {
835
- commit("SET_REJECTED_MISSING_ANNOTATIONS", null);
836
- dispatch("fetchMissingAnnotations");
878
+ commit("SET_ANNOTATIONS_MARKED_AS_MISSING", null);
879
+ commit("ADD_MISSING_ANNOTATIONS", response.data);
880
+ commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
837
881
  }
838
882
 
839
883
  resolve(response);
@@ -845,12 +889,13 @@ const actions = {
845
889
  });
846
890
  },
847
891
 
848
- deleteMissingAnnotation: ({ commit, getters, dispatch }, id) => {
892
+ deleteMissingAnnotation: ({ commit, getters }, id) => {
849
893
  return new Promise((resolve, reject) => {
850
894
  return HTTP.delete(`/missing-annotations/${id}/`)
851
895
  .then((response) => {
852
896
  if (response.status === 204) {
853
- dispatch("fetchMissingAnnotations");
897
+ commit("DELETE_MISSING_ANNOTATION", id);
898
+ commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
854
899
  resolve(true);
855
900
  }
856
901
  })
@@ -891,8 +936,11 @@ const actions = {
891
936
  `documents/${state.documentId}/?fields=status_data,labeling_available`
892
937
  )
893
938
  .then((response) => {
894
- if (getters.isDocumentReadyToBeReviewed(response.data)) {
895
- // ready
939
+ if (
940
+ getters.isDocumentReadyToBeReviewed(response.data) ||
941
+ getters.waitingForSplittingConfirmation(response.data)
942
+ ) {
943
+ // ready or has splitting suggestions
896
944
  return resolve(true);
897
945
  } else if (getters.documentHadErrorDuringExtraction(response.data)) {
898
946
  // error
@@ -1123,7 +1171,20 @@ const mutations = {
1123
1171
  SET_MISSING_ANNOTATIONS: (state, missingAnnotations) => {
1124
1172
  state.missingAnnotations = missingAnnotations;
1125
1173
  },
1174
+ ADD_MISSING_ANNOTATIONS: (state, missingAnnotations) => {
1175
+ missingAnnotations.map((annotation) => {
1176
+ state.missingAnnotations.push(annotation);
1177
+ });
1178
+ },
1179
+ DELETE_MISSING_ANNOTATION: (state, id) => {
1180
+ const indexOfAnnotationToDelete = state.missingAnnotations.findIndex(
1181
+ (annotation) => annotation.id === id
1182
+ );
1126
1183
 
1184
+ if (indexOfAnnotationToDelete > -1) {
1185
+ state.missingAnnotations.splice(indexOfAnnotationToDelete, 1);
1186
+ }
1187
+ },
1127
1188
  SET_SHOW_ACTION_ERROR: (state, value) => {
1128
1189
  state.showActionError = value;
1129
1190
  },
@@ -1133,8 +1194,8 @@ const mutations = {
1133
1194
  SET_DOCUMENT_ERROR: (state, value) => {
1134
1195
  state.showDocumentError = value;
1135
1196
  },
1136
- SET_REJECTED_MISSING_ANNOTATIONS: (state, annotations) => {
1137
- state.rejectedMissingAnnotations = annotations;
1197
+ SET_ANNOTATIONS_MARKED_AS_MISSING: (state, annotations) => {
1198
+ state.annotationsMarkedAsMissing = annotations;
1138
1199
  },
1139
1200
  SET_ERROR_MESSAGE_WIDTH: (state, width) => {
1140
1201
  state.errorMessageWidth = width;
@@ -1164,6 +1225,9 @@ const mutations = {
1164
1225
  UPDATE_FILE_NAME: (state, value) => {
1165
1226
  state.selectedDocument.data_file_name = value;
1166
1227
  },
1228
+ SET_SPLITTING_SUGGESTIONS: (state, array) => {
1229
+ state.splittingSuggestions = array;
1230
+ },
1167
1231
  };
1168
1232
 
1169
1233
  export default {