@truedat/dd 4.33.2 → 4.33.7

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 (35) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/package.json +6 -6
  3. package/src/api.js +6 -0
  4. package/src/components/DictionaryRoutes.js +21 -3
  5. package/src/components/GraphLoader.js +22 -6
  6. package/src/components/LineageEvents.js +23 -0
  7. package/src/components/LineageEventsTable.js +91 -0
  8. package/src/components/LineageForm.js +2 -1
  9. package/src/components/LineageGraph.js +59 -11
  10. package/src/components/LineageRoutes.js +9 -7
  11. package/src/components/StructureTypesLoader.js +4 -2
  12. package/src/components/__tests__/LineageEventsTable.spec.js +40 -0
  13. package/src/components/__tests__/__snapshots__/LineageEventsTable.spec.js.snap +90 -0
  14. package/src/components/__tests__/__snapshots__/LineageRoutes.spec.js.snap +4 -0
  15. package/src/messages/en.js +18 -0
  16. package/src/messages/es.js +19 -0
  17. package/src/reducers/__tests__/graphLoading.spec.js +2 -2
  18. package/src/reducers/__tests__/lineageEventsLoading.spec.js +24 -0
  19. package/src/reducers/graph.js +4 -1
  20. package/src/reducers/graphLoading.js +8 -4
  21. package/src/reducers/graphRedirect.js +1 -2
  22. package/src/reducers/index.js +4 -0
  23. package/src/reducers/lineageEvents.js +13 -0
  24. package/src/reducers/lineageEventsLoading.js +14 -0
  25. package/src/routines.js +3 -0
  26. package/src/sagas/__tests__/createGraph.spec.js +162 -12
  27. package/src/sagas/createGraph.js +99 -6
  28. package/src/sagas/fetchGraph.js +1 -0
  29. package/src/sagas/fetchLineageEvents.js +26 -0
  30. package/src/sagas/fetchStructureTypes.js +5 -3
  31. package/src/sagas/index.js +6 -0
  32. package/src/selectors/__tests__/getTabVisibility.spec.js +3 -6
  33. package/src/selectors/getLineageEventColumns.js +48 -0
  34. package/src/selectors/getTabVisibility.js +3 -12
  35. package/src/styles/lineageGraph.less +3 -0
@@ -83,10 +83,9 @@ describe("selectors: getTabVisibility", () => {
83
83
  });
84
84
  });
85
85
 
86
- it("should include notes if templates are not loading and a template matches the valid structure type", () => {
87
- const structure = { type: "foo" };
88
- const templates = [{ name: "foo" }];
89
- const structureTypes = [{ name: "foo", template: { id: 1, name: "n" } }];
86
+ it("should include notes if template_id is in structure_note", () => {
87
+ const structure = { type: "foo", data_structure_type: { template_id: 1 } };
88
+ const templates = [{ name: "foo", id: 1 }];
90
89
  expect(getTabVisibility({ templatesLoading: true })).toMatchObject({
91
90
  notes: false,
92
91
  });
@@ -94,8 +93,6 @@ describe("selectors: getTabVisibility", () => {
94
93
  getTabVisibility({
95
94
  structure,
96
95
  templates,
97
- structureTypes,
98
- structureTypesLoading: false,
99
96
  })
100
97
  ).toMatchObject({
101
98
  notes: true,
@@ -0,0 +1,48 @@
1
+ import _ from "lodash/fp";
2
+ import React from "react";
3
+ import { FormattedMessage } from "react-intl";
4
+ import Moment from "react-moment";
5
+
6
+ const dateDecorator = (date) =>
7
+ date && <Moment locale="es" date={date} format="YYYY-MM-DD HH:mm" />;
8
+
9
+ const statusDecorator = (status) => (
10
+ <FormattedMessage id={`lineage.graph.status.${_.toLower(status)}`} />
11
+ );
12
+
13
+ const graphDataDecorator = (graphData) => <span>{graphData}</span>;
14
+
15
+ const customLineageEventColumns = null;
16
+ const defaultLineageEventColumns = [
17
+ {
18
+ name: "graph_data",
19
+ fieldSelector: (event) => {
20
+ const graphData = _.get("graph_data")(event);
21
+ try {
22
+ return JSON.parse(graphData).join("\n");
23
+ } catch (e) {
24
+ return graphData;
25
+ }
26
+ },
27
+ fieldDecorator: graphDataDecorator,
28
+ width: 2,
29
+ },
30
+ {
31
+ name: "status",
32
+ fieldDecorator: statusDecorator,
33
+ width: 2,
34
+ },
35
+ {
36
+ name: "message",
37
+ width: 2,
38
+ },
39
+ {
40
+ name: "inserted_at",
41
+ fieldDecorator: dateDecorator,
42
+ textAlign: "center",
43
+ width: 2,
44
+ },
45
+ ];
46
+
47
+ export const lineageEventColumns =
48
+ customLineageEventColumns || defaultLineageEventColumns;
@@ -24,25 +24,16 @@ const linksTabVisible = (state) => {
24
24
  return conceptCount > 0 || !_.isEmpty(structureLinks);
25
25
  };
26
26
 
27
- const notesTabVisible = ({
28
- templatesLoading,
29
- templates,
30
- structure,
31
- structureTypes,
32
- structureTypesLoading,
33
- }) =>
27
+ const notesTabVisible = ({ templatesLoading, templates, structure }) =>
34
28
  !templatesLoading &&
35
29
  notEmpty(templates) &&
36
30
  _.has("type")(structure) &&
37
- !structureTypesLoading &&
38
- notEmpty(structureTypes) &&
39
31
  _.flow(
40
32
  _.find({
41
- name: _.prop("type")(structure),
33
+ id: _.propOr(null, "data_structure_type.template_id")(structure),
42
34
  }),
43
- _.get("template"),
44
35
  _.negate(_.isNil)
45
- )(structureTypes);
36
+ )(templates);
46
37
 
47
38
  const versionsTabVisible = notEmptyPath("structureVersions");
48
39
  const rulesTabVisible = notEmptyPath("ruleImplementations");
@@ -0,0 +1,3 @@
1
+ .graph-hash {
2
+ font-family: monospace;
3
+ }