@truedat/dq 4.37.2 → 4.37.6
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 +26 -0
- package/package.json +4 -4
- package/src/components/ExecutionDetails.js +17 -9
- package/src/components/ImplementationsRoutes.js +4 -0
- package/src/components/RuleEvents.js +1 -2
- package/src/components/RuleImplementationSelectedFilters.js +23 -1
- package/src/components/RuleRoutes.js +2 -2
- package/src/components/RuleSelectedFilters.js +21 -1
- package/src/components/RuleTabs.js +1 -1
- package/src/components/RulesRoutes.js +13 -1
- package/src/components/__tests__/ExecutionDetails.spec.js +31 -24
- package/src/components/__tests__/RuleEvents.spec.js +5 -5
- package/src/components/__tests__/RuleRoutes.spec.js +23 -0
- package/src/components/__tests__/__snapshots__/ExecutionDetails.spec.js.snap +2 -5
- package/src/components/__tests__/__snapshots__/RuleRoutes.spec.js.snap +3 -0
- package/src/reducers/__tests__/ruleActiveFilters.spec.js +32 -7
- package/src/reducers/__tests__/ruleImplementationActiveFilters.spec.js +32 -7
- package/src/reducers/index.js +2 -0
- package/src/reducers/ruleActiveFilters.js +8 -0
- package/src/reducers/ruleImplementationActiveFilters.js +10 -0
- package/src/reducers/ruleImplementationFilters.js +1 -1
- package/src/reducers/ruleImplementationFiltersLoading.js +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.37.6] 2022-02-06
|
|
4
|
+
|
|
5
|
+
### Fix
|
|
6
|
+
|
|
7
|
+
- [TD-2929] Clear Rule and RuleImplementation filters when leaving
|
|
8
|
+
|
|
9
|
+
## [4.37.5] 2022-02-06
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [TD-4426]
|
|
14
|
+
- On `ExecutionDetails` decode detail fields with prefix `base64_`
|
|
15
|
+
- Option to create messages with `ruleResult.details.props.<field_name>` to replace detail key
|
|
16
|
+
|
|
17
|
+
## [4.37.4] 2022-02-04
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- [TD-4424] Disable user filters while rule filters are loading
|
|
22
|
+
|
|
23
|
+
## [4.37.3] 2022-02-03
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- [TD-2929] Added support for `UserSearchFilters` on `Rules` and `RuleImplementations`
|
|
28
|
+
|
|
3
29
|
## [4.37.2] 2022-02-02
|
|
4
30
|
|
|
5
31
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.37.
|
|
3
|
+
"version": "4.37.6",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@apollo/client": "^3.4.10",
|
|
85
|
-
"@truedat/core": "4.37.
|
|
86
|
-
"@truedat/df": "4.37.
|
|
85
|
+
"@truedat/core": "4.37.6",
|
|
86
|
+
"@truedat/df": "4.37.6",
|
|
87
87
|
"axios": "^0.19.2",
|
|
88
88
|
"graphql": "^15.5.3",
|
|
89
89
|
"path-to-regexp": "^1.7.0",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"react-dom": ">= 16.8.6 < 17",
|
|
104
104
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "7a5cbf3bc73e19015fe5cc9891ed0c64f5b7246e"
|
|
107
107
|
}
|
|
@@ -28,7 +28,7 @@ const GeneralInformation = ({ ruleImplementation, ruleResult }) => {
|
|
|
28
28
|
|
|
29
29
|
<Table.Row>
|
|
30
30
|
<Table.Cell>
|
|
31
|
-
{formatMessage({ id: "ruleResult.props.date" })}
|
|
31
|
+
{formatMessage({ id: "ruleResult.props.date" })}
|
|
32
32
|
</Table.Cell>
|
|
33
33
|
<Table.Cell>
|
|
34
34
|
<DateTime value={ruleResult.date} />
|
|
@@ -37,14 +37,14 @@ const GeneralInformation = ({ ruleImplementation, ruleResult }) => {
|
|
|
37
37
|
|
|
38
38
|
<Table.Row>
|
|
39
39
|
<Table.Cell>
|
|
40
|
-
{formatMessage({ id: "ruleResult.props.records" })}
|
|
40
|
+
{formatMessage({ id: "ruleResult.props.records" })}
|
|
41
41
|
</Table.Cell>
|
|
42
42
|
<Table.Cell>{formatNumber(ruleResult.records)}</Table.Cell>
|
|
43
43
|
</Table.Row>
|
|
44
44
|
|
|
45
45
|
<Table.Row>
|
|
46
46
|
<Table.Cell>
|
|
47
|
-
{formatMessage({ id: "ruleResult.props.errors" })}
|
|
47
|
+
{formatMessage({ id: "ruleResult.props.errors" })}
|
|
48
48
|
</Table.Cell>
|
|
49
49
|
<Table.Cell>{formatNumber(ruleResult.errors)}</Table.Cell>
|
|
50
50
|
</Table.Row>
|
|
@@ -58,13 +58,19 @@ GeneralInformation.propTypes = {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const DetailRow = ({ details }) => {
|
|
61
|
+
const { formatMessage } = useIntl();
|
|
61
62
|
return _.flow(
|
|
62
63
|
_.keys,
|
|
63
64
|
_.map((key) => (
|
|
64
65
|
<Table.Row key={key}>
|
|
65
|
-
<Table.Cell>{key}</Table.Cell>
|
|
66
66
|
<Table.Cell>
|
|
67
|
-
{
|
|
67
|
+
{formatMessage({
|
|
68
|
+
id: `ruleResult.details.props.${key.replace(/^(base64_)/, "")}`,
|
|
69
|
+
defaultMessage: key.replace(/^(base64_)/, ""),
|
|
70
|
+
})}
|
|
71
|
+
</Table.Cell>
|
|
72
|
+
<Table.Cell>
|
|
73
|
+
{key === "Query" || key.startsWith("base64_")
|
|
68
74
|
? Buffer.from(details[key], "base64").toString()
|
|
69
75
|
: JSON.stringify(details[key], null, 2)}
|
|
70
76
|
</Table.Cell>
|
|
@@ -73,11 +79,13 @@ const DetailRow = ({ details }) => {
|
|
|
73
79
|
)(details);
|
|
74
80
|
};
|
|
75
81
|
|
|
76
|
-
|
|
82
|
+
DetailRow.propTypes = { details: PropTypes.object };
|
|
83
|
+
|
|
84
|
+
export const ExecutionDetails = ({ ruleImplementation, ruleResultId }) => {
|
|
77
85
|
const { formatMessage } = useIntl();
|
|
78
|
-
const { rule_result_id:
|
|
86
|
+
const { rule_result_id: paramsId } = useParams();
|
|
79
87
|
|
|
80
|
-
const result_id = _.defaultTo(_.toNumber(
|
|
88
|
+
const result_id = _.defaultTo(_.toNumber(paramsId))(ruleResultId);
|
|
81
89
|
|
|
82
90
|
const ruleResult = _.find(_.propEq("id", result_id))(
|
|
83
91
|
ruleImplementation.results
|
|
@@ -128,7 +136,7 @@ export const ExecutionDetails = ({ ruleImplementation, rule_result_id }) => {
|
|
|
128
136
|
|
|
129
137
|
ExecutionDetails.propTypes = {
|
|
130
138
|
ruleImplementation: PropTypes.object,
|
|
131
|
-
|
|
139
|
+
ruleResultId: PropTypes.number,
|
|
132
140
|
};
|
|
133
141
|
|
|
134
142
|
const mapStateToProps = (state) => ({
|
|
@@ -8,6 +8,9 @@ import RuleImplementationsLoader from "./RuleImplementationsLoader";
|
|
|
8
8
|
const TemplatesLoader = React.lazy(() =>
|
|
9
9
|
import("@truedat/df/templates/components/TemplatesLoader")
|
|
10
10
|
);
|
|
11
|
+
const UserSearchFiltersLoader = React.lazy(() =>
|
|
12
|
+
import("@truedat/dd/components/UserSearchFiltersLoader")
|
|
13
|
+
);
|
|
11
14
|
|
|
12
15
|
const ImplementationsRoutes = () => (
|
|
13
16
|
<Route
|
|
@@ -17,6 +20,7 @@ const ImplementationsRoutes = () => (
|
|
|
17
20
|
<RuleImplementationsLoader />
|
|
18
21
|
<ImplementationFiltersLoader />
|
|
19
22
|
<TemplatesLoader scope="qe" />
|
|
23
|
+
<UserSearchFiltersLoader scope="rule_implementation" />
|
|
20
24
|
<RuleImplementations exact />
|
|
21
25
|
</>
|
|
22
26
|
)}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { Feed, Segment } from "semantic-ui-react";
|
|
@@ -29,4 +28,4 @@ const mapStateToProps = (state) => {
|
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
export default connect(mapStateToProps)(RuleEvents);
|
|
31
|
+
export default connect(mapStateToProps)(RuleEvents);
|
|
@@ -4,6 +4,11 @@ import { connect } from "react-redux";
|
|
|
4
4
|
import { injectIntl } from "react-intl";
|
|
5
5
|
import { makeOption } from "@truedat/core/services/i18n";
|
|
6
6
|
import { SelectedFilters } from "@truedat/core/components";
|
|
7
|
+
import {
|
|
8
|
+
applyUserSearchFilter,
|
|
9
|
+
deleteUserSearchFilter,
|
|
10
|
+
saveUserSearchFilters,
|
|
11
|
+
} from "@truedat/dd/routines";
|
|
7
12
|
import {
|
|
8
13
|
closeImplementationFilter,
|
|
9
14
|
openImplementationFilter,
|
|
@@ -24,29 +29,46 @@ const translations = (formatMessage) => ({
|
|
|
24
29
|
|
|
25
30
|
export const mapStateToProps = (state, ownProps) => {
|
|
26
31
|
const formatMessage = _.pathOr(_.prop("id"), "intl.formatMessage")(ownProps);
|
|
27
|
-
const {
|
|
32
|
+
const {
|
|
33
|
+
ruleImplementationFiltersLoading: loading,
|
|
34
|
+
ruleImplementationSelectedFilter: selectedFilter,
|
|
35
|
+
} = state;
|
|
28
36
|
const i18nValues = _.flow(
|
|
29
37
|
getRuleImplementationSelectedFilterValues,
|
|
30
38
|
_.map(makeOption(translations(formatMessage), selectedFilter))
|
|
31
39
|
)(state);
|
|
32
40
|
|
|
41
|
+
const {
|
|
42
|
+
selectedUserSearchFilter: selectedUserFilter,
|
|
43
|
+
ruleImplementationActiveFilters: activeFilters,
|
|
44
|
+
userSearchFilters: userFilters,
|
|
45
|
+
} = state;
|
|
46
|
+
|
|
33
47
|
return {
|
|
48
|
+
loading,
|
|
34
49
|
selectedFilter,
|
|
35
50
|
selectedFilters: getRuleImplementationSelectedFilters(state),
|
|
36
51
|
selectedFilterActiveValues:
|
|
37
52
|
getRuleImplementationSelectedFilterActiveValues(state),
|
|
38
53
|
selectedFilterValues: i18nValues,
|
|
54
|
+
selectedUserFilter,
|
|
55
|
+
activeFilters,
|
|
56
|
+
userFilters,
|
|
57
|
+
userFilterScope: "rule_implementation",
|
|
39
58
|
};
|
|
40
59
|
};
|
|
41
60
|
|
|
42
61
|
const mapDispatchToProps = (dispatch) =>
|
|
43
62
|
bindActionCreators(
|
|
44
63
|
{
|
|
64
|
+
applyUserFilter: applyUserSearchFilter,
|
|
45
65
|
closeFilter: closeImplementationFilter,
|
|
66
|
+
deleteUserFilter: deleteUserSearchFilter,
|
|
46
67
|
openFilter: openImplementationFilter,
|
|
47
68
|
removeFilter: removeImplementationFilter,
|
|
48
69
|
resetFilters: resetImplementationFilters,
|
|
49
70
|
toggleFilterValue: toggleImplementationFilterValue,
|
|
71
|
+
saveFilters: saveUserSearchFilters,
|
|
50
72
|
},
|
|
51
73
|
dispatch
|
|
52
74
|
);
|
|
@@ -75,7 +75,7 @@ const ImplementationEventsLoader = () => {
|
|
|
75
75
|
return <EventsLoader resource_id={id} resource_type="implementation" />;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const RuleRoutes = ({
|
|
78
|
+
export const RuleRoutes = ({
|
|
79
79
|
ruleLoaded,
|
|
80
80
|
ruleImplementationLoaded,
|
|
81
81
|
implementationStructures,
|
|
@@ -312,7 +312,7 @@ const RuleRoutes = ({
|
|
|
312
312
|
<RuleImplementationLoader />
|
|
313
313
|
{ruleLoaded && ruleImplementationLoaded && (
|
|
314
314
|
<RuleImplementation>
|
|
315
|
-
<ExecutionDetails
|
|
315
|
+
<ExecutionDetails ruleResultId={latest.id} />
|
|
316
316
|
</RuleImplementation>
|
|
317
317
|
)}
|
|
318
318
|
</Segment>
|
|
@@ -4,6 +4,11 @@ import { connect } from "react-redux";
|
|
|
4
4
|
import { injectIntl } from "react-intl";
|
|
5
5
|
import { makeOption } from "@truedat/core/services/i18n";
|
|
6
6
|
import { SelectedFilters } from "@truedat/core/components";
|
|
7
|
+
import {
|
|
8
|
+
applyUserSearchFilter,
|
|
9
|
+
deleteUserSearchFilter,
|
|
10
|
+
saveUserSearchFilters,
|
|
11
|
+
} from "@truedat/dd/routines";
|
|
7
12
|
import {
|
|
8
13
|
closeRuleFilter,
|
|
9
14
|
openRuleFilter,
|
|
@@ -24,28 +29,43 @@ const translations = (formatMessage) => ({
|
|
|
24
29
|
|
|
25
30
|
export const mapStateToProps = (state, ownProps) => {
|
|
26
31
|
const formatMessage = _.pathOr(_.prop("id"), "intl.formatMessage")(ownProps);
|
|
27
|
-
const { ruleSelectedFilter: selectedFilter } =
|
|
32
|
+
const { ruleFiltersLoading: loading, ruleSelectedFilter: selectedFilter } =
|
|
33
|
+
state;
|
|
28
34
|
const i18nValues = _.flow(
|
|
29
35
|
getRuleSelectedFilterValues,
|
|
30
36
|
_.map(makeOption(translations(formatMessage), selectedFilter))
|
|
31
37
|
)(state);
|
|
32
38
|
|
|
39
|
+
const {
|
|
40
|
+
selectedUserSearchFilter: selectedUserFilter,
|
|
41
|
+
ruleActiveFilters: activeFilters,
|
|
42
|
+
userSearchFilters: userFilters,
|
|
43
|
+
} = state;
|
|
44
|
+
|
|
33
45
|
return {
|
|
46
|
+
loading,
|
|
34
47
|
selectedFilter,
|
|
35
48
|
selectedFilters: getRuleSelectedFilters(state),
|
|
36
49
|
selectedFilterActiveValues: getRuleSelectedFilterActiveValues(state),
|
|
37
50
|
selectedFilterValues: i18nValues,
|
|
51
|
+
selectedUserFilter,
|
|
52
|
+
activeFilters,
|
|
53
|
+
userFilters,
|
|
54
|
+
userFilterScope: "rule",
|
|
38
55
|
};
|
|
39
56
|
};
|
|
40
57
|
|
|
41
58
|
const mapDispatchToProps = (dispatch) =>
|
|
42
59
|
bindActionCreators(
|
|
43
60
|
{
|
|
61
|
+
applyUserFilter: applyUserSearchFilter,
|
|
44
62
|
closeFilter: closeRuleFilter,
|
|
63
|
+
deleteUserFilter: deleteUserSearchFilter,
|
|
45
64
|
openFilter: openRuleFilter,
|
|
46
65
|
removeFilter: removeRuleFilter,
|
|
47
66
|
resetFilters: resetRuleFilters,
|
|
48
67
|
toggleFilterValue: toggleRuleFilterValue,
|
|
68
|
+
saveFilters: saveUserSearchFilters,
|
|
49
69
|
},
|
|
50
70
|
dispatch
|
|
51
71
|
);
|
|
@@ -13,13 +13,25 @@ const DomainsLoader = React.lazy(() =>
|
|
|
13
13
|
const TemplatesLoader = React.lazy(() =>
|
|
14
14
|
import("@truedat/df/templates/components/TemplatesLoader")
|
|
15
15
|
);
|
|
16
|
+
const UserSearchFiltersLoader = React.lazy(() =>
|
|
17
|
+
import("@truedat/dd/components/UserSearchFiltersLoader")
|
|
18
|
+
);
|
|
16
19
|
const QualityTemplatesLoader = () => <TemplatesLoader scope="dq" />;
|
|
17
20
|
|
|
18
21
|
const RulesRoutes = () => (
|
|
19
22
|
<>
|
|
20
23
|
<Route path={RULES} component={RulesLoader} />
|
|
21
24
|
<Route path={RULES} component={RuleFiltersLoader} />
|
|
22
|
-
<Route
|
|
25
|
+
<Route
|
|
26
|
+
exact
|
|
27
|
+
path={RULES}
|
|
28
|
+
render={() => (
|
|
29
|
+
<>
|
|
30
|
+
<UserSearchFiltersLoader scope="rule" />
|
|
31
|
+
<Rules />
|
|
32
|
+
</>
|
|
33
|
+
)}
|
|
34
|
+
/>
|
|
23
35
|
<Switch>
|
|
24
36
|
<Route
|
|
25
37
|
exact
|
|
@@ -11,41 +11,48 @@ jest.mock("react-router-dom", () => ({
|
|
|
11
11
|
|
|
12
12
|
const renderOpts = {
|
|
13
13
|
messages: {
|
|
14
|
-
en:
|
|
14
|
+
en: {
|
|
15
|
+
...messages.en,
|
|
16
|
+
"ruleResult.details.props.test": "TestMessage",
|
|
17
|
+
},
|
|
15
18
|
},
|
|
16
19
|
};
|
|
17
20
|
|
|
18
|
-
describe("<
|
|
19
|
-
const rule = {
|
|
20
|
-
result_type: "percentage",
|
|
21
|
-
minimum: 50,
|
|
22
|
-
goal: 100,
|
|
23
|
-
};
|
|
24
|
-
const ruleImplementation = {
|
|
25
|
-
results: [{ foo: "bar", id: 100, details: { Query: "ImZvbyI=" } }],
|
|
26
|
-
};
|
|
27
|
-
const customColumns = [{ foo: "bar", name: "foo" }];
|
|
28
|
-
const props = {
|
|
29
|
-
rule,
|
|
30
|
-
ruleImplementation,
|
|
31
|
-
customColumns,
|
|
32
|
-
};
|
|
33
|
-
|
|
21
|
+
describe("<ExecutionDetails>", () => {
|
|
34
22
|
it("matches the lastest snapshot", () => {
|
|
23
|
+
const props = {
|
|
24
|
+
ruleImplementation: {
|
|
25
|
+
results: [{ foo: "bar", id: 100, details: { Query: "ImZvbyI=" } }],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
35
28
|
const { container } = render(<ExecutionDetails {...props} />, renderOpts);
|
|
36
29
|
expect(container).toMatchSnapshot();
|
|
37
30
|
});
|
|
38
31
|
|
|
32
|
+
it("decodes details with base64 prefix", () => {
|
|
33
|
+
const props = {
|
|
34
|
+
ruleImplementation: {
|
|
35
|
+
results: [
|
|
36
|
+
{
|
|
37
|
+
foo: "bar",
|
|
38
|
+
id: 100,
|
|
39
|
+
details: {
|
|
40
|
+
value: "valor",
|
|
41
|
+
base64_test: "QmFzZTY0X3ZhbHVl", //base64 for Base64_value
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const { getByText } = render(<ExecutionDetails {...props} />, renderOpts);
|
|
48
|
+
expect(getByText("TestMessage")).toBeInTheDocument();
|
|
49
|
+
expect(getByText("Base64_value")).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
|
|
39
52
|
it("without details", () => {
|
|
40
53
|
const propsWithoutDetails = {
|
|
41
|
-
...props,
|
|
42
54
|
ruleImplementation: {
|
|
43
|
-
|
|
44
|
-
results: {
|
|
45
|
-
..._.map((result) => _.omit(["details"])(result))(
|
|
46
|
-
props.ruleImplementation.results
|
|
47
|
-
),
|
|
48
|
-
},
|
|
55
|
+
results: [{ foo: "bar", id: 100 }],
|
|
49
56
|
},
|
|
50
57
|
};
|
|
51
58
|
const { container } = render(
|
|
@@ -20,9 +20,9 @@ describe("<RuleEvents />", () => {
|
|
|
20
20
|
email: "some.user@domain.tld",
|
|
21
21
|
full_name: "Some User",
|
|
22
22
|
id: 142,
|
|
23
|
-
user_name: "some.user@domain.tld"
|
|
23
|
+
user_name: "some.user@domain.tld",
|
|
24
24
|
},
|
|
25
|
-
ts: "2021-09-16T07:36:32.848603Z"
|
|
25
|
+
ts: "2021-09-16T07:36:32.848603Z",
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
id: 100436,
|
|
@@ -31,7 +31,7 @@ describe("<RuleEvents />", () => {
|
|
|
31
31
|
resource_type: "rule",
|
|
32
32
|
event: "rule_updated",
|
|
33
33
|
payload: {
|
|
34
|
-
domain_id: 168
|
|
34
|
+
domain_id: 168,
|
|
35
35
|
},
|
|
36
36
|
user_id: 171,
|
|
37
37
|
user_name: null,
|
|
@@ -39,9 +39,9 @@ describe("<RuleEvents />", () => {
|
|
|
39
39
|
email: "some.user@domain.tld",
|
|
40
40
|
full_name: "Some User",
|
|
41
41
|
id: 171,
|
|
42
|
-
user_name: "some.user"
|
|
42
|
+
user_name: "some.user",
|
|
43
43
|
},
|
|
44
|
-
ts: "2021-09-16T09:31:03.061864Z"
|
|
44
|
+
ts: "2021-09-16T09:31:03.061864Z",
|
|
45
45
|
},
|
|
46
46
|
];
|
|
47
47
|
const renderOpts = {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { RuleRoutes } from "../RuleRoutes";
|
|
4
|
+
|
|
5
|
+
describe("<RuleRoutes>", () => {
|
|
6
|
+
const props = {
|
|
7
|
+
rule: {},
|
|
8
|
+
implementationStructures: [],
|
|
9
|
+
ruleLoaded: true,
|
|
10
|
+
template: {},
|
|
11
|
+
ruleImplementation: {},
|
|
12
|
+
ruleImplementationLoaded: true,
|
|
13
|
+
implementationStructuresLoaded: true,
|
|
14
|
+
systemsLoading: true,
|
|
15
|
+
templatesLoaded: true,
|
|
16
|
+
structuresAliasesLoading: true,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
it("matches the lastest snapshot", () => {
|
|
20
|
+
const { container } = render(<RuleRoutes {...props} />, {});
|
|
21
|
+
expect(container).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<
|
|
3
|
+
exports[`<ExecutionDetails> matches the lastest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<table
|
|
6
6
|
class="ui table implementation-results medium"
|
|
@@ -47,7 +47,6 @@ exports[`<ExecutionDetetails> matches the lastest snapshot 1`] = `
|
|
|
47
47
|
class=""
|
|
48
48
|
>
|
|
49
49
|
Date
|
|
50
|
-
|
|
51
50
|
</td>
|
|
52
51
|
<td
|
|
53
52
|
class=""
|
|
@@ -60,7 +59,6 @@ exports[`<ExecutionDetetails> matches the lastest snapshot 1`] = `
|
|
|
60
59
|
class=""
|
|
61
60
|
>
|
|
62
61
|
Records
|
|
63
|
-
|
|
64
62
|
</td>
|
|
65
63
|
<td
|
|
66
64
|
class=""
|
|
@@ -73,7 +71,6 @@ exports[`<ExecutionDetetails> matches the lastest snapshot 1`] = `
|
|
|
73
71
|
class=""
|
|
74
72
|
>
|
|
75
73
|
Errors
|
|
76
|
-
|
|
77
74
|
</td>
|
|
78
75
|
<td
|
|
79
76
|
class=""
|
|
@@ -116,7 +113,7 @@ exports[`<ExecutionDetetails> matches the lastest snapshot 1`] = `
|
|
|
116
113
|
</div>
|
|
117
114
|
`;
|
|
118
115
|
|
|
119
|
-
exports[`<
|
|
116
|
+
exports[`<ExecutionDetails> without details 1`] = `
|
|
120
117
|
<div>
|
|
121
118
|
<div
|
|
122
119
|
class="ui message"
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { applyUserSearchFilter } from "@truedat/dd/routines";
|
|
1
2
|
import { initialState } from "../ruleActiveFilters";
|
|
2
3
|
import {
|
|
3
4
|
addRuleFilter,
|
|
5
|
+
clearRuleFilters,
|
|
4
6
|
closeRuleFilter,
|
|
5
7
|
removeRuleFilter,
|
|
6
8
|
resetRuleFilters,
|
|
7
|
-
toggleRuleFilterValue
|
|
9
|
+
toggleRuleFilterValue,
|
|
8
10
|
} from "../../routines";
|
|
9
11
|
import { ruleActiveFilters } from "..";
|
|
10
12
|
|
|
@@ -21,11 +23,22 @@ describe("reducers: ruleActiveFilters", () => {
|
|
|
21
23
|
expect(
|
|
22
24
|
ruleActiveFilters(fooState, {
|
|
23
25
|
type: addRuleFilter.TRIGGER,
|
|
24
|
-
payload
|
|
26
|
+
payload,
|
|
25
27
|
})
|
|
26
28
|
).toEqual({ ...fooState, baz: [] });
|
|
27
29
|
});
|
|
28
30
|
|
|
31
|
+
it("should handle the applyUserSearchFilter.TRIGGER action", () => {
|
|
32
|
+
const filters = { country: ["Sp"] };
|
|
33
|
+
const payload = { userFilter: { filters }, scope: "rule" };
|
|
34
|
+
expect(
|
|
35
|
+
ruleActiveFilters(fooState, {
|
|
36
|
+
type: applyUserSearchFilter.TRIGGER,
|
|
37
|
+
payload,
|
|
38
|
+
})
|
|
39
|
+
).toEqual({ ...filters });
|
|
40
|
+
});
|
|
41
|
+
|
|
29
42
|
it("should handle the closeRuleFilter.TRIGGER action", () => {
|
|
30
43
|
const foo = ["foo1"];
|
|
31
44
|
const bar = [];
|
|
@@ -34,11 +47,23 @@ describe("reducers: ruleActiveFilters", () => {
|
|
|
34
47
|
expect(
|
|
35
48
|
ruleActiveFilters(state, {
|
|
36
49
|
type: closeRuleFilter.TRIGGER,
|
|
37
|
-
payload
|
|
50
|
+
payload,
|
|
38
51
|
})
|
|
39
52
|
).toEqual({ foo });
|
|
40
53
|
});
|
|
41
54
|
|
|
55
|
+
it("should handle the clearRuleFilters.TRIGGER action", () => {
|
|
56
|
+
const foo = ["foo1"];
|
|
57
|
+
const state = { foo };
|
|
58
|
+
const payload = { filter: "bar" };
|
|
59
|
+
expect(
|
|
60
|
+
ruleActiveFilters(state, {
|
|
61
|
+
type: clearRuleFilters.TRIGGER,
|
|
62
|
+
payload,
|
|
63
|
+
})
|
|
64
|
+
).toEqual({});
|
|
65
|
+
});
|
|
66
|
+
|
|
42
67
|
it("should handle the removeRuleFilter.TRIGGER action", () => {
|
|
43
68
|
const foo = ["foo1"];
|
|
44
69
|
const bar = [];
|
|
@@ -47,7 +72,7 @@ describe("reducers: ruleActiveFilters", () => {
|
|
|
47
72
|
expect(
|
|
48
73
|
ruleActiveFilters(state, {
|
|
49
74
|
type: removeRuleFilter.TRIGGER,
|
|
50
|
-
payload
|
|
75
|
+
payload,
|
|
51
76
|
})
|
|
52
77
|
).toEqual({ bar });
|
|
53
78
|
});
|
|
@@ -55,7 +80,7 @@ describe("reducers: ruleActiveFilters", () => {
|
|
|
55
80
|
it("should handle the resetRuleFilters.TRIGGER action", () => {
|
|
56
81
|
expect(
|
|
57
82
|
ruleActiveFilters(fooState, {
|
|
58
|
-
type: resetRuleFilters.TRIGGER
|
|
83
|
+
type: resetRuleFilters.TRIGGER,
|
|
59
84
|
})
|
|
60
85
|
).toEqual(initialState);
|
|
61
86
|
});
|
|
@@ -63,7 +88,7 @@ describe("reducers: ruleActiveFilters", () => {
|
|
|
63
88
|
it("should handle the resetRuleFilters.TRIGGER action when execution filter exists", () => {
|
|
64
89
|
expect(
|
|
65
90
|
ruleActiveFilters(fooState, {
|
|
66
|
-
type: resetRuleFilters.TRIGGER
|
|
91
|
+
type: resetRuleFilters.TRIGGER,
|
|
67
92
|
})
|
|
68
93
|
).toEqual(initialState);
|
|
69
94
|
});
|
|
@@ -76,7 +101,7 @@ describe("reducers: ruleActiveFilters", () => {
|
|
|
76
101
|
expect(
|
|
77
102
|
ruleActiveFilters(state, {
|
|
78
103
|
type: toggleRuleFilterValue.TRIGGER,
|
|
79
|
-
payload
|
|
104
|
+
payload,
|
|
80
105
|
})
|
|
81
106
|
).toEqual({ foo: ["foo1", "foo3"], bar });
|
|
82
107
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { applyUserSearchFilter } from "@truedat/dd/routines";
|
|
1
2
|
import { initialState } from "../ruleImplementationActiveFilters";
|
|
2
3
|
import {
|
|
3
4
|
addImplementationFilter,
|
|
5
|
+
clearImplementationFilters,
|
|
4
6
|
closeImplementationFilter,
|
|
5
7
|
removeImplementationFilter,
|
|
6
8
|
resetImplementationFilters,
|
|
7
|
-
toggleImplementationFilterValue
|
|
9
|
+
toggleImplementationFilterValue,
|
|
8
10
|
} from "../../routines";
|
|
9
11
|
import { ruleImplementationActiveFilters } from "..";
|
|
10
12
|
|
|
@@ -17,17 +19,40 @@ describe("reducers: ruleImplementationActiveFilters", () => {
|
|
|
17
19
|
);
|
|
18
20
|
});
|
|
19
21
|
|
|
22
|
+
it("should handle the applyUserSearchFilter.TRIGGER action", () => {
|
|
23
|
+
const filters = { country: ["Sp"] };
|
|
24
|
+
const payload = { userFilter: { filters }, scope: "rule_implementation" };
|
|
25
|
+
expect(
|
|
26
|
+
ruleImplementationActiveFilters(fooState, {
|
|
27
|
+
type: applyUserSearchFilter.TRIGGER,
|
|
28
|
+
payload,
|
|
29
|
+
})
|
|
30
|
+
).toEqual({ ...filters });
|
|
31
|
+
});
|
|
32
|
+
|
|
20
33
|
it("should handle the addImplementationFilter.TRIGGER action", () => {
|
|
21
34
|
const filter = "baz";
|
|
22
35
|
const payload = { filter };
|
|
23
36
|
expect(
|
|
24
37
|
ruleImplementationActiveFilters(fooState, {
|
|
25
38
|
type: addImplementationFilter.TRIGGER,
|
|
26
|
-
payload
|
|
39
|
+
payload,
|
|
27
40
|
})
|
|
28
41
|
).toEqual({ ...fooState, baz: [] });
|
|
29
42
|
});
|
|
30
43
|
|
|
44
|
+
it("should handle the clearImplementationFilters.TRIGGER action", () => {
|
|
45
|
+
const foo = ["foo1"];
|
|
46
|
+
const state = { foo };
|
|
47
|
+
const payload = { filter: "bar" };
|
|
48
|
+
expect(
|
|
49
|
+
ruleImplementationActiveFilters(state, {
|
|
50
|
+
type: clearImplementationFilters.TRIGGER,
|
|
51
|
+
payload,
|
|
52
|
+
})
|
|
53
|
+
).toEqual({});
|
|
54
|
+
});
|
|
55
|
+
|
|
31
56
|
it("should handle the closeImplementationFilter.TRIGGER action", () => {
|
|
32
57
|
const foo = ["foo1"];
|
|
33
58
|
const bar = [];
|
|
@@ -36,7 +61,7 @@ describe("reducers: ruleImplementationActiveFilters", () => {
|
|
|
36
61
|
expect(
|
|
37
62
|
ruleImplementationActiveFilters(state, {
|
|
38
63
|
type: closeImplementationFilter.TRIGGER,
|
|
39
|
-
payload
|
|
64
|
+
payload,
|
|
40
65
|
})
|
|
41
66
|
).toEqual({ foo });
|
|
42
67
|
});
|
|
@@ -49,7 +74,7 @@ describe("reducers: ruleImplementationActiveFilters", () => {
|
|
|
49
74
|
expect(
|
|
50
75
|
ruleImplementationActiveFilters(state, {
|
|
51
76
|
type: removeImplementationFilter.TRIGGER,
|
|
52
|
-
payload
|
|
77
|
+
payload,
|
|
53
78
|
})
|
|
54
79
|
).toEqual({ bar });
|
|
55
80
|
});
|
|
@@ -57,7 +82,7 @@ describe("reducers: ruleImplementationActiveFilters", () => {
|
|
|
57
82
|
it("should handle the resetImplementationFilters.TRIGGER action", () => {
|
|
58
83
|
expect(
|
|
59
84
|
ruleImplementationActiveFilters(fooState, {
|
|
60
|
-
type: resetImplementationFilters.TRIGGER
|
|
85
|
+
type: resetImplementationFilters.TRIGGER,
|
|
61
86
|
})
|
|
62
87
|
).toEqual(initialState);
|
|
63
88
|
});
|
|
@@ -67,7 +92,7 @@ describe("reducers: ruleImplementationActiveFilters", () => {
|
|
|
67
92
|
ruleImplementationActiveFilters(
|
|
68
93
|
{ ...fooState, executable: [true] },
|
|
69
94
|
{
|
|
70
|
-
type: resetImplementationFilters.TRIGGER
|
|
95
|
+
type: resetImplementationFilters.TRIGGER,
|
|
71
96
|
}
|
|
72
97
|
)
|
|
73
98
|
).toEqual({ executable: [true] });
|
|
@@ -81,7 +106,7 @@ describe("reducers: ruleImplementationActiveFilters", () => {
|
|
|
81
106
|
expect(
|
|
82
107
|
ruleImplementationActiveFilters(state, {
|
|
83
108
|
type: toggleImplementationFilterValue.TRIGGER,
|
|
84
|
-
payload
|
|
109
|
+
payload,
|
|
85
110
|
})
|
|
86
111
|
).toEqual({ foo: ["foo1", "foo3"], bar });
|
|
87
112
|
});
|
package/src/reducers/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { ruleImplementation } from "./ruleImplementation";
|
|
|
17
17
|
import { ruleImplementationCount } from "./ruleImplementationCount";
|
|
18
18
|
import { ruleImplementationCreating } from "./ruleImplementationCreating";
|
|
19
19
|
import { ruleImplementationFilters } from "./ruleImplementationFilters";
|
|
20
|
+
import { ruleImplementationFiltersLoading } from "./ruleImplementationFiltersLoading";
|
|
20
21
|
import { ruleImplementationLoading } from "./ruleImplementationLoading";
|
|
21
22
|
import { ruleImplementationQuery } from "./ruleImplementationQuery";
|
|
22
23
|
import { ruleImplementationRaw } from "./ruleImplementationRaw";
|
|
@@ -64,6 +65,7 @@ export {
|
|
|
64
65
|
ruleImplementationCount,
|
|
65
66
|
ruleImplementationCreating,
|
|
66
67
|
ruleImplementationFilters,
|
|
68
|
+
ruleImplementationFiltersLoading,
|
|
67
69
|
ruleImplementationLoading,
|
|
68
70
|
ruleImplementationQuery,
|
|
69
71
|
ruleImplementationRaw,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
+
import { applyUserSearchFilter } from "@truedat/dd/routines";
|
|
2
3
|
import {
|
|
3
4
|
addRuleFilter,
|
|
5
|
+
clearRuleFilters,
|
|
4
6
|
closeRuleFilter,
|
|
5
7
|
removeRuleFilter,
|
|
6
8
|
resetRuleFilters,
|
|
@@ -11,10 +13,16 @@ export const initialState = {};
|
|
|
11
13
|
|
|
12
14
|
export const ruleActiveFilters = (state = initialState, { type, payload }) => {
|
|
13
15
|
switch (type) {
|
|
16
|
+
case clearRuleFilters.TRIGGER:
|
|
17
|
+
return initialState;
|
|
14
18
|
case addRuleFilter.TRIGGER: {
|
|
15
19
|
const { filter } = payload;
|
|
16
20
|
return { ...state, [filter]: [] };
|
|
17
21
|
}
|
|
22
|
+
case applyUserSearchFilter.TRIGGER: {
|
|
23
|
+
const { userFilter, scope } = payload;
|
|
24
|
+
return scope === "rule" ? _.prop("filters")(userFilter) : state;
|
|
25
|
+
}
|
|
18
26
|
case closeRuleFilter.TRIGGER: {
|
|
19
27
|
const { filter } = payload;
|
|
20
28
|
const values = _.propOr([], filter)(state);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
+
import { applyUserSearchFilter } from "@truedat/dd/routines";
|
|
2
3
|
import {
|
|
3
4
|
addImplementationFilter,
|
|
5
|
+
clearImplementationFilters,
|
|
4
6
|
closeImplementationFilter,
|
|
5
7
|
removeImplementationFilter,
|
|
6
8
|
resetImplementationFilters,
|
|
@@ -14,10 +16,18 @@ export const ruleImplementationActiveFilters = (
|
|
|
14
16
|
{ type, payload }
|
|
15
17
|
) => {
|
|
16
18
|
switch (type) {
|
|
19
|
+
case clearImplementationFilters.TRIGGER:
|
|
20
|
+
return initialState;
|
|
17
21
|
case addImplementationFilter.TRIGGER: {
|
|
18
22
|
const { filter } = payload;
|
|
19
23
|
return { ...state, [filter]: [] };
|
|
20
24
|
}
|
|
25
|
+
case applyUserSearchFilter.TRIGGER: {
|
|
26
|
+
const { userFilter, scope } = payload;
|
|
27
|
+
return scope === "rule_implementation"
|
|
28
|
+
? _.prop("filters")(userFilter)
|
|
29
|
+
: state;
|
|
30
|
+
}
|
|
21
31
|
case closeImplementationFilter.TRIGGER: {
|
|
22
32
|
const { filter } = payload;
|
|
23
33
|
const values = _.propOr([], filter)(state);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { fetchImplementationFilters } from "../routines";
|
|
2
|
+
|
|
3
|
+
const ruleImplementationFiltersLoading = (state = false, { type }) => {
|
|
4
|
+
switch (type) {
|
|
5
|
+
case fetchImplementationFilters.REQUEST:
|
|
6
|
+
return true;
|
|
7
|
+
case fetchImplementationFilters.FULFILL:
|
|
8
|
+
return false;
|
|
9
|
+
default:
|
|
10
|
+
return state;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { ruleImplementationFiltersLoading };
|