@konfuzio/document-validation-ui 0.1.29-dev.2 → 0.1.29-dev.4

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.29-dev.2",
3
+ "version": "0.1.29-dev.4",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -0,0 +1,14 @@
1
+ @import "./imports.scss";
2
+
3
+ .error-page {
4
+ width: 100vw;
5
+ height: 100vh;
6
+ display: flex;
7
+ justify-content: center;
8
+ align-items: center;
9
+ flex-direction: column;
10
+ gap: 16px;
11
+ .error-icon {
12
+ color: $red;
13
+ }
14
+ }
@@ -39,6 +39,16 @@
39
39
  -ms-text-size-adjust: 100%;
40
40
  text-size-adjust: 100%;
41
41
  box-sizing: border-box;
42
+
43
+ h1 {
44
+ font-size: 48px;
45
+ color: $text-color;
46
+ }
47
+ h2 {
48
+ font-size: 24px;
49
+ color: $text-color;
50
+ }
51
+
42
52
  button {
43
53
  &.is-primary {
44
54
  background-color: $primary !important;
@@ -621,6 +631,13 @@
621
631
  margin: 0 !important;
622
632
  }
623
633
 
634
+ .icon.is-48 {
635
+ svg {
636
+ height: 48px;
637
+ width: 48px;
638
+ }
639
+ }
640
+
624
641
  .icon.is-24 {
625
642
  svg {
626
643
  height: 24px;
@@ -1,13 +1,16 @@
1
1
  <template>
2
2
  <div class="dv-ui-app-container dv-ui-theme">
3
3
  <DocumentsList v-if="showDocumentsList" />
4
- <DocumentDashboard />
4
+ <DocumentDashboard v-if="!pageError" />
5
+ <ErrorPage v-else :error="pageError" />
5
6
  </div>
6
7
  </template>
7
8
  <script>
8
9
  import Vue from "vue";
10
+ import { mapState } from "vuex";
9
11
  import * as Sentry from "@sentry/vue";
10
12
  import DocumentDashboard from "./DocumentDashboard";
13
+ import ErrorPage from "./ErrorPage";
11
14
  import { DocumentsList } from "./DocumentsList";
12
15
  import { getURLQueryParam, getURLPath } from "../utils/utils";
13
16
  import { Integrations } from "@sentry/tracing";
@@ -18,6 +21,7 @@ export default {
18
21
  components: {
19
22
  DocumentsList,
20
23
  DocumentDashboard,
24
+ ErrorPage,
21
25
  },
22
26
  props: {
23
27
  document: {
@@ -86,6 +90,7 @@ export default {
86
90
  },
87
91
  },
88
92
  computed: {
93
+ ...mapState("display", ["pageError"]),
89
94
  documentId() {
90
95
  if (getURLQueryParam("document")) {
91
96
  return getURLQueryParam("document");
@@ -25,7 +25,7 @@
25
25
  </b-tooltip>
26
26
  <div v-if="isEditModeAvailable" class="toolbar-divider" />
27
27
  <div
28
- v-if="!publicView"
28
+ v-if="!publicView && !editMode"
29
29
  class="search-document icons"
30
30
  @click="toggleSearch"
31
31
  >
@@ -115,6 +115,7 @@ export default {
115
115
  },
116
116
  computed: {
117
117
  ...mapState("display", ["scale"]),
118
+ ...mapState("edit", ["editMode"]),
118
119
  ...mapGetters("edit", ["isEditModeAvailable"]),
119
120
  ...mapState("document", [
120
121
  "selectedDocument",
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <div class="error-page">
3
+ <b-icon icon="circle-exclamation" size="is-48" class="error-icon" />
4
+ <h1>
5
+ {{ $t("document_error_title") }}
6
+ </h1>
7
+ <h2>
8
+ {{ error ? error : "" }}
9
+ </h2>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: "ErrorPage",
16
+ props: {
17
+ error: {
18
+ type: String,
19
+ required: false,
20
+ default: null,
21
+ },
22
+ },
23
+ };
24
+ </script>
25
+
26
+ <style scoped lang="scss" src="../assets/scss/error_page.scss"></style>
package/src/icons.js CHANGED
@@ -21,6 +21,7 @@ import {
21
21
  faSearch,
22
22
  faTrashArrowUp,
23
23
  faFloppyDisk,
24
+ faCircleExclamation,
24
25
  } from "@fortawesome/free-solid-svg-icons";
25
26
  import { FontAwesomeIcon as Icons } from "@fortawesome/vue-fontawesome";
26
27
 
@@ -45,7 +46,8 @@ library.add(
45
46
  faDownload,
46
47
  faSearch,
47
48
  faTrashArrowUp,
48
- faFloppyDisk
49
+ faFloppyDisk,
50
+ faCircleExclamation
49
51
  );
50
52
 
51
53
  export default Icons;
@@ -42,6 +42,7 @@ const state = {
42
42
  currentSearchResult: null,
43
43
  detailsUrl: null,
44
44
  reviewFilter: false,
45
+ pageError: null,
45
46
  };
46
47
 
47
48
  const getters = {
@@ -342,6 +343,10 @@ const actions = {
342
343
  commit("SET_CURRENT_SEARCH", currentSearch);
343
344
  },
344
345
 
346
+ setPageError({ commit }, value) {
347
+ commit("SET_PAGE_ERROR", value);
348
+ },
349
+
345
350
  setCurrentSearchResult({ commit, state }, n) {
346
351
  let newSearchResult = state.currentSearchResult + n;
347
352
  const searchResultsMaxIndex = state.searchResults.length - 1;
@@ -425,6 +430,9 @@ const mutations = {
425
430
  SET_REVIEW_FILTER: (state, value) => {
426
431
  state.reviewFilter = value;
427
432
  },
433
+ SET_PAGE_ERROR: (state, value) => {
434
+ state.pageError = value;
435
+ },
428
436
  };
429
437
 
430
438
  export default {
@@ -907,6 +907,9 @@ const actions = {
907
907
  })
908
908
  .catch((error) => {
909
909
  console.log(error, "Could not fetch document details from the backend");
910
+ dispatch("display/setPageError", error.response.data.detail, {
911
+ root: true,
912
+ });
910
913
  return;
911
914
  });
912
915