@konfuzio/document-validation-ui 0.1.5 → 0.1.6-multi-ann-set-2

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 (73) 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/DraggableIcon.vue +14 -0
  8. package/src/assets/images/GridIcon.vue +16 -0
  9. package/src/assets/images/MagicWandIcon.vue +16 -0
  10. package/src/assets/images/NotFoundIcon.vue +16 -0
  11. package/src/assets/images/SettingsIcon.vue +14 -0
  12. package/src/assets/images/SplitZigZag.vue +47 -14
  13. package/src/assets/images/StarIcon.vue +16 -0
  14. package/src/assets/scss/ann_set_table_options.scss +26 -0
  15. package/src/assets/scss/annotation_details.scss +85 -73
  16. package/src/assets/scss/document_annotations.scss +54 -57
  17. package/src/assets/scss/document_category.scss +0 -1
  18. package/src/assets/scss/document_dashboard.scss +7 -2
  19. package/src/assets/scss/document_edit.scss +90 -46
  20. package/src/assets/scss/main.scss +725 -7
  21. package/src/assets/scss/multi_ann_table_overlay.scss +38 -0
  22. package/src/assets/scss/splitting_confirmation_modal.scss +41 -0
  23. package/src/assets/scss/variables.scss +2 -657
  24. package/src/components/App.vue +9 -3
  25. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +171 -0
  26. package/src/components/DocumentAnnotations/AnnotationContent.vue +5 -3
  27. package/src/components/DocumentAnnotations/AnnotationDetails.vue +28 -7
  28. package/src/components/DocumentAnnotations/AnnotationRow.vue +133 -41
  29. package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +86 -0
  30. package/src/components/DocumentAnnotations/CategorizeModal.vue +28 -2
  31. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +121 -97
  32. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +21 -5
  33. package/src/components/DocumentAnnotations/ExtractingData.vue +3 -3
  34. package/src/components/DocumentAnnotations/index.js +0 -1
  35. package/src/components/DocumentCategory.vue +13 -5
  36. package/src/components/DocumentDashboard.vue +17 -6
  37. package/src/components/DocumentEdit/DocumentEdit.vue +208 -68
  38. package/src/components/DocumentEdit/EditConfirmationModal.vue +54 -0
  39. package/src/components/DocumentEdit/EditPages.vue +29 -18
  40. package/src/components/DocumentEdit/EditSidebar.vue +92 -45
  41. package/src/components/DocumentEdit/SidebarButtons.vue +53 -0
  42. package/src/components/DocumentEdit/SplitInfoBar.vue +19 -0
  43. package/src/components/DocumentEdit/SplitOverview.vue +4 -5
  44. package/src/components/{DocumentError.vue → DocumentModals/DocumentErrorModal.vue} +3 -4
  45. package/src/components/{NotOptimizedViewportModal.vue → DocumentModals/NotOptimizedViewportModal.vue} +2 -2
  46. package/src/components/DocumentModals/SplittingSuggestionsModal.vue +120 -0
  47. package/src/components/DocumentPage/ActionBar.vue +3 -3
  48. package/src/components/DocumentPage/AnnSetTableOptions.vue +107 -0
  49. package/src/components/DocumentPage/DocumentPage.vue +39 -10
  50. package/src/components/DocumentPage/DocumentToolbar.vue +6 -2
  51. package/src/components/DocumentPage/MultiAnnSelection.vue +90 -2
  52. package/src/components/DocumentPage/MultiAnnotationTableOverlay.vue +274 -0
  53. package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +19 -46
  54. package/src/components/DocumentPage/NewAnnotation.vue +1 -1
  55. package/src/components/DocumentPage/ScrollingDocument.vue +43 -4
  56. package/src/components/DocumentPage/ScrollingPage.vue +4 -5
  57. package/src/components/DocumentThumbnails/DocumentThumbnails.vue +14 -11
  58. package/src/components/DocumentTopBar/DocumentName.vue +6 -1
  59. package/src/components/DocumentTopBar/DocumentTopBar.vue +9 -9
  60. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +38 -32
  61. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +9 -3
  62. package/src/components/DocumentsList/DocumentsList.vue +11 -2
  63. package/src/locales/de.json +23 -6
  64. package/src/locales/en.json +24 -6
  65. package/src/locales/es.json +23 -6
  66. package/src/store/category.js +1 -1
  67. package/src/store/display.js +51 -0
  68. package/src/store/document.js +181 -24
  69. package/src/store/edit.js +71 -48
  70. package/src/store/project.js +14 -14
  71. package/src/utils/utils.js +13 -0
  72. package/src/components/DocumentAnnotations/ActionButtons.vue +0 -257
  73. package/src/components/DocumentAnnotations/RejectedLabels.vue +0 -96
@@ -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
  };
@@ -5,12 +5,25 @@ export function sleep(duration) {
5
5
  export function getURLQueryParam(param) {
6
6
  const queryString = window.location.search;
7
7
  const urlParams = new URLSearchParams(queryString);
8
+
8
9
  if (urlParams.has(param)) {
9
10
  return urlParams.get(param);
10
11
  }
11
12
  return undefined;
12
13
  }
13
14
 
15
+ export function getURLPath(value) {
16
+ const path = window.location.pathname;
17
+
18
+ if (!path.includes(value)) return;
19
+
20
+ const id = path.split(value)[1].split("/")[1];
21
+
22
+ if (id === "") return;
23
+
24
+ return id;
25
+ }
26
+
14
27
  export function navigateToNewDocumentURL(oldId, newId) {
15
28
  const url = window.location.href;
16
29
  const newUrl = url.replace(oldId, newId);
@@ -1,257 +0,0 @@
1
- <template>
2
- <div class="action-buttons">
3
- <!-- loading -->
4
- <div v-if="isLoading && !finishReviewBtn">
5
- <b-notification :closable="false" class="loading-background">
6
- <b-loading :active="isLoading" :is-full-page="loadingOnFullPage">
7
- <b-icon icon="spinner" class="fa-spin loading-icon-size spinner" />
8
- </b-loading>
9
- </b-notification>
10
- </div>
11
-
12
- <!-- save button -->
13
- <b-button
14
- v-if="saveBtn && !isLoading && !publicView"
15
- :class="[
16
- 'annotation-save-btn text-btn',
17
- actionBar && 'action-bar-save-btn',
18
- actionBar ? 'tertiary-button' : 'primary-button',
19
- ]"
20
- type="is-primary"
21
- @click.stop="save"
22
- >
23
- {{ $t("save") }}
24
- </b-button>
25
-
26
- <!-- cancel button -->
27
- <b-button
28
- v-if="cancelBtn && !isLoading"
29
- class="is-small annotation-cancel-btn"
30
- icon-left="xmark"
31
- @click.stop="cancel"
32
- />
33
-
34
- <!-- decline button -->
35
- <div
36
- v-if="declineBtn && !isLoading && !saveBtn && !cancelBtn && !publicView"
37
- class="reject-decline-button-container"
38
- >
39
- <b-button
40
- type="is-ghost"
41
- class="reject-decline-btn decline-btn"
42
- @click.stop="decline"
43
- >
44
- {{ $t("decline") }}
45
- </b-button>
46
- </div>
47
-
48
- <!-- accept button -->
49
- <b-button
50
- v-if="acceptBtn && !isLoading && !saveBtn && !cancelBtn && !publicView"
51
- class="annotation-accept-btn primary-button"
52
- type="is-primary"
53
- @click.stop="accept"
54
- >
55
- {{ $t("accept") }}
56
- </b-button>
57
-
58
- <!-- reject button -->
59
- <div
60
- v-if="showReject && !isLoading && !cancelBtn && !saveBtn && !publicView"
61
- class="reject-decline-button-container"
62
- >
63
- <b-button
64
- type="is-ghost"
65
- class="reject-decline-btn reject-btn"
66
- @click.stop="reject"
67
- >
68
- {{ $t("reject_label") }}
69
- </b-button>
70
- </div>
71
-
72
- <!-- reject all labels -->
73
- <div
74
- v-if="
75
- !publicView && rejectAllEmptyBtn && !isLoading && !cancelBtn && !saveBtn
76
- "
77
- class="reject-decline-button-container reject-all"
78
- @mouseenter="mouseenterAnnotationSet('reject')"
79
- @mouseleave="mouseleaveAnnotationSet"
80
- >
81
- <b-button
82
- type="is-ghost"
83
- class="reject-decline-btn reject-btn reject-all-btn"
84
- :disabled="emptyLabelsLength(annotationSet) === 0"
85
- @click.stop="rejectAllEmpty"
86
- >
87
- {{ $t("reject_all_empty") }} ({{ emptyLabelsLength(annotationSet) }})
88
- </b-button>
89
- </div>
90
-
91
- <!-- accept all pending annotations -->
92
- <div
93
- v-if="!publicView && acceptAllBtn && !isLoading"
94
- class="accept-all"
95
- @mouseenter="mouseenterAnnotationSet('accept')"
96
- @mouseleave="mouseleaveAnnotationSet"
97
- >
98
- <b-button
99
- type="is-primary"
100
- class="accept-all-btn"
101
- :disabled="annotationsWithPendingReviewLength(annotationSet) === 0"
102
- @click.stop="acceptGroup"
103
- >
104
- {{ $t("accept_group") }} ({{
105
- annotationsWithPendingReviewLength(annotationSet)
106
- }})
107
- </b-button>
108
- </div>
109
-
110
- <!-- finish review button -->
111
- <b-tooltip
112
- :active="finishDisabled"
113
- position="is-bottom"
114
- multilined
115
- class="right-aligned finish-review"
116
- >
117
- <b-button
118
- v-if="finishReviewBtn && !publicView"
119
- :class="['finish-review-btn', 'text-btn', 'primary-button']"
120
- type="is-primary"
121
- :disabled="finishDisabled"
122
- @click.stop="finishReview"
123
- >
124
- <span v-if="!isLoading">
125
- {{ $t("finish_review") }}
126
- </span>
127
-
128
- <div v-else>
129
- <b-notification :closable="false" :class="['loading-background']">
130
- <b-loading :active="isLoading" :is-full-page="loadingOnFullPage">
131
- <b-icon
132
- icon="spinner"
133
- class="fa-spin loading-icon-size spinner"
134
- />
135
- </b-loading>
136
- </b-notification>
137
- </div>
138
- </b-button>
139
-
140
- <template #content> {{ $t("disabled_finish_review") }} </template>
141
- </b-tooltip>
142
- </div>
143
- </template>
144
- <script>
145
- /* Component for showing actions for each annotation row */
146
- import { mapState, mapGetters } from "vuex";
147
- export default {
148
- name: "ActionButtons",
149
- props: {
150
- saveBtn: {
151
- type: Boolean,
152
- },
153
- cancelBtn: {
154
- type: Boolean,
155
- },
156
- showReject: {
157
- type: Boolean,
158
- },
159
- isLoading: {
160
- type: Boolean,
161
- },
162
- acceptBtn: {
163
- type: Boolean,
164
- },
165
- // TODO: finishReviewBtn should not be here (see comment above for purpose of this component)
166
- finishReviewBtn: {
167
- type: Boolean,
168
- },
169
- // TODO: finishDisabled should not be here
170
- finishDisabled: {
171
- type: Boolean,
172
- },
173
- // TODO: handleReject should not be here
174
- handleReject: {
175
- type: Function,
176
- default: null,
177
- },
178
- // TODO: rejectAllEmptyBtn should not be here
179
- rejectAllEmptyBtn: {
180
- type: Boolean,
181
- },
182
- // TODO: annotationSet should not be needed on a UI only component
183
- annotationSet: {
184
- type: Object,
185
- default: null,
186
- },
187
- // TODO: acceptAllBtn should not be here
188
- acceptAllBtn: {
189
- type: Boolean,
190
- },
191
- declineBtn: {
192
- type: Boolean,
193
- },
194
- actionBar: {
195
- type: Boolean,
196
- required: false,
197
- },
198
- },
199
- data() {
200
- return {
201
- loadingOnFullPage: false,
202
- };
203
- },
204
- computed: {
205
- ...mapState("document", ["publicView", "missingAnnotations"]),
206
- ...mapGetters("document", [
207
- "emptyLabelsLength",
208
- "annotationsWithPendingReviewLength",
209
- ]),
210
- },
211
- methods: {
212
- save() {
213
- this.$emit("save");
214
- },
215
- cancel() {
216
- this.$emit("cancel");
217
- },
218
- accept() {
219
- this.$emit("accept");
220
- },
221
- reject() {
222
- this.$emit("reject");
223
- },
224
- mouseenterAnnotationSet(type) {
225
- if (type == "reject") {
226
- this.$emit("hover-annotation-set-to-reject");
227
- }
228
-
229
- if (type == "accept") {
230
- this.$emit("hover-annotation-set-to-accept");
231
- }
232
- },
233
- mouseleaveAnnotationSet() {
234
- this.$emit("leave-annotation-set-to-accept");
235
- this.$emit("leave-annotation-set-to-reject");
236
- },
237
- rejectAllEmpty() {
238
- this.$emit("reject-all-empty");
239
- },
240
- finishReview() {
241
- this.$emit("finish-review");
242
- },
243
- acceptGroup() {
244
- this.$emit("accept-group");
245
- },
246
- decline() {
247
- this.$emit("decline");
248
- },
249
- },
250
- };
251
- </script>
252
-
253
- <style
254
- scoped
255
- lang="scss"
256
- src="../../assets/scss/document_annotations.scss"
257
- ></style>
@@ -1,96 +0,0 @@
1
- <template>
2
- <div class="rejected-label-container">
3
- <p class="title">
4
- {{ `${$t("rejected")} (${missingAnnotations.length})` }}
5
- </p>
6
- <section class="rejected-tag-container">
7
- <b-taglist
8
- v-for="missingAnnotation in missingAnnotations"
9
- :key="missingAnnotation.id"
10
- >
11
- <b-tag
12
- attached
13
- closable
14
- aria-close-label="Close tag"
15
- :class="[
16
- isLoading && closedTag === missingAnnotation.id && 'loading-active',
17
- ]"
18
- @close="removeRejectedLabel(missingAnnotation.id)"
19
- >
20
- <span
21
- :class="[
22
- 'label-name',
23
- isLoading && closedTag === missingAnnotation.id && 'loading',
24
- ]"
25
- >
26
- {{ getLabelName(missingAnnotation.label) }}
27
- </span>
28
- </b-tag>
29
- <div class="tag-loading-container">
30
- <ActionButtons
31
- :is-loading="isLoading && closedTag === missingAnnotation.id"
32
- />
33
- </div>
34
- </b-taglist>
35
- </section>
36
- </div>
37
- </template>
38
-
39
- <script>
40
- import { mapState } from "vuex";
41
- import ActionButtons from "./ActionButtons.vue";
42
-
43
- export default {
44
- name: "RejectedLabels",
45
- components: { ActionButtons },
46
- props: {
47
- missingAnnotations: {
48
- default: null,
49
- type: Array,
50
- },
51
- },
52
-
53
- data() {
54
- return {
55
- isLoading: false,
56
- closedTag: null,
57
- };
58
- },
59
- computed: {
60
- ...mapState("document", ["labels"]),
61
- },
62
- methods: {
63
- removeRejectedLabel(id) {
64
- this.isLoading = true;
65
- this.closedTag = id;
66
-
67
- this.$store
68
- .dispatch("document/deleteMissingAnnotation", id)
69
- .catch((error) => {
70
- this.$store.dispatch("document/createErrorMessage", {
71
- error,
72
- serverErrorMessage: this.$t("server_error"),
73
- defaultErrorMessage: this.$t("edit_error"),
74
- });
75
- })
76
- .finally(() => {
77
- this.isLoading = false;
78
- this.closedTag = null;
79
- });
80
- },
81
- getLabelName(label) {
82
- if (!this.labels) return;
83
- const found = this.labels.find((l) => l.id === label);
84
- if (found) {
85
- return found.name;
86
- }
87
- },
88
- },
89
- };
90
- </script>
91
-
92
- <style
93
- scoped
94
- lang="scss"
95
- src="../../assets/scss/document_annotations.scss"
96
- ></style>