@truedat/dd 7.1.5 → 7.1.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.7",
|
|
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.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "7.1.
|
|
37
|
+
"@truedat/test": "7.1.7",
|
|
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.7.1",
|
|
91
|
-
"@truedat/auth": "7.1.
|
|
92
|
-
"@truedat/core": "7.1.
|
|
93
|
-
"@truedat/df": "7.1.
|
|
91
|
+
"@truedat/auth": "7.1.7",
|
|
92
|
+
"@truedat/core": "7.1.7",
|
|
93
|
+
"@truedat/df": "7.1.7",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"moment": "^2.29.4",
|
|
96
96
|
"path-to-regexp": "^1.7.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"react-dom": ">= 16.8.6 < 17",
|
|
116
116
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "080df9a1d6c8a4464e10b974875b6d00db751616"
|
|
119
119
|
}
|
|
@@ -9,7 +9,10 @@ import {
|
|
|
9
9
|
STRUCTURE_NOTES_EDIT,
|
|
10
10
|
} from "@truedat/core/routes";
|
|
11
11
|
import { getActiveTab } from "../selectors/getActiveTab";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
getTabVisibility,
|
|
14
|
+
getLinkedImplementationsToStructuresColumns,
|
|
15
|
+
} from "../selectors";
|
|
13
16
|
import StructureChildrenRelations from "./StructureChildrenRelations";
|
|
14
17
|
import StructureEvents from "./StructureEvents";
|
|
15
18
|
import StructureGrants from "./StructureGrants";
|
|
@@ -40,7 +43,7 @@ const RuleImplementationsTable = React.lazy(() =>
|
|
|
40
43
|
import("@truedat/dq/components/RuleImplementationsTable")
|
|
41
44
|
);
|
|
42
45
|
|
|
43
|
-
export const StructureTabPane = ({ activeTab, tabVisibility }) => {
|
|
46
|
+
export const StructureTabPane = ({ activeTab, tabVisibility, columns }) => {
|
|
44
47
|
return (
|
|
45
48
|
<ErrorBoundary>
|
|
46
49
|
{activeTab === "fields" && <StructureFields />}
|
|
@@ -82,7 +85,7 @@ export const StructureTabPane = ({ activeTab, tabVisibility }) => {
|
|
|
82
85
|
{activeTab === "events" && <StructureEvents />}
|
|
83
86
|
{activeTab === "roles" && <StructureRoles />}
|
|
84
87
|
{activeTab === "rules" && tabVisibility.rules && (
|
|
85
|
-
<RuleImplementationsTable
|
|
88
|
+
<RuleImplementationsTable columns={columns} />
|
|
86
89
|
)}
|
|
87
90
|
{activeTab === "metadata" && tabVisibility.metadata && (
|
|
88
91
|
<StructureMetadata />
|
|
@@ -96,6 +99,7 @@ export const StructureTabPane = ({ activeTab, tabVisibility }) => {
|
|
|
96
99
|
StructureTabPane.propTypes = {
|
|
97
100
|
activeTab: PropTypes.string,
|
|
98
101
|
tabVisibility: PropTypes.object,
|
|
102
|
+
columns: PropTypes.array,
|
|
99
103
|
};
|
|
100
104
|
|
|
101
105
|
const mapStateToProps = (
|
|
@@ -107,6 +111,7 @@ const mapStateToProps = (
|
|
|
107
111
|
return {
|
|
108
112
|
tabVisibility,
|
|
109
113
|
activeTab,
|
|
114
|
+
columns: getLinkedImplementationsToStructuresColumns(state),
|
|
110
115
|
};
|
|
111
116
|
};
|
|
112
117
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLinkedImplementationsToStructuresColumns,
|
|
3
|
+
defaultImplementationToStructuresColumns,
|
|
4
|
+
} from "..";
|
|
5
|
+
|
|
6
|
+
describe("selectors: getLinkedImplementationsToStructuresColumns", () => {
|
|
7
|
+
it("should return custom ruleColumns when present", () => {
|
|
8
|
+
const ruleImplementationToStructuresColumns = [{ name: "test" }];
|
|
9
|
+
const res = getLinkedImplementationsToStructuresColumns({
|
|
10
|
+
ruleImplementationToStructuresColumns,
|
|
11
|
+
});
|
|
12
|
+
expect(res).toHaveLength(1);
|
|
13
|
+
expect(res).toEqual(ruleImplementationToStructuresColumns);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should return default defaultImplementationToStructuresColumns when no customized", () => {
|
|
17
|
+
const res = getLinkedImplementationsToStructuresColumns({});
|
|
18
|
+
expect(res).toHaveLength(defaultImplementationToStructuresColumns.length);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { createSelector } from "reselect";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import DateTime from "@truedat/core/components/DateTime";
|
|
6
|
+
import { formatNumber } from "@truedat/core/services/format";
|
|
7
|
+
import ConceptsLinkDecorator from "@truedat/bg/concepts/components/ConceptsLinkDecorator";
|
|
8
|
+
import RuleResultDecorator from "@truedat/dq/components/RuleResultDecorator";
|
|
9
|
+
import RuleImplementationLink from "@truedat/dq/components/RuleImplementationLink";
|
|
10
|
+
import RuleLink from "@truedat/dq/components/RuleLink";
|
|
11
|
+
|
|
12
|
+
const translateDecorator = (id) =>
|
|
13
|
+
id ? <FormattedMessage id={id} defaultMessage={id} /> : null;
|
|
14
|
+
|
|
15
|
+
const resultTypeDecorator = (result, result_type, resultType) =>
|
|
16
|
+
_.defaultTo(result_type)(resultType) === "errors_number"
|
|
17
|
+
? formatNumber(result)
|
|
18
|
+
: `${result}%`;
|
|
19
|
+
|
|
20
|
+
export const defaultImplementationToStructuresColumns = [
|
|
21
|
+
{
|
|
22
|
+
name: "implementation_key",
|
|
23
|
+
fieldSelector: _.pick(["id", "implementation_key", "rule_id"]),
|
|
24
|
+
fieldDecorator: RuleImplementationLink,
|
|
25
|
+
sort: { name: "implementation_key.raw" },
|
|
26
|
+
width: 2,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "rule",
|
|
30
|
+
fieldSelector: ({ rule, rule_id: id }) => ({ id, name: rule?.name }),
|
|
31
|
+
sort: { name: "rule.name.raw" },
|
|
32
|
+
fieldDecorator: RuleLink,
|
|
33
|
+
width: 2,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "business_concepts",
|
|
37
|
+
fieldSelector: _.path("concepts"),
|
|
38
|
+
fieldDecorator: ConceptsLinkDecorator,
|
|
39
|
+
width: 2,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "last_execution_at",
|
|
43
|
+
fieldSelector: ({ execution_result_info }) => ({
|
|
44
|
+
value: execution_result_info?.date,
|
|
45
|
+
}),
|
|
46
|
+
fieldDecorator: DateTime,
|
|
47
|
+
sort: { name: "execution_result_info.date" },
|
|
48
|
+
width: 2,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "result_type",
|
|
52
|
+
fieldDecorator: (value) =>
|
|
53
|
+
_.isNil(value)
|
|
54
|
+
? null
|
|
55
|
+
: translateDecorator(`ruleImplementations.props.result_type.${value}`),
|
|
56
|
+
sort: { name: "result_type.raw" },
|
|
57
|
+
width: 2,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "minimum",
|
|
61
|
+
fieldSelector: _.pick(["minimum", "result_type"]),
|
|
62
|
+
fieldDecorator: (field) =>
|
|
63
|
+
resultTypeDecorator(field.minimum, field.result_type),
|
|
64
|
+
sort: { name: "minimum" },
|
|
65
|
+
textAlign: "right",
|
|
66
|
+
width: 1,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "goal",
|
|
70
|
+
fieldSelector: _.pick(["goal", "result_type"]),
|
|
71
|
+
fieldDecorator: (field) =>
|
|
72
|
+
resultTypeDecorator(field.goal, field.result_type),
|
|
73
|
+
sort: { name: "goal" },
|
|
74
|
+
textAlign: "right",
|
|
75
|
+
width: 1,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "result",
|
|
79
|
+
fieldSelector: (ruleImplementation) => ({
|
|
80
|
+
ruleResult: ruleImplementation?.execution_result_info,
|
|
81
|
+
ruleImplementation,
|
|
82
|
+
}),
|
|
83
|
+
fieldDecorator: RuleResultDecorator,
|
|
84
|
+
textAlign: "center",
|
|
85
|
+
sort: { name: "execution_result_info.result.sort" },
|
|
86
|
+
width: 2,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
const getColumns = (state) => state.ruleImplementationToStructuresColumns;
|
|
91
|
+
|
|
92
|
+
export const getLinkedImplementationsToStructuresColumns = createSelector(
|
|
93
|
+
[getColumns],
|
|
94
|
+
_.defaultTo(defaultImplementationToStructuresColumns)
|
|
95
|
+
);
|
package/src/selectors/index.js
CHANGED
|
@@ -53,6 +53,10 @@ export { getSystemTemplate } from "./getSystemTemplate";
|
|
|
53
53
|
export { getTabVisibility } from "./getTabVisibility";
|
|
54
54
|
export { groupOptionsSelector } from "./groupOptionsSelector";
|
|
55
55
|
export { resourceOptionsSelector } from "./resourceOptionsSelector";
|
|
56
|
+
export {
|
|
57
|
+
getLinkedImplementationsToStructuresColumns,
|
|
58
|
+
defaultImplementationToStructuresColumns,
|
|
59
|
+
} from "./getLinkedImplementationsToStructuresColumns";
|
|
56
60
|
export * from "./templateNamesSelector";
|
|
57
61
|
export * from "./getGrantsColumns";
|
|
58
62
|
export * from "./getLineageLevels";
|