@truedat/lm 4.40.3 → 4.40.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.40.4] 2022-03-15
4
+
5
+ ### Fixed
6
+
7
+ - [TD-4271] Remove linking implementations tab for users without permissions
8
+
3
9
  ## [4.40.3] 2022-03-14
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/lm",
3
- "version": "4.40.3",
3
+ "version": "4.40.4",
4
4
  "description": "Truedat Link Manager",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -33,7 +33,7 @@
33
33
  "@testing-library/jest-dom": "^5.14.1",
34
34
  "@testing-library/react": "^12.0.0",
35
35
  "@testing-library/user-event": "^13.2.1",
36
- "@truedat/test": "4.40.3",
36
+ "@truedat/test": "4.40.4",
37
37
  "babel-jest": "^27.0.6",
38
38
  "babel-plugin-dynamic-import-node": "^2.3.3",
39
39
  "babel-plugin-lodash": "^3.3.4",
@@ -83,7 +83,7 @@
83
83
  ]
84
84
  },
85
85
  "dependencies": {
86
- "@truedat/core": "4.40.3",
86
+ "@truedat/core": "4.40.4",
87
87
  "path-to-regexp": "^1.7.0",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-graph-vis": "1.0.5",
@@ -100,5 +100,5 @@
100
100
  "react-dom": ">= 16.8.6 < 17",
101
101
  "semantic-ui-react": ">= 0.88.2 < 2.1"
102
102
  },
103
- "gitHead": "03104a28941b568007ad53b85874ff58225eaa6a"
103
+ "gitHead": "e9f62f91507d810f91963967a5f3afa20100c1b9"
104
104
  }
@@ -34,17 +34,29 @@ export const ImplementationLinks = ({
34
34
  ]
35
35
  : [];
36
36
 
37
+ const hasTags = _.flow(
38
+ _.map("tags"),
39
+ _.flatten,
40
+ _.isEmpty
41
+ )(implementationLinks);
42
+
43
+ const tagsColumn = !hasTags
44
+ ? [
45
+ {
46
+ header: "concepts.props.tags",
47
+ fieldSelector: _.identity,
48
+ fieldDecorator: ConceptLinkTags,
49
+ },
50
+ ]
51
+ : [];
52
+
37
53
  const columns = [
38
54
  {
39
55
  header: "concepts.props.name",
40
56
  fieldSelector: _.identity,
41
57
  fieldDecorator: ConceptImplementationLink,
42
58
  },
43
- {
44
- header: "concepts.props.tags",
45
- fieldSelector: _.identity,
46
- fieldDecorator: ConceptLinkTags,
47
- },
59
+ ...tagsColumn,
48
60
  {
49
61
  header: "concepts.props.domain",
50
62
  fieldSelector: _.path("domain.name"),
@@ -14,14 +14,34 @@ describe("<ImplementationLinks />", () => {
14
14
  },
15
15
  };
16
16
 
17
- const props = {
18
- implementation: { rule_id: 2, id: 4 },
19
- canCreateLink: true,
20
- implementationLinks: [
21
- { name: "name", tags: [], domain: { name: "domain" }, resource_id: 2 },
22
- ],
23
- };
24
17
  it("matches the latest snapshot", () => {
18
+ const props = {
19
+ implementation: { rule_id: 2, id: 4 },
20
+ canCreateLink: true,
21
+ implementationLinks: [
22
+ {
23
+ name: "name",
24
+ tags: ["sometags"],
25
+ domain: { name: "domain" },
26
+ resource_id: 2,
27
+ },
28
+ ],
29
+ };
30
+ const { container } = render(
31
+ <ImplementationLinks {...props} />,
32
+ renderOpts
33
+ );
34
+ expect(container).toMatchSnapshot();
35
+ });
36
+
37
+ it("matches the latest snapshot when implementations have no tags", () => {
38
+ const props = {
39
+ implementation: { rule_id: 2, id: 4 },
40
+ canCreateLink: true,
41
+ implementationLinks: [
42
+ { name: "name", tags: [], domain: { name: "domain" }, resource_id: 2 },
43
+ ],
44
+ };
25
45
  const { container } = render(
26
46
  <ImplementationLinks {...props} />,
27
47
  renderOpts
@@ -71,8 +71,95 @@ exports[`<ImplementationLinks /> matches the latest snapshot 1`] = `
71
71
  >
72
72
  <ul
73
73
  class="concept-link-tags"
74
+ >
75
+ <li>
76
+ sometags
77
+ </li>
78
+ </ul>
79
+ </td>
80
+ <td
81
+ class=""
82
+ >
83
+ domain
84
+ </td>
85
+ <td
86
+ class=""
87
+ >
88
+ <i
89
+ aria-hidden="true"
90
+ class="red trash alternate outline icon"
74
91
  />
75
92
  </td>
93
+ </tr>
94
+ </tbody>
95
+ </table>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ `;
101
+
102
+ exports[`<ImplementationLinks /> matches the latest snapshot when implementations have no tags 1`] = `
103
+ <div>
104
+ <div
105
+ class="ui bottom attached segment"
106
+ >
107
+ <div
108
+ class="ui grid"
109
+ >
110
+ <div
111
+ class="sixteen wide column"
112
+ >
113
+ <a
114
+ class="ui primary right floated button"
115
+ href="/rules/2/implementations/4/links/new"
116
+ role="button"
117
+ >
118
+ create
119
+ </a>
120
+ </div>
121
+ <div
122
+ class="sixteen wide column"
123
+ >
124
+ <table
125
+ class="ui table"
126
+ >
127
+ <thead
128
+ class=""
129
+ >
130
+ <tr
131
+ class=""
132
+ >
133
+ <th
134
+ class=""
135
+ >
136
+ name
137
+ </th>
138
+ <th
139
+ class=""
140
+ >
141
+ domain
142
+ </th>
143
+ <th
144
+ class=""
145
+ />
146
+ </tr>
147
+ </thead>
148
+ <tbody
149
+ class=""
150
+ >
151
+ <tr
152
+ class=""
153
+ >
154
+ <td
155
+ class=""
156
+ >
157
+ <a
158
+ href="/concepts/2/versions/current/links/implementations"
159
+ >
160
+ name
161
+ </a>
162
+ </td>
76
163
  <td
77
164
  class=""
78
165
  >