@konfuzio/document-validation-ui 0.1.10-dev.8 → 0.1.10

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 (46) 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 +1 -1
  6. package/package.json +1 -1
  7. package/src/.DS_Store +0 -0
  8. package/src/api.js +10 -0
  9. package/src/assets/scss/document_category.scss +1 -0
  10. package/src/assets/scss/document_edit.scss +2 -0
  11. package/src/assets/scss/document_name.scss +0 -2
  12. package/src/assets/scss/document_top_bar.scss +22 -0
  13. package/src/assets/scss/new_annotation.scss +17 -3
  14. package/src/assets/scss/theme.scss +779 -0
  15. package/src/assets/scss/variables.scss +0 -7
  16. package/src/components/App.vue +79 -10
  17. package/src/components/DocumentAnnotations/AnnotationContent.vue +33 -18
  18. package/src/components/DocumentAnnotations/AnnotationRow.vue +21 -60
  19. package/src/components/DocumentAnnotations/ChooseLabelSetModal.vue +3 -2
  20. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +1 -5
  21. package/src/components/DocumentAnnotations/MultiAnnotationTableOverlay.vue +1 -1
  22. package/src/components/DocumentDashboard.vue +8 -0
  23. package/src/components/DocumentEdit/DocumentEdit.vue +20 -11
  24. package/src/components/DocumentEdit/EditConfirmationModal.vue +1 -0
  25. package/src/components/DocumentEdit/EditPageThumbnail.vue +1 -3
  26. package/src/components/DocumentEdit/EditSidebar.vue +8 -3
  27. package/src/components/DocumentPage/DocumentPage.vue +0 -18
  28. package/src/components/DocumentPage/DocumentToolbar.vue +1 -0
  29. package/src/components/DocumentPage/MultiAnnSelection.vue +4 -26
  30. package/src/components/DocumentPage/NewAnnotation.vue +6 -23
  31. package/src/components/DocumentTopBar/DocumentName.vue +3 -1
  32. package/src/components/DocumentTopBar/DocumentTopBar.vue +81 -2
  33. package/src/components/DocumentsList/DocumentsList.vue +1 -6
  34. package/src/locales/de.json +3 -2
  35. package/src/locales/en.json +2 -1
  36. package/src/locales/es.json +2 -1
  37. package/src/main.js +0 -24
  38. package/src/store/category.js +19 -35
  39. package/src/store/display.js +7 -0
  40. package/src/store/document.js +29 -5
  41. package/src/store/edit.js +27 -15
  42. package/src/store/project.js +31 -1
  43. package/src/utils/utils.js +18 -1
  44. package/dist/css/chunk-vendors.css +0 -5
  45. package/src/assets/scss/main.scss +0 -760
  46. package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +0 -226
@@ -18,14 +18,6 @@
18
18
  :container-height="scaledViewport.height"
19
19
  @close="closePopups"
20
20
  />
21
- <MultiAnnotationTablePopup
22
- v-if="newMultiAnnotationSetTable"
23
- :table-position="newMultiAnnotationSetTable.position"
24
- :page-size="scaledViewport"
25
- :label-set="newMultiAnnotationSetTable.labelSet"
26
- :grouped-entities="newMultiAnnotationSetTable.entities"
27
- @close="closePopups"
28
- />
29
21
 
30
22
  <AnnSetTableOptions v-if="showAnnSetTable" :page="page" />
31
23
 
@@ -117,7 +109,6 @@
117
109
  :page="page"
118
110
  @buttonEnter="onElementEnter"
119
111
  @buttonLeave="onElementLeave"
120
- @finished="handleMultiAnnSelectionFinished"
121
112
  />
122
113
  </v-layer>
123
114
  </v-stage>
@@ -136,7 +127,6 @@ import api from "../../api";
136
127
  import BoxSelection from "./BoxSelection";
137
128
  import MultiAnnSelection from "./MultiAnnSelection";
138
129
  import NewAnnotation from "./NewAnnotation";
139
- import MultiAnnotationTablePopup from "./MultiAnnotationTablePopup";
140
130
  import AnnSetTableOptions from "./AnnSetTableOptions";
141
131
 
142
132
  export default {
@@ -145,7 +135,6 @@ export default {
145
135
  BoxSelection,
146
136
  MultiAnnSelection,
147
137
  NewAnnotation,
148
- MultiAnnotationTablePopup,
149
138
  AnnSetTableOptions,
150
139
  },
151
140
 
@@ -160,7 +149,6 @@ export default {
160
149
  return {
161
150
  image: null,
162
151
  newAnnotation: [],
163
- newMultiAnnotationSetTable: null,
164
152
  };
165
153
  },
166
154
 
@@ -393,7 +381,6 @@ export default {
393
381
  },
394
382
 
395
383
  handleFocusedAnnotation(annotation, trigger) {
396
- this.$store.dispatch("document/resetEditAnnotation");
397
384
  this.$store.dispatch("document/setSidebarAnnotationSelected", {
398
385
  annotation,
399
386
  trigger,
@@ -461,10 +448,6 @@ export default {
461
448
  this.$refs.stage.$el.style.cursor = "inherit";
462
449
  },
463
450
 
464
- handleMultiAnnSelectionFinished(newMultiAnnotationSetTable) {
465
- this.newMultiAnnotationSetTable = newMultiAnnotationSetTable;
466
- },
467
-
468
451
  /**
469
452
  * Konva draws pages like this.
470
453
  */
@@ -557,7 +540,6 @@ export default {
557
540
  };
558
541
  },
559
542
  closePopups(closeNewAnnotaton) {
560
- this.newMultiAnnotationSetTable = null;
561
543
  if (closeNewAnnotaton) {
562
544
  this.newAnnotation = [];
563
545
  }
@@ -119,6 +119,7 @@ export default {
119
119
  methods: {
120
120
  handleEdit() {
121
121
  if (this.editModeDisabled) return;
122
+ this.$store.dispatch("selection/disableSelection");
122
123
  this.$store.dispatch("edit/enableEditMode");
123
124
  },
124
125
  zoomIn() {
@@ -132,34 +132,12 @@ export default {
132
132
  },
133
133
  methods: {
134
134
  openMultiAnnotationModal() {
135
- this.$buefy.modal.open({
136
- parent: this.$parent,
137
- component: ChooseLabelSetModal,
138
- hasModalCard: true,
139
- trapFocus: true,
140
- canCancel: false,
141
- customClass: "dv-ui-theme invisible-parent-modal",
142
- props: { isMultipleAnnotations: true },
143
- events: {
144
- labelSet: this.submitAnnotations,
145
- },
135
+ this.$store.dispatch("display/showChooseLabelSetModal", {
136
+ show: true,
137
+ isMultipleAnnotations: true,
138
+ finish: this.submitAnnotations,
146
139
  });
147
140
  },
148
- chooseLabelSet(labelSet) {
149
- // TODO: deprecated with new multi ann set table
150
- const tableSelection = {
151
- labelSet,
152
- position: {
153
- x: this.selection.start.x,
154
- y: this.selection.start.y,
155
- width: this.selection.end.x - this.selection.start.x,
156
- height: this.selection.end.y - this.selection.start.y,
157
- },
158
- entities: this.entities,
159
- };
160
- this.$store.dispatch("selection/disableSelection");
161
- this.$emit("finished", tableSelection);
162
- },
163
141
 
164
142
  async submitAnnotations(labelSet) {
165
143
  const columns = labelSet.labels.map((label) => {
@@ -5,6 +5,7 @@
5
5
  v-model="selectedSet"
6
6
  aria-role="list"
7
7
  :class="[
8
+ 'annotation-dropdown',
8
9
  'no-padding-bottom',
9
10
  setsList.length === 0 ? 'no-padding-top' : '',
10
11
  ]"
@@ -69,7 +70,7 @@
69
70
  v-model="selectedLabel"
70
71
  aria-role="list"
71
72
  :disabled="!labels || labels.length === 0"
72
- class="label-dropdown"
73
+ class="label-dropdown annotation-dropdown"
73
74
  >
74
75
  <template #trigger>
75
76
  <b-button
@@ -258,15 +259,7 @@ export default {
258
259
  this.loading = false;
259
260
  });
260
261
  },
261
- disableLabelSetModalShowing() {
262
- // timeout to stop propagation of click event
263
- setTimeout(() => {
264
- this.isAnnSetModalShowing = false;
265
- }, 500);
266
- },
267
262
  chooseLabelSet(labelSet) {
268
- this.disableLabelSetModalShowing();
269
-
270
263
  const newSet = {
271
264
  label_set: labelSet,
272
265
  labels: labelSet.labels,
@@ -276,20 +269,10 @@ export default {
276
269
  this.selectedSet = newSet;
277
270
  },
278
271
  openAnnotationSetCreation() {
279
- this.isAnnSetModalShowing = true;
280
-
281
- this.$buefy.modal.open({
282
- parent: this.$parent,
283
- component: ChooseLabelSetModal,
284
- hasModalCard: true,
285
- trapFocus: true,
286
- canCancel: false,
287
- onCancel: this.disableLabelSetModalShowing,
288
- customClass: "dv-ui-theme invisible-parent-modal",
289
- events: {
290
- labelSet: this.chooseLabelSet,
291
- close: this.disableLabelSetModalShowing,
292
- },
272
+ this.$store.dispatch("display/showChooseLabelSetModal", {
273
+ show: true,
274
+ isMultipleAnnotations: true,
275
+ finish: this.chooseLabelSet,
293
276
  });
294
277
  },
295
278
  setTooltipText() {
@@ -1,5 +1,7 @@
1
1
  <template>
2
- <div class="document-name-component">
2
+ <div
3
+ :class="['document-name-component', editMode && 'document-name-edit-mode']"
4
+ >
3
5
  <div class="document-icon">
4
6
  <ServerImage
5
7
  :height="'22px'"
@@ -10,7 +10,36 @@
10
10
  />
11
11
  </div>
12
12
 
13
- <DocumentName :data-file-name="selectedDocument.data_file_name" />
13
+ <div
14
+ :class="[
15
+ 'center-bar-components',
16
+ recalculatingAnnotations && 'single-component',
17
+ ]"
18
+ >
19
+ <div
20
+ :class="[
21
+ 'left-arrow navigation-arrow',
22
+ !previousDocument && 'navigation-disabled',
23
+ ]"
24
+ type="button"
25
+ @click="navigateToDocument(previousDocument)"
26
+ >
27
+ <b-icon icon="angle-left" size="is-small" />
28
+ </div>
29
+
30
+ <DocumentName :data-file-name="selectedDocument.data_file_name" />
31
+
32
+ <div
33
+ :class="[
34
+ 'right-arrow navigation-arrow',
35
+ !nextDocument && 'navigation-disabled',
36
+ ]"
37
+ type="button"
38
+ @click="navigateToDocument(nextDocument)"
39
+ >
40
+ <b-icon icon="angle-right" size="is-small" />
41
+ </div>
42
+ </div>
14
43
 
15
44
  <div v-if="!recalculatingAnnotations" class="right-bar-components">
16
45
  <div
@@ -87,6 +116,8 @@ export default {
87
116
  data() {
88
117
  return {
89
118
  categoryError: false,
119
+ previousDocument: null,
120
+ nextDocument: null,
90
121
  };
91
122
  },
92
123
  computed: {
@@ -98,7 +129,19 @@ export default {
98
129
  ]),
99
130
  ...mapState("category", ["categories"]),
100
131
  ...mapState("edit", ["editMode"]),
101
- ...mapGetters("document", ["isDocumentReviewed"]),
132
+ ...mapState("project", ["documentsInProject"]),
133
+ ...mapGetters("document", [
134
+ "isDocumentReviewed",
135
+ "isDocumentReadyToBeReviewed",
136
+ "waitingForSplittingConfirmation",
137
+ ]),
138
+ },
139
+ watch: {
140
+ documentsInProject(newValue) {
141
+ if (newValue && this.selectedDocument) {
142
+ this.getPreviousAndNextDocuments();
143
+ }
144
+ },
102
145
  },
103
146
  created() {
104
147
  window.addEventListener("resize", this.handleResize);
@@ -120,6 +163,42 @@ export default {
120
163
  handleResize() {
121
164
  this.setComponentWidth(this.$refs.documentTopBar.offsetWidth);
122
165
  },
166
+ getPreviousAndNextDocuments() {
167
+ // Only consider documents who have a status of "ready"
168
+ const filteredDocuments = this.documentsInProject.filter(
169
+ (document) =>
170
+ this.isDocumentReadyToBeReviewed(document) ||
171
+ this.waitingForSplittingConfirmation(document)
172
+ );
173
+
174
+ if (!filteredDocuments) return;
175
+
176
+ const found = filteredDocuments.find(
177
+ (document) => document.id === this.selectedDocument.id
178
+ );
179
+
180
+ const indexOfCurrentDocument = filteredDocuments.indexOf(found);
181
+
182
+ if (!(indexOfCurrentDocument < 0)) {
183
+ this.previousDocument = filteredDocuments[indexOfCurrentDocument - 1];
184
+ this.nextDocument = filteredDocuments[indexOfCurrentDocument + 1];
185
+ } else {
186
+ this.previousDocument = filteredDocuments[0];
187
+ this.nextDocument = filteredDocuments[1];
188
+ }
189
+ },
190
+ navigateToDocument(document) {
191
+ if (!document) return;
192
+
193
+ this.$store.dispatch("document/changeCurrentDocument", document.id);
194
+
195
+ if (this.editMode) {
196
+ // Reset edit mode when changing the document,
197
+ // in case the change was made from the arrows in the Edit Mode
198
+ // so that the user does not get stuck in this interface
199
+ this.$store.dispatch("edit/disableEditMode");
200
+ }
201
+ },
123
202
  },
124
203
  };
125
204
  </script>
@@ -110,12 +110,7 @@ export default {
110
110
  },
111
111
  methods: {
112
112
  changeDocument(documentId) {
113
- if (getURLQueryParam("document") || getURLPath("docs")) {
114
- navigateToNewDocumentURL(this.selectedDocument.id, documentId);
115
- } else {
116
- this.$store.dispatch("document/setDocId", documentId);
117
- this.$store.dispatch("document/fetchDocument");
118
- }
113
+ this.$store.dispatch("document/changeCurrentDocument", documentId);
119
114
  },
120
115
  requestTrialAccess() {
121
116
  window.open("https://konfuzio.com", "_blank");
@@ -57,7 +57,7 @@
57
57
  "reorder": "Sortieren",
58
58
  "rotate": "Rotieren",
59
59
  "edit_error": "Die Änderungen konnten nicht gespeichert werden. Bitte versuchen Sie es später erneut.",
60
- "select_pages": "Sie können nun Seiten drehen, neu sortieren und Dokumente splitten.",
60
+ "select_pages": "Sie können nun Seiten drehen, neu sortieren und Dokumente teilen.",
61
61
  "edit_document": "Dokument bearbeiten (Early Access)",
62
62
  "edit_early_access": "Sie sind einer der Nutzer, die Zugang zu diesen Funktionalitäten vor dem offiziellen Erscheinungstermin erhalten.",
63
63
  "selected": "ausgewählt",
@@ -131,5 +131,6 @@
131
131
  "edit_label": "Label editieren",
132
132
  "delete_label": "Label löschen",
133
133
  "table": "Tabelle",
134
- "prepare_document": "Dokument vorbereiten"
134
+ "prepare_document": "Dokument vorbereiten",
135
+ "delete_table": "Tabelle löschen"
135
136
  }
@@ -131,5 +131,6 @@
131
131
  "missing_from_document": "Missing from the document",
132
132
  "edit_label": "Edit label",
133
133
  "delete_label": "Delete label",
134
- "table": "Table"
134
+ "table": "Table",
135
+ "delete_table": "Delete table"
135
136
  }
@@ -131,5 +131,6 @@
131
131
  "table": "Tabla",
132
132
  "new_multi_ann_description": "Seleccione un modelo de datos de los existentes, luego deseleccione las etiquetas que no existen en este documento.",
133
133
  "new_multi_ann_title": "Crear múltiples anotaciones",
134
- "prepare_document": "Prepare el documento"
134
+ "prepare_document": "Prepare el documento",
135
+ "delete_table": "Eliminar tabla"
135
136
  }
package/src/main.js CHANGED
@@ -1,10 +1,7 @@
1
1
  import Vue from "vue";
2
2
  import Buefy from "buefy";
3
- import "buefy/dist/buefy.css";
4
3
  import VueKonva from "vue-konva";
5
4
  import App from "./components/App";
6
- import * as Sentry from "@sentry/vue";
7
- import { Integrations } from "@sentry/tracing";
8
5
  import i18n from "./i18n";
9
6
  import store from "./store";
10
7
  import { library } from "@fortawesome/fontawesome-svg-core";
@@ -59,27 +56,6 @@ Vue.use(Buefy, {
59
56
  });
60
57
  Vue.use(VueObserveVisibility);
61
58
 
62
- // Sentry config
63
- if (process.env.NODE_ENV != "development") {
64
- Sentry.init({
65
- Vue,
66
- dsn: process.env.VUE_APP_SENTRY_DSN,
67
- integrations: [new Integrations.BrowserTracing()],
68
- environment: process.env.VUE_APP_SENTRY_ENVIRONMENT,
69
-
70
- // We recommend adjusting this value in production, or using tracesSampler
71
- // for finer control
72
- tracesSampleRate: 1.0,
73
-
74
- // If false, errors won't show up in devtools
75
- logErrors: true,
76
-
77
- tracingOptions: {
78
- trackComponents: true,
79
- },
80
- });
81
- }
82
-
83
59
  /**
84
60
  * Main entrypoint for the App
85
61
  */
@@ -3,7 +3,7 @@ import myImports from "../api";
3
3
  const HTTP = myImports.HTTP;
4
4
 
5
5
  const state = {
6
- documentsInProject: [],
6
+ createAvailableListOfDocuments: false,
7
7
  documentsAvailableToReview: [], // filtered by user
8
8
  categories: null,
9
9
  };
@@ -39,37 +39,21 @@ const getters = {
39
39
  };
40
40
 
41
41
  const actions = {
42
- setDocumentsInProject: ({ commit }, documents) => {
43
- commit("SET_DOCUMENTS_IN_PROJECT", documents);
44
- },
45
42
  setDocumentsAvailableToReview: ({ commit }, documentsAvailableToReview) => {
46
43
  commit("SET_AVAILABLE_DOCUMENTS", documentsAvailableToReview);
47
44
  },
48
45
  setCategories: ({ commit }, categories) => {
49
46
  commit("SET_CATEGORIES", categories);
50
47
  },
51
- /**
52
- * Actions that use HTTP requests always return the axios promise,
53
- * so they can be `await`ed (useful to set the `loading` status).
54
- */
55
- fetchDocumentList: ({ commit, rootState }, categoryId) => {
56
- return HTTP.get(
57
- `documents/?category=${categoryId}&assignee=${rootState.project.currentUser}&limit=100`
58
- )
59
- .then((response) => {
60
- if (response.data.results) {
61
- commit("SET_DOCUMENTS_IN_PROJECT", response.data.results);
62
- }
63
- })
64
- .catch((error) => {
65
- console.log(error, "Could not fetch document list from the backend");
66
- });
67
- },
68
48
 
69
49
  createAvailableDocumentsList: (
70
- { commit, state, dispatch, rootGetters },
50
+ { commit, state, dispatch, rootState, rootGetters },
71
51
  { categoryId, user, poll }
72
52
  ) => {
53
+ if (!state.createAvailableListOfDocuments) return;
54
+
55
+ const parameters = `category=${categoryId}`;
56
+
73
57
  const sleep = (duration) =>
74
58
  new Promise((resolve) => setTimeout(resolve, duration));
75
59
 
@@ -80,10 +64,10 @@ const actions = {
80
64
  let errors = 0;
81
65
  count += 1;
82
66
 
83
- return dispatch("fetchDocumentList", categoryId).then(() => {
84
- for (let i = 0; i < state.documentsInProject.length; i++) {
67
+ return dispatch("project/fetchDocumentList", parameters).then(() => {
68
+ for (let i = 0; i < rootState.project.documentsInProject.length; i++) {
85
69
  const found = state.documentsAvailableToReview.find(
86
- (doc) => doc.id === state.documentsInProject[i].id
70
+ (doc) => doc.id === rootState.project.documentsInProject[i].id
87
71
  );
88
72
 
89
73
  if (found) {
@@ -92,14 +76,17 @@ const actions = {
92
76
  continue;
93
77
  } else if (
94
78
  rootGetters["document/isDocumentReadyToBeReviewed"](
95
- state.documentsInProject[i]
79
+ rootState.project.documentsInProject[i]
96
80
  )
97
81
  ) {
98
82
  // add available doc to the end of the array
99
- commit("ADD_AVAILABLE_DOCUMENT", state.documentsInProject[i]);
83
+ commit(
84
+ "ADD_AVAILABLE_DOCUMENT",
85
+ rootState.project.documentsInProject[i]
86
+ );
100
87
  } else if (
101
88
  rootGetters["document/documentHadErrorDuringExtraction"](
102
- state.documentsInProject[i]
89
+ rootState.project.documentsInProject[i]
103
90
  )
104
91
  ) {
105
92
  dispatch("document/setDocumentError", null, { root: true });
@@ -118,10 +105,10 @@ const actions = {
118
105
  // And if the difference is due to errors or to docs not ready
119
106
  if (
120
107
  poll &&
121
- state.documentsInProject.length !==
108
+ rootState.project.documentsInProject.length !==
122
109
  state.documentsAvailableToReview.length &&
123
110
  state.documentsAvailableToReview.length + errors !==
124
- state.documentsInProject.length
111
+ rootState.project.documentsInProject.length
125
112
  ) {
126
113
  if (count >= 10) return true;
127
114
 
@@ -137,8 +124,8 @@ const actions = {
137
124
 
138
125
  // Poll as long as the lengths are different
139
126
  if (
140
- state.documentsInProject.length === 0 ||
141
- state.documentsInProject.length !==
127
+ rootState.project.documentsInProject.length === 0 ||
128
+ rootState.project.documentsInProject.length !==
142
129
  state.documentsAvailableToReview.length
143
130
  ) {
144
131
  let duration;
@@ -169,9 +156,6 @@ const actions = {
169
156
  };
170
157
 
171
158
  const mutations = {
172
- SET_DOCUMENTS_IN_PROJECT: (state, documents) => {
173
- state.documentsInProject = documents;
174
- },
175
159
  SET_AVAILABLE_DOCUMENTS: (state, documentsAvailableToReview) => {
176
160
  state.documentsAvailableToReview = documentsAvailableToReview;
177
161
  },
@@ -31,6 +31,7 @@ const state = {
31
31
  categorizeModalIsActive: false,
32
32
  pageChangedFromThumbnail: false,
33
33
  showAnnSetTable: null,
34
+ showChooseLabelSetModal: null,
34
35
  };
35
36
 
36
37
  const getters = {
@@ -236,6 +237,9 @@ const actions = {
236
237
  showAnnSetTable({ commit }, tableSet) {
237
238
  commit("SET_ANN_SET_TABLE", tableSet);
238
239
  },
240
+ showChooseLabelSetModal({ commit }, options) {
241
+ commit("SET_SHOW_CHOOSE_LABEL_SET_MODAL", options);
242
+ },
239
243
  toggleAnnSetTable({ commit }, tableSet) {
240
244
  commit("TOGGLE_ANN_SET_TABLE", tableSet);
241
245
  },
@@ -286,6 +290,9 @@ const mutations = {
286
290
  SET_PAGE_CHANGED_FROM_THUMBNAIL: (state, value) => {
287
291
  state.pageChangedFromThumbnail = value;
288
292
  },
293
+ SET_SHOW_CHOOSE_LABEL_SET_MODAL: (state, options) => {
294
+ state.showChooseLabelSetModal = options;
295
+ },
289
296
  };
290
297
 
291
298
  export default {
@@ -1,5 +1,10 @@
1
1
  import myImports from "../api";
2
- import { sleep } from "../utils/utils";
2
+ import {
3
+ sleep,
4
+ getURLQueryParam,
5
+ navigateToNewDocumentURL,
6
+ getURLPath,
7
+ } from "../utils/utils";
3
8
 
4
9
  const HTTP = myImports.HTTP;
5
10
  const documentPollDuration = 1000;
@@ -758,13 +763,18 @@ const actions = {
758
763
  await dispatch("category/fetchCategories", projectId, {
759
764
  root: true,
760
765
  });
766
+
767
+ // get list of documents not reviewed
768
+ await dispatch("project/fetchDocumentList", "is_reviewed=false", {
769
+ root: true,
770
+ });
761
771
  }
762
- if (categoryId) {
772
+ if (categoryId && rootState.category.createAvailableListOfDocuments) {
763
773
  await dispatch(
764
774
  "category/createAvailableDocumentsList",
765
775
  {
766
776
  categoryId,
767
- user: rootState.project.currentUser,
777
+ user: rootState.project.currentUser.username,
768
778
  poll: pollDocumentList,
769
779
  },
770
780
  {
@@ -1063,7 +1073,7 @@ const actions = {
1063
1073
  { error, serverErrorMessage, defaultErrorMessage }
1064
1074
  ) => {
1065
1075
  // check type of error
1066
- if (error && error.status === 500) {
1076
+ if (error && error.status >= 500 && error.status < 600) {
1067
1077
  dispatch("setErrorMessage", serverErrorMessage);
1068
1078
  commit("SET_SERVER_ERROR", true);
1069
1079
  } else if (error.data && error.data.length > 0) {
@@ -1083,11 +1093,25 @@ const actions = {
1083
1093
 
1084
1094
  contactSupport: ({ rootState }, error) => {
1085
1095
  const url = "https://konfuzio.com/support/";
1086
- const params = `project=${rootState.project.projectId}&email=${rootState.project.currentUser}&issue=${error}`;
1096
+ const params = `project=${rootState.project.projectId}&email=${rootState.project.currentUser.username}&issue=${error}`;
1087
1097
  const fullUrl = `${url}?${params}`;
1088
1098
 
1089
1099
  window.open(fullUrl, "_blank");
1090
1100
  },
1101
+
1102
+ changeCurrentDocument: ({ commit, state, dispatch }, newDocumentId) => {
1103
+ // reset splitting suggestions
1104
+ if (state.splittingSuggestions) {
1105
+ commit("SET_SPLITTING_SUGGESTIONS", null);
1106
+ }
1107
+
1108
+ if (getURLQueryParam("document") || getURLPath("d")) {
1109
+ navigateToNewDocumentURL(state.selectedDocument.id, newDocumentId);
1110
+ } else {
1111
+ commit("SET_DOC_ID", newDocumentId);
1112
+ dispatch("fetchDocument");
1113
+ }
1114
+ },
1091
1115
  };
1092
1116
 
1093
1117
  const mutations = {