@truedat/dd 5.2.9 → 5.3.1

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.
@@ -0,0 +1,45 @@
1
+ import { compile } from "path-to-regexp";
2
+ import { call, put, takeLatest, getContext } from "redux-saga/effects";
3
+ import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
4
+ import { API_STRUCTURE_TO_STRUCTURE_LINK } from "../api";
5
+ import { deleteStructureStructureLink } from "../routines";
6
+
7
+ export const evictDataStructureLink = (cache, dataStructureLinkId) => {
8
+ const cachedDataStructureLink = cache.identify({
9
+ __typename: "DataStructureLink",
10
+ id: dataStructureLinkId,
11
+ });
12
+ cache.evict(cachedDataStructureLink);
13
+ cache.gc();
14
+ };
15
+
16
+ export function* deleteStructureStructureLinkSaga({
17
+ payload: { sourceStructureId, targetStructureId, dataStructureLinkId },
18
+ }) {
19
+ const client = yield getContext("client");
20
+ const cache = client.cache;
21
+ try {
22
+ const payload = { sourceStructureId, targetStructureId };
23
+ const url = compile(API_STRUCTURE_TO_STRUCTURE_LINK)(payload);
24
+ yield put(deleteStructureStructureLink.request(payload));
25
+ yield call(apiJsonDelete, url, JSON_OPTS);
26
+ evictDataStructureLink(cache, dataStructureLinkId);
27
+ yield put(deleteStructureStructureLink.success(payload));
28
+ } catch (error) {
29
+ if (error.response) {
30
+ const { status, data } = error.response;
31
+ yield put(deleteStructureStructureLink.failure({ status, data }));
32
+ } else {
33
+ yield put(deleteStructureStructureLink.failure(error.message));
34
+ }
35
+ } finally {
36
+ yield put(deleteStructureStructureLink.fulfill());
37
+ }
38
+ }
39
+
40
+ export function* deleteStructureStructureLinkRequestSaga() {
41
+ yield takeLatest(
42
+ deleteStructureStructureLink.TRIGGER,
43
+ deleteStructureStructureLinkSaga
44
+ );
45
+ }
@@ -12,6 +12,7 @@ import { deleteGrantApprovalRuleRequestSaga } from "./deleteGrantApprovalRule";
12
12
  import { deleteStructureTagRequestSaga } from "./deleteStructureTag";
13
13
  import { deleteReferenceDatasetRequestSaga } from "./deleteReferenceDataset";
14
14
  import { deleteStructureRequestSaga } from "./deleteStructure";
15
+ import { deleteStructureStructureLinkRequestSaga } from "./deleteStructureStructureLink";
15
16
  import { deleteTagRequestSaga } from "./deleteTag";
16
17
  import { deleteUserSearchFilterRequestSaga } from "./deleteUserSearchFilter";
17
18
  import { doStructureNoteActionRequestSaga } from "./doStructureNoteAction";
@@ -41,6 +42,7 @@ import { fetchSystemRequestSaga } from "./fetchSystem";
41
42
  import { fetchSystemStructuresRequestSaga } from "./fetchSystemStructures";
42
43
  import { fetchSystemsRequestSaga } from "./fetchSystems";
43
44
  import { fetchUserSearchFiltersRequestSaga } from "./fetchUserSearchFilters";
45
+ import { linkStructureToStructureRequestSaga } from "./linkStructureToStructure";
44
46
  import { tagStructureRequestSaga } from "./tagStructure";
45
47
  import { operateGrantRequestToCartRequestSaga } from "./operateGrantRequestCart";
46
48
  import { requestGrantRemovalRequestSaga } from "./requestGrantRemoval";
@@ -69,6 +71,7 @@ export {
69
71
  deleteStructureTagRequestSaga,
70
72
  deleteReferenceDatasetRequestSaga,
71
73
  deleteStructureRequestSaga,
74
+ deleteStructureStructureLinkRequestSaga,
72
75
  deleteTagRequestSaga,
73
76
  deleteUserSearchFilterRequestSaga,
74
77
  doStructureNoteActionRequestSaga,
@@ -98,6 +101,7 @@ export {
98
101
  fetchSystemStructuresRequestSaga,
99
102
  fetchSystemsRequestSaga,
100
103
  fetchUserSearchFiltersRequestSaga,
104
+ linkStructureToStructureRequestSaga,
101
105
  tagStructureRequestSaga,
102
106
  operateGrantRequestToCartRequestSaga,
103
107
  requestGrantRemovalRequestSaga,
@@ -127,6 +131,7 @@ export default [
127
131
  deleteStructureTagRequestSaga(),
128
132
  deleteReferenceDatasetRequestSaga(),
129
133
  deleteStructureRequestSaga(),
134
+ deleteStructureStructureLinkRequestSaga(),
130
135
  deleteTagRequestSaga(),
131
136
  deleteUserSearchFilterRequestSaga(),
132
137
  doStructureNoteActionRequestSaga(),
@@ -156,6 +161,7 @@ export default [
156
161
  fetchSystemStructuresRequestSaga(),
157
162
  fetchSystemsRequestSaga(),
158
163
  fetchUserSearchFiltersRequestSaga(),
164
+ linkStructureToStructureRequestSaga(),
159
165
  tagStructureRequestSaga(),
160
166
  operateGrantRequestToCartRequestSaga(),
161
167
  requestGrantRemovalRequestSaga(),
@@ -0,0 +1,46 @@
1
+ import _ from "lodash/fp";
2
+ import { call, put, takeLatest } from "redux-saga/effects";
3
+ import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
4
+ import { linkStructureToStructure } from "../routines";
5
+ import { API_STRUCTURE_TO_STRUCTURE_LINKS } from "../api";
6
+
7
+ export function* linkStructureToStructureSaga({ payload }) {
8
+ try {
9
+ const {
10
+ sourceStructureId: source_id,
11
+ targetStructureId: target_id,
12
+ labelIds: label_ids,
13
+ } = payload;
14
+
15
+ const payloadSnakeCase = {
16
+ source_id,
17
+ target_id,
18
+ label_ids,
19
+ };
20
+
21
+ yield put(linkStructureToStructure.request(payloadSnakeCase));
22
+ const { data } = yield call(
23
+ apiJsonPost,
24
+ API_STRUCTURE_TO_STRUCTURE_LINKS,
25
+ { data_structure_link: payloadSnakeCase },
26
+ JSON_OPTS
27
+ );
28
+ yield put(linkStructureToStructure.success({ ...data, ...payload }));
29
+ } catch (error) {
30
+ if (error.response) {
31
+ const { status, data } = error.response;
32
+ yield put(linkStructureToStructure.failure({ status, data }));
33
+ } else {
34
+ yield put(linkStructureToStructure.failure(error.message));
35
+ }
36
+ } finally {
37
+ yield put(linkStructureToStructure.fulfill());
38
+ }
39
+ }
40
+
41
+ export function* linkStructureToStructureRequestSaga() {
42
+ yield takeLatest(
43
+ linkStructureToStructure.TRIGGER,
44
+ linkStructureToStructureSaga
45
+ );
46
+ }
@@ -12,7 +12,7 @@ describe("selectors: getStructuresFields", () => {
12
12
  external_id: null,
13
13
  inserted_at: "2019-10-22T10:37:54Z",
14
14
  links: [],
15
- name: "CMESANO",
15
+ name: "STRUCTURE_1",
16
16
  nullable: true,
17
17
  precision: "8.0",
18
18
  type: "num",
@@ -73,7 +73,7 @@ describe("selectors: getStructuresFields", () => {
73
73
  external_id: null,
74
74
  inserted_at: "2019-10-22T10:37:54Z",
75
75
  links: [],
76
- name: "CMESANO",
76
+ name: "STRUCTURE_1",
77
77
  nullable: true,
78
78
  precision: "8.0",
79
79
  type: "num",
@@ -8,7 +8,7 @@ import {
8
8
  STRUCTURE_NOTES_EDIT,
9
9
  STRUCTURE_PARENTS,
10
10
  STRUCTURE_PROFILE,
11
- STRUCTURE_LINKED_STRUCTURES,
11
+ STRUCTURE_STRUCTURE_LINKS,
12
12
  STRUCTURE_RULES,
13
13
  STRUCTURE_LINKS,
14
14
  STRUCTURE_LINKS_NEW,
@@ -44,7 +44,7 @@ export const getActiveTab = (tabVisibility, path) => {
44
44
  [_.eq(STRUCTURE_METADATA), _.constant("metadata")],
45
45
  [_.eq(STRUCTURE_PARENTS), _.constant("parents")],
46
46
  [_.eq(STRUCTURE_PROFILE), _.constant("profile")],
47
- [_.eq(STRUCTURE_LINKED_STRUCTURES), _.constant("structureLinks")],
47
+ [_.eq(STRUCTURE_STRUCTURE_LINKS), _.constant("structureLinks")],
48
48
  [_.eq(STRUCTURE_RULES), _.constant("rules")],
49
49
  [_.eq(STRUCTURE_LINKS), _.constant("links")],
50
50
  [_.eq(STRUCTURE_LINKS_NEW), _.constant("links")],
@@ -37,6 +37,7 @@ const notesTabVisible = ({ templatesLoading, templates, structure }) =>
37
37
 
38
38
  const versionsTabVisible = notEmptyPath("structureVersions");
39
39
  const structureLinksTabVisible = (state) =>
40
+ _.has("manage_structure_to_structure_link", state?.structureActions) ||
40
41
  state?.structure?.data_structure_link_count > 0;
41
42
  const rulesTabVisible = (state) => state?.structure?.implementation_count > 0;
42
43
  const lineageTabVisible = _.anyPass([_.path("structure.degree.in")]);
@@ -1,287 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<StructureStructureLinks /> matches the latest snapshot 1`] = `
4
- <div>
5
- <div
6
- class="ui grid"
7
- >
8
- <div
9
- class="sixteen wide column"
10
- >
11
- <table
12
- class="ui table"
13
- >
14
- <thead
15
- class=""
16
- >
17
- <tr
18
- class=""
19
- >
20
- <th
21
- class=""
22
- >
23
- Current structure
24
- </th>
25
- <th
26
- class=""
27
- >
28
- Relation label
29
- </th>
30
- <th
31
- class=""
32
- >
33
- Related structure
34
- </th>
35
- </tr>
36
- </thead>
37
- <tbody
38
- class=""
39
- >
40
- <tr
41
- class=""
42
- >
43
- <td
44
- class=""
45
- >
46
- CMESANO
47
- </td>
48
- <td
49
- class=""
50
- >
51
- <svg
52
- height="40"
53
- viewBox="0 0 100 10"
54
- width="200"
55
- xmlns="http://www.w3.org/2000/svg"
56
- >
57
- <defs>
58
- <marker
59
- id="arrow"
60
- markerHeight="5"
61
- markerUnits="strokeWidth"
62
- markerWidth="6"
63
- orient="auto"
64
- refX="0"
65
- refY="2"
66
- >
67
- <path
68
- d="M0,0 L0,4 L5,2 z"
69
- fill="#7d6060"
70
- />
71
- </marker>
72
- </defs>
73
- <path
74
- d="M 0,10 h 90"
75
- fill="none"
76
- id="p0"
77
- marker-end="url(#arrow)"
78
- stroke="#871f1f"
79
- stroke-width="1"
80
- />
81
- <path
82
- d="M 0,4 h 90"
83
- fill="none"
84
- id="path-for-text"
85
- />
86
- <text
87
- font-size="8"
88
- >
89
- <textpath
90
- dominant-baseline="middle"
91
- href="#path-for-text"
92
- startOffset="50%"
93
- text-anchor="middle"
94
- y="10%"
95
- >
96
- copy
97
- </textpath>
98
- </text>
99
- </svg>
100
- </td>
101
- <td
102
- class=""
103
- >
104
- <div
105
- class="ui breadcrumb"
106
- >
107
- <a
108
- class="section"
109
- href="/structures"
110
- >
111
- Structures
112
- </a>
113
- <i
114
- aria-hidden="true"
115
- class="right angle icon divider"
116
- />
117
- <a
118
- class="section"
119
- href="/systems/2/structures"
120
- >
121
- Oracle producción solvencia
122
- </a>
123
- <i
124
- aria-hidden="true"
125
- class="right angle icon divider"
126
- />
127
- <a
128
- class="section"
129
- href="/structures/114207"
130
- >
131
- SRV_DS2P.PRO.SANTALUCIA.ES
132
- </a>
133
- <i
134
- aria-hidden="true"
135
- class="right angle icon divider"
136
- />
137
- <a
138
- class="section"
139
- href="/structures/58050"
140
- >
141
- SIISDS2
142
- </a>
143
- <i
144
- aria-hidden="true"
145
- class="right angle icon divider"
146
- />
147
- <a
148
- class="section"
149
- href="/structures/58045"
150
- >
151
- INPAHEM_SINIEPAGO
152
- </a>
153
- <i
154
- aria-hidden="true"
155
- class="right angle icon divider"
156
- />
157
- <a
158
- class="active section"
159
- href="/structures/60218"
160
- >
161
- NIDSINIE
162
- </a>
163
- </div>
164
- </td>
165
- </tr>
166
- <tr
167
- class=""
168
- >
169
- <td
170
- class=""
171
- >
172
- CMESANO
173
- </td>
174
- <td
175
- class=""
176
- >
177
- <svg
178
- height="40"
179
- viewBox="0 0 100 10"
180
- width="200"
181
- xmlns="http://www.w3.org/2000/svg"
182
- >
183
- <defs>
184
- <marker
185
- id="arrow"
186
- markerHeight="5"
187
- markerUnits="strokeWidth"
188
- markerWidth="6"
189
- orient="auto"
190
- refX="0"
191
- refY="2"
192
- >
193
- <path
194
- d="M0,0 L0,4 L5,2 z"
195
- fill="#7d6060"
196
- />
197
- </marker>
198
- </defs>
199
- <path
200
- d="M 95,10 h -90"
201
- fill="none"
202
- id="p0"
203
- marker-end="url(#arrow)"
204
- stroke="#871f1f"
205
- stroke-width="1"
206
- />
207
- <path
208
- d="M 0,4 h 90"
209
- fill="none"
210
- id="path-for-text"
211
- />
212
- <text
213
- font-size="8"
214
- >
215
- <textpath
216
- dominant-baseline="middle"
217
- href="#path-for-text"
218
- startOffset="50%"
219
- text-anchor="middle"
220
- y="10%"
221
- >
222
- label_1_1, label_1_2
223
- </textpath>
224
- </text>
225
- </svg>
226
- </td>
227
- <td
228
- class=""
229
- >
230
- <div
231
- class="ui breadcrumb"
232
- >
233
- <a
234
- class="section"
235
- href="/structures"
236
- >
237
- Structures
238
- </a>
239
- <i
240
- aria-hidden="true"
241
- class="right angle icon divider"
242
- />
243
- <a
244
- class="section"
245
- href="/systems/11/structures"
246
- >
247
- Azure Databricks
248
- </a>
249
- <i
250
- aria-hidden="true"
251
- class="right angle icon divider"
252
- />
253
- <a
254
- class="section"
255
- href="/structures/147587"
256
- >
257
- bdrs
258
- </a>
259
- <i
260
- aria-hidden="true"
261
- class="right angle icon divider"
262
- />
263
- <a
264
- class="section"
265
- href="/structures/151648"
266
- >
267
- inpahem_siniepago
268
- </a>
269
- <i
270
- aria-hidden="true"
271
- class="right angle icon divider"
272
- />
273
- <a
274
- class="active section"
275
- href="/structures/151674"
276
- >
277
- ivalindm
278
- </a>
279
- </div>
280
- </td>
281
- </tr>
282
- </tbody>
283
- </table>
284
- </div>
285
- </div>
286
- </div>
287
- `;