@truedat/dd 4.46.12 → 4.47.1

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,8 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.47.0] 2022-06-22
4
+
5
+ ### Changed
6
+
7
+ - [TD-4392] "Request grant" button is only displayed if the structure's has been
8
+ classified as `_grantable`
9
+
3
10
  ## [4.46.12] 2022-06-20
4
11
 
5
- ### Reverted
12
+ ### Removed
6
13
 
7
14
  - [TD-4894] Multiple column operator in implementation creation
8
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.46.12",
3
+ "version": "4.47.1",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.46.12",
37
+ "@truedat/test": "4.47.1",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -88,9 +88,9 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.6.4",
91
- "@truedat/auth": "4.46.12",
92
- "@truedat/core": "4.46.12",
93
- "@truedat/df": "4.46.12",
91
+ "@truedat/auth": "4.47.1",
92
+ "@truedat/core": "4.47.1",
93
+ "@truedat/df": "4.47.1",
94
94
  "lodash": "^4.17.21",
95
95
  "path-to-regexp": "^1.7.0",
96
96
  "prop-types": "^15.8.1",
@@ -112,5 +112,5 @@
112
112
  "react-dom": ">= 16.8.6 < 17",
113
113
  "semantic-ui-react": ">= 0.88.2 < 2.1"
114
114
  },
115
- "gitHead": "97adb120fffb6392692f94ed99b5f74385ce0f0b"
115
+ "gitHead": "dffde75b85272debd04fb2fe17c2f54f9045f112"
116
116
  }
@@ -7,10 +7,17 @@ import StructureItem from "./StructureItem";
7
7
  import StructureItems from "./StructureItems";
8
8
  import StructureNavClassified from "./StructureNavClassified";
9
9
 
10
+ export const navClasses = _.flow(
11
+ _.prop("classes"),
12
+ _.keys,
13
+ _.without(["_grantable"])
14
+ );
15
+ export const hasNavClass = _.flow(navClasses, _.negate(_.isEmpty));
16
+
10
17
  export const StructureNav = ({ childStructures, parentStructure }) => {
11
- const firstWithClasses = _.find("classes")(childStructures);
18
+ const firstWithClasses = _.find(hasNavClass)(childStructures);
12
19
  const classifier = firstWithClasses
13
- ? Object.keys(firstWithClasses.classes)[0]
20
+ ? _.flow(navClasses, _.head)(firstWithClasses)
14
21
  : undefined;
15
22
 
16
23
  return (
@@ -55,6 +55,7 @@ const dateProperties = (deleted_at, updatedAt) =>
55
55
 
56
56
  export const StructureSummary = ({
57
57
  class: structureClass,
58
+ classes: structureClasses,
58
59
  name,
59
60
  published_note,
60
61
  description,
@@ -79,7 +80,9 @@ export const StructureSummary = ({
79
80
  {_.isEmpty(published_note?.alias)
80
81
  ? name
81
82
  : published_note.alias}
82
- <StructureGrantButton />
83
+ {structureClasses?._grantable ? (
84
+ <StructureGrantButton />
85
+ ) : null}
83
86
  {!_.isEmpty(published_note?.alias) && (
84
87
  <Header.Subheader>{name}</Header.Subheader>
85
88
  )}
@@ -117,6 +120,7 @@ export const StructureSummary = ({
117
120
 
118
121
  StructureSummary.propTypes = {
119
122
  class: PropTypes.string,
123
+ classes: PropTypes.object,
120
124
  name: PropTypes.string,
121
125
  published_note: PropTypes.object,
122
126
  description: PropTypes.string,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
- import { StructureNav } from "../StructureNav";
3
+ import { StructureNav, hasNavClass, navClasses } from "../StructureNav";
4
4
 
5
5
  const renderOpts = {
6
6
  messages: {
@@ -25,3 +25,27 @@ describe("<StructureNav />", () => {
25
25
  expect(container).toMatchSnapshot();
26
26
  });
27
27
  });
28
+
29
+ describe("navClasses", () => {
30
+ it("returns all classes keys except _grantable", () => {
31
+ expect(navClasses({ classes: { foo: "foo" } })).toEqual(["foo"]);
32
+ expect(navClasses({ classes: { b: "b", _grantable: "x" } })).toEqual(["b"]);
33
+ expect(navClasses({})).toEqual([]);
34
+ });
35
+ });
36
+
37
+ describe("hasNavClass", () => {
38
+ it("returns true for an item with a class other than _grantable", () => {
39
+ expect(hasNavClass({ classes: { foo: "foo" } })).toBe(true);
40
+ });
41
+
42
+ it("returns false for an item with only _grantable class", () => {
43
+ expect(hasNavClass({ classes: { _grantable: "foo" } })).toBe(false);
44
+ });
45
+
46
+ it("returns false for an item with no classes", () => {
47
+ expect(hasNavClass({ classes: {} })).toBe(false);
48
+ expect(hasNavClass({ classes: null })).toBe(false);
49
+ expect(hasNavClass({})).toBe(false);
50
+ });
51
+ });