@konfuzio/document-validation-ui 0.1.55-dev.0 → 0.1.55

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.
@@ -40,20 +40,9 @@ const state = {
40
40
  splittingSuggestions: null,
41
41
  enableGroupingFeature: true,
42
42
  annotationFilters: {
43
- showFeedbackNeeded:
44
- window.location.hash === "#unrevised" ||
45
- window.location.hash === "#possiblyIncorrect" ||
46
- true,
47
- showEmpty:
48
- window.location.hash === "#unrevised" ||
49
- window.location.hash === "#possiblyIncorrect"
50
- ? false
51
- : true,
52
- showAccepted:
53
- window.location.hash === "#unrevised" ||
54
- window.location.hash === "#possiblyIncorrect"
55
- ? false
56
- : true,
43
+ showFeedbackNeeded: true,
44
+ showEmpty: true,
45
+ showAccepted: true,
57
46
  },
58
47
  annotationSearch:
59
48
  (getURLQueryParam("search") && getURLQueryParam("search").split(",")) || [],
@@ -1268,11 +1257,19 @@ const actions = {
1268
1257
  });
1269
1258
  },
1270
1259
 
1271
- deleteAnnotation: ({ commit, getters }, { annotationId, annotationSet }) => {
1260
+ deleteAnnotation: (
1261
+ { commit, getters, state },
1262
+ { annotationId, annotationSet }
1263
+ ) => {
1272
1264
  return new Promise((resolve, reject) => {
1273
1265
  HTTP.delete(`/annotations/${annotationId}/`)
1274
1266
  .then(async (response) => {
1275
1267
  if (response.status === 204) {
1268
+ if (state.annotationId === annotationId) {
1269
+ commit("SET_ANNOTATION_ID", null);
1270
+ setURLAnnotationHash(null);
1271
+ }
1272
+
1276
1273
  commit("DELETE_ANNOTATION", annotationId);
1277
1274
 
1278
1275
  // Check if the deleted annotation was the last one in a multiple annotation set
@@ -1535,6 +1532,15 @@ const actions = {
1535
1532
  dispatch("fetchDocument");
1536
1533
  }
1537
1534
  },
1535
+ showMissingAnnotations({ commit }, show) {
1536
+ commit("SET_SHOW_MISSING_ANNOTATIONS", show);
1537
+ },
1538
+ showFeedbackNeededAnnotations({ commit }, show) {
1539
+ commit("SET_SHOW_FEEDBACK_NEEDED_ANNOTATIONS", show);
1540
+ },
1541
+ showAcceptedAnnotations({ commit }, show) {
1542
+ commit("SET_SHOW_ACCEPTED_ANNOTATIONS", show);
1543
+ },
1538
1544
  };
1539
1545
 
1540
1546
  const mutations = {
@@ -1799,6 +1805,15 @@ const mutations = {
1799
1805
  state.annotationSearch = search;
1800
1806
  setURLQueryParam("search", search);
1801
1807
  },
1808
+ SET_SHOW_MISSING_ANNOTATIONS: (state, show) => {
1809
+ state.annotationFilters.showEmpty = show;
1810
+ },
1811
+ SET_SHOW_ACCEPTED_ANNOTATIONS: (state, show) => {
1812
+ state.annotationFilters.showAccepted = show;
1813
+ },
1814
+ SET_SHOW_FEEDBACK_NEEDED_ANNOTATIONS: (state, show) => {
1815
+ state.annotationFilters.showFeedbackNeeded = show;
1816
+ },
1802
1817
  };
1803
1818
 
1804
1819
  export default {
@@ -51,6 +51,12 @@ export function setURLQueryParam(query, value, deleteParam = "") {
51
51
  export function setURLAnnotationHash(annotationId) {
52
52
  if (annotationId) {
53
53
  window.location.hash = `ann${annotationId}`;
54
+ } else {
55
+ history.pushState(
56
+ "",
57
+ document.title,
58
+ window.location.pathname + window.location.search
59
+ );
54
60
  }
55
61
  }
56
62