@konfuzio/document-validation-ui 0.1.24-dev.1 → 0.1.24-dev.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.24-dev.1",
3
+ "version": "0.1.24-dev.2",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -72,6 +72,12 @@ export default {
72
72
  required: false,
73
73
  default: "",
74
74
  },
75
+ // eslint-disable-next-line vue/prop-name-casing
76
+ details_url: {
77
+ type: String,
78
+ required: false,
79
+ default: "",
80
+ },
75
81
  },
76
82
  computed: {
77
83
  documentId() {
@@ -115,6 +121,15 @@ export default {
115
121
  return null;
116
122
  }
117
123
  },
124
+ detailsUrl() {
125
+ if (process.env.VUE_APP_DOCUMENT_DETAILS_URL) {
126
+ return process.env.VUE_APP_DOCUMENT_DETAILS_URL;
127
+ } else if (this.details_url) {
128
+ return this.details_url;
129
+ } else {
130
+ return null;
131
+ }
132
+ },
118
133
  },
119
134
  created() {
120
135
  // Sentry config
@@ -156,6 +171,7 @@ export default {
156
171
 
157
172
  // document and project config
158
173
  Promise.all([
174
+ this.$store.dispatch("display/setDetailsUrl", this.detailsUrl),
159
175
  this.$store.dispatch("document/setDocId", this.documentId),
160
176
  this.$store.dispatch("document/setPublicView", this.isPublicView),
161
177
  this.$store.dispatch(
@@ -57,11 +57,7 @@
57
57
  <span>{{ saved ? $t("saved") : $t("not_saved") }}</span>
58
58
  </div>
59
59
 
60
- <div
61
- v-if="showDetailsButton"
62
- class="details-btn btn"
63
- @click="openDocumentDetails"
64
- >
60
+ <div v-if="detailsUrl" class="details-btn btn" @click="openDocumentDetails">
65
61
  {{ $t("document_details") }}
66
62
  </div>
67
63
  </div>
@@ -71,7 +67,6 @@
71
67
  import ServerImage from "../../assets/images/ServerImage";
72
68
  import FileNameSaved from "../../assets/images/FileNameSavedImage";
73
69
  import FileNameNotSaved from "../../assets/images/FileNameNotSavedImage";
74
- import { isKonfuzioDomain, getDocumentDetailsLink } from "../../utils/utils";
75
70
  import { mapGetters, mapState } from "vuex";
76
71
 
77
72
  export default {
@@ -101,11 +96,6 @@ export default {
101
96
  saved: false,
102
97
  };
103
98
  },
104
- computed: {
105
- showDetailsButton() {
106
- return isKonfuzioDomain();
107
- },
108
- },
109
99
  computed: {
110
100
  ...mapState("document", [
111
101
  "selectedDocument",
@@ -113,7 +103,7 @@ export default {
113
103
  "recalculatingAnnotations",
114
104
  "documentId",
115
105
  ]),
116
- ...mapState("display", ["optimalResolution"]),
106
+ ...mapState("display", ["optimalResolution", "detailsUrl"]),
117
107
  ...mapState("edit", ["editMode"]),
118
108
  ...mapGetters("document", ["isDocumentReviewed"]),
119
109
  textContent() {
@@ -245,7 +235,7 @@ export default {
245
235
  }
246
236
  },
247
237
  openDocumentDetails() {
248
- window.location.href = getDocumentDetailsLink(this.documentId);
238
+ window.location.href = this.detailsUrl;
249
239
  },
250
240
  },
251
241
  };
@@ -18,6 +18,7 @@
18
18
  "edit": "Edit",
19
19
  "rename": "Rename",
20
20
  "save": "Save",
21
+ "details": "Details",
21
22
  "autosaving": "Auto saving...",
22
23
  "saved": "Saved",
23
24
  "not_saved": "Could not save. Try again",
@@ -40,6 +40,7 @@ const state = {
40
40
  searchResults: [],
41
41
  searchLoading: false,
42
42
  currentSearchResult: null,
43
+ detailsUrl: null,
43
44
  };
44
45
 
45
46
  const getters = {
@@ -291,6 +292,10 @@ const actions = {
291
292
  commit("SET_PAGE_CHANGED_FROM_THUMBNAIL", value);
292
293
  },
293
294
 
295
+ setDetailsUrl: ({ commit }, value) => {
296
+ commit("SET_DETAILS_URL", value);
297
+ },
298
+
294
299
  debounceSearch: debounce(({ commit, dispatch }, query) => {
295
300
  dispatch("search", query);
296
301
  }, 300),
@@ -409,6 +414,9 @@ const mutations = {
409
414
  SET_CURRENT_SEARCH_RESULT: (state, n) => {
410
415
  state.currentSearchResult = n;
411
416
  },
417
+ SET_DETAILS_URL: (state, value) => {
418
+ state.detailsUrl = value;
419
+ },
412
420
  };
413
421
 
414
422
  export default {
@@ -49,15 +49,6 @@ export function navigateToDocumentsList(path, projectId, userId) {
49
49
  return true;
50
50
  }
51
51
 
52
- export function isKonfuzioDomain() {
53
- return window.location.hostname.includes("konfuzio.com");
54
- }
55
-
56
- export function getDocumentDetailsLink(docId) {
57
- const domain = window.location.hostname;
58
- return `https://${domain}/admin/server/document/${docId}/change`;
59
- }
60
-
61
52
  export function isElementArray(element) {
62
53
  return Array.isArray(element);
63
54
  }