@piveau/dpi 0.1.0-beta.5 → 0.1.0-beta.7
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/dist/assets/dpi.css +1 -1
- package/dist/data-provider-interface/DataProviderInterface.vue2.js +45 -40
- package/dist/data-provider-interface/HappyFlowComponents/HomeTable.vue.js +15 -15
- package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/AdditionalsSubModal.vue.js +15 -14
- package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/DistributionModal.vue.js +73 -32
- package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/FindabilityChips.vue.js +26 -24
- package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/HVDSwitch.vue.js +23 -22
- package/dist/data-provider-interface/HappyFlowComponents/ui/TableRowV3.vue.js +88 -85
- package/dist/data-provider-interface/components/DistributionSimplePage.vue.js +382 -382
- package/dist/data-provider-interface/components/ReviewAndPublishPage.vue.js +183 -174
- package/dist/data-provider-interface/composables/useDpiContext.js +5 -7
- package/dist/data-provider-interface/composables/useDpiEditMode.js +15 -13
- package/dist/data-provider-interface/composables/useDpiSimpleLoader.js +7 -7
- package/dist/data-provider-interface/store/index.js +32 -0
- package/dist/data-provider-interface/store/modules/authStore.js +301 -0
- package/dist/data-provider-interface/store/modules/catalogueDetailsStore.js +34 -0
- package/dist/data-provider-interface/store/modules/cataloguesStore.js +256 -0
- package/dist/data-provider-interface/store/modules/datasetDetailsStore.js +644 -0
- package/dist/data-provider-interface/store/modules/datasetsStore.js +361 -0
- package/dist/data-provider-interface/store/{dpiStore.js → modules/dpiStore.js} +11 -12
- package/dist/data-provider-interface/store/modules/snackbarStore.js +45 -0
- package/dist/data-provider-interface/views/InputPage.vue.js +100 -99
- package/dist/index.js +4 -4
- package/dist/utils/draftApi.js +33 -0
- package/dist/utils/helpers.js +36 -22
- package/dist/utils/identifiersApi.js +16 -0
- package/dist/utils/jwt.js +7 -0
- package/package.json +6 -4
- package/dist/data-provider-interface/store/modules/formSchemaStore.js +0 -94
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useRoute as
|
|
1
|
+
import { useRoute as g } from "vue-router";
|
|
2
2
|
import { useDpiContext as j } from "./useDpiContext.js";
|
|
3
3
|
import { computed as o, toValue as n, watchEffect as R, watch as U } from "vue";
|
|
4
|
-
import { useStore as
|
|
4
|
+
import { useStore as D } from "vuex";
|
|
5
5
|
import { useRuntimeEnv as A } from "../../composables/useRuntimeEnv.js";
|
|
6
6
|
import { useAsyncState as k } from "@vueuse/core";
|
|
7
7
|
import L from "axios";
|
|
8
8
|
import { useDpiSimpleLoader as Q } from "./useDpiSimpleLoader.js";
|
|
9
9
|
function _(u) {
|
|
10
|
-
const s =
|
|
10
|
+
const s = g(), a = D(), d = A(), m = o(() => {
|
|
11
11
|
var e, i;
|
|
12
12
|
return ((i = (e = n(u)) == null ? void 0 : e.edit) == null ? void 0 : i.enabled) ?? s.query.edit === "true";
|
|
13
13
|
}), l = o(() => {
|
|
@@ -19,10 +19,10 @@ function _(u) {
|
|
|
19
19
|
});
|
|
20
20
|
m.value && (localStorage.setItem("dpi_editmode", "false"), a.dispatch("auth/setIsEditMode", !1));
|
|
21
21
|
const t = o(() => {
|
|
22
|
-
var
|
|
23
|
-
const e = c.value, i = (
|
|
22
|
+
var y;
|
|
23
|
+
const e = c.value, i = (y = a.getters["auth/getUserData"]) == null ? void 0 : y.rtpToken, $ = s.params.property, M = s.params.id;
|
|
24
24
|
return { endpoint: e ? `${d.api.hubUrl}drafts/datasets/${l.value}.jsonld?catalogue=${s.query.catalog}` : s.params.property === "catalogues" ? `${d.api.hubUrl}catalogues/${s.query.catalog}.jsonld` : `${d.api.hubUrl}datasets/${l.value}.jsonld?useNormalizedId=true`, token: i, property: $, id: M };
|
|
25
|
-
}), { state: r, execute:
|
|
25
|
+
}), { state: r, execute: b, isLoading: f, error: E } = k(
|
|
26
26
|
async () => (await L.get(t.value.endpoint, {
|
|
27
27
|
headers: {
|
|
28
28
|
Accept: "application/ld+json",
|
|
@@ -41,28 +41,30 @@ function _(u) {
|
|
|
41
41
|
U(p, () => {
|
|
42
42
|
if (!p.value) return;
|
|
43
43
|
const e = c.value;
|
|
44
|
-
a.dispatch("auth/setIsEditMode", !0), a.dispatch("auth/setIsDraft", e),
|
|
44
|
+
a.dispatch("auth/setIsEditMode", !0), a.dispatch("auth/setIsDraft", e), b();
|
|
45
45
|
}, { immediate: !0 });
|
|
46
|
-
const { isReady:
|
|
46
|
+
const { isReady: h, result: I, isMaterialized: v, errors: q } = Q(r, {
|
|
47
47
|
enabled: p,
|
|
48
48
|
hubSearchUrl: d.api.baseUrl
|
|
49
49
|
}), S = o(() => {
|
|
50
50
|
var e;
|
|
51
|
-
return (e = n(u).edit) != null && e.enabled ? !!a.getters["dpiStore/getSpecificationName"] && !
|
|
51
|
+
return (e = n(u).edit) != null && e.enabled ? !!a.getters["dpiStore/getSpecificationName"] && !f.value && h.value && v.value : !0;
|
|
52
52
|
});
|
|
53
53
|
return o(() => {
|
|
54
54
|
}), {
|
|
55
55
|
inEditModeAndRptAvailable: p,
|
|
56
56
|
isReady: S,
|
|
57
57
|
result: I,
|
|
58
|
-
isSimpleLoaderReady:
|
|
59
|
-
isMaterialized:
|
|
58
|
+
isSimpleLoaderReady: h,
|
|
59
|
+
isMaterialized: v,
|
|
60
60
|
fetchError: E,
|
|
61
|
-
parsingErrors: q
|
|
61
|
+
parsingErrors: q,
|
|
62
|
+
isLoading: f,
|
|
63
|
+
jsonld: r
|
|
62
64
|
};
|
|
63
65
|
}
|
|
64
66
|
function G() {
|
|
65
|
-
const u =
|
|
67
|
+
const u = g(), s = D(), a = j(), d = o(() => {
|
|
66
68
|
var t, r;
|
|
67
69
|
return ((r = (t = n(a)) == null ? void 0 : t.edit) == null ? void 0 : r.id) ?? u.query.id;
|
|
68
70
|
}), m = o(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toRef as O,
|
|
1
|
+
import { toRef as O, ref as E, toValue as F, computed as T, watch as x } from "vue";
|
|
2
2
|
import { useAsyncState as C } from "@vueuse/core";
|
|
3
3
|
import { defineJsonldResolver as M, dcatDatasetTransformer as k, datasetResolvers as G } from "@piveau/jsonld";
|
|
4
4
|
import { isEmpty as N } from "lodash-es";
|
|
@@ -16,7 +16,7 @@ function $(e) {
|
|
|
16
16
|
return Object.fromEntries(Object.entries(e).filter(([i, t]) => t != null && !N(t)));
|
|
17
17
|
}
|
|
18
18
|
function ce(e, i) {
|
|
19
|
-
const { enabled: t, hubSearchUrl: r } = i, n = O(
|
|
19
|
+
const { enabled: t, hubSearchUrl: r } = i, n = O(t), { safeTransform: f } = M({
|
|
20
20
|
baseUrl: r,
|
|
21
21
|
resolvers: G(),
|
|
22
22
|
transformer: k
|
|
@@ -29,7 +29,7 @@ function ce(e, i) {
|
|
|
29
29
|
} = C(
|
|
30
30
|
async () => {
|
|
31
31
|
var I;
|
|
32
|
-
const c = await f(
|
|
32
|
+
const c = await f(F(e));
|
|
33
33
|
if (c.error)
|
|
34
34
|
return p.value.push({
|
|
35
35
|
code: "transform_failed",
|
|
@@ -53,12 +53,12 @@ function ce(e, i) {
|
|
|
53
53
|
var c;
|
|
54
54
|
return (c = m.value) == null ? void 0 : c.data;
|
|
55
55
|
});
|
|
56
|
-
return
|
|
57
|
-
() =>
|
|
56
|
+
return x(
|
|
57
|
+
() => F(e),
|
|
58
58
|
(c) => c && n.value ? R() : null
|
|
59
|
-
),
|
|
59
|
+
), x(A, (c) => {
|
|
60
60
|
console.log("jsonld resolved result:", c);
|
|
61
|
-
}),
|
|
61
|
+
}), x(v, (c) => {
|
|
62
62
|
console.log("jsonld error:", c);
|
|
63
63
|
}), {
|
|
64
64
|
processedInput: m,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createStore as o } from "vuex";
|
|
2
|
+
import r from "./modules/cataloguesStore.js";
|
|
3
|
+
import e from "./modules/catalogueDetailsStore.js";
|
|
4
|
+
import m from "./modules/datasetsStore.js";
|
|
5
|
+
import a from "./modules/datasetDetailsStore.js";
|
|
6
|
+
import s from "./modules/authStore.js";
|
|
7
|
+
import i from "./modules/snackbarStore.js";
|
|
8
|
+
import u from "./modules/dpiStore.js";
|
|
9
|
+
const l = {}, d = {}, c = {}, p = {
|
|
10
|
+
/**
|
|
11
|
+
* @description Returns the current route (name).
|
|
12
|
+
* @param state
|
|
13
|
+
*/
|
|
14
|
+
getCurrentRoute: (t) => t.route
|
|
15
|
+
}, k = o({
|
|
16
|
+
state: l,
|
|
17
|
+
actions: d,
|
|
18
|
+
mutations: c,
|
|
19
|
+
getters: p,
|
|
20
|
+
modules: {
|
|
21
|
+
catalogs: r,
|
|
22
|
+
catalogDetails: e,
|
|
23
|
+
datasets: m,
|
|
24
|
+
datasetDetails: a,
|
|
25
|
+
dpiStore: u,
|
|
26
|
+
auth: s,
|
|
27
|
+
snackbar: i
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
k as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import o from "axios";
|
|
2
|
+
import { cloneDeep as u, get as T } from "lodash-es";
|
|
3
|
+
import i from "../../../utils/draftApi.js";
|
|
4
|
+
import f from "../../../utils/identifiersApi.js";
|
|
5
|
+
import { decode as R } from "../../../utils/jwt.js";
|
|
6
|
+
let _, A;
|
|
7
|
+
const d = {
|
|
8
|
+
authenticated: !1,
|
|
9
|
+
rtptoken: "",
|
|
10
|
+
keycloak: null,
|
|
11
|
+
userData: {
|
|
12
|
+
authToken: "",
|
|
13
|
+
rtpToken: "",
|
|
14
|
+
userName: "",
|
|
15
|
+
permissions: [],
|
|
16
|
+
drafts: [],
|
|
17
|
+
roles: []
|
|
18
|
+
},
|
|
19
|
+
isEditMode: !1,
|
|
20
|
+
isDraft: !1
|
|
21
|
+
}, U = {
|
|
22
|
+
securityAuth: (e) => e.authenticated,
|
|
23
|
+
getRTPToken: (e) => e.rtptoken,
|
|
24
|
+
getKeycloak: (e) => e.keycloak,
|
|
25
|
+
getUserData: (e) => e.userData,
|
|
26
|
+
getUserName: (e) => e.userData.userName,
|
|
27
|
+
/**
|
|
28
|
+
* @description Get all catalogs associated to the user where they have access to.
|
|
29
|
+
* @returns {Array} Array of catalogs
|
|
30
|
+
*/
|
|
31
|
+
getUserCatalogs: (e) => e.userData.permissions.filter(
|
|
32
|
+
// User must have CRUD authorization
|
|
33
|
+
(t) => ["dataset:update", "dataset:delete", "dataset:create"].every(
|
|
34
|
+
(a) => t.scopes.includes(a)
|
|
35
|
+
)
|
|
36
|
+
),
|
|
37
|
+
/**
|
|
38
|
+
* @description Get all catalog IDs associated to the user where they have access to.
|
|
39
|
+
*/
|
|
40
|
+
getUserCatalogIds: (e, t) => t.getUserCatalogs.map((a) => a.rsname),
|
|
41
|
+
getUserDrafts: (e) => e.userData.drafts,
|
|
42
|
+
getUserDraftIds: (e) => e.userData.drafts.map((t) => t.id),
|
|
43
|
+
getIsEditMode: (e) => e.isEditMode,
|
|
44
|
+
getIsDraft: (e) => e.isDraft
|
|
45
|
+
}, l = {
|
|
46
|
+
authLogin({ commit: e }, t) {
|
|
47
|
+
e("SECURITY_AUTH", t);
|
|
48
|
+
},
|
|
49
|
+
authLogout({ commit: e }) {
|
|
50
|
+
e("SECURITY_AUTH", !1), e("RTP_TOKEN", "");
|
|
51
|
+
},
|
|
52
|
+
rtpToken({ commit: e }, t) {
|
|
53
|
+
e("RTP_TOKEN", t);
|
|
54
|
+
},
|
|
55
|
+
setKeycloak({ commit: e }, t) {
|
|
56
|
+
e("SET_KEYCLOAK", t);
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Updates user data according to an authentication token and by supplying neccessary
|
|
60
|
+
* information to retrieve tFhe user's permissions as well as their drafts.
|
|
61
|
+
* @param {*} commit
|
|
62
|
+
* @param {Object} params
|
|
63
|
+
* @returns {Promise<Object>}
|
|
64
|
+
*/
|
|
65
|
+
async updateUserData({ commit: e, dispatch: t }, { authToken: a, rtpToken: s, hubUrl: r }) {
|
|
66
|
+
if (!a || !s)
|
|
67
|
+
return console.error("Missing authToken or rtpToken"), e("UPDATE_USER_DATA_ERROR"), {};
|
|
68
|
+
e("UPDATE_USER_DATA_PENDING");
|
|
69
|
+
try {
|
|
70
|
+
if (!s) throw new Error("Failed to retrieve RTP token");
|
|
71
|
+
const E = R(s), D = T(E, "authorization.permissions", []), n = T(E, "realm_access.roles", []);
|
|
72
|
+
e("SET_USER_DATA", {
|
|
73
|
+
authToken: a,
|
|
74
|
+
rtpToken: s,
|
|
75
|
+
userName: E.preferred_username,
|
|
76
|
+
permissions: D,
|
|
77
|
+
drafts: [],
|
|
78
|
+
roles: n
|
|
79
|
+
}), _ = i({ baseURL: r, authToken: s }), A = f({
|
|
80
|
+
baseURL: r,
|
|
81
|
+
authToken: s
|
|
82
|
+
}), t("updateUserDrafts"), e("UPDATE_USER_DATA_SUCCESS");
|
|
83
|
+
} catch (E) {
|
|
84
|
+
console.error(E), e("UPDATE_USER_DATA_ERROR");
|
|
85
|
+
}
|
|
86
|
+
return {};
|
|
87
|
+
},
|
|
88
|
+
async updateUserDrafts({ commit: e, state: t }) {
|
|
89
|
+
if (!t.userData.rtpToken) throw new Error("Requires RTP token");
|
|
90
|
+
const s = await _.getAllDatasetDrafts(), r = s.status === 200 && s.data;
|
|
91
|
+
e("SET_USER_DATA", { drafts: r });
|
|
92
|
+
},
|
|
93
|
+
async createDataset({ commit: e }, t) {
|
|
94
|
+
const a = {
|
|
95
|
+
method: "PUT",
|
|
96
|
+
url: t.url,
|
|
97
|
+
headers: {
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
Authorization: `Bearer ${t.token}`
|
|
100
|
+
},
|
|
101
|
+
data: t.body
|
|
102
|
+
};
|
|
103
|
+
console.log("############", a);
|
|
104
|
+
const s = await o.request(a);
|
|
105
|
+
(s.status === 201 || s.status === 204) && (e("CHANGE_IS_EDIT_MODE", !1), e("CHANGE_IS_DRAFT", !1));
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Creates a draft dataset
|
|
109
|
+
* @param {*} commit
|
|
110
|
+
* @param {object} dataset - The dataset object
|
|
111
|
+
* @param {string} dataset.id - The ID of the dataset
|
|
112
|
+
* @param {string} dataset.catalog - The ID of the dataset
|
|
113
|
+
* @param {object} dataset.description - The description object of the dataset containing different locales
|
|
114
|
+
* @param {object} dataset.title - The title object of the dataset containing different locales
|
|
115
|
+
* @param {object} dataset.body - the JSON-LD representation of the dataset
|
|
116
|
+
* @returns {Promise<Object>}
|
|
117
|
+
*/
|
|
118
|
+
async createUserDraft({ commit: e }, { id: t, catalog: a, description: s = { en: "" }, title: r = { en: "" }, body: E = {} }) {
|
|
119
|
+
if (!_) return {};
|
|
120
|
+
e("UPDATE_USER_DATA_PENDING");
|
|
121
|
+
let D;
|
|
122
|
+
try {
|
|
123
|
+
D = await _.createDatasetDraft({
|
|
124
|
+
id: t,
|
|
125
|
+
catalogue: a,
|
|
126
|
+
body: E
|
|
127
|
+
}), e("CREATE_USER_DRAFT", {
|
|
128
|
+
id: t,
|
|
129
|
+
catalog: a,
|
|
130
|
+
description: s,
|
|
131
|
+
title: r,
|
|
132
|
+
body: E
|
|
133
|
+
}), e("UPDATE_USER_DATA_SUCCESS");
|
|
134
|
+
} catch (n) {
|
|
135
|
+
throw e("UPDATE_USER_DATA_ERROR"), n;
|
|
136
|
+
}
|
|
137
|
+
return D;
|
|
138
|
+
},
|
|
139
|
+
async deleteUserDraftById({ commit: e, state: t }, { id: a, catalog: s }) {
|
|
140
|
+
if (console.log(a), !_) return {};
|
|
141
|
+
if (!t.userData.drafts.find((D) => D.id === a)) return {};
|
|
142
|
+
e("UPDATE_USER_DATA_PENDING");
|
|
143
|
+
let E;
|
|
144
|
+
try {
|
|
145
|
+
E = await _.deleteDatasetDraft({ id: a, catalogue: s }), e("DELETE_USER_DRAFT", a), e("UPDATE_USER_DATA_SUCCESS");
|
|
146
|
+
} catch (D) {
|
|
147
|
+
throw e("UPDATE_USER_DATA_ERROR"), D;
|
|
148
|
+
}
|
|
149
|
+
return E;
|
|
150
|
+
},
|
|
151
|
+
async publishUserDraftById({ commit: e, state: t }, { id: a, catalog: s, body: r = {} }) {
|
|
152
|
+
if (!_) return {};
|
|
153
|
+
if (!t.userData.drafts.find((n) => n.id === a)) return {};
|
|
154
|
+
e("UPDATE_USER_DATA_PENDING");
|
|
155
|
+
let D;
|
|
156
|
+
try {
|
|
157
|
+
D = await _.publishDatasetDraft({
|
|
158
|
+
id: a,
|
|
159
|
+
catalogue: s,
|
|
160
|
+
body: r
|
|
161
|
+
}), e("DELETE_USER_DRAFT", a), e("UPDATE_USER_DATA_SUCCESS"), e("CHANGE_IS_DRAFT", !1), e("CHANGE_IS_EDIT_MODE", !1);
|
|
162
|
+
} catch (n) {
|
|
163
|
+
throw e("UPDATE_USER_DATA_ERROR"), n;
|
|
164
|
+
}
|
|
165
|
+
return D;
|
|
166
|
+
},
|
|
167
|
+
async duplicateDataset({ commit: e, state: t }, { id: a, newId: s, catalog: r, url: E }) {
|
|
168
|
+
console.log(a, r, E);
|
|
169
|
+
const D = {
|
|
170
|
+
method: "GET",
|
|
171
|
+
url: E + "drafts/datasets/" + a + ".nt?catalogue=" + r
|
|
172
|
+
};
|
|
173
|
+
await o.request(D);
|
|
174
|
+
},
|
|
175
|
+
async publishUserDraft({ dispatch: e }, { id: t, catalog: a, body: s }) {
|
|
176
|
+
return e("publishUserDraftById", { id: t, catalog: a, body: s });
|
|
177
|
+
},
|
|
178
|
+
async putDatasetToDraft({ commit: e }, { id: t, catalog: a, title: s, description: r }) {
|
|
179
|
+
if (!_) return {};
|
|
180
|
+
e("UPDATE_USER_DATA_PENDING");
|
|
181
|
+
let E;
|
|
182
|
+
try {
|
|
183
|
+
console.log(t, a, s, r), E = await _.putDatasetToDraft({ id: t, catalogue: a }), e("PUT_DATASET_TO_DRAFT", {
|
|
184
|
+
id: t,
|
|
185
|
+
catalog: a,
|
|
186
|
+
title: s,
|
|
187
|
+
description: r
|
|
188
|
+
}), e("UPDATE_USER_DATA_SUCCESS");
|
|
189
|
+
} catch (D) {
|
|
190
|
+
throw e("UPDATE_USER_DATA_ERROR"), D;
|
|
191
|
+
}
|
|
192
|
+
return E;
|
|
193
|
+
},
|
|
194
|
+
setIsEditMode({ commit: e }, t) {
|
|
195
|
+
e("CHANGE_IS_EDIT_MODE", t);
|
|
196
|
+
},
|
|
197
|
+
setIsDraft({ commit: e }, t) {
|
|
198
|
+
e("CHANGE_IS_DRAFT", t);
|
|
199
|
+
},
|
|
200
|
+
async createPersistentIdentifier({ commit: e }, { id: t, catalog: a, type: s = "mock" }) {
|
|
201
|
+
if (!A) return {};
|
|
202
|
+
e("UPDATE_USER_DATA_PENDING");
|
|
203
|
+
let r;
|
|
204
|
+
try {
|
|
205
|
+
r = await A.createPersistentIdentifier({
|
|
206
|
+
id: t,
|
|
207
|
+
catalogue: a,
|
|
208
|
+
type: s
|
|
209
|
+
}), e("UPDATE_USER_DATA_SUCCESS");
|
|
210
|
+
} catch (E) {
|
|
211
|
+
throw e("UPDATE_USER_DATA_ERROR"), E;
|
|
212
|
+
}
|
|
213
|
+
return r;
|
|
214
|
+
},
|
|
215
|
+
populateDraftAndEdit({ commit: e }) {
|
|
216
|
+
e("PREDEFINE_DRAFT_AND_EDIT");
|
|
217
|
+
},
|
|
218
|
+
async createCatalogue({ commit: e }, t) {
|
|
219
|
+
const a = {
|
|
220
|
+
method: "PUT",
|
|
221
|
+
url: t.url,
|
|
222
|
+
headers: {
|
|
223
|
+
"Content-Type": "text/turtle",
|
|
224
|
+
Authorization: `Bearer ${t.token}`
|
|
225
|
+
},
|
|
226
|
+
data: t.data
|
|
227
|
+
}, s = await o.request(a);
|
|
228
|
+
if (s.status === 201 | s.status === 204) {
|
|
229
|
+
e("CHANGE_IS_EDIT_MODE", !1), e("CHANGE_IS_DRAFT", !1);
|
|
230
|
+
const r = u(d.userData), E = {
|
|
231
|
+
rsid: "",
|
|
232
|
+
rsname: t.id,
|
|
233
|
+
scopes: ["dataset:update", "dataset:delete", "dataset:create"]
|
|
234
|
+
};
|
|
235
|
+
r.permissions.push(E), e("SET_USER_DATA", r);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}, S = {
|
|
239
|
+
SECURITY_AUTH(e, t) {
|
|
240
|
+
e.authenticated = t;
|
|
241
|
+
},
|
|
242
|
+
RTP_TOKEN(e, t) {
|
|
243
|
+
e.rtptoken = t;
|
|
244
|
+
},
|
|
245
|
+
SET_KEYCLOAK(e, t) {
|
|
246
|
+
e.keycloak = t;
|
|
247
|
+
},
|
|
248
|
+
SET_USER_DATA(e, t) {
|
|
249
|
+
e.userData = { ...e.userData, ...t };
|
|
250
|
+
},
|
|
251
|
+
UPDATE_USER_DATA_PENDING(e) {
|
|
252
|
+
e.userData.pending = !0;
|
|
253
|
+
},
|
|
254
|
+
UPDATE_USER_DATA_SUCCESS(e) {
|
|
255
|
+
e.userData.pending = !1;
|
|
256
|
+
},
|
|
257
|
+
UPDATE_USER_DATA_ERROR(e) {
|
|
258
|
+
e.userData.pending = !1;
|
|
259
|
+
},
|
|
260
|
+
CREATE_USER_DRAFT(e, { id: t, catalog: a, title: s, description: r }) {
|
|
261
|
+
e.userData.drafts.push({
|
|
262
|
+
id: t,
|
|
263
|
+
catalog: a,
|
|
264
|
+
title: s,
|
|
265
|
+
description: r
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
PUT_DATASET_TO_DRAFT(e, { id: t, catalog: a, title: s, description: r }) {
|
|
269
|
+
e.userData.drafts.push({
|
|
270
|
+
id: t,
|
|
271
|
+
catalog: a,
|
|
272
|
+
title: s,
|
|
273
|
+
description: r
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
DELETE_USER_DRAFT(e, t) {
|
|
277
|
+
const a = e.userData.drafts.findIndex(
|
|
278
|
+
(s) => s.id === t
|
|
279
|
+
);
|
|
280
|
+
a > -1 && e.userData.drafts.splice(a, 1);
|
|
281
|
+
},
|
|
282
|
+
CHANGE_IS_EDIT_MODE(e, t) {
|
|
283
|
+
e.isEditMode = t, localStorage.setItem("dpi_editmode", t);
|
|
284
|
+
},
|
|
285
|
+
CHANGE_IS_DRAFT(e, t) {
|
|
286
|
+
e.isDraft = t, localStorage.setItem("dpi_draftmode", t);
|
|
287
|
+
},
|
|
288
|
+
PREDEFINE_DRAFT_AND_EDIT(e) {
|
|
289
|
+
const t = Object.keys(localStorage);
|
|
290
|
+
t.includes("dpi_editmode") && (e.isEditMode = JSON.parse(localStorage.getItem("dpi_editmode"))), t.includes("dpi_draftmode") && (e.isDraft = JSON.parse(localStorage.getItem("dpi_draftmode")));
|
|
291
|
+
}
|
|
292
|
+
}, C = {
|
|
293
|
+
namespaced: !0,
|
|
294
|
+
state: d,
|
|
295
|
+
actions: l,
|
|
296
|
+
mutations: S,
|
|
297
|
+
getters: U
|
|
298
|
+
};
|
|
299
|
+
export {
|
|
300
|
+
C as default
|
|
301
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const l = {
|
|
2
|
+
catalog: {}
|
|
3
|
+
}, g = {
|
|
4
|
+
getCatalog: (a) => a.catalog
|
|
5
|
+
}, n = {
|
|
6
|
+
/**
|
|
7
|
+
* @description Loads details for the dataset with the given ID.
|
|
8
|
+
* @param commit
|
|
9
|
+
* @param state
|
|
10
|
+
* @param id {String} The dataset ID.
|
|
11
|
+
*/
|
|
12
|
+
loadCatalog({ state: a, commit: o }, e) {
|
|
13
|
+
return new Promise((c, s) => {
|
|
14
|
+
this.$catalogService.getSingle(e).then((t) => {
|
|
15
|
+
o("SET_catalog", t), c(t);
|
|
16
|
+
}).catch((t) => {
|
|
17
|
+
console.error(t), s(t);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}, r = {
|
|
22
|
+
SET_catalog(a, o) {
|
|
23
|
+
a.catalog = o;
|
|
24
|
+
}
|
|
25
|
+
}, i = {
|
|
26
|
+
namespaced: !0,
|
|
27
|
+
state: l,
|
|
28
|
+
actions: n,
|
|
29
|
+
mutations: r,
|
|
30
|
+
getters: g
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
i as default
|
|
34
|
+
};
|