@konfuzio/document-validation-ui 0.1.3-pre-release-3 → 0.1.4-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.3-pre-release-3",
3
+ "version": "0.1.4-pre-release-1",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -41,10 +41,7 @@ $text-color: #1a1a1a;
41
41
 
42
42
  :root {
43
43
  --primary-color: #{$konfuzio-green};
44
-
45
44
  --primary-button: 4px;
46
- --secondary-button: 8px;
47
- --tertiary-button: 20px;
48
45
  }
49
46
 
50
47
  $primary: var(--primary-color);
@@ -171,12 +168,8 @@ button {
171
168
  border-radius: var(--primary-button) !important;
172
169
  }
173
170
 
174
- &.secondary-button {
175
- border-radius: var(--secondary-button) !important;
176
- }
177
-
178
171
  &.tertiary-button {
179
- border-radius: var(--tertiary-button) !important;
172
+ border-radius: 20px !important;
180
173
  }
181
174
  }
182
175
 
@@ -7,6 +7,7 @@
7
7
  <script>
8
8
  import DocumentDashboard from "./DocumentDashboard";
9
9
  import { DocumentsList } from "./DocumentsList";
10
+ import { changeDocumentURL, getURLQueryParam } from "../utils/utils";
10
11
  import API from "../api";
11
12
 
12
13
  export default {
@@ -36,7 +37,9 @@ export default {
36
37
  },
37
38
  computed: {
38
39
  documentId() {
39
- if (process.env.VUE_APP_DOCUMENT_ID) {
40
+ if (getURLQueryParam("document")) {
41
+ return getURLQueryParam("document");
42
+ } else if (process.env.VUE_APP_DOCUMENT_ID) {
40
43
  return process.env.VUE_APP_DOCUMENT_ID;
41
44
  } else if (this.document) {
42
45
  return this.document;
@@ -15,7 +15,7 @@
15
15
  :class="[
16
16
  'annotation-save-btn text-btn',
17
17
  actionBar && 'action-bar-save-btn',
18
- actionBar ? 'tertiary-button' : 'secondary-button',
18
+ actionBar ? 'tertiary-button' : 'primary-button',
19
19
  ]"
20
20
  type="is-primary"
21
21
  @click.stop="save"
@@ -48,7 +48,7 @@
48
48
  <!-- accept button -->
49
49
  <b-button
50
50
  v-if="acceptBtn && !isLoading && !saveBtn && !cancelBtn && !publicView"
51
- class="annotation-accept-btn secondary-button"
51
+ class="annotation-accept-btn primary-button"
52
52
  type="is-primary"
53
53
  @click.stop="accept"
54
54
  >
@@ -114,17 +114,17 @@ export default {
114
114
  }
115
115
  },
116
116
  spanSelection(newValue) {
117
- if (!newValue) return;
118
-
119
- const isSpanArray = Array.isArray(newValue);
117
+ if (this.elementSelected === this.emptyAnnotationId() && newValue) {
118
+ const isSpanArray = Array.isArray(newValue);
120
119
 
121
- // Check if the bbox is empty
122
- if (
123
- (isSpanArray && !newValue[0].offset_string) ||
124
- (!isSpanArray && !newValue.offset_string)
125
- ) {
126
- this.$store.dispatch("document/resetEditAnnotation");
127
- this.$store.dispatch("selection/disableSelection");
120
+ // Check if the bbox is empty
121
+ if (
122
+ (isSpanArray && !newValue[0].offset_string) ||
123
+ (!isSpanArray && !newValue.offset_string)
124
+ ) {
125
+ this.$store.dispatch("document/resetEditAnnotation");
126
+ this.$store.dispatch("selection/disableSelection");
127
+ }
128
128
  }
129
129
  },
130
130
  },
@@ -1,5 +1,5 @@
1
1
  import myImports from "../api";
2
- import sleep from "../utils/utils";
2
+ import { sleep } from "../utils/utils";
3
3
 
4
4
  const HTTP = myImports.HTTP;
5
5
  const documentPollDuration = 1000;
@@ -923,11 +923,11 @@ const actions = {
923
923
  }
924
924
 
925
925
  // check type of error
926
- if (error.data && error.data.length > 0) {
927
- dispatch("setErrorMessage", error.data[0]);
928
- } else if (errorAsString.startsWith("5")) {
926
+ if (error && error.status === 500) {
929
927
  dispatch("setErrorMessage", serverErrorMessage);
930
928
  commit("SET_SERVER_ERROR", true);
929
+ } else if (error.data && error.data.length > 0) {
930
+ dispatch("setErrorMessage", error.data[0]);
931
931
  } else {
932
932
  dispatch("setErrorMessage", defaultErrorMessage);
933
933
  }
@@ -143,7 +143,6 @@ const mutations = {
143
143
  state.selection.start = start;
144
144
  },
145
145
  MOVE_SELECTION: (state, points) => {
146
- state.isSelecting = true;
147
146
  const { start, end } = points;
148
147
  if (start) {
149
148
  state.selection.start = start;
@@ -1,3 +1,18 @@
1
- export default function sleep(duration) {
2
- new Promise(resolve => setTimeout(resolve, duration));
3
- }
1
+ export function sleep(duration) {
2
+ new Promise((resolve) => setTimeout(resolve, duration));
3
+ }
4
+
5
+ export function getURLQueryParam(param) {
6
+ const queryString = window.location.search;
7
+ const urlParams = new URLSearchParams(queryString);
8
+ if (urlParams.has(param)) {
9
+ return urlParams.get(param);
10
+ }
11
+ return undefined;
12
+ }
13
+
14
+ export function navigateToNewDocumentURL(oldId, newId) {
15
+ const url = window.location.href;
16
+ const newUrl = url.replace(oldId, newId);
17
+ window.location.replace(newUrl);
18
+ }