@truedat/dd 4.44.5 → 4.45.3

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/package.json +7 -7
  3. package/src/components/StructureCrumbs.js +28 -11
  4. package/src/components/StructureItem.js +2 -1
  5. package/src/components/StructureSummary.js +7 -9
  6. package/src/components/StructureTabPane.js +4 -2
  7. package/src/components/__tests__/StructureItem.spec.js +23 -6
  8. package/src/components/__tests__/StructureItems.spec.js +14 -4
  9. package/src/components/__tests__/StructureProperties.spec.js +1 -1
  10. package/src/components/__tests__/StructureSummary.spec.js +13 -0
  11. package/src/components/__tests__/__snapshots__/StructureItem.spec.js.snap +68 -43
  12. package/src/components/__tests__/__snapshots__/StructureItems.spec.js.snap +47 -4
  13. package/src/components/__tests__/__snapshots__/StructureProperties.spec.js.snap +22 -0
  14. package/src/components/__tests__/__snapshots__/StructureSummary.spec.js.snap +102 -11
  15. package/src/components/__tests__/__snapshots__/StructureTabPane.spec.js.snap +1 -1
  16. package/src/components/index.js +0 -6
  17. package/src/reducers/structure.js +1 -0
  18. package/src/reducers/structures.js +2 -0
  19. package/src/selectors/__tests__/getStructureParent.spec.js +13 -4
  20. package/src/selectors/__tests__/getStructureProperties.spec.js +2 -2
  21. package/src/selectors/getSortedStructureChildren.js +1 -1
  22. package/src/selectors/getStructureFieldColumns.js +20 -14
  23. package/src/selectors/getStructureParent.js +9 -4
  24. package/src/selectors/getStructureProperties.js +12 -0
  25. package/src/selectors/structureColumnsSelector.js +11 -3
  26. package/src/components/ProfilingElements.js +0 -89
  27. package/src/components/ProfilingGraph.js +0 -89
  28. package/src/components/ProfilingPatterns.js +0 -57
  29. package/src/components/StructureProfiling.js +0 -124
  30. package/src/components/__tests__/StructureProfiling.spec.js +0 -45
  31. package/src/components/__tests__/__snapshots__/StructureProfiling.spec.js.snap +0 -444
package/CHANGELOG.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.45.3] 2022-06-01
4
+
5
+ ### Added
6
+
7
+ - [TD-3920] Alias support for structures
8
+
3
9
  ## [4.44.4] 2022-05-19
4
10
 
5
- ## Added
11
+ ### Added
6
12
 
7
13
  - [TD-4660] Support for reference datasets
8
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.44.5",
3
+ "version": "4.45.3",
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.44.5",
37
+ "@truedat/test": "4.45.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.44.5",
92
- "@truedat/core": "4.44.5",
93
- "@truedat/df": "4.44.5",
91
+ "@truedat/auth": "4.45.1",
92
+ "@truedat/core": "4.45.1",
93
+ "@truedat/df": "4.45.1",
94
94
  "lodash": "^4.17.21",
95
95
  "path-to-regexp": "^1.7.0",
96
96
  "prop-types": "^15.8.1",
@@ -99,7 +99,6 @@
99
99
  "react-moment": "^1.1.2",
100
100
  "react-redux": "^7.2.4",
101
101
  "react-router-dom": "^5.2.0",
102
- "react-vis": "^1.11.7",
103
102
  "redux": "^4.1.1",
104
103
  "redux-saga": "^1.1.3",
105
104
  "redux-saga-routines": "^3.2.3",
@@ -107,9 +106,10 @@
107
106
  "svg-pan-zoom": "^3.6.1"
108
107
  },
109
108
  "peerDependencies": {
109
+ "@truedat/profile": ">= 4.45.0",
110
110
  "react": ">= 16.8.6 < 17",
111
111
  "react-dom": ">= 16.8.6 < 17",
112
112
  "semantic-ui-react": ">= 0.88.2 < 2.1"
113
113
  },
114
- "gitHead": "5a339468198c803592b285eddd0dd0c0b0eced93"
114
+ "gitHead": "35c764482ee330282ab7d56d9325314691da72db"
115
115
  }
@@ -29,18 +29,21 @@ export const SystemCrumb = ({ name, id }) => (
29
29
  </>
30
30
  );
31
31
 
32
- export const AncestorCrumb = ({ name, id }) => (
32
+ export const AncestorCrumb = ({ name, id, published_note }) => (
33
33
  <>
34
34
  <Breadcrumb.Section as={Link} to={linkTo.STRUCTURE({ id })} active={false}>
35
- {name}
35
+ {_.isEmpty(published_note?.alias) ? name : published_note.alias}
36
36
  </Breadcrumb.Section>
37
37
  <Breadcrumb.Divider icon="right angle" />
38
38
  </>
39
39
  );
40
40
 
41
- export const StructureCrumb = ({ name, id, version }) =>
41
+ export const StructureCrumb = ({ name, id, version, published_note }) =>
42
42
  _.isNil(version) ? (
43
- <Breadcrumb.Section active content={name} />
43
+ <Breadcrumb.Section
44
+ active
45
+ content={_.isEmpty(published_note?.alias) ? name : published_note.alias}
46
+ />
44
47
  ) : (
45
48
  <>
46
49
  <Breadcrumb.Section
@@ -48,7 +51,7 @@ export const StructureCrumb = ({ name, id, version }) =>
48
51
  to={linkTo.STRUCTURE({ id })}
49
52
  active={false}
50
53
  >
51
- {name}
54
+ {_.isEmpty(published_note?.alias) ? name : published_note.alias}
52
55
  </Breadcrumb.Section>
53
56
  <Breadcrumb.Divider icon="right angle" />
54
57
  </>
@@ -60,20 +63,33 @@ export const VersionCrumb = ({ version }) => (
60
63
  </Breadcrumb.Section>
61
64
  );
62
65
 
63
- export const StructureCrumbs = ({ id, system, ancestry, name, version }) =>
66
+ export const StructureCrumbs = ({
67
+ id,
68
+ system,
69
+ ancestry,
70
+ name,
71
+ version,
72
+ published_note,
73
+ }) =>
64
74
  name ? (
65
75
  <Breadcrumb>
66
76
  <StructuresCrumb />
67
77
  {!_.isEmpty(system) && <SystemCrumb {...system} />}
68
78
  {!_.isEmpty(ancestry) &&
69
- _.map(({ data_structure_id, name }) => (
79
+ _.map(({ data_structure_id, name, published_note }) => (
70
80
  <AncestorCrumb
71
81
  key={data_structure_id}
72
82
  name={name}
73
83
  id={data_structure_id}
84
+ published_note={published_note}
74
85
  />
75
86
  ))(ancestry)}
76
- <StructureCrumb name={name} id={id} version={version} />
87
+ <StructureCrumb
88
+ name={name}
89
+ id={id}
90
+ version={version}
91
+ published_note={published_note}
92
+ />
77
93
  {!_.isNil(version) && <VersionCrumb id={id} version={version} />}
78
94
  </Breadcrumb>
79
95
  ) : null;
@@ -84,18 +100,19 @@ StructureCrumbs.propTypes = {
84
100
  name: PropTypes.string,
85
101
  field: PropTypes.object,
86
102
  system: PropTypes.object,
87
- version: PropTypes.string
103
+ version: PropTypes.string,
104
+ published_note: PropTypes.object,
88
105
  };
89
106
 
90
107
  const mapStateToProps = ({
91
108
  structure,
92
109
  structureAncestry: ancestry,
93
110
  structureVersion: version,
94
- structureSystem: system
111
+ structureSystem: system,
95
112
  }) => ({
96
113
  ...structure,
97
114
  ancestry,
98
115
  system,
99
- version
116
+ version,
100
117
  });
101
118
  export default connect(mapStateToProps)(StructureCrumbs);
@@ -49,13 +49,14 @@ StructureItem.propTypes = {
49
49
 
50
50
  export const mapStateToProps = (
51
51
  { structure },
52
- { data_structure_id, id: structureId, type }
52
+ { data_structure_id, id: structureId, type, name, published_note }
53
53
  ) => {
54
54
  const id = data_structure_id || structureId;
55
55
  return {
56
56
  id: id,
57
57
  active:
58
58
  type !== "system" && _.isFinite(id) && _.propEq("id", id)(structure),
59
+ name: _.isEmpty(published_note?.alias) ? name : published_note.alias,
59
60
  };
60
61
  };
61
62
 
@@ -56,6 +56,7 @@ const dateProperties = (deleted_at, updatedAt) =>
56
56
  export const StructureSummary = ({
57
57
  class: structureClass,
58
58
  name,
59
+ published_note,
59
60
  description,
60
61
  type,
61
62
  userPermissions,
@@ -79,7 +80,9 @@ export const StructureSummary = ({
79
80
  <Dimmer.Dimmable dimmed={linkedStructureTagsLoading}>
80
81
  <Header as="h2">
81
82
  <Header.Content>
82
- {name}
83
+ {_.isEmpty(published_note?.alias)
84
+ ? name
85
+ : published_note.alias}
83
86
  {grant ? (
84
87
  structureGrant ? (
85
88
  structureGrant(grant)
@@ -92,14 +95,8 @@ export const StructureSummary = ({
92
95
  ) : (
93
96
  <StructureGrantRequestButton />
94
97
  )}
95
- {type && (
96
- <Header.Subheader>
97
- {formatMessage({
98
- id: `structure.type.${type}.text`,
99
- defaultMessage:
100
- _.get("translation")(data_structure_type) || type,
101
- })}
102
- </Header.Subheader>
98
+ {!_.isEmpty(published_note?.alias) && (
99
+ <Header.Subheader>{name}</Header.Subheader>
103
100
  )}
104
101
  </Header.Content>
105
102
  </Header>
@@ -136,6 +133,7 @@ export const StructureSummary = ({
136
133
  StructureSummary.propTypes = {
137
134
  class: PropTypes.string,
138
135
  name: PropTypes.string,
136
+ published_note: PropTypes.object,
139
137
  description: PropTypes.string,
140
138
  type: PropTypes.string,
141
139
  userPermissions: PropTypes.object,
@@ -18,7 +18,6 @@ import StructureLineage from "./StructureLineage";
18
18
  import StructureNotes from "./StructureNotes";
19
19
  import StructureNotesEdit from "./StructureNotesEdit";
20
20
  import StructureParentRelations from "./StructureParentRelations";
21
- import StructureProfiling from "./StructureProfiling";
22
21
  import StructureVersions from "./StructureVersions";
23
22
  import StructureMetadata from "./StructureMetadata";
24
23
  import StructureNotesLoader from "./StructureNotesLoader";
@@ -26,6 +25,9 @@ import StructureNotesLoader from "./StructureNotesLoader";
26
25
  const StructureLinks = React.lazy(() =>
27
26
  import("@truedat/lm/components/StructureLinks")
28
27
  );
28
+
29
+ const StructureProfile = React.lazy(() => import("@truedat/profile"));
30
+
29
31
  const StructureRelationForm = React.lazy(() =>
30
32
  import("@truedat/lm/components/StructureRelationForm")
31
33
  );
@@ -59,7 +61,7 @@ export const StructureTabPane = ({ activeTab, tabVisibility }) => (
59
61
  <Route render={() => <StructureLinks />} />
60
62
  </Switch>
61
63
  )}
62
- {activeTab === "profile" && tabVisibility.profile && <StructureProfiling />}
64
+ {activeTab === "profile" && tabVisibility.profile && <StructureProfile />}
63
65
  {activeTab === "parents" && <StructureParentRelations />}
64
66
  {activeTab === "children" && <StructureChildrenRelations />}
65
67
  {activeTab === "versions" && <StructureVersions />}
@@ -1,8 +1,12 @@
1
1
  import React from "react";
2
+ import { render } from "@truedat/test/render";
2
3
  import { shallow } from "enzyme";
3
4
  import { Link } from "react-router-dom";
4
5
  import { intl } from "@truedat/test/intl-stub";
5
- import { StructureItem, mapStateToProps } from "../StructureItem";
6
+ import DefaultStructureItem, {
7
+ StructureItem,
8
+ mapStateToProps,
9
+ } from "../StructureItem";
6
10
 
7
11
  // workaround for enzyme issue with React.useContext
8
12
  // see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
@@ -14,14 +18,27 @@ describe("<StructureItem />", () => {
14
18
 
15
19
  it("matches the latest snapshot", () => {
16
20
  const props = { id, name };
17
- const wrapper = shallow(<StructureItem {...props} />);
18
- expect(wrapper).toMatchSnapshot();
21
+
22
+ const { container } = render(<DefaultStructureItem {...props} />);
23
+ expect(container).toMatchSnapshot();
19
24
  });
20
25
 
21
26
  it("matches the latest snapshot (active state)", () => {
22
- const props = { id, name };
23
- const wrapper = shallow(<StructureItem active={true} {...props} />);
24
- expect(wrapper).toMatchSnapshot();
27
+ const props = { data_structure_id: 8, name, type: "not_system" };
28
+ const state = {
29
+ structure: { id: 8 },
30
+ };
31
+ const { container } = render(<DefaultStructureItem {...props} />, {
32
+ state,
33
+ });
34
+ expect(container).toMatchSnapshot();
35
+ });
36
+
37
+ it("matches the latest snapshot with alias", () => {
38
+ const props = { id, name, published_note: { alias: "alias" } };
39
+
40
+ const { container } = render(<DefaultStructureItem {...props} />);
41
+ expect(container).toMatchSnapshot();
25
42
  });
26
43
 
27
44
  it("renders as a link to the /structures/:id route if id is present", () => {
@@ -1,13 +1,23 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
2
+ import { render } from "@truedat/test/render";
3
3
  import { StructureItems } from "../StructureItems";
4
4
 
5
5
  describe("<StructureItems />", () => {
6
6
  it("matches the latest snapshot", () => {
7
- const structures = [{ id: 1 }];
7
+ const structures = [{ id: 1, name: "some structure" }];
8
8
  const props = { structures };
9
9
 
10
- const wrapper = shallow(<StructureItems {...props} />);
11
- expect(wrapper).toMatchSnapshot();
10
+ const { container } = render(<StructureItems {...props} />);
11
+ expect(container).toMatchSnapshot();
12
+ });
13
+
14
+ it("matches the latest snapshot with alias", () => {
15
+ const structures = [
16
+ { id: 1, name: "some structure", published_note: { alias: "alias" } },
17
+ ];
18
+ const props = { structures };
19
+
20
+ const { container } = render(<StructureItems {...props} />);
21
+ expect(container).toMatchSnapshot();
12
22
  });
13
23
  });
@@ -4,7 +4,7 @@ import StructureProperties from "../StructureProperties";
4
4
 
5
5
  describe("<StructureProperties />", () => {
6
6
  it("matches the latest snapshot", () => {
7
- const structure = { description: "dd", group: "gp" };
7
+ const structure = { description: "dd", group: "gp", type: "Database" };
8
8
  const state = { structure };
9
9
  const { container } = render(<StructureProperties />, { state });
10
10
  expect(container).toMatchSnapshot();
@@ -44,6 +44,19 @@ describe("<StructureSummary />", () => {
44
44
  expect(wrapper).toMatchSnapshot();
45
45
  });
46
46
 
47
+ it("matches the latest snapshot with alias", () => {
48
+ const props = {
49
+ ...structure,
50
+ published_note: { alias: "some alias" },
51
+ updatedAt,
52
+ deleted_at,
53
+ structureFields,
54
+ linkedStructureTagsLoading: false,
55
+ };
56
+ const wrapper = shallow(<StructureSummary {...props} />);
57
+ expect(wrapper).toMatchSnapshot();
58
+ });
59
+
47
60
  it("renders loading when linkedStructureTagsLoading is true", () => {
48
61
  const props = {
49
62
  ...structure,
@@ -1,50 +1,75 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<StructureItem /> matches the latest snapshot (active state) 1`] = `
4
- <ListItem
5
- active={true}
6
- as="a"
7
- title="foo"
8
- >
9
- <ListIcon
10
- name="question circle outline"
11
- verticalAlign="middle"
12
- />
13
- <ListContent>
14
- <ListDescription>
15
- foo
16
- </ListDescription>
17
- </ListContent>
18
- </ListItem>
4
+ <div>
5
+ <a
6
+ class="active item"
7
+ role="listitem"
8
+ title="foo"
9
+ >
10
+ <i
11
+ aria-hidden="true"
12
+ class="question circle outline icon middle aligned"
13
+ />
14
+ <div
15
+ class="content"
16
+ >
17
+ <div
18
+ class="description"
19
+ >
20
+ foo
21
+ </div>
22
+ </div>
23
+ </a>
24
+ </div>
19
25
  `;
20
26
 
21
27
  exports[`<StructureItem /> matches the latest snapshot 1`] = `
22
- <ListItem
23
- as={
24
- Object {
25
- "$$typeof": Symbol(react.forward_ref),
26
- "displayName": "Link",
27
- "propTypes": Object {
28
- "innerRef": [Function],
29
- "onClick": [Function],
30
- "replace": [Function],
31
- "target": [Function],
32
- "to": [Function],
33
- },
34
- "render": [Function],
35
- }
36
- }
37
- title="foo"
38
- to="/structures/1"
39
- >
40
- <ListIcon
41
- name="question circle outline"
42
- verticalAlign="middle"
43
- />
44
- <ListContent>
45
- <ListDescription>
46
- foo
47
- </ListDescription>
48
- </ListContent>
49
- </ListItem>
28
+ <div>
29
+ <a
30
+ class="item"
31
+ href="/structures/1"
32
+ role="listitem"
33
+ title="foo"
34
+ >
35
+ <i
36
+ aria-hidden="true"
37
+ class="question circle outline icon middle aligned"
38
+ />
39
+ <div
40
+ class="content"
41
+ >
42
+ <div
43
+ class="description"
44
+ >
45
+ foo
46
+ </div>
47
+ </div>
48
+ </a>
49
+ </div>
50
+ `;
51
+
52
+ exports[`<StructureItem /> matches the latest snapshot with alias 1`] = `
53
+ <div>
54
+ <a
55
+ class="item"
56
+ href="/structures/1"
57
+ role="listitem"
58
+ title="alias"
59
+ >
60
+ <i
61
+ aria-hidden="true"
62
+ class="question circle outline icon middle aligned"
63
+ />
64
+ <div
65
+ class="content"
66
+ >
67
+ <div
68
+ class="description"
69
+ >
70
+ alias
71
+ </div>
72
+ </div>
73
+ </a>
74
+ </div>
50
75
  `;
@@ -1,8 +1,51 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<StructureItems /> matches the latest snapshot 1`] = `
4
- <Connect(StructureItem)
5
- id={1}
6
- key="0"
7
- />
4
+ <div>
5
+ <a
6
+ class="item"
7
+ href="/structures/1"
8
+ role="listitem"
9
+ title="some structure"
10
+ >
11
+ <i
12
+ aria-hidden="true"
13
+ class="question circle outline icon middle aligned"
14
+ />
15
+ <div
16
+ class="content"
17
+ >
18
+ <div
19
+ class="description"
20
+ >
21
+ some structure
22
+ </div>
23
+ </div>
24
+ </a>
25
+ </div>
26
+ `;
27
+
28
+ exports[`<StructureItems /> matches the latest snapshot with alias 1`] = `
29
+ <div>
30
+ <a
31
+ class="item"
32
+ href="/structures/1"
33
+ role="listitem"
34
+ title="alias"
35
+ >
36
+ <i
37
+ aria-hidden="true"
38
+ class="question circle outline icon middle aligned"
39
+ />
40
+ <div
41
+ class="content"
42
+ >
43
+ <div
44
+ class="description"
45
+ >
46
+ alias
47
+ </div>
48
+ </div>
49
+ </a>
50
+ </div>
8
51
  `;
@@ -95,6 +95,28 @@ exports[`<StructureProperties /> matches the latest snapshot 1`] = `
95
95
  </div>
96
96
  </div>
97
97
  </div>
98
+ <div
99
+ class="three wide column"
100
+ >
101
+ <div
102
+ class="item"
103
+ >
104
+ <div
105
+ class="content"
106
+ >
107
+ <h5
108
+ class="header"
109
+ >
110
+ Type
111
+ </h5>
112
+ <div
113
+ class="description"
114
+ >
115
+ Database
116
+ </div>
117
+ </div>
118
+ </div>
119
+ </div>
98
120
  </div>
99
121
  </div>
100
122
  </div>