@truedat/dd 8.7.5 → 8.8.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/dd",
3
- "version": "8.7.5",
3
+ "version": "8.8.0",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -51,7 +51,7 @@
51
51
  "@testing-library/jest-dom": "^6.6.3",
52
52
  "@testing-library/react": "^16.3.0",
53
53
  "@testing-library/user-event": "^14.6.1",
54
- "@truedat/test": "8.7.5",
54
+ "@truedat/test": "8.8.0",
55
55
  "identity-obj-proxy": "^3.0.0",
56
56
  "jest": "^29.7.0",
57
57
  "redux-saga-test-plan": "^4.0.6"
@@ -86,5 +86,5 @@
86
86
  "svg-pan-zoom": "^3.6.2",
87
87
  "swr": "^2.3.3"
88
88
  },
89
- "gitHead": "c6330f05c6d7eb7b601ff861385deedb257efc3d"
89
+ "gitHead": "006b9cd6486cd37976d4dc06ede1a48e37175f30"
90
90
  }
@@ -106,8 +106,10 @@ export const StructureTabPane = ({ path }) => {
106
106
  {activeTab === "metadata" && tabVisibility.metadata && (
107
107
  <StructureMetadata />
108
108
  )}
109
- {activeTab === "lineage" && <StructureLineage />}
110
- {activeTab === "impact" && <StructureImpact />}
109
+ {activeTab === "lineage" && tabVisibility?.lineage && (
110
+ <StructureLineage />
111
+ )}
112
+ {activeTab === "impact" && tabVisibility?.impact && <StructureImpact />}
111
113
  {<CustomTab tabs={customTabs} activeTab={activeTab} />}
112
114
  </ErrorBoundary>
113
115
  );
@@ -40,21 +40,9 @@ exports[`<StructureTabPane /> renders correctly with grants tab 1`] = `
40
40
  </div>
41
41
  `;
42
42
 
43
- exports[`<StructureTabPane /> renders correctly with impact tab 1`] = `
44
- <div>
45
- <div>
46
- StructureImpact
47
- </div>
48
- </div>
49
- `;
43
+ exports[`<StructureTabPane /> renders correctly with impact tab 1`] = `<div />`;
50
44
 
51
- exports[`<StructureTabPane /> renders correctly with lineage tab 1`] = `
52
- <div>
53
- <div>
54
- StructureLineage
55
- </div>
56
- </div>
57
- `;
45
+ exports[`<StructureTabPane /> renders correctly with lineage tab 1`] = `<div />`;
58
46
 
59
47
  exports[`<StructureTabPane /> renders correctly with links tab 1`] = `
60
48
  <div>
@@ -14,21 +14,45 @@ describe("selectors: getTabVisibility", () => {
14
14
  });
15
15
  });
16
16
 
17
- it("should include lineage iff structure has in degree", () => {
17
+ it("should include lineage iff structure has in degree and user has view_lineage permission", () => {
18
18
  expect(
19
- getTabVisibility({ structure: { degree: { in: 1 } } }),
19
+ getTabVisibility({
20
+ structure: { degree: { in: 1 } },
21
+ userPermissions: { view_lineage: true },
22
+ }),
20
23
  ).toMatchObject({ lineage: true });
21
24
  expect(
22
- getTabVisibility({ structure: { degree: { in: 0 } } }),
25
+ getTabVisibility({
26
+ structure: { degree: { in: 0 } },
27
+ userPermissions: { view_lineage: true },
28
+ }),
29
+ ).toMatchObject({ lineage: false });
30
+ expect(
31
+ getTabVisibility({
32
+ structure: { degree: { in: 1 } },
33
+ userPermissions: { view_lineage: false },
34
+ }),
23
35
  ).toMatchObject({ lineage: false });
24
36
  });
25
37
 
26
- it("should include impact iff structure has out degree", () => {
38
+ it("should include impact iff structure has out degree and user has view_lineage permission", () => {
27
39
  expect(
28
- getTabVisibility({ structure: { degree: { out: 1 } } }),
40
+ getTabVisibility({
41
+ structure: { degree: { out: 1 } },
42
+ userPermissions: { view_lineage: true },
43
+ }),
29
44
  ).toMatchObject({ impact: true });
30
45
  expect(
31
- getTabVisibility({ structure: { degree: { out: 0 } } }),
46
+ getTabVisibility({
47
+ structure: { degree: { out: 0 } },
48
+ userPermissions: { view_lineage: true },
49
+ }),
50
+ ).toMatchObject({ impact: false });
51
+ expect(
52
+ getTabVisibility({
53
+ structure: { degree: { out: 1 } },
54
+ userPermissions: { view_lineage: false },
55
+ }),
32
56
  ).toMatchObject({ impact: false });
33
57
  });
34
58
 
@@ -249,4 +273,60 @@ describe("selectors: getTabVisibility", () => {
249
273
  }),
250
274
  ).toMatchObject({ roles: true });
251
275
  });
276
+
277
+ describe("acceptance criteria: lineage and impact tab visibility", () => {
278
+ it("1a: without permission + with data -> tabs hidden", () => {
279
+ expect(
280
+ getTabVisibility({
281
+ structure: { degree: { in: 1, out: 1 } },
282
+ userPermissions: { view_lineage: false },
283
+ }),
284
+ ).toMatchObject({ lineage: false, impact: false });
285
+ });
286
+
287
+ it("1b: without permission + without data -> tabs hidden", () => {
288
+ expect(
289
+ getTabVisibility({
290
+ structure: { degree: { in: 0, out: 0 } },
291
+ userPermissions: { view_lineage: false },
292
+ }),
293
+ ).toMatchObject({ lineage: false, impact: false });
294
+ });
295
+
296
+ it("2a: with permission in dom A + data in dom A -> tabs visible", () => {
297
+ expect(
298
+ getTabVisibility({
299
+ structure: { degree: { in: 1, out: 1 } },
300
+ userPermissions: { view_lineage: true },
301
+ }),
302
+ ).toMatchObject({ lineage: true, impact: true });
303
+ });
304
+
305
+ it("2c: with permission in dom A + without data in dom A -> tabs hidden", () => {
306
+ expect(
307
+ getTabVisibility({
308
+ structure: { degree: { in: 0, out: 0 } },
309
+ userPermissions: { view_lineage: true },
310
+ }),
311
+ ).toMatchObject({ lineage: false, impact: false });
312
+ });
313
+
314
+ it("2e: with permission in dom A and B + data -> tabs visible", () => {
315
+ expect(
316
+ getTabVisibility({
317
+ structure: { degree: { in: 1, out: 1 } },
318
+ userPermissions: { view_lineage: true },
319
+ }),
320
+ ).toMatchObject({ lineage: true, impact: true });
321
+ });
322
+
323
+ it("2f: with permission in dom A and B + without data -> tabs hidden", () => {
324
+ expect(
325
+ getTabVisibility({
326
+ structure: { degree: { in: 0, out: 0 } },
327
+ userPermissions: { view_lineage: true },
328
+ }),
329
+ ).toMatchObject({ lineage: false, impact: false });
330
+ });
331
+ });
252
332
  });
@@ -50,9 +50,13 @@ const rulesTabVisible = (state) =>
50
50
  state?.structure?.implementation_count > 0 &&
51
51
  state?.userPermissions?.view_quality;
52
52
 
53
- const lineageTabVisible = _.anyPass([_.path("structure.degree.in")]);
53
+ const lineageTabVisible = (state) =>
54
+ state?.userPermissions?.view_lineage &&
55
+ _.anyPass([_.path("structure.degree.in")])(state);
54
56
 
55
- const impactTabVisible = _.anyPass([_.path("structure.degree.out")]);
57
+ const impactTabVisible = (state) =>
58
+ state?.userPermissions?.view_lineage &&
59
+ _.anyPass([_.path("structure.degree.out")])(state);
56
60
 
57
61
  const parentsTabVisible = _.conformsTo({ parentRelations: notEmpty });
58
62