@truedat/dd 8.7.1 → 8.7.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": "8.7.
|
|
3
|
+
"version": "8.7.2",
|
|
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.
|
|
54
|
+
"@truedat/test": "8.7.2",
|
|
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": "e971cd8773dc15ad949f260abbfe4d3236473af7"
|
|
90
90
|
}
|
package/src/api/queries.js
CHANGED
|
@@ -68,27 +68,28 @@ describe("selectors: getTabVisibility", () => {
|
|
|
68
68
|
).toMatchObject({ profile: true });
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
it("should include links
|
|
71
|
+
it("should include links tab if user has create_link permission", () => {
|
|
72
72
|
expect(
|
|
73
|
-
getTabVisibility({
|
|
73
|
+
getTabVisibility({ structureActions: { create_link: {} } }),
|
|
74
74
|
).toMatchObject({
|
|
75
75
|
links: true,
|
|
76
76
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
expect(
|
|
83
|
-
getTabVisibility({
|
|
84
|
-
structureLinks: [{ resource_type: "foo" }],
|
|
85
|
-
structureActions: { create_link: {} },
|
|
86
|
-
}),
|
|
87
|
-
).toMatchObject({
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("should include links tab if structure has links_count > 0", () => {
|
|
80
|
+
expect(getTabVisibility({ structure: { links_count: 2 } })).toMatchObject({
|
|
88
81
|
links: true,
|
|
89
82
|
});
|
|
90
83
|
});
|
|
91
84
|
|
|
85
|
+
it("should not include links tab if no permission and no links", () => {
|
|
86
|
+
expect(getTabVisibility({})).toMatchObject({ links: false });
|
|
87
|
+
expect(getTabVisibility({ structure: {} })).toMatchObject({ links: false });
|
|
88
|
+
expect(getTabVisibility({ structure: { links_count: 0 } })).toMatchObject({
|
|
89
|
+
links: false,
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
92
93
|
it("should include notes if template_id is in structure_note", () => {
|
|
93
94
|
const structure = { type: "foo", structure_type: { template_id: 1 } };
|
|
94
95
|
const templates = [{ name: "foo", id: 1 }];
|
|
@@ -19,10 +19,9 @@ const profileTabVisible = ({
|
|
|
19
19
|
notEmpty(structureProfile?.patterns));
|
|
20
20
|
|
|
21
21
|
const linksTabVisible = (state) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
);
|
|
22
|
+
const hasPermission = _.has("create_link", state?.structureActions);
|
|
23
|
+
const hasLinks = (state?.structure?.links_count || 0) > 0;
|
|
24
|
+
return hasPermission || hasLinks;
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
const notesTabVisible = ({ templatesLoading, templates, structure }) =>
|