@konfuzio/document-validation-ui 0.1.5-styles-refactor → 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 (49) 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/.DS_Store +0 -0
  7. package/src/assets/images/MagicWandIcon.vue +16 -0
  8. package/src/assets/images/NotFoundIcon.vue +16 -0
  9. package/src/assets/images/SplitZigZag.vue +47 -14
  10. package/src/assets/images/StarIcon.vue +16 -0
  11. package/src/assets/scss/document_annotations.scss +9 -59
  12. package/src/assets/scss/document_category.scss +0 -1
  13. package/src/assets/scss/document_dashboard.scss +6 -0
  14. package/src/assets/scss/document_edit.scss +90 -46
  15. package/src/assets/scss/main.scss +67 -44
  16. package/src/assets/scss/splitting_confirmation_modal.scss +41 -0
  17. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +153 -0
  18. package/src/components/DocumentAnnotations/AnnotationDetails.vue +21 -4
  19. package/src/components/DocumentAnnotations/AnnotationRow.vue +97 -34
  20. package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +86 -0
  21. package/src/components/DocumentAnnotations/CategorizeModal.vue +24 -2
  22. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +77 -81
  23. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +16 -3
  24. package/src/components/DocumentAnnotations/ExtractingData.vue +3 -3
  25. package/src/components/DocumentAnnotations/index.js +0 -1
  26. package/src/components/DocumentCategory.vue +13 -5
  27. package/src/components/DocumentDashboard.vue +17 -6
  28. package/src/components/DocumentEdit/DocumentEdit.vue +208 -68
  29. package/src/components/DocumentEdit/EditConfirmationModal.vue +54 -0
  30. package/src/components/DocumentEdit/EditPages.vue +29 -18
  31. package/src/components/DocumentEdit/EditSidebar.vue +92 -45
  32. package/src/components/DocumentEdit/SidebarButtons.vue +53 -0
  33. package/src/components/DocumentEdit/SplitInfoBar.vue +19 -0
  34. package/src/components/DocumentEdit/SplitOverview.vue +4 -5
  35. package/src/components/{DocumentError.vue → DocumentModals/DocumentErrorModal.vue} +3 -4
  36. package/src/components/{NotOptimizedViewportModal.vue → DocumentModals/NotOptimizedViewportModal.vue} +2 -2
  37. package/src/components/DocumentModals/SplittingSuggestionsModal.vue +120 -0
  38. package/src/components/DocumentPage/ActionBar.vue +3 -3
  39. package/src/components/DocumentPage/ScrollingDocument.vue +7 -3
  40. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +35 -30
  41. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +3 -1
  42. package/src/locales/de.json +19 -6
  43. package/src/locales/en.json +20 -6
  44. package/src/locales/es.json +19 -6
  45. package/src/store/document.js +81 -17
  46. package/src/store/edit.js +67 -48
  47. package/src/store/project.js +14 -14
  48. package/src/components/DocumentAnnotations/ActionButtons.vue +0 -257
  49. package/src/components/DocumentAnnotations/RejectedLabels.vue +0 -96
@@ -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
  }
@@ -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 {
package/src/store/edit.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import myImports from "../api";
2
+ import { getURLQueryParam, navigateToNewDocumentURL } from "../utils/utils";
2
3
 
3
4
  const HTTP = myImports.HTTP;
4
5
 
@@ -6,9 +7,10 @@ const state = {
6
7
  editMode: false,
7
8
  splitOverview: false,
8
9
  isMultipleSelection: false,
9
- documentPagesListForEditMode: [], // TODO: change name
10
+ pagesForPostprocess: [],
10
11
  selectedPages: [],
11
12
  updatedDocument: [],
13
+ showEditConfirmationModal: false,
12
14
  };
13
15
 
14
16
  const actions = {
@@ -25,8 +27,8 @@ const actions = {
25
27
  commit("SET_SPLIT_OVERVIEW", overview);
26
28
  },
27
29
 
28
- setDocumentPagesListForEditMode: ({ commit }, pages) => {
29
- commit("SET_DOCUMENT_PAGES_FOR_EDIT_MODE", pages);
30
+ setPagesForPostprocess: ({ commit }, pages) => {
31
+ commit("SET_PAGES_FOR_POSTPROCESS", pages);
30
32
  },
31
33
 
32
34
  setUpdatedDocument: ({ commit }, updatedDocument) => {
@@ -57,42 +59,41 @@ const actions = {
57
59
  },
58
60
 
59
61
  rotatePage: ({ state, commit }, { page, direction }) => {
60
- if (state.documentPagesListForEditMode.find((p) => p.id === page[0].id)) {
61
- const documentPagesListForEditMode =
62
- state.documentPagesListForEditMode.map((p) => {
63
- let rotatedAngle;
64
- if (direction === "left") {
65
- rotatedAngle = p.angle - 90;
66
- if (p.id === page[0].id) {
67
- if (rotatedAngle === -270) {
68
- rotatedAngle = 90;
69
- }
70
- return {
71
- ...p,
72
- angle: rotatedAngle,
73
- };
62
+ if (state.pagesForPostprocess.find((p) => p.id === page[0].id)) {
63
+ const pagesForPostprocess = state.pagesForPostprocess.map((p) => {
64
+ let rotatedAngle;
65
+ if (direction === "left") {
66
+ rotatedAngle = p.angle - 90;
67
+ if (p.id === page[0].id) {
68
+ if (rotatedAngle === -270) {
69
+ rotatedAngle = 90;
74
70
  }
75
- return p;
71
+ return {
72
+ ...p,
73
+ angle: rotatedAngle,
74
+ };
76
75
  }
77
- if (direction === "right") {
78
- rotatedAngle = p.angle + 90;
79
- if (p.id === page[0].id) {
80
- if (rotatedAngle === 270) {
81
- rotatedAngle = -90;
82
- }
83
- return {
84
- ...p,
85
- angle: rotatedAngle,
86
- };
76
+ return p;
77
+ }
78
+ if (direction === "right") {
79
+ rotatedAngle = p.angle + 90;
80
+ if (p.id === page[0].id) {
81
+ if (rotatedAngle === 270) {
82
+ rotatedAngle = -90;
87
83
  }
88
- return p;
84
+ return {
85
+ ...p,
86
+ angle: rotatedAngle,
87
+ };
89
88
  }
90
- });
89
+ return p;
90
+ }
91
+ });
91
92
 
92
- commit("SET_DOCUMENT_PAGES_FOR_EDIT_MODE", documentPagesListForEditMode);
93
+ commit("SET_PAGES_FOR_POSTPROCESS", pagesForPostprocess);
93
94
  } else {
94
95
  if (direction === "left") {
95
- state.documentPagesListForEditMode.push({
96
+ state.pagesForPostprocess.push({
96
97
  id: page.id,
97
98
  number: page.number,
98
99
  angle: -90,
@@ -102,7 +103,7 @@ const actions = {
102
103
  }
103
104
 
104
105
  if (direction === "right") {
105
- state.documentPagesListForEditMode.push({
106
+ state.pagesForPostprocess.push({
106
107
  id: page.id,
107
108
  number: page.number,
108
109
  angle: 90,
@@ -115,7 +116,7 @@ const actions = {
115
116
 
116
117
  updateRotationToTheLeft: ({ state, commit }) => {
117
118
  // updated the angles that will be sent to the backend
118
- const array = state.documentPagesListForEditMode.map((p) => {
119
+ const array = state.pagesForPostprocess.map((p) => {
119
120
  let rotatedAngle = p.angle - 90;
120
121
  if (rotatedAngle === -270) {
121
122
  rotatedAngle = 90;
@@ -126,12 +127,12 @@ const actions = {
126
127
  };
127
128
  });
128
129
 
129
- commit("SET_DOCUMENT_PAGES_FOR_EDIT_MODE", array);
130
+ commit("SET_PAGES_FOR_POSTPROCESS", array);
130
131
  },
131
132
 
132
133
  updateRotationToTheRight: ({ state, commit }) => {
133
134
  // updated the angles that will be sent to the backend
134
- const array = state.documentPagesListForEditMode.map((p) => {
135
+ const array = state.pagesForPostprocess.map((p) => {
135
136
  let rotatedAngle = p.angle + 90;
136
137
  if (rotatedAngle === 270) {
137
138
  rotatedAngle = -90;
@@ -142,13 +143,16 @@ const actions = {
142
143
  };
143
144
  });
144
145
 
145
- commit("SET_DOCUMENT_PAGES_FOR_EDIT_MODE", array);
146
+ commit("SET_PAGES_FOR_POSTPROCESS", array);
146
147
  },
147
148
 
148
149
  editDocument: ({ rootState, dispatch }, editedDocument) => {
149
150
  dispatch("document/startRecalculatingAnnotations", null, {
150
151
  root: true,
151
152
  });
153
+
154
+ const oldId = rootState.document.documentId;
155
+
152
156
  return new Promise((resolve, reject) => {
153
157
  HTTP.post(
154
158
  `/documents/${rootState.document.documentId}/postprocess/`,
@@ -156,15 +160,23 @@ const actions = {
156
160
  )
157
161
  .then(async (response) => {
158
162
  if (response && response.status === 200) {
159
- const newDocument = response.data[0];
160
- const newId = newDocument.id;
161
-
162
- await dispatch("document/setDocId", newId, {
163
- root: true,
164
- });
165
- dispatch("document/pollDocumentEndpoint", null, {
166
- root: true,
167
- });
163
+ const newId = response.data[0].id;
164
+ dispatch("document/setSplittingSuggestions", null, { root: true });
165
+
166
+ if (newId !== oldId) {
167
+ if (getURLQueryParam("document")) {
168
+ navigateToNewDocumentURL(oldId, newId);
169
+ } else {
170
+ await dispatch("document/setDocId", newId, {
171
+ root: true,
172
+ });
173
+
174
+ dispatch("document/pollDocumentEndpoint", null, {
175
+ root: true,
176
+ });
177
+ }
178
+ }
179
+
168
180
  resolve(null);
169
181
  } else {
170
182
  resolve(response);
@@ -176,6 +188,10 @@ const actions = {
176
188
  });
177
189
  });
178
190
  },
191
+
192
+ setShowEditConfirmationModal: ({ commit }, value) => {
193
+ commit("SET_SHOW_EDIT_CONFIRMATION_MODAL", value);
194
+ },
179
195
  };
180
196
 
181
197
  const mutations = {
@@ -187,8 +203,8 @@ const mutations = {
187
203
  state.splitOverview = overview;
188
204
  },
189
205
 
190
- SET_DOCUMENT_PAGES_FOR_EDIT_MODE: (state, pages) => {
191
- state.documentPagesListForEditMode = pages;
206
+ SET_PAGES_FOR_POSTPROCESS: (state, pages) => {
207
+ state.pagesForPostprocess = pages;
192
208
  },
193
209
 
194
210
  SET_UPDATED_DOCUMENT: (state, updatedDocument) => {
@@ -200,6 +216,9 @@ const mutations = {
200
216
  ADD_SELECTED_PAGE: (state, selectedPage) => {
201
217
  state.selectedPages.push(selectedPage);
202
218
  },
219
+ SET_SHOW_EDIT_CONFIRMATION_MODAL: (state, value) => {
220
+ state.showEditConfirmationModal = value;
221
+ },
203
222
  };
204
223
 
205
224
  export default {
@@ -3,7 +3,7 @@ const HTTP = myImports.HTTP;
3
3
 
4
4
  const state = {
5
5
  projectId: null,
6
- currentUser: null
6
+ currentUser: null,
7
7
  };
8
8
 
9
9
  const getters = {
@@ -11,13 +11,13 @@ const getters = {
11
11
  * Gets label sets for an annotation set creation
12
12
  */
13
13
  labelSetsFilteredForAnnotationSetCreation:
14
- state => (labelsSet, annotationSets) => {
14
+ (state) => (labelsSet, annotationSets) => {
15
15
  let returnLabels = [];
16
16
  if (labelsSet) {
17
- returnLabels = labelsSet.filter(labelSet => {
17
+ returnLabels = labelsSet.filter((labelSet) => {
18
18
  // check if label set has multiple and if not, if there's already an annotation set created
19
19
  if (!labelSet.has_multiple_annotation_sets) {
20
- const existingAnnotationSet = annotationSets.find(annSet => {
20
+ const existingAnnotationSet = annotationSets.find((annSet) => {
21
21
  return annSet.id === labelSet.id;
22
22
  });
23
23
  return existingAnnotationSet;
@@ -27,7 +27,7 @@ const getters = {
27
27
  });
28
28
  }
29
29
  return returnLabels;
30
- }
30
+ },
31
31
  };
32
32
 
33
33
  const actions = {
@@ -38,10 +38,10 @@ const actions = {
38
38
  fetchLabelSetDetails: ({ commit, state }, labelSetId) => {
39
39
  return new Promise((resolve, reject) => {
40
40
  HTTP.get(`label-sets/${labelSetId}/`)
41
- .then(response => {
41
+ .then((response) => {
42
42
  return resolve(response.data);
43
43
  })
44
- .catch(error => {
44
+ .catch((error) => {
45
45
  reject(error);
46
46
  console.log(error);
47
47
  });
@@ -52,10 +52,10 @@ const actions = {
52
52
  fetchLabelSets: ({ state }) => {
53
53
  return new Promise((resolve, reject) => {
54
54
  HTTP.get(`label-sets/?project=${state.projectId}`)
55
- .then(response => {
55
+ .then((response) => {
56
56
  return resolve(response.data.results);
57
57
  })
58
- .catch(error => {
58
+ .catch((error) => {
59
59
  reject(error);
60
60
  console.log(error);
61
61
  });
@@ -64,17 +64,17 @@ const actions = {
64
64
 
65
65
  fetchCurrentUser: ({ commit }) => {
66
66
  return HTTP.get(`/auth/me/`)
67
- .then(response => {
67
+ .then((response) => {
68
68
  commit("SET_CURRENT_USER", response.data.username);
69
69
  })
70
- .catch(error => {
70
+ .catch((error) => {
71
71
  console.log(error);
72
72
  });
73
73
  },
74
74
 
75
75
  setCurrentUser: ({ commit }, currentUser) => {
76
76
  commit("SET_CURRENT_USER", currentUser);
77
- }
77
+ },
78
78
  };
79
79
 
80
80
  const mutations = {
@@ -83,7 +83,7 @@ const mutations = {
83
83
  },
84
84
  SET_CURRENT_USER: (state, currentUser) => {
85
85
  state.currentUser = currentUser;
86
- }
86
+ },
87
87
  };
88
88
 
89
89
  export default {
@@ -91,5 +91,5 @@ export default {
91
91
  state,
92
92
  actions,
93
93
  mutations,
94
- getters
94
+ getters,
95
95
  };