@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/README.md +0 -2
- package/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/scss/variables.scss +1 -8
- package/src/components/App.vue +4 -1
- package/src/components/DocumentAnnotations/ActionButtons.vue +2 -2
- package/src/components/DocumentAnnotations/EmptyAnnotation.vue +10 -10
- package/src/store/document.js +4 -4
- package/src/store/selection.js +0 -1
- package/src/utils/utils.js +18 -3
package/package.json
CHANGED
|
@@ -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:
|
|
172
|
+
border-radius: 20px !important;
|
|
180
173
|
}
|
|
181
174
|
}
|
|
182
175
|
|
package/src/components/App.vue
CHANGED
|
@@ -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 (
|
|
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' : '
|
|
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
|
|
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 (
|
|
118
|
-
|
|
119
|
-
const isSpanArray = Array.isArray(newValue);
|
|
117
|
+
if (this.elementSelected === this.emptyAnnotationId() && newValue) {
|
|
118
|
+
const isSpanArray = Array.isArray(newValue);
|
|
120
119
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
},
|
package/src/store/document.js
CHANGED
|
@@ -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
|
|
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
|
}
|
package/src/store/selection.js
CHANGED
package/src/utils/utils.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
export
|
|
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
|
+
}
|