@truedat/dd 8.7.4 → 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 +3 -3
- package/src/components/StructureTabPane.js +4 -2
- package/src/components/__tests__/__snapshots__/StructureTabPane.spec.js.snap +2 -14
- package/src/selectors/__tests__/getBusinessConceptsLinksToStructuresColumnsSelector.spec.js +22 -0
- package/src/selectors/__tests__/getTabVisibility.spec.js +86 -6
- package/src/selectors/getBusinessConceptsLinksToStructuresColumnsSelector.js +11 -17
- package/src/selectors/getTabVisibility.js +6 -2
- package/src/styles/BusinessConceptLinks.less +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "8.
|
|
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.
|
|
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": "
|
|
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" &&
|
|
110
|
-
|
|
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>
|
|
@@ -20,4 +20,26 @@ describe("selectors: getBusinessConceptsLinksToStructuresColumns", () => {
|
|
|
20
20
|
defaultBusinessConceptsLinksToStructuresColumns.length,
|
|
21
21
|
);
|
|
22
22
|
});
|
|
23
|
+
|
|
24
|
+
it("should render path as text", () => {
|
|
25
|
+
const res = getBusinessConceptsLinksToStructuresColumns({});
|
|
26
|
+
const pathIndex = res.findIndex(({ name }) => name === "path");
|
|
27
|
+
const pathColumn = res[pathIndex];
|
|
28
|
+
|
|
29
|
+
expect(pathIndex).toBeGreaterThan(-1);
|
|
30
|
+
expect(pathColumn.fieldDecorator(["system", "group", "field"])).toEqual(
|
|
31
|
+
"system › group › field",
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should style dates through a class instead of inline styles", () => {
|
|
36
|
+
const res = getBusinessConceptsLinksToStructuresColumns({});
|
|
37
|
+
const dateColumn = res.find(({ name }) => name === "updated_at");
|
|
38
|
+
const date = dateColumn.fieldDecorator("2026-06-15T10:00:00Z");
|
|
39
|
+
|
|
40
|
+
expect(date.props.className).toContain(
|
|
41
|
+
"business-concept-links__date-label",
|
|
42
|
+
);
|
|
43
|
+
expect(date.props.style).toBeUndefined();
|
|
44
|
+
});
|
|
23
45
|
});
|
|
@@ -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({
|
|
19
|
+
getTabVisibility({
|
|
20
|
+
structure: { degree: { in: 1 } },
|
|
21
|
+
userPermissions: { view_lineage: true },
|
|
22
|
+
}),
|
|
20
23
|
).toMatchObject({ lineage: true });
|
|
21
24
|
expect(
|
|
22
|
-
getTabVisibility({
|
|
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({
|
|
40
|
+
getTabVisibility({
|
|
41
|
+
structure: { degree: { out: 1 } },
|
|
42
|
+
userPermissions: { view_lineage: true },
|
|
43
|
+
}),
|
|
29
44
|
).toMatchObject({ impact: true });
|
|
30
45
|
expect(
|
|
31
|
-
getTabVisibility({
|
|
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
|
});
|
|
@@ -3,6 +3,7 @@ import { Link } from "react-router";
|
|
|
3
3
|
import { createSelector } from "reselect";
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
import Moment from "react-moment";
|
|
6
|
+
import { Icon, Label } from "semantic-ui-react";
|
|
6
7
|
import { linkTo } from "@truedat/core/routes";
|
|
7
8
|
|
|
8
9
|
const typeTranslateDecorator = ({ type }) => (
|
|
@@ -10,7 +11,10 @@ const typeTranslateDecorator = ({ type }) => (
|
|
|
10
11
|
);
|
|
11
12
|
|
|
12
13
|
const dateDecorator = (date) => (
|
|
13
|
-
<
|
|
14
|
+
<Label className="alert info business-concept-links__date-label">
|
|
15
|
+
<Icon name="info circle" color="blue" />
|
|
16
|
+
<Moment locale="es" date={date} format="YYYY-MM-DD HH:mm" />
|
|
17
|
+
</Label>
|
|
14
18
|
);
|
|
15
19
|
|
|
16
20
|
const relationTypeDecorator = _.map((relationTag) => (
|
|
@@ -20,39 +24,34 @@ const relationTypeDecorator = _.map((relationTag) => (
|
|
|
20
24
|
defaultMessage={relationTag}
|
|
21
25
|
/>
|
|
22
26
|
));
|
|
23
|
-
const pathDecorator = (
|
|
24
|
-
<span title={_.join(" › ")(path)}>
|
|
25
|
-
{_.flow(_.join(" › "), _.truncate({ length: 90 }))(path)}{" "}
|
|
26
|
-
</span>
|
|
27
|
-
);
|
|
27
|
+
const pathDecorator = _.flow(_.defaultTo([]), _.join(" › "));
|
|
28
28
|
|
|
29
29
|
export const defaultBusinessConceptsLinksToStructuresColumns = [
|
|
30
30
|
{
|
|
31
31
|
name: "name",
|
|
32
|
-
width: 2,
|
|
33
32
|
},
|
|
34
33
|
{
|
|
35
34
|
name: "type",
|
|
36
35
|
fieldSelector: _.pick(["type"]),
|
|
37
36
|
fieldDecorator: typeTranslateDecorator,
|
|
38
|
-
width: 1,
|
|
39
37
|
},
|
|
40
38
|
{
|
|
41
39
|
name: "system",
|
|
42
40
|
fieldSelector: _.path("system.name"),
|
|
43
|
-
width: 1,
|
|
44
41
|
},
|
|
45
42
|
{
|
|
46
43
|
name: "relation.relation_type_name",
|
|
47
44
|
fieldSelector: _.path("tags"),
|
|
48
45
|
fieldDecorator: relationTypeDecorator,
|
|
49
|
-
width: 1,
|
|
50
46
|
},
|
|
51
|
-
{
|
|
47
|
+
{
|
|
48
|
+
name: "path",
|
|
49
|
+
fieldDecorator: pathDecorator,
|
|
50
|
+
},
|
|
52
51
|
{
|
|
53
52
|
name: "updated_at",
|
|
54
53
|
fieldDecorator: dateDecorator,
|
|
55
|
-
|
|
54
|
+
textAlign: "center",
|
|
56
55
|
},
|
|
57
56
|
{
|
|
58
57
|
name: "relationTags.props.expandable",
|
|
@@ -71,11 +70,6 @@ export const defaultBusinessConceptsLinksToStructuresColumns = [
|
|
|
71
70
|
</Link>
|
|
72
71
|
);
|
|
73
72
|
},
|
|
74
|
-
width: 1,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "path",
|
|
78
|
-
fieldDecorator: pathDecorator,
|
|
79
73
|
},
|
|
80
74
|
];
|
|
81
75
|
|
|
@@ -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 =
|
|
53
|
+
const lineageTabVisible = (state) =>
|
|
54
|
+
state?.userPermissions?.view_lineage &&
|
|
55
|
+
_.anyPass([_.path("structure.degree.in")])(state);
|
|
54
56
|
|
|
55
|
-
const impactTabVisible =
|
|
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
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.ui.label.business-concept-links__date-label {
|
|
2
|
+
background-color: #dbeafe;
|
|
3
|
+
border-color: #bfdbfe;
|
|
4
|
+
color: #1f2937;
|
|
5
|
+
white-space: nowrap;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.business-concept-links__icon-popup {
|
|
9
|
+
max-width: 420px;
|
|
10
|
+
overflow-wrap: anywhere;
|
|
11
|
+
white-space: pre-wrap;
|
|
12
|
+
word-break: break-word;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.business-concept-links__icon-trigger {
|
|
16
|
+
align-items: center;
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ui.icon.business-concept-links__icon {
|
|
23
|
+
cursor: default;
|
|
24
|
+
margin: 0;
|
|
25
|
+
max-width: 100%;
|
|
26
|
+
}
|