@truedat/core 6.0.5 → 6.1.0

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/core",
3
- "version": "6.0.5",
3
+ "version": "6.1.0",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -117,5 +117,5 @@
117
117
  "react-dom": ">= 16.8.6 < 17",
118
118
  "semantic-ui-react": ">= 2.0.3 < 2.2"
119
119
  },
120
- "gitHead": "abbaf37328ae24646d2a2c2851f77a611e5476d8"
120
+ "gitHead": "0e2dd260284f95d075f53ec5df1111606b5ecd0d"
121
121
  }
@@ -53,7 +53,6 @@ export const CatalogMenu = ({ catalogViewConfigs }) => {
53
53
  "data_dictionary_structure_notes"
54
54
  );
55
55
  const { formatMessage } = useIntl();
56
-
57
56
  const submenuItems = [
58
57
  { name: "structures", routes: [STRUCTURES, SYSTEMS] },
59
58
  ...catalogViewConfigItems(formatMessage)(catalogViewConfigs),
@@ -73,10 +72,8 @@ CatalogMenu.propTypes = {
73
72
  };
74
73
 
75
74
  export const CatalogMenuLoader = (props) => {
76
- const adminAuthorized = useAuthorized();
77
75
  const { loading, error, data } = useQuery(CATALOG_VIEW_CONFIGS_QUERY, {
78
76
  fetchPolicy: "cache-and-network",
79
- skip: !adminAuthorized,
80
77
  });
81
78
 
82
79
  if (error) return null;
@@ -3,71 +3,95 @@ import React from "react";
3
3
  import { render } from "@truedat/test/render";
4
4
  import { within } from "@testing-library/react";
5
5
  import { MemoryRouter } from "react-router-dom";
6
+ import { waitForElementToBeRemoved } from "@testing-library/react";
7
+
6
8
  import { linkTo } from "@truedat/core/routes";
7
- import { CatalogMenu } from "../CatalogMenu";
9
+ import { CATALOG_VIEW_CONFIGS_QUERY } from "@truedat/dd/api/queries";
10
+ import CatalogMenu from "../CatalogMenu";
8
11
 
9
12
  jest.mock("../../hooks", () => ({
10
13
  ...jest.requireActual("../../hooks"),
11
14
  useAuthorized: jest.fn(() => true),
15
+ useAuthorizedItems: jest.fn((items) => items),
12
16
  }));
13
17
 
14
- const commonRenderOpts = {
15
- messages: {
16
- en: {
17
- "metadata.region": "metadata.region",
18
- "note.layer": "note.layer",
18
+ const mocks = [
19
+ {
20
+ request: { query: CATALOG_VIEW_CONFIGS_QUERY },
21
+ result: {
22
+ data: {
23
+ catalogViewConfigs: [
24
+ {
25
+ id: "1",
26
+ fieldType: "metadata",
27
+ fieldName: "region",
28
+ },
29
+ {
30
+ id: "2",
31
+ fieldType: "note",
32
+ fieldName: "layer",
33
+ },
34
+ ],
35
+ },
19
36
  },
20
37
  },
38
+ ];
39
+
40
+ const commonRenderOpts = {
41
+ mocks,
42
+ state: { sidebarVisible: true },
21
43
  };
22
44
 
23
45
  describe("<CatalogMenu />", () => {
24
- it("matches the latest snapshot", () => {
25
- const { container } = render(<CatalogMenu />, commonRenderOpts);
46
+ it("matches the latest snapshot", async () => {
47
+ const { container } = render(
48
+ <MemoryRouter initialEntries={[linkTo.STRUCTURE({ id: 1234 })]}>
49
+ <CatalogMenu />
50
+ </MemoryRouter>,
51
+ commonRenderOpts
52
+ );
53
+ const loader = container.querySelector(".loader");
54
+ await waitForElementToBeRemoved(loader);
26
55
  expect(container).toMatchSnapshot();
27
56
  });
28
57
 
29
- it("Path active route", () => {
58
+ it("Path active route", async () => {
30
59
  const { container } = render(
31
60
  <MemoryRouter initialEntries={[linkTo.STRUCTURE({ id: 1234 })]}>
32
61
  <CatalogMenu />
33
62
  </MemoryRouter>,
34
63
  commonRenderOpts
35
64
  );
65
+ const loader = container.querySelector(".loader");
66
+ await waitForElementToBeRemoved(loader);
36
67
 
37
- const activeMenus = container.querySelectorAll('a[aria-checked="true"]');
68
+ const activeMenus = container.querySelectorAll("a.active");
38
69
  expect(activeMenus.length).toBe(1);
39
- expect(within(activeMenus[0]).getByText("structures")).toBeInTheDocument();
70
+ expect(within(activeMenus[0]).getByText("Structures")).toBeInTheDocument();
40
71
  });
41
72
 
42
- it("Navigation filter has priority over path for active menu and submenu", () => {
43
- const renderOpts = {
44
- ...commonRenderOpts,
73
+ it("Navigation filter has priority over path for active menu and submenu", async () => {
74
+ const renderOpts = _.merge(commonRenderOpts, {
45
75
  state: {
46
76
  navFilter: { "metadata.region": "eu-west-1" },
47
77
  },
48
- };
49
-
50
- const catalogViewConfigs = [
51
- {
52
- id: "1",
53
- fieldType: "metadata",
54
- fieldName: "region",
55
- },
56
- {
57
- id: "2",
58
- fieldType: "note",
59
- fieldName: "layer",
60
- },
61
- ];
78
+ });
62
79
 
63
80
  const { getByText, container } = render(
64
- <MemoryRouter initialEntries={[linkTo.STRUCTURE({ id: 1234 })]}>
65
- <CatalogMenu catalogViewConfigs={catalogViewConfigs} />
81
+ <MemoryRouter
82
+ initialEntries={[
83
+ linkTo.BUCKETS_VIEW({ propertyPath: `metadata.region` }),
84
+ ]}
85
+ >
86
+ <CatalogMenu />
66
87
  </MemoryRouter>,
67
88
  renderOpts
68
89
  );
69
90
 
70
- const structuresMenu = getByText("structures").closest("a");
91
+ const loader = container.querySelector(".loader");
92
+ await waitForElementToBeRemoved(loader);
93
+
94
+ const structuresMenu = getByText("Structures").closest("a");
71
95
  const metadataBucketMenu = getByText("metadata.region").closest("a");
72
96
  const noteBucketMenu = getByText("note.layer").closest("a");
73
97
 
@@ -75,7 +99,7 @@ describe("<CatalogMenu />", () => {
75
99
  expect(metadataBucketMenu).toBeInTheDocument();
76
100
  expect(noteBucketMenu).toBeInTheDocument();
77
101
 
78
- const activeMenus = container.querySelectorAll('a[aria-checked="true"]');
102
+ const activeMenus = container.querySelectorAll("a.active");
79
103
  expect(activeMenus.length).toBe(1);
80
104
  expect(
81
105
  within(activeMenus[0]).getByText("metadata.region")
@@ -1,17 +1,52 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
+ import { waitForElementToBeRemoved } from "@testing-library/react";
4
+ import { CATALOG_VIEW_CONFIGS_QUERY } from "@truedat/dd/api/queries";
3
5
  import SideMenu from "../SideMenu";
4
6
 
5
- const renderOpts = { state: { sidebarVisible: true } };
7
+ jest.mock("@truedat/core/hooks", () => ({
8
+ useActiveRoutes: jest.fn(() => true),
9
+ useAuthorized: jest.fn(() => true),
10
+ useAuthorizedItems: jest.fn((items) => items),
11
+ }));
12
+
13
+ const mocks = [
14
+ {
15
+ request: { query: CATALOG_VIEW_CONFIGS_QUERY },
16
+ result: {
17
+ data: {
18
+ catalogViewConfigs: [
19
+ {
20
+ id: "1",
21
+ fieldType: "metadata",
22
+ fieldName: "region",
23
+ },
24
+ {
25
+ id: "2",
26
+ fieldType: "note",
27
+ fieldName: "layer",
28
+ },
29
+ ],
30
+ },
31
+ },
32
+ },
33
+ ];
34
+
35
+ const renderOpts = {
36
+ mocks,
37
+ state: { sidebarVisible: true },
38
+ };
6
39
 
7
40
  describe("<SideMenu />", () => {
8
- it("matches the latest snapshot", () => {
41
+ it("matches the latest snapshot", async () => {
9
42
  const { container } = render(
10
43
  <SideMenu>
11
44
  <p>Hello</p>
12
45
  </SideMenu>,
13
46
  renderOpts
14
47
  );
48
+ const loader = container.querySelector(".loader");
49
+ await waitForElementToBeRemoved(loader);
15
50
  expect(container).toMatchSnapshot();
16
51
  });
17
52
  });
@@ -2,125 +2,75 @@
2
2
 
3
3
  exports[`<CatalogMenu /> matches the latest snapshot 1`] = `
4
4
  <div>
5
- <div>
5
+ <div
6
+ class="active item selectable"
7
+ >
8
+ <a
9
+ href="/structures"
10
+ >
11
+ <i
12
+ aria-hidden="true"
13
+ class="block layout large icon"
14
+ />
15
+ Catalog
16
+ </a>
6
17
  <div
7
- aria-expanded="false"
8
- class="ui item dropdown"
9
- role="listbox"
10
- tabindex="0"
18
+ class="menu"
11
19
  >
12
20
  <a
13
- class="ui"
21
+ class="active link item"
14
22
  href="/structures"
15
23
  >
16
- <i
17
- aria-hidden="true"
18
- class="block layout large icon"
19
- />
24
+ Structures
25
+ </a>
26
+ <a
27
+ class="link item"
28
+ href="/buckets/metadata.region"
29
+ >
30
+ metadata.region
31
+ </a>
32
+ <a
33
+ class="link item"
34
+ href="/buckets/note.layer"
35
+ >
36
+ note.layer
37
+ </a>
38
+ <a
39
+ class="link item"
40
+ href="/referenceDatasets"
41
+ >
42
+ Reference Data
43
+ </a>
44
+ <a
45
+ class="link item"
46
+ href="/structureNotes"
47
+ >
48
+ Pending notes
49
+ </a>
50
+ <a
51
+ class="link item"
52
+ href="/bulkUpdateTemplateContentEvents"
53
+ >
54
+ My loads
55
+ </a>
56
+ <a
57
+ class="link item"
58
+ href="/bucketViewConfigs"
59
+ >
60
+ Catalog views
61
+ </a>
62
+ <a
63
+ class="link item"
64
+ href="/structureTypes"
65
+ >
66
+ Structure Types
20
67
  </a>
21
- <div
22
- class="menu transition"
68
+ <a
69
+ class="link item"
70
+ href="/structureTags"
23
71
  >
24
- <div
25
- class="header selectable"
26
- >
27
- catalog
28
- </div>
29
- <div
30
- class="divider"
31
- />
32
- <a
33
- aria-checked="false"
34
- class="item"
35
- href="/structures"
36
- name="structures"
37
- role="option"
38
- >
39
- <span
40
- class="text"
41
- >
42
- structures
43
- </span>
44
- </a>
45
- <a
46
- aria-checked="false"
47
- class="item"
48
- href="/referenceDatasets"
49
- name="referenceData"
50
- role="option"
51
- >
52
- <span
53
- class="text"
54
- >
55
- referenceData
56
- </span>
57
- </a>
58
- <a
59
- aria-checked="false"
60
- class="item"
61
- href="/structureNotes"
62
- name="pending_structure_notes"
63
- role="option"
64
- >
65
- <span
66
- class="text"
67
- >
68
- pending_structure_notes
69
- </span>
70
- </a>
71
- <a
72
- aria-checked="false"
73
- class="item"
74
- href="/bulkUpdateTemplateContentEvents"
75
- name="structures_upload_events"
76
- role="option"
77
- >
78
- <span
79
- class="text"
80
- >
81
- structures_upload_events
82
- </span>
83
- </a>
84
- <a
85
- aria-checked="false"
86
- class="item"
87
- href="/bucketViewConfigs"
88
- name="catalogViewConfigs"
89
- role="option"
90
- >
91
- <span
92
- class="text"
93
- >
94
- catalogViewConfigs
95
- </span>
96
- </a>
97
- <a
98
- aria-checked="false"
99
- class="item"
100
- href="/structureTypes"
101
- name="structureTypes"
102
- role="option"
103
- >
104
- <span
105
- class="text"
106
- >
107
- structureTypes
108
- </span>
109
- </a>
110
- <a
111
- aria-checked="false"
112
- class="item"
113
- href="/structureTags"
114
- name="structureTags"
115
- role="option"
116
- >
117
- <span
118
- class="text"
119
- >
120
- structureTags
121
- </span>
122
- </a>
123
- </div>
72
+ Structure Tags
73
+ </a>
124
74
  </div>
125
75
  </div>
126
76
  </div>
@@ -8,40 +8,472 @@ exports[`<SideMenu /> matches the latest snapshot 1`] = `
8
8
  <div
9
9
  class="ui vertical ui push left visible sidebar menu"
10
10
  >
11
- <div>
11
+ <div
12
+ class="active item selectable"
13
+ >
14
+ <a
15
+ href="/search"
16
+ >
17
+ <i
18
+ aria-hidden="true"
19
+ class="search large icon"
20
+ />
21
+ Search
22
+ </a>
23
+ </div>
24
+ <div
25
+ class="active item selectable"
26
+ >
27
+ <a
28
+ href="/concepts"
29
+ >
30
+ <i
31
+ aria-hidden="true"
32
+ class="tags large icon"
33
+ />
34
+ Glossary
35
+ </a>
36
+ <div
37
+ class="menu"
38
+ >
39
+ <a
40
+ class="link item"
41
+ href="/concepts"
42
+ >
43
+ Glossary
44
+ </a>
45
+ <a
46
+ class="link item"
47
+ href="/pendingConcepts"
48
+ >
49
+ Drafts
50
+ </a>
51
+ <a
52
+ class="link item"
53
+ href="/deprecatedConcepts"
54
+ >
55
+ Deprecated
56
+ </a>
57
+ <a
58
+ class="link item"
59
+ href="/links/concepts/management"
60
+ >
61
+ Links manager
62
+ </a>
63
+ <a
64
+ class="link item"
65
+ href="/concepts/bulk_upload_event"
66
+ >
67
+ My loads
68
+ </a>
69
+ </div>
70
+ </div>
71
+ <div
72
+ class="active item selectable"
73
+ >
74
+ <a
75
+ href="/structures"
76
+ >
77
+ <i
78
+ aria-hidden="true"
79
+ class="block layout large icon"
80
+ />
81
+ Catalog
82
+ </a>
83
+ <div
84
+ class="menu"
85
+ >
86
+ <a
87
+ class="link item"
88
+ href="/structures"
89
+ >
90
+ Structures
91
+ </a>
92
+ <a
93
+ class="link item"
94
+ href="/buckets/metadata.region"
95
+ >
96
+ metadata.region
97
+ </a>
98
+ <a
99
+ class="link item"
100
+ href="/buckets/note.layer"
101
+ >
102
+ note.layer
103
+ </a>
104
+ <a
105
+ class="link item"
106
+ href="/referenceDatasets"
107
+ >
108
+ Reference Data
109
+ </a>
110
+ <a
111
+ class="link item"
112
+ href="/structureNotes"
113
+ >
114
+ Pending notes
115
+ </a>
116
+ <a
117
+ class="link item"
118
+ href="/bulkUpdateTemplateContentEvents"
119
+ >
120
+ My loads
121
+ </a>
122
+ <a
123
+ class="link item"
124
+ href="/bucketViewConfigs"
125
+ >
126
+ Catalog views
127
+ </a>
128
+ <a
129
+ class="link item"
130
+ href="/structureTypes"
131
+ >
132
+ Structure Types
133
+ </a>
134
+ <a
135
+ class="link item"
136
+ href="/structureTags"
137
+ >
138
+ Structure Tags
139
+ </a>
140
+ </div>
141
+ </div>
142
+ <div
143
+ class="active item selectable"
144
+ >
145
+ <a
146
+ href="/structuresGrantRequests"
147
+ >
148
+ <i
149
+ aria-hidden="true"
150
+ class="key large icon"
151
+ />
152
+ Grants
153
+ </a>
154
+ <div
155
+ class="menu"
156
+ >
157
+ <a
158
+ class="link item"
159
+ href="/structuresGrantRequests"
160
+ >
161
+ Structures grant requests
162
+ </a>
163
+ <a
164
+ class="link item"
165
+ href="/myGrants"
166
+ >
167
+ My Grants
168
+ </a>
169
+ <a
170
+ class="link item"
171
+ href="/grants"
172
+ >
173
+ Grants
174
+ </a>
175
+ <a
176
+ class="link item"
177
+ href="/myGrantRequests"
178
+ >
179
+ My Grant Requests
180
+ </a>
181
+ <a
182
+ class="link item"
183
+ href="/grantRequests"
184
+ >
185
+ Approve Grant Requests
186
+ </a>
187
+ <a
188
+ class="link item"
189
+ href="/grantApprovalRules"
190
+ >
191
+ Approval Rules
192
+ </a>
193
+ </div>
194
+ </div>
195
+ <div
196
+ class="active item selectable"
197
+ >
198
+ <a
199
+ href="/rules"
200
+ >
201
+ <i
202
+ aria-hidden="true"
203
+ class="check square large icon"
204
+ />
205
+ Data Quality
206
+ </a>
207
+ <div
208
+ class="menu"
209
+ >
210
+ <a
211
+ class="link item"
212
+ href="/rules"
213
+ >
214
+ Quality Rules
215
+ </a>
216
+ <a
217
+ class="link item"
218
+ href="/implementations"
219
+ >
220
+ Implementations
221
+ </a>
222
+ <a
223
+ class="link item"
224
+ href="/pendingImplementations"
225
+ >
226
+ Drafts
227
+ </a>
228
+ <a
229
+ class="link item"
230
+ href="/deprecatedImplementations"
231
+ >
232
+ Deprecated
233
+ </a>
234
+ <a
235
+ class="link item"
236
+ href="/executionGroups"
237
+ >
238
+ My Executions
239
+ </a>
240
+ </div>
241
+ </div>
242
+ <div
243
+ class="active item selectable"
244
+ >
245
+ <a
246
+ href="/dataViews"
247
+ >
248
+ <i
249
+ aria-hidden="true"
250
+ class="weight large icon"
251
+ />
252
+ quality_experience
253
+ </a>
254
+ <div
255
+ class="menu"
256
+ >
257
+ <a
258
+ class="link item"
259
+ href="/dataViews"
260
+ >
261
+ dataViews
262
+ </a>
263
+ <a
264
+ class="link item"
265
+ href="/functions"
266
+ >
267
+ functions
268
+ </a>
269
+ <a
270
+ class="link item"
271
+ href="/qualityControls"
272
+ >
273
+ quality_controls_published
274
+ </a>
275
+ <a
276
+ class="link item"
277
+ href="/qualityControls/deprecated"
278
+ >
279
+ quality_controls_deprecated
280
+ </a>
281
+ <a
282
+ class="link item"
283
+ href="/qualityControls/drafts"
284
+ >
285
+ quality_controls_drafts
286
+ </a>
287
+ <a
288
+ class="link item"
289
+ href="/qualityControls/executionGroups"
290
+ >
291
+ quality_controls_execution_groups
292
+ </a>
293
+ </div>
294
+ </div>
295
+ <div
296
+ class="active item selectable"
297
+ >
298
+ <a
299
+ href="/graphs"
300
+ >
301
+ <i
302
+ aria-hidden="true"
303
+ class="shuffle large icon"
304
+ />
305
+ Lineage Analysis
306
+ </a>
12
307
  <div
13
- aria-expanded="false"
14
- class="ui item dropdown"
15
- role="listbox"
16
- tabindex="0"
17
- >
18
- <a
19
- class="ui"
20
- href="/search"
21
- >
22
- <i
23
- aria-hidden="true"
24
- class="search large icon"
25
- />
26
- Search
27
- </a>
28
- <div
29
- class="menu transition"
30
- >
31
- <a
32
- aria-checked="false"
33
- class="item"
34
- href="/search"
35
- name="search"
36
- role="option"
37
- >
38
- <span
39
- class="text"
40
- >
41
- Search
42
- </span>
43
- </a>
44
- </div>
308
+ class="menu"
309
+ >
310
+ <a
311
+ class="link item"
312
+ href="/graphs"
313
+ >
314
+ Lineage Analysis
315
+ </a>
316
+ <a
317
+ class="link item"
318
+ href="/lineageEvents"
319
+ >
320
+ My graphs
321
+ </a>
322
+ </div>
323
+ </div>
324
+ <div
325
+ class="active item selectable"
326
+ >
327
+ <a
328
+ href="/ingests"
329
+ >
330
+ <i
331
+ aria-hidden="true"
332
+ class="hdd outline large icon"
333
+ />
334
+ Data Requests
335
+ </a>
336
+ </div>
337
+ <div
338
+ class="active item selectable"
339
+ >
340
+ <a
341
+ href="/resource_mappings"
342
+ >
343
+ <i
344
+ aria-hidden="true"
345
+ class="lightbulb outline large icon"
346
+ />
347
+ artificial_intelligence
348
+ </a>
349
+ <div
350
+ class="menu"
351
+ >
352
+ <a
353
+ class="link item"
354
+ href="/resource_mappings"
355
+ >
356
+ resource_mappings
357
+ </a>
358
+ <a
359
+ class="link item"
360
+ href="/prompts"
361
+ >
362
+ prompts
363
+ </a>
364
+ </div>
365
+ </div>
366
+ <div
367
+ class="active item selectable"
368
+ >
369
+ <a
370
+ href="/domains"
371
+ >
372
+ <i
373
+ aria-hidden="true"
374
+ class="sitemap large icon"
375
+ />
376
+ Taxonomy
377
+ </a>
378
+ </div>
379
+ <div
380
+ class="active item selectable"
381
+ >
382
+ <a
383
+ href="/users"
384
+ >
385
+ <i
386
+ aria-hidden="true"
387
+ class="users large icon"
388
+ />
389
+ Members
390
+ </a>
391
+ <div
392
+ class="menu"
393
+ >
394
+ <a
395
+ class="link item"
396
+ href="/users"
397
+ >
398
+ Users
399
+ </a>
400
+ <a
401
+ class="link item"
402
+ href="/roles"
403
+ >
404
+ Roles
405
+ </a>
406
+ </div>
407
+ </div>
408
+ <div
409
+ class="active item selectable"
410
+ >
411
+ <a
412
+ href="/templates"
413
+ >
414
+ <i
415
+ aria-hidden="true"
416
+ class="setting large icon"
417
+ />
418
+ Administration
419
+ </a>
420
+ <div
421
+ class="menu"
422
+ >
423
+ <a
424
+ class="link item"
425
+ href="/templates"
426
+ >
427
+ Templates
428
+ </a>
429
+ <a
430
+ class="link item"
431
+ href="/hierarchies"
432
+ >
433
+ Hierarchies
434
+ </a>
435
+ <a
436
+ class="link item"
437
+ href="/relationTags"
438
+ >
439
+ Relations
440
+ </a>
441
+ <a
442
+ class="link item"
443
+ href="/subscriptions"
444
+ >
445
+ Subscriptions
446
+ </a>
447
+ <a
448
+ class="link item"
449
+ href="/sources"
450
+ >
451
+ Sources
452
+ </a>
453
+ <a
454
+ class="link item"
455
+ href="/jobs"
456
+ >
457
+ Jobs
458
+ </a>
459
+ <a
460
+ class="link item"
461
+ href="/configurations"
462
+ >
463
+ Configuration
464
+ </a>
465
+ <a
466
+ class="link item"
467
+ href="/i18n/messages"
468
+ >
469
+ Translations
470
+ </a>
471
+ <a
472
+ class="link item"
473
+ href="/tasks"
474
+ >
475
+ Tasks
476
+ </a>
45
477
  </div>
46
478
  </div>
47
479
  <a