@truedat/dd 6.5.0 → 6.5.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": "@truedat/dd",
3
- "version": "6.5.0",
3
+ "version": "6.5.2",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.5",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "6.5.0",
37
+ "@truedat/test": "6.5.2",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -88,9 +88,9 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.7.1",
91
- "@truedat/auth": "6.5.0",
92
- "@truedat/core": "6.5.0",
93
- "@truedat/df": "6.5.0",
91
+ "@truedat/auth": "6.5.2",
92
+ "@truedat/core": "6.5.2",
93
+ "@truedat/df": "6.5.2",
94
94
  "lodash": "^4.17.21",
95
95
  "moment": "^2.29.4",
96
96
  "path-to-regexp": "^1.7.0",
@@ -115,5 +115,5 @@
115
115
  "react-dom": ">= 16.8.6 < 17",
116
116
  "semantic-ui-react": ">= 2.0.3 < 2.2"
117
117
  },
118
- "gitHead": "28aa11eed2113e0aa15b3510dc79b3c43f41ffe2"
118
+ "gitHead": "4e35f7cfa7562cdb15da70e2c74ceeaa458ad741"
119
119
  }
@@ -233,6 +233,7 @@ export const STRUCTURE_STRUCTURE_LINKS_QUERY = gql`
233
233
  id
234
234
  name
235
235
  }
236
+ alias
236
237
  }
237
238
  }
238
239
  `;
@@ -113,14 +113,14 @@ DeleteLink.propTypes = {
113
113
 
114
114
  export const StructureStructureLinks = ({
115
115
  structureId,
116
- currentVersion,
116
+ aliasOrName,
117
117
  structureLinks,
118
118
  canLinkStructureToStructure,
119
119
  }) => {
120
120
  const fixedColumns = [
121
121
  {
122
122
  header: "structureLink.currentStructure",
123
- fieldSelector: () => currentVersion.name,
123
+ fieldSelector: (_structureLink) => aliasOrName,
124
124
  },
125
125
  {
126
126
  header: "structureLink.label",
@@ -217,6 +217,7 @@ StructureStructureLinks.propTypes = {
217
217
  currentVersion: PropTypes.object,
218
218
  structureLinks: PropTypes.array,
219
219
  canLinkStructureToStructure: PropTypes.bool,
220
+ aliasOrName: PropTypes.string,
220
221
  };
221
222
 
222
223
  const mapStateToProps = (state) => {
@@ -245,6 +246,11 @@ export const StructuresStructureLinksLoader = () => {
245
246
  return (
246
247
  <StructureStructureLinksConnected
247
248
  structureId={data?.dataStructure?.id}
249
+ aliasOrName={
250
+ data?.dataStructure?.alias
251
+ ? data?.dataStructure?.alias
252
+ : data?.dataStructure?.currentVersion?.name
253
+ }
248
254
  structureLinks={data?.dataStructure?.dataStructureLinks}
249
255
  currentVersion={data?.dataStructure?.currentVersion}
250
256
  />
@@ -1,7 +1,7 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import { render } from "@truedat/test/render";
4
- import { waitFor } from "@testing-library/react";
4
+ import { waitFor, waitForElementToBeRemoved } from "@testing-library/react";
5
5
  import userEvent from "@testing-library/user-event";
6
6
  import { STRUCTURE_STRUCTURE_LINKS_QUERY } from "../../api/queries";
7
7
  import { deleteStructureStructureLink } from "../../routines";
@@ -47,6 +47,7 @@ const dataStructureWithLinks = {
47
47
  ],
48
48
  },
49
49
  id: "60217",
50
+ alias: null,
50
51
  system: {
51
52
  id: "2",
52
53
  name: "SYSTEM_1",
@@ -106,6 +107,7 @@ const dataStructureWithLinks = {
106
107
  ],
107
108
  },
108
109
  id: "151674",
110
+ alias: null,
109
111
  system: {
110
112
  id: "11",
111
113
  name: "SYSTEM_2",
@@ -130,6 +132,7 @@ const dataStructureWithLinks = {
130
132
  ],
131
133
  },
132
134
  id: "60217",
135
+ alias: null,
133
136
  system: {
134
137
  id: "2",
135
138
  name: "SYSTEM_1",
@@ -138,6 +141,7 @@ const dataStructureWithLinks = {
138
141
  },
139
142
  ],
140
143
  id: "60217",
144
+ alias: null,
141
145
  };
142
146
 
143
147
  const linksMock = {
@@ -148,6 +152,18 @@ const linksMock = {
148
152
  result: { data: { dataStructure: dataStructureWithLinks } },
149
153
  };
150
154
 
155
+ const linksAndAliasMock = {
156
+ request: {
157
+ query: STRUCTURE_STRUCTURE_LINKS_QUERY,
158
+ variables: { id: 60217 },
159
+ },
160
+ result: {
161
+ data: {
162
+ dataStructure: { ...dataStructureWithLinks, alias: "Alias of alias" },
163
+ },
164
+ },
165
+ };
166
+
151
167
  describe("<StructureStructureLinks />", () => {
152
168
  const props = {
153
169
  dataStructureWithLinks,
@@ -186,6 +202,22 @@ describe("<StructureStructureLinks />", () => {
186
202
  ).toBeInTheDocument();
187
203
  });
188
204
 
205
+ it("matches the latest snapshot of StructureStructureLinks for alias check", async () => {
206
+ const { getByRole, debug, container } = render(
207
+ <StructureStructureLinks {...props} />,
208
+ {
209
+ routes: ["/structures/60217/structureLinks"],
210
+ mocks: [linksAndAliasMock],
211
+ state: { navFilter: { view: "SYSTEM_STRUCTURES", filter: {} } },
212
+ }
213
+ );
214
+
215
+ await waitFor(() => {
216
+ expect(getByRole("link", { name: /alias/i })).toBeInTheDocument();
217
+ expect(container).toMatchSnapshot();
218
+ });
219
+ });
220
+
189
221
  it("hides the 'add link' and delete link buttons if there are no permissions", async () => {
190
222
  const { getByRole, queryByRole } = render(
191
223
  <StructureStructureLinks {...props} />,
@@ -0,0 +1,287 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<StructureStructureLinks /> matches the latest snapshot of StructureStructureLinks for alias check 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
+ Alias of alias
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
+ SYSTEM_1
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
+ UNO
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
+ DOS
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
+ TRES
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
+ alias
162
+ </a>
163
+ </div>
164
+ </td>
165
+ </tr>
166
+ <tr
167
+ class=""
168
+ >
169
+ <td
170
+ class=""
171
+ >
172
+ Alias of alias
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
+ SYSTEM_2
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
+ UNO
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
+ DOS
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
+ STRUCTURE_3
278
+ </a>
279
+ </div>
280
+ </td>
281
+ </tr>
282
+ </tbody>
283
+ </table>
284
+ </div>
285
+ </div>
286
+ </div>
287
+ `;