@konfuzio/document-validation-ui 0.1.10-dev.15 → 0.1.10-dev.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.10-dev.15",
3
+ "version": "0.1.10-dev.16",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -46,6 +46,8 @@
46
46
  display: flex;
47
47
  flex-direction: row;
48
48
  justify-content: space-between;
49
+ height: 100%;
50
+ align-items: center;
49
51
  }
50
52
  .bottom-section {
51
53
  text-align: center;
@@ -1,11 +1,9 @@
1
1
  @import "./imports.scss";
2
2
 
3
3
  .document-name-component {
4
- flex: 1;
5
4
  display: flex;
6
5
  align-items: center;
7
6
  justify-content: center;
8
- width: 100%;
9
7
  gap: 12px;
10
8
  line-height: 20px;
11
9
 
@@ -37,6 +37,12 @@
37
37
  align-items: center;
38
38
  gap: 38px;
39
39
 
40
+ &.single-component {
41
+ flex: 1;
42
+ align-items: center;
43
+ justify-content: center;
44
+ }
45
+
40
46
  .navigation-arrow {
41
47
  &:hover {
42
48
  cursor: pointer;
@@ -291,7 +291,7 @@
291
291
  }
292
292
 
293
293
  .b-checkbox.checkbox {
294
- .check {
294
+ input[type="checkbox"] + .check {
295
295
  background-color: $white;
296
296
  }
297
297
  &:hover input[type="checkbox"]:not(:disabled) + .check {
@@ -66,6 +66,7 @@ export default {
66
66
  required: false,
67
67
  default: "",
68
68
  },
69
+ // eslint-disable-next-line vue/require-default-prop
69
70
  locale: {
70
71
  type: String,
71
72
  required: false,
@@ -110,11 +111,7 @@ export default {
110
111
  }
111
112
  },
112
113
  isPublicView() {
113
- if (
114
- process.env.VUE_APP_GUEST_USER_TOKEN ||
115
- this.user_token ||
116
- (this.full_mode && this.full_mode === "true")
117
- ) {
114
+ if (this.userToken || (this.full_mode && this.full_mode === "true")) {
118
115
  return false;
119
116
  } else {
120
117
  return true;
@@ -66,7 +66,6 @@ export default {
66
66
  "isDocumentReviewed",
67
67
  ]),
68
68
  ...mapGetters("display", ["bboxToRect"]),
69
- ...mapState("selection", ["spanSelection"]),
70
69
  ...mapState("document", [
71
70
  "editAnnotation",
72
71
  "publicView",
@@ -85,8 +85,9 @@ export default {
85
85
  "selectedPages",
86
86
  "submitEditChanges",
87
87
  ]),
88
- ...mapState("project", ["projectId", "documentsListPath"]),
88
+ ...mapState("project", ["projectId", "documentsListPath", "currentUser"]),
89
89
  ...mapGetters("edit", ["documentShouldBePostprocessed"]),
90
+ ...mapGetters("document", ["waitingForSplittingConfirmation"]),
90
91
  },
91
92
  watch: {
92
93
  renameAndCategorize(newValue) {
@@ -375,7 +376,10 @@ export default {
375
376
  // Send update request to the backend
376
377
  saveEditChanges() {
377
378
  // Verify if there was splitting, rotating and/or reordering
378
- if (this.documentShouldBePostprocessed) {
379
+ if (
380
+ this.documentShouldBePostprocessed ||
381
+ this.waitingForSplittingConfirmation(this.selectedDocument)
382
+ ) {
379
383
  this.$store
380
384
  .dispatch("edit/editDocument", this.updatedDocument)
381
385
  .catch((error) => {
@@ -386,9 +390,13 @@ export default {
386
390
  });
387
391
  });
388
392
 
389
- navigateToDocumentsList(this.documentsListPath, this.projectId);
393
+ navigateToDocumentsList(
394
+ this.documentsListPath,
395
+ this.projectId,
396
+ this.currentUser.id
397
+ );
390
398
  } else {
391
- // Check if only the category changes:
399
+ // Check if only the category and/or name changes:
392
400
  const newCategory = this.updatedDocument[0].category;
393
401
  const newName = this.updatedDocument[0].name;
394
402
  let category = {};
@@ -11,9 +11,7 @@
11
11
  isVisible && 'visible',
12
12
  checkboxValue && 'selected',
13
13
  ]"
14
- :style="{
15
- transform: `rotate(${rotation}deg)`,
16
- }"
14
+ :style="`rotate:${rotation}deg`"
17
15
  @click="selectPage()"
18
16
  >
19
17
  <ServerImage :image-url="`${page.thumbnail_url}?${page.updated_at}`">
@@ -96,7 +96,7 @@ export default {
96
96
  };
97
97
  },
98
98
  computed: {
99
- ...mapState("edit", ["selectedPages"]),
99
+ ...mapState("edit", ["selectedPages", "updatedDocument"]),
100
100
  ...mapState("document", ["splittingSuggestions", "selectedDocument"]),
101
101
  ...mapGetters("document", ["documentHasProposedSplit"]),
102
102
  },
@@ -117,6 +117,11 @@ export default {
117
117
  this.switchStatus = false;
118
118
  }
119
119
  },
120
+ updatedDocument(newValue) {
121
+ if (newValue && newValue.length === 1) {
122
+ this.switchStatus = false;
123
+ }
124
+ },
120
125
  },
121
126
  mounted() {
122
127
  this.$nextTick(() => {
@@ -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() {
@@ -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,12 @@
10
10
  />
11
11
  </div>
12
12
 
13
- <div class="center-bar-components">
13
+ <div
14
+ :class="[
15
+ 'center-bar-components',
16
+ recalculatingAnnotations && 'single-component',
17
+ ]"
18
+ >
14
19
  <div
15
20
  :class="[
16
21
  'left-arrow navigation-arrow',
@@ -774,7 +774,7 @@ const actions = {
774
774
  "category/createAvailableDocumentsList",
775
775
  {
776
776
  categoryId,
777
- user: rootState.project.currentUser,
777
+ user: rootState.project.currentUser.username,
778
778
  poll: pollDocumentList,
779
779
  },
780
780
  {
@@ -1093,7 +1093,7 @@ const actions = {
1093
1093
 
1094
1094
  contactSupport: ({ rootState }, error) => {
1095
1095
  const url = "https://konfuzio.com/support/";
1096
- 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}`;
1097
1097
  const fullUrl = `${url}?${params}`;
1098
1098
 
1099
1099
  window.open(fullUrl, "_blank");
package/src/store/edit.js CHANGED
@@ -28,12 +28,19 @@ const getters = {
28
28
  (page) => page.angle !== 0
29
29
  );
30
30
 
31
- let foundReorderedPage;
32
-
33
- state.pagesForPostprocess.map((page) => {
34
- foundReorderedPage = rootState.document.selectedDocument.pages.find(
35
- (p) => p.id === page.id && p.number !== page.number
36
- );
31
+ let foundReorderedPage = false;
32
+
33
+ state.pagesForPostprocess.map((page, index) => {
34
+ if (
35
+ (page.id === rootState.document.selectedDocument.pages[index].id &&
36
+ page.number !==
37
+ rootState.document.selectedDocument.pages[index].number) ||
38
+ (page.id !== rootState.document.selectedDocument.pages[index].id &&
39
+ page.number ===
40
+ rootState.document.selectedDocument.pages[index].number)
41
+ ) {
42
+ foundReorderedPage = true;
43
+ }
37
44
  });
38
45
 
39
46
  return (
@@ -219,7 +226,7 @@ const actions = {
219
226
 
220
227
  commit("SET_SUBMIT_EDIT_CHANGES", false);
221
228
 
222
- if (newId !== oldId) {
229
+ if (newId != oldId) {
223
230
  if (getURLQueryParam("document") || getURLPath("docs")) {
224
231
  navigateToNewDocumentURL(oldId, newId);
225
232
  } else {
@@ -231,12 +238,17 @@ const actions = {
231
238
  root: true,
232
239
  });
233
240
  }
241
+ } else {
242
+ dispatch("document/setSelectedDocument", response.data[0], {
243
+ root: true,
244
+ });
245
+
246
+ dispatch("document/pollDocumentEndpoint", null, {
247
+ root: true,
248
+ });
234
249
  }
235
-
236
- resolve(null);
237
- } else {
238
- resolve(response);
239
250
  }
251
+ resolve(response);
240
252
  })
241
253
  .catch((error) => {
242
254
  reject(error.response);
@@ -67,7 +67,7 @@ const actions = {
67
67
  fetchCurrentUser: ({ commit }) => {
68
68
  return HTTP.get(`/auth/me/`)
69
69
  .then((response) => {
70
- commit("SET_CURRENT_USER", response.data.username);
70
+ commit("SET_CURRENT_USER", response.data);
71
71
  })
72
72
  .catch((error) => {
73
73
  console.log(error);
@@ -88,7 +88,7 @@ const actions = {
88
88
 
89
89
  fetchDocumentList: ({ commit, state }, parameters) => {
90
90
  return HTTP.get(
91
- `documents/?project=${state.projectId}&assignee=${state.currentUser}&limit=100&${parameters}`
91
+ `documents/?project=${state.projectId}&assignee=${state.currentUser.username}&limit=100&${parameters}`
92
92
  )
93
93
  .then((response) => {
94
94
  if (response.data.results) {
@@ -30,10 +30,10 @@ export function navigateToNewDocumentURL(oldId, newId) {
30
30
  window.location.replace(newUrl);
31
31
  }
32
32
 
33
- export function navigateToDocumentsList(path, projectId) {
33
+ export function navigateToDocumentsList(path, projectId, userId) {
34
34
  if (!path) return;
35
35
 
36
- const parameters = `?project=${projectId}&is_reviewed__exact=0`;
36
+ const parameters = `?project=${projectId}&is_reviewed__exact=0&assignee__id__exact=${userId}`;
37
37
 
38
38
  const newPath = `${path}/${parameters}`;
39
39