@truedat/dq 4.40.0 → 4.40.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.
- package/CHANGELOG.md +13 -0
- package/package.json +5 -5
- package/src/components/ImplementationsRoutes.js +0 -4
- package/src/components/RuleImplementationTabs.js +14 -1
- package/src/components/RuleImplementationsActions.js +16 -8
- package/src/components/RuleImplementationsOptions.js +3 -2
- package/src/components/RuleImplementationsTable.js +5 -2
- package/src/components/RuleResultsUpload.js +10 -28
- package/src/components/RuleRoutes.js +48 -5
- package/src/components/__tests__/RuleImplementation.spec.js +9 -8
- package/src/components/__tests__/RuleImplementationTabs.spec.js +30 -0
- package/src/components/__tests__/RuleImplementationsActions.spec.js +2 -0
- package/src/components/__tests__/RuleImplementationsOptions.spec.js +16 -12
- package/src/components/__tests__/RuleResultsUpload.spec.js +8 -66
- package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +6 -0
- package/src/components/__tests__/__snapshots__/RuleImplementationTabs.spec.js.snap +34 -0
- package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +1 -0
- package/src/components/__tests__/__snapshots__/RuleImplementationsOptions.spec.js.snap +63 -54
- package/src/components/__tests__/__snapshots__/RuleResultsUpload.spec.js.snap +16 -8
- package/src/messages/en.js +2 -0
- package/src/messages/es.js +17 -8
- package/src/reducers/__tests__/implementationActions.spec.js +44 -0
- package/src/reducers/__tests__/implementationLinks.spec.js +62 -0
- package/src/reducers/__tests__/implementationsActions.spec.js +50 -0
- package/src/reducers/__tests__/{uploadingResults.spec.js → resultsUploading.spec.js} +5 -5
- package/src/reducers/implementationActions.js +17 -0
- package/src/reducers/implementationLinks.js +22 -0
- package/src/reducers/implementationsActions.js +24 -0
- package/src/reducers/index.js +16 -10
- package/src/reducers/{uploadingResults.js → resultsUploading.js} +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.40.3] 2022-03-14
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- [TD-4271] Support for linking implementations with business_concepts
|
|
8
|
+
|
|
9
|
+
## [4.40.1] 2022-03-08
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [TD-4604] Use actions from `POST /api/implementations/search` instead of
|
|
14
|
+
fetching permissions
|
|
15
|
+
|
|
3
16
|
## [4.39.0] 2022-03-01
|
|
4
17
|
|
|
5
18
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.40.
|
|
3
|
+
"version": "4.40.3",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@babel/plugin-transform-modules-commonjs": "^7.15.0",
|
|
32
32
|
"@babel/preset-env": "^7.15.0",
|
|
33
33
|
"@babel/preset-react": "^7.14.5",
|
|
34
|
-
"@truedat/test": "4.
|
|
34
|
+
"@truedat/test": "4.40.3",
|
|
35
35
|
"babel-jest": "^27.0.6",
|
|
36
36
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
37
37
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@apollo/client": "^3.4.10",
|
|
85
|
-
"@truedat/core": "4.40.
|
|
86
|
-
"@truedat/df": "4.40.
|
|
85
|
+
"@truedat/core": "4.40.3",
|
|
86
|
+
"@truedat/df": "4.40.3",
|
|
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": "03104a28941b568007ad53b85874ff58225eaa6a"
|
|
107
107
|
}
|
|
@@ -8,9 +8,6 @@ import RuleImplementationsLoader from "./RuleImplementationsLoader";
|
|
|
8
8
|
const TemplatesLoader = React.lazy(() =>
|
|
9
9
|
import("@truedat/df/templates/components/TemplatesLoader")
|
|
10
10
|
);
|
|
11
|
-
const UserDomainsLoader = React.lazy(() =>
|
|
12
|
-
import("@truedat/auth/users/components/UserDomainsLoader")
|
|
13
|
-
);
|
|
14
11
|
const UserSearchFiltersLoader = React.lazy(() =>
|
|
15
12
|
import("@truedat/dd/components/UserSearchFiltersLoader")
|
|
16
13
|
);
|
|
@@ -24,7 +21,6 @@ const ImplementationsRoutes = () => (
|
|
|
24
21
|
<ImplementationFiltersLoader />
|
|
25
22
|
<TemplatesLoader scope="qe" />
|
|
26
23
|
<UserSearchFiltersLoader scope="rule_implementation" />
|
|
27
|
-
<UserDomainsLoader permissions={["manage_rule_results"]} />
|
|
28
24
|
<RuleImplementations exact />
|
|
29
25
|
</>
|
|
30
26
|
)}
|
|
@@ -8,8 +8,9 @@ import { connect } from "react-redux";
|
|
|
8
8
|
import { FormattedMessage } from "react-intl";
|
|
9
9
|
import {
|
|
10
10
|
RULE_IMPLEMENTATION_EVENTS,
|
|
11
|
-
|
|
11
|
+
IMPLEMENTATION_CONCEPT_LINKS,
|
|
12
12
|
RULE_IMPLEMENTATION_MOVE,
|
|
13
|
+
RULE_IMPLEMENTATION_RESULTS_DETAILS,
|
|
13
14
|
RULE_IMPLEMENTATION_RESULTS,
|
|
14
15
|
RULE_IMPLEMENTATION,
|
|
15
16
|
linkTo,
|
|
@@ -37,6 +38,18 @@ export const RuleImplementationTabs = ({ rule, ruleImplementation, match }) => {
|
|
|
37
38
|
>
|
|
38
39
|
<FormattedMessage id="tabs.dq.ruleImplementation" />
|
|
39
40
|
</Menu.Item>
|
|
41
|
+
|
|
42
|
+
<Menu.Item
|
|
43
|
+
active={match.path === IMPLEMENTATION_CONCEPT_LINKS}
|
|
44
|
+
as={Link}
|
|
45
|
+
to={linkTo.IMPLEMENTATION_CONCEPT_LINKS({
|
|
46
|
+
id: rule.id,
|
|
47
|
+
implementation_id: ruleImplementation.id,
|
|
48
|
+
})}
|
|
49
|
+
>
|
|
50
|
+
<FormattedMessage id="tabs.dq.implementation.links" />
|
|
51
|
+
</Menu.Item>
|
|
52
|
+
|
|
40
53
|
<Menu.Item
|
|
41
54
|
active={match.path === RULE_IMPLEMENTATION_RESULTS}
|
|
42
55
|
as={Link}
|
|
@@ -14,18 +14,19 @@ import ExecutionPopup from "./ExecutionPopup";
|
|
|
14
14
|
import RuleImplementationsOptions from "./RuleImplementationsOptions";
|
|
15
15
|
|
|
16
16
|
export const RuleImplementationsActions = ({
|
|
17
|
+
actions,
|
|
17
18
|
addImplementationFilter,
|
|
18
19
|
canExecute,
|
|
19
|
-
executeImplementationsOn,
|
|
20
|
-
toggleImplementationFilterValue,
|
|
21
|
-
removeImplementationFilter,
|
|
22
20
|
createExecutionGroup,
|
|
23
|
-
|
|
21
|
+
executeImplementationsOn,
|
|
24
22
|
implementationQuery,
|
|
25
|
-
setMode,
|
|
26
23
|
implementationsExecution,
|
|
24
|
+
removeImplementationFilter,
|
|
27
25
|
ruleImplementationCount,
|
|
28
26
|
ruleImplementationsLoading,
|
|
27
|
+
selectedImplementations,
|
|
28
|
+
setMode,
|
|
29
|
+
toggleImplementationFilterValue,
|
|
29
30
|
}) => {
|
|
30
31
|
const showExecutableInfo = () => {
|
|
31
32
|
addImplementationFilter({ filter: "executable" });
|
|
@@ -50,6 +51,8 @@ export const RuleImplementationsActions = ({
|
|
|
50
51
|
: { filters: { id: selectedImplementations } };
|
|
51
52
|
createExecutionGroup({ ...query, df_content });
|
|
52
53
|
};
|
|
54
|
+
|
|
55
|
+
const canUploadResults = !!actions?.uploadResults;
|
|
53
56
|
return (
|
|
54
57
|
<div style={{ float: "right" }}>
|
|
55
58
|
{implementationsExecution && canExecute && (
|
|
@@ -73,24 +76,28 @@ export const RuleImplementationsActions = ({
|
|
|
73
76
|
/>
|
|
74
77
|
</>
|
|
75
78
|
)}
|
|
76
|
-
<RuleImplementationsOptions
|
|
79
|
+
<RuleImplementationsOptions
|
|
80
|
+
loading={ruleImplementationsLoading}
|
|
81
|
+
canUploadResults={canUploadResults}
|
|
82
|
+
/>
|
|
77
83
|
</div>
|
|
78
84
|
);
|
|
79
85
|
};
|
|
80
86
|
|
|
81
87
|
RuleImplementationsActions.propTypes = {
|
|
88
|
+
actions: PropTypes.object,
|
|
82
89
|
addImplementationFilter: PropTypes.func,
|
|
83
90
|
canExecute: PropTypes.bool,
|
|
84
91
|
createExecutionGroup: PropTypes.func,
|
|
85
92
|
executeImplementationsOn: PropTypes.bool,
|
|
86
|
-
implementationsExecution: PropTypes.bool,
|
|
87
93
|
implementationQuery: PropTypes.object,
|
|
94
|
+
implementationsExecution: PropTypes.bool,
|
|
88
95
|
removeImplementationFilter: PropTypes.func,
|
|
89
96
|
ruleImplementationCount: PropTypes.number,
|
|
97
|
+
ruleImplementationsLoading: PropTypes.bool,
|
|
90
98
|
selectedImplementations: PropTypes.array,
|
|
91
99
|
setMode: PropTypes.func,
|
|
92
100
|
toggleImplementationFilterValue: PropTypes.func,
|
|
93
|
-
ruleImplementationsLoading: PropTypes.bool,
|
|
94
101
|
};
|
|
95
102
|
|
|
96
103
|
const mapStateToProps = (state) => ({
|
|
@@ -98,6 +105,7 @@ const mapStateToProps = (state) => ({
|
|
|
98
105
|
ruleImplementationCount: state.ruleImplementationCount,
|
|
99
106
|
implementationsExecution: getImplementationsExecution(state),
|
|
100
107
|
ruleImplementationsLoading: state.ruleImplementationsLoading,
|
|
108
|
+
actions: state.implementationsActions,
|
|
101
109
|
});
|
|
102
110
|
|
|
103
111
|
export default connect(mapStateToProps, {
|
|
@@ -5,7 +5,7 @@ import RuleImplementationsDownload from "./RuleImplementationsDownload";
|
|
|
5
5
|
import RuleResultsUpload from "./RuleResultsUpload";
|
|
6
6
|
import ImplementationsUploadButton from "./ImplementationsUploadButton";
|
|
7
7
|
|
|
8
|
-
export const RuleImplementationsOptions = ({ loading }) => (
|
|
8
|
+
export const RuleImplementationsOptions = ({ loading, canUploadResults }) => (
|
|
9
9
|
<Dropdown
|
|
10
10
|
icon="ellipsis vertical"
|
|
11
11
|
className="button icon group-actions button-update"
|
|
@@ -16,13 +16,14 @@ export const RuleImplementationsOptions = ({ loading }) => (
|
|
|
16
16
|
<Dropdown.Menu>
|
|
17
17
|
<RuleImplementationsDownload />
|
|
18
18
|
<ImplementationsUploadButton />
|
|
19
|
-
<RuleResultsUpload />
|
|
19
|
+
{canUploadResults ? <RuleResultsUpload /> : null}
|
|
20
20
|
</Dropdown.Menu>
|
|
21
21
|
</Dropdown>
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
RuleImplementationsOptions.propTypes = {
|
|
25
25
|
loading: PropTypes.bool,
|
|
26
|
+
canUploadResults: PropTypes.bool,
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export default RuleImplementationsOptions;
|
|
@@ -132,9 +132,12 @@ RuleImplementationsTable.propTypes = {
|
|
|
132
132
|
withoutColumns: PropTypes.array,
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
const mapStateToProps = (state) => ({
|
|
135
|
+
const mapStateToProps = (state, props) => ({
|
|
136
136
|
columns: getRuleImplementationColumns(state),
|
|
137
|
-
ruleImplementations:
|
|
137
|
+
ruleImplementations: _.getOr(
|
|
138
|
+
state.ruleImplementations,
|
|
139
|
+
"ruleImplementations"
|
|
140
|
+
)(props),
|
|
138
141
|
ruleImplementationsLoading: state.ruleImplementationsLoading,
|
|
139
142
|
implementationsSort: _.path("ruleImplementationQuery.sort")(state),
|
|
140
143
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
1
|
+
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { connect } from "react-redux";
|
|
5
4
|
import { Dropdown } from "semantic-ui-react";
|
|
@@ -7,31 +6,18 @@ import { useIntl } from "react-intl";
|
|
|
7
6
|
import { UploadModal } from "@truedat/core/components";
|
|
8
7
|
import { uploadResults } from "../routines";
|
|
9
8
|
|
|
10
|
-
export const RuleResultsUpload = ({ uploadResults, loading
|
|
9
|
+
export const RuleResultsUpload = ({ uploadResults, loading }) => {
|
|
11
10
|
const { formatMessage } = useIntl();
|
|
12
|
-
const [permissionFound, setPermissionFound] = useState(false);
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
setPermissionFound(
|
|
16
|
-
!_.flow(
|
|
17
|
-
_.find({ permission: "manage_rule_results" }),
|
|
18
|
-
_.path("domains"),
|
|
19
|
-
_.isEmpty
|
|
20
|
-
)(userDomains)
|
|
21
|
-
);
|
|
22
|
-
}, [userDomains]);
|
|
23
11
|
|
|
24
12
|
return (
|
|
25
13
|
<UploadModal
|
|
26
14
|
icon="upload"
|
|
27
15
|
trigger={
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/>
|
|
34
|
-
) : null
|
|
16
|
+
<Dropdown.Item
|
|
17
|
+
icon="upload"
|
|
18
|
+
text={formatMessage({ id: "ruleResults.actions.upload.tooltip" })}
|
|
19
|
+
disabled={loading}
|
|
20
|
+
/>
|
|
35
21
|
}
|
|
36
22
|
header={formatMessage({
|
|
37
23
|
id: "ruleResults.actions.upload.confirmation.header",
|
|
@@ -52,14 +38,10 @@ export const RuleResultsUpload = ({ uploadResults, loading, userDomains }) => {
|
|
|
52
38
|
RuleResultsUpload.propTypes = {
|
|
53
39
|
uploadResults: PropTypes.func,
|
|
54
40
|
loading: PropTypes.bool,
|
|
55
|
-
userDomains: PropTypes.array,
|
|
56
41
|
};
|
|
57
42
|
|
|
58
|
-
const mapStateToProps = (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
userDomains: state.userDomains,
|
|
62
|
-
};
|
|
63
|
-
};
|
|
43
|
+
const mapStateToProps = ({ resultsUploading: loading }) => ({
|
|
44
|
+
loading,
|
|
45
|
+
});
|
|
64
46
|
|
|
65
47
|
export default connect(mapStateToProps, { uploadResults })(RuleResultsUpload);
|
|
@@ -10,14 +10,16 @@ import {
|
|
|
10
10
|
RULE,
|
|
11
11
|
RULE_EDIT,
|
|
12
12
|
RULE_EVENTS,
|
|
13
|
-
RULE_IMPLEMENTATION_RESULT_DETAILS,
|
|
14
|
-
RULE_IMPLEMENTATION_RESULTS_DETAILS,
|
|
15
|
-
RULE_IMPLEMENTATION,
|
|
16
|
-
RULE_IMPLEMENTATION_EVENTS,
|
|
17
|
-
RULE_IMPLEMENTATION_NEW,
|
|
18
13
|
RULE_IMPLEMENTATION_CLONE,
|
|
19
14
|
RULE_IMPLEMENTATION_EDIT,
|
|
15
|
+
RULE_IMPLEMENTATION_EVENTS,
|
|
16
|
+
IMPLEMENTATION_CONCEPT_LINKS,
|
|
17
|
+
IMPLEMENTATION_CONCEPT_LINKS_NEW,
|
|
20
18
|
RULE_IMPLEMENTATION_MOVE,
|
|
19
|
+
RULE_IMPLEMENTATION_NEW,
|
|
20
|
+
RULE_IMPLEMENTATION_RESULT_DETAILS,
|
|
21
|
+
RULE_IMPLEMENTATION_RESULTS_DETAILS,
|
|
22
|
+
RULE_IMPLEMENTATION,
|
|
21
23
|
RULE_NEW,
|
|
22
24
|
RULE_IMPLEMENTATION_RESULTS,
|
|
23
25
|
RULE_IMPLEMENTATIONS,
|
|
@@ -60,6 +62,13 @@ const TemplatesLoader = React.lazy(() =>
|
|
|
60
62
|
const ImplementationStructuresLoader = React.lazy(() =>
|
|
61
63
|
import("@truedat/dd/components/ImplementationStructuresLoader")
|
|
62
64
|
);
|
|
65
|
+
const ImplementationLinks = React.lazy(() =>
|
|
66
|
+
import("@truedat/lm/components/ImplementationLinks")
|
|
67
|
+
);
|
|
68
|
+
const ImplementationRelationForm = React.lazy(() =>
|
|
69
|
+
import("@truedat/lm/components/ImplementationRelationForm")
|
|
70
|
+
);
|
|
71
|
+
|
|
63
72
|
const QualityTemplatesLoader = () => <TemplatesLoader scope="dq" />;
|
|
64
73
|
const ImplementationTemplatesLoader = () => <TemplatesLoader scope="ri" />;
|
|
65
74
|
|
|
@@ -285,6 +294,40 @@ export const RuleRoutes = ({
|
|
|
285
294
|
</>
|
|
286
295
|
)}
|
|
287
296
|
/>
|
|
297
|
+
<Route
|
|
298
|
+
exact
|
|
299
|
+
path={IMPLEMENTATION_CONCEPT_LINKS}
|
|
300
|
+
render={() => (
|
|
301
|
+
<>
|
|
302
|
+
<RuleCrumbs />
|
|
303
|
+
<Segment>
|
|
304
|
+
<RuleImplementationLoader />
|
|
305
|
+
{ruleLoaded && ruleImplementationLoaded && (
|
|
306
|
+
<RuleImplementation>
|
|
307
|
+
<ImplementationLinks />
|
|
308
|
+
</RuleImplementation>
|
|
309
|
+
)}
|
|
310
|
+
</Segment>
|
|
311
|
+
</>
|
|
312
|
+
)}
|
|
313
|
+
/>
|
|
314
|
+
<Route
|
|
315
|
+
exact
|
|
316
|
+
path={IMPLEMENTATION_CONCEPT_LINKS_NEW}
|
|
317
|
+
render={() => (
|
|
318
|
+
<>
|
|
319
|
+
<RuleCrumbs />
|
|
320
|
+
<Segment>
|
|
321
|
+
<RuleImplementationLoader />
|
|
322
|
+
{ruleLoaded && ruleImplementationLoaded && (
|
|
323
|
+
<RuleImplementation>
|
|
324
|
+
<ImplementationRelationForm />
|
|
325
|
+
</RuleImplementation>
|
|
326
|
+
)}
|
|
327
|
+
</Segment>
|
|
328
|
+
</>
|
|
329
|
+
)}
|
|
330
|
+
/>
|
|
288
331
|
<Route
|
|
289
332
|
exact
|
|
290
333
|
path={RULE_IMPLEMENTATION_RESULTS}
|
|
@@ -19,16 +19,17 @@ const state = {
|
|
|
19
19
|
const renderOpts = {
|
|
20
20
|
messages: {
|
|
21
21
|
en: {
|
|
22
|
-
"
|
|
23
|
-
"tabs.dq.ruleImplementation": "implementation",
|
|
24
|
-
"tabs.dq.ruleImplementation.audit": "events",
|
|
22
|
+
"quality.result.no.data": "No information about quality",
|
|
25
23
|
"ruleImplementation.actions.clone": "clone",
|
|
26
|
-
"ruleImplementation.actions.move": "move",
|
|
27
|
-
"ruleImplementation.actions.edit": "edit",
|
|
28
|
-
"ruleImplementation.actions.deprecate": "archive",
|
|
29
|
-
"ruleImplementation.actions.delete.confirmation.header": "header",
|
|
30
24
|
"ruleImplementation.actions.delete.confirmation.content": "confirm",
|
|
31
|
-
"
|
|
25
|
+
"ruleImplementation.actions.delete.confirmation.header": "header",
|
|
26
|
+
"ruleImplementation.actions.deprecate": "archive",
|
|
27
|
+
"ruleImplementation.actions.edit": "edit",
|
|
28
|
+
"ruleImplementation.actions.move": "move",
|
|
29
|
+
"tabs.dq.implementation.links": "Related concepts",
|
|
30
|
+
"tabs.dq.ruleImplementation.audit": "events",
|
|
31
|
+
"tabs.dq.ruleImplementation.results": "results",
|
|
32
|
+
"tabs.dq.ruleImplementation": "implementation",
|
|
32
33
|
},
|
|
33
34
|
},
|
|
34
35
|
state,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { RuleImplementationTabs } from "../RuleImplementationTabs";
|
|
4
|
+
|
|
5
|
+
describe("<RuleImplementationTabs />", () => {
|
|
6
|
+
const renderOpts = {
|
|
7
|
+
messages: {
|
|
8
|
+
en: {
|
|
9
|
+
"tabs.dq.ruleImplementation": "ruleImplementation",
|
|
10
|
+
"tabs.dq.implementation.links": "links",
|
|
11
|
+
"tabs.dq.ruleImplementation.results": "results",
|
|
12
|
+
"tabs.dq.ruleImplementation.details": "details",
|
|
13
|
+
"tabs.dq.ruleImplementation.audit": "audit",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const props = {
|
|
19
|
+
rule: { id: 8 },
|
|
20
|
+
ruleImplementation: { id: 1 },
|
|
21
|
+
match: { path: "" },
|
|
22
|
+
};
|
|
23
|
+
it("matches the latest snapshot", () => {
|
|
24
|
+
const { container } = render(
|
|
25
|
+
<RuleImplementationTabs {...props} />,
|
|
26
|
+
renderOpts
|
|
27
|
+
);
|
|
28
|
+
expect(container).toMatchSnapshot();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -12,6 +12,7 @@ describe("<RuleImplementationsActions />", () => {
|
|
|
12
12
|
const setMode = jest.fn();
|
|
13
13
|
const removeImplementationFilter = jest.fn();
|
|
14
14
|
const props = {
|
|
15
|
+
actions: { uploadResults: {} },
|
|
15
16
|
canExecute: true,
|
|
16
17
|
executionGroupLoading: false,
|
|
17
18
|
ruleImplementationCount: 12,
|
|
@@ -23,6 +24,7 @@ describe("<RuleImplementationsActions />", () => {
|
|
|
23
24
|
setMode,
|
|
24
25
|
removeImplementationFilter,
|
|
25
26
|
};
|
|
27
|
+
|
|
26
28
|
it("matches the latest snapshot", () => {
|
|
27
29
|
const wrapper = shallow(<RuleImplementationsActions {...props} />);
|
|
28
30
|
expect(wrapper).toMatchSnapshot();
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
1
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render } from "@truedat/test/render";
|
|
4
|
+
import coreEn from "@truedat/core/messages/en";
|
|
5
|
+
import RuleImplementationsOptions from "../RuleImplementationsOptions";
|
|
6
|
+
import en from "../../messages/en";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
const renderOpts = {
|
|
9
|
+
messages: { en: { ...coreEn, ...en } },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const props = { canUploadResults: true };
|
|
8
13
|
|
|
9
14
|
describe("<RuleImplementationsOptions />", () => {
|
|
10
|
-
it("matches the latest snapshot", () => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expect(wrapper).toMatchSnapshot();
|
|
15
|
+
it("matches the latest snapshot", async () => {
|
|
16
|
+
const { container } = render(
|
|
17
|
+
<RuleImplementationsOptions {...props} />,
|
|
18
|
+
renderOpts
|
|
19
|
+
);
|
|
20
|
+
await waitFor(() => expect(container).toMatchSnapshot());
|
|
17
21
|
});
|
|
18
22
|
});
|
|
@@ -1,73 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { IntlProvider } from "react-intl";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
4
3
|
import { render } from "@truedat/test/render";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import coreEn from "@truedat/core/messages/en";
|
|
5
|
+
import RuleResultsUpload from "../RuleResultsUpload";
|
|
6
|
+
import en from "../../messages/en";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
jest.clearAllMocks();
|
|
10
|
-
});
|
|
8
|
+
const renderOpts = { messages: { en: { ...coreEn, ...en } } };
|
|
11
9
|
|
|
12
10
|
describe("<RuleResultsUpload />", () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"ruleResults.actions.upload.tooltip": "Upload rule results",
|
|
17
|
-
"ruleResults.actions.upload.confirmation.header": "Upload rule results",
|
|
18
|
-
"uploadModal.actions.upload.confirmation.content": "Drag an drop file or click to select file",
|
|
19
|
-
"ruleResults.actions.upload.confirmation.header": "Upload rule results",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
it("matches the latest snapshot", () => {
|
|
25
|
-
const spy = jest.spyOn(React, "useContext").mockImplementation(() => intl);
|
|
26
|
-
const props = {
|
|
27
|
-
uploadResults: jest.fn(),
|
|
28
|
-
loading: false,
|
|
29
|
-
};
|
|
30
|
-
const wrapper = shallow(<RuleResultsUpload {...props} />);
|
|
31
|
-
expect(wrapper).toMatchSnapshot();
|
|
32
|
-
spy.mockRestore();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("Renders upload rule results menu item if there is a domain with manage_rule_results permission", () => {
|
|
36
|
-
const props = {
|
|
37
|
-
uploadResults: jest.fn(),
|
|
38
|
-
loading: false,
|
|
39
|
-
userDomains: [
|
|
40
|
-
{
|
|
41
|
-
domains: [
|
|
42
|
-
{
|
|
43
|
-
external_id: "Truedat",
|
|
44
|
-
id: 2,
|
|
45
|
-
name: "Truedat",
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
permission: "manage_rule_results",
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
const { getByText } = render(<RuleResultsUpload {...props} />, renderOpts);
|
|
53
|
-
|
|
54
|
-
const element = getByText("Upload rule results");
|
|
55
|
-
expect(element).toBeInTheDocument()
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("Does not render upload rule results menu item if there is no domain with manage_rule_results permission", () => {
|
|
59
|
-
const props = {
|
|
60
|
-
uploadResults: jest.fn(),
|
|
61
|
-
loading: false,
|
|
62
|
-
userDomains: [],
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const { queryByText } = render(
|
|
66
|
-
<RuleResultsUpload {...props} />,
|
|
67
|
-
renderOpts
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const element = queryByText("Upload rule results");
|
|
71
|
-
expect(element).toBeNull();
|
|
11
|
+
it("matches the latest snapshot", async () => {
|
|
12
|
+
const { container } = render(<RuleResultsUpload />, renderOpts);
|
|
13
|
+
await waitFor(() => expect(container).toMatchSnapshot());
|
|
72
14
|
});
|
|
73
15
|
});
|
|
@@ -134,6 +134,12 @@ exports[`<RuleImplementation /> matches the latest snapshot 1`] = `
|
|
|
134
134
|
>
|
|
135
135
|
implementation
|
|
136
136
|
</a>
|
|
137
|
+
<a
|
|
138
|
+
class="item"
|
|
139
|
+
href="/rules/1/implementations/1/links"
|
|
140
|
+
>
|
|
141
|
+
Related concepts
|
|
142
|
+
</a>
|
|
137
143
|
<a
|
|
138
144
|
class="item"
|
|
139
145
|
href="/rules/1/implementations/1/results"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<RuleImplementationTabs /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui pointing secondary top attached tabular menu"
|
|
7
|
+
>
|
|
8
|
+
<a
|
|
9
|
+
class="item"
|
|
10
|
+
href="/rules/8/implementations/1"
|
|
11
|
+
>
|
|
12
|
+
ruleImplementation
|
|
13
|
+
</a>
|
|
14
|
+
<a
|
|
15
|
+
class="item"
|
|
16
|
+
href="/rules/8/implementations/1/links"
|
|
17
|
+
>
|
|
18
|
+
links
|
|
19
|
+
</a>
|
|
20
|
+
<a
|
|
21
|
+
class="item"
|
|
22
|
+
href="/rules/8/implementations/1/results"
|
|
23
|
+
>
|
|
24
|
+
results
|
|
25
|
+
</a>
|
|
26
|
+
<a
|
|
27
|
+
class="item"
|
|
28
|
+
href="/rules/8/implementations/1/events"
|
|
29
|
+
>
|
|
30
|
+
audit
|
|
31
|
+
</a>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
`;
|
|
@@ -1,58 +1,67 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<RuleImplementationsOptions /> matches the latest loading snapshot 1`] = `
|
|
4
|
-
<Dropdown
|
|
5
|
-
additionLabel="Add "
|
|
6
|
-
additionPosition="top"
|
|
7
|
-
className="button icon group-actions button-update"
|
|
8
|
-
closeOnBlur={true}
|
|
9
|
-
closeOnEscape={true}
|
|
10
|
-
deburr={false}
|
|
11
|
-
direction="left"
|
|
12
|
-
disabled={true}
|
|
13
|
-
floating={true}
|
|
14
|
-
icon="ellipsis vertical"
|
|
15
|
-
minCharacters={1}
|
|
16
|
-
noResultsMessage="No results found."
|
|
17
|
-
openOnFocus={true}
|
|
18
|
-
renderLabel={[Function]}
|
|
19
|
-
searchInput="text"
|
|
20
|
-
selectOnBlur={true}
|
|
21
|
-
selectOnNavigation={true}
|
|
22
|
-
wrapSelection={true}
|
|
23
|
-
>
|
|
24
|
-
<DropdownMenu>
|
|
25
|
-
<Connect(RuleImplementationsDownload) />
|
|
26
|
-
<Connect(ImplementationsUploadButton) />
|
|
27
|
-
<Connect(RuleResultsUpload) />
|
|
28
|
-
</DropdownMenu>
|
|
29
|
-
</Dropdown>
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
3
|
exports[`<RuleImplementationsOptions /> matches the latest snapshot 1`] = `
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
aria-expanded="false"
|
|
7
|
+
class="ui floating dropdown button icon group-actions button-update"
|
|
8
|
+
role="listbox"
|
|
9
|
+
tabindex="0"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="ellipsis vertical icon"
|
|
14
|
+
/>
|
|
15
|
+
<div
|
|
16
|
+
class="menu transition left"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
aria-disabled="true"
|
|
20
|
+
class="disabled item"
|
|
21
|
+
role="option"
|
|
22
|
+
>
|
|
23
|
+
<i
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
class="download icon"
|
|
26
|
+
/>
|
|
27
|
+
<span>
|
|
28
|
+
Download with csv format
|
|
29
|
+
</span>
|
|
30
|
+
<p
|
|
31
|
+
class="menu-item-description"
|
|
32
|
+
>
|
|
33
|
+
There are no Implementations to be downloaded
|
|
34
|
+
</p>
|
|
35
|
+
</div>
|
|
36
|
+
<div
|
|
37
|
+
class="item"
|
|
38
|
+
role="option"
|
|
39
|
+
>
|
|
40
|
+
<i
|
|
41
|
+
aria-hidden="true"
|
|
42
|
+
class="upload icon"
|
|
43
|
+
/>
|
|
44
|
+
<span
|
|
45
|
+
class="text"
|
|
46
|
+
>
|
|
47
|
+
Upload Implementations
|
|
48
|
+
</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div
|
|
51
|
+
class="item"
|
|
52
|
+
role="option"
|
|
53
|
+
>
|
|
54
|
+
<i
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
class="upload icon"
|
|
57
|
+
/>
|
|
58
|
+
<span
|
|
59
|
+
class="text"
|
|
60
|
+
>
|
|
61
|
+
Upload rule results
|
|
62
|
+
</span>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
58
67
|
`;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<RuleResultsUpload /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="item"
|
|
7
|
+
role="option"
|
|
8
|
+
>
|
|
9
|
+
<i
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
class="upload icon"
|
|
12
|
+
/>
|
|
13
|
+
<span
|
|
14
|
+
class="text"
|
|
15
|
+
>
|
|
16
|
+
Upload rule results
|
|
17
|
+
</span>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
12
20
|
`;
|
package/src/messages/en.js
CHANGED
|
@@ -419,6 +419,7 @@ export default {
|
|
|
419
419
|
"ruleImplementation.props.system.placeholder": "System",
|
|
420
420
|
"ruleImplementation.props.type": "Type",
|
|
421
421
|
"ruleImplementation.props.type.placeholder": "Type",
|
|
422
|
+
"ruleImplementations.relation.new.header": "Link to Concept",
|
|
422
423
|
"ruleImplementation.summary.database": "Database",
|
|
423
424
|
"ruleImplementation.summary.dataset": "Dataset",
|
|
424
425
|
"ruleImplementation.summary.field": "Field",
|
|
@@ -561,6 +562,7 @@ export default {
|
|
|
561
562
|
"structureFields.dropdown.label": "Select Field",
|
|
562
563
|
"structureFields.dropdown.placeholder": "Fields",
|
|
563
564
|
"summary.link.and": "and",
|
|
565
|
+
"tabs.dq.implementation.links": "Link to concepts",
|
|
564
566
|
"tabs.dq.rule": "Rule",
|
|
565
567
|
"tabs.dq.rule.audit": "Audit",
|
|
566
568
|
"tabs.dq.ruleImplementation": "Implementation",
|
package/src/messages/es.js
CHANGED
|
@@ -5,7 +5,8 @@ export default {
|
|
|
5
5
|
"actions.prev": "Anterior",
|
|
6
6
|
"actions.save": "Guardar",
|
|
7
7
|
"actions.submit": "Guardar",
|
|
8
|
-
"alert.deleteRuleImplementation.failed.header":
|
|
8
|
+
"alert.deleteRuleImplementation.failed.header":
|
|
9
|
+
"Error al archivar implementación",
|
|
9
10
|
"alert.createExecutionGroup.success.content":
|
|
10
11
|
"Se ha solicitado la ejecución de {count} implementaciones",
|
|
11
12
|
"alert.createExecutionGroup.success.header": "Ejecuciones programadas",
|
|
@@ -27,7 +28,7 @@ export default {
|
|
|
27
28
|
"dataset.form.button.add_structure": "Añadir Estructura",
|
|
28
29
|
"datasetForm.implementation_key.tooltip":
|
|
29
30
|
"En caso de no introducir clave de implementación, se autogenerará al guardar la implementación",
|
|
30
|
-
|
|
31
|
+
executionGroup: "Ejecuciones",
|
|
31
32
|
"executions.completed.content": "Se han ejecutado {count} implementaciones.",
|
|
32
33
|
"executions.completed.header": "Ejecuciones finalizadas",
|
|
33
34
|
"executions.pending.content":
|
|
@@ -189,8 +190,10 @@ export default {
|
|
|
189
190
|
"rule.props.name": "Nombre",
|
|
190
191
|
"rule.props.type_params.placeholder": "Parametros a cumplimentar",
|
|
191
192
|
"rule.props.type_params": "Parametros",
|
|
192
|
-
"rule.props.type.placeholder": "Rango de valores",
|
|
193
193
|
"rule.props.type": "Tipo de regla",
|
|
194
|
+
"rule.props.type.placeholder": "Rango de valores",
|
|
195
|
+
"ruleImplementations.relation.new.header":
|
|
196
|
+
"Vas a vincular esta implementación a un término de glosario",
|
|
194
197
|
"rule.ruleImplementation.results.details.empty":
|
|
195
198
|
"No existen detalles para este resultado",
|
|
196
199
|
"rule.ruleImplementation.results.empty":
|
|
@@ -477,10 +480,12 @@ export default {
|
|
|
477
480
|
"ruleImplementations.actions.create": "Crear nueva implementación",
|
|
478
481
|
"ruleImplementations.actions.edit": "Editar implementación",
|
|
479
482
|
"ruleImplementations.actions.popup.deprecated": "Implementaciones Archivadas",
|
|
480
|
-
"ruleImplementations.events.action_created":
|
|
483
|
+
"ruleImplementations.events.action_created":
|
|
484
|
+
"Implementación creada en regla: {0}",
|
|
481
485
|
"ruleImplementations.events.action_changed": "Campo {0} actualizado a {1}",
|
|
482
486
|
"ruleImplementations.events.action_deprecated": "Implementación archivada",
|
|
483
|
-
"ruleImplementations.events.action_moved":
|
|
487
|
+
"ruleImplementations.events.action_moved":
|
|
488
|
+
"Implementación movida a la regla: {0}",
|
|
484
489
|
"ruleImplementations.events.action_restored": "Implementación restaurada",
|
|
485
490
|
"ruleImplementations.events.action_updated": "Implementación actualizada",
|
|
486
491
|
"ruleImplementations.header": "Implementaciones de calidad",
|
|
@@ -512,7 +517,8 @@ export default {
|
|
|
512
517
|
"ruleImplementations.props.status": "Estado",
|
|
513
518
|
"ruleImplementations.props.template": "Plantilla",
|
|
514
519
|
"ruleImplementations.props.rule_template": "Plantilla de regla",
|
|
515
|
-
"ruleImplementations.props.implementation_template":
|
|
520
|
+
"ruleImplementations.props.implementation_template":
|
|
521
|
+
"Plantilla de implementación",
|
|
516
522
|
"ruleImplementations.retrieved.results":
|
|
517
523
|
"{count} implementaciones encontradas",
|
|
518
524
|
"ruleImplementations.search.results.empty":
|
|
@@ -560,10 +566,12 @@ export default {
|
|
|
560
566
|
"rules.events.action_changed": "Campo {0} actualizado: {1}",
|
|
561
567
|
"rules.events.action_changed_to": "Campo {0} actualizado a {1}",
|
|
562
568
|
"rules.events.action_updated": "Regla actualizada",
|
|
563
|
-
"ruleImplementations.events.action_created":
|
|
569
|
+
"ruleImplementations.events.action_created":
|
|
570
|
+
"Implementación creada en regla: {0}",
|
|
564
571
|
"ruleImplementations.events.action_changed": "Campo {0} actualizado a {1}",
|
|
565
572
|
"ruleImplementations.events.action_deprecated": "Implementación archivada",
|
|
566
|
-
"ruleImplementations.events.action_moved":
|
|
573
|
+
"ruleImplementations.events.action_moved":
|
|
574
|
+
"Implementación movida a la regla: {0}",
|
|
567
575
|
"rules.retrieved.results": "{count} reglas encontradas",
|
|
568
576
|
"rules.search.placeholder": "Buscar reglas...",
|
|
569
577
|
"rules.searching": "Buscando...",
|
|
@@ -580,6 +588,7 @@ export default {
|
|
|
580
588
|
"structureFields.dropdown.label": "Seleccionar Campo",
|
|
581
589
|
"structureFields.dropdown.placeholder": "Campos",
|
|
582
590
|
"summary.link.and": "y",
|
|
591
|
+
"tabs.dq.implementation.links": "Conceptos relacionados",
|
|
583
592
|
"tabs.dq.rule": "Regla",
|
|
584
593
|
"tabs.dq.rule.audit": "Auditoría",
|
|
585
594
|
"tabs.dq.ruleImplementation.audit": "Auditoría",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearRuleImplementations,
|
|
3
|
+
fetchRuleImplementation,
|
|
4
|
+
} from "../../routines";
|
|
5
|
+
import { implementationActions } from "..";
|
|
6
|
+
|
|
7
|
+
const fooState = { foo: "bar" };
|
|
8
|
+
|
|
9
|
+
describe("reducers: implementationActions", () => {
|
|
10
|
+
const initialState = {};
|
|
11
|
+
|
|
12
|
+
it("should provide the initial state", () => {
|
|
13
|
+
expect(implementationActions(undefined, {})).toEqual(initialState);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should handle the clearRuleImplementations.TRIGGER action", () => {
|
|
17
|
+
expect(
|
|
18
|
+
implementationActions(fooState, {
|
|
19
|
+
type: clearRuleImplementations.TRIGGER,
|
|
20
|
+
})
|
|
21
|
+
).toEqual(initialState);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should handle the fetchRuleImplementation.SUCCESS action", () => {
|
|
25
|
+
const actions = { action1: { href: "1" } };
|
|
26
|
+
const payload = {
|
|
27
|
+
id: 2,
|
|
28
|
+
implementation_key: "xxx",
|
|
29
|
+
results: [],
|
|
30
|
+
_actions: actions,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
expect(
|
|
34
|
+
implementationActions(fooState, {
|
|
35
|
+
type: fetchRuleImplementation.SUCCESS,
|
|
36
|
+
payload,
|
|
37
|
+
})
|
|
38
|
+
).toMatchObject(actions);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("should ignore unknown actions", () => {
|
|
42
|
+
expect(implementationActions(fooState, { type: "FOO" })).toBe(fooState);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { deleteRelation } from "@truedat/lm/routines";
|
|
2
|
+
import {
|
|
3
|
+
clearRuleImplementation,
|
|
4
|
+
fetchRuleImplementation,
|
|
5
|
+
} from "../../routines";
|
|
6
|
+
import { implementationLinks } from "..";
|
|
7
|
+
|
|
8
|
+
const fooState = { foo: "bar" };
|
|
9
|
+
|
|
10
|
+
describe("reducers: implementationLinks", () => {
|
|
11
|
+
const initialState = [];
|
|
12
|
+
|
|
13
|
+
it("should provide the initial state", () => {
|
|
14
|
+
expect(implementationLinks(undefined, {})).toEqual(initialState);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should handle the clearRuleImplementation.TRIGGER action", () => {
|
|
18
|
+
expect(
|
|
19
|
+
implementationLinks(fooState, { type: clearRuleImplementation.TRIGGER })
|
|
20
|
+
).toEqual(initialState);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should handle the fetchRuleImplementation.TRIGGER action", () => {
|
|
24
|
+
expect(
|
|
25
|
+
implementationLinks(fooState, { type: fetchRuleImplementation.TRIGGER })
|
|
26
|
+
).toEqual(initialState);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should handle the fetchRuleImplementation.SUCCESS action", () => {
|
|
30
|
+
const links = [{ name: "link1" }, { name: "link2" }];
|
|
31
|
+
const data = {
|
|
32
|
+
id: 2,
|
|
33
|
+
implementation_key: "xxx",
|
|
34
|
+
results: [],
|
|
35
|
+
links,
|
|
36
|
+
};
|
|
37
|
+
const payload = { data };
|
|
38
|
+
|
|
39
|
+
expect(
|
|
40
|
+
implementationLinks(fooState, {
|
|
41
|
+
type: fetchRuleImplementation.SUCCESS,
|
|
42
|
+
payload,
|
|
43
|
+
})
|
|
44
|
+
).toMatchObject(links);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should filter deleted id on deleteRelation.SUCCESS action", () => {
|
|
48
|
+
const links = [{ id: "1" }, { id: "2" }];
|
|
49
|
+
const payload = { id: "1" };
|
|
50
|
+
|
|
51
|
+
expect(
|
|
52
|
+
implementationLinks(links, {
|
|
53
|
+
type: deleteRelation.SUCCESS,
|
|
54
|
+
payload,
|
|
55
|
+
})
|
|
56
|
+
).toMatchObject([{ id: "2" }]);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("should ignore unknown actions", () => {
|
|
60
|
+
expect(implementationLinks(fooState, { type: "FOO" })).toBe(fooState);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearRuleImplementations,
|
|
3
|
+
searchRuleImplementations,
|
|
4
|
+
} from "../../routines";
|
|
5
|
+
import {
|
|
6
|
+
implementationsActions,
|
|
7
|
+
initialState,
|
|
8
|
+
} from "../implementationsActions";
|
|
9
|
+
|
|
10
|
+
const fooState = { foo: "bar" };
|
|
11
|
+
const payload = {};
|
|
12
|
+
|
|
13
|
+
describe("reducers: implementationsActions", () => {
|
|
14
|
+
it("should provide the initial state", () => {
|
|
15
|
+
expect(implementationsActions(undefined, {})).toBe(initialState);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should be the initial state after receiving the clearRuleImplementations.TRIGGER action", () => {
|
|
19
|
+
expect(
|
|
20
|
+
implementationsActions(fooState, {
|
|
21
|
+
type: clearRuleImplementations.TRIGGER,
|
|
22
|
+
payload,
|
|
23
|
+
})
|
|
24
|
+
).toBe(initialState);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should be the initial state after receiving the searchRuleImplementations.TRIGGER action", () => {
|
|
28
|
+
expect(
|
|
29
|
+
implementationsActions(fooState, {
|
|
30
|
+
type: searchRuleImplementations.TRIGGER,
|
|
31
|
+
payload,
|
|
32
|
+
})
|
|
33
|
+
).toBe(initialState);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should extract _actions from the searchRuleImplementations.SUCCESS action", () => {
|
|
37
|
+
const _actions = { uploadResults: { foo: "bar" } };
|
|
38
|
+
const payload = { data: { _actions } };
|
|
39
|
+
expect(
|
|
40
|
+
implementationsActions(fooState, {
|
|
41
|
+
type: searchRuleImplementations.SUCCESS,
|
|
42
|
+
payload,
|
|
43
|
+
})
|
|
44
|
+
).toMatchObject(_actions);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should ignore unhandled actions", () => {
|
|
48
|
+
expect(implementationsActions(fooState, { type: "FOO" })).toBe(fooState);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { uploadResults } from "../../routines";
|
|
2
|
-
import {
|
|
2
|
+
import { resultsUploading } from "../resultsUploading";
|
|
3
3
|
|
|
4
4
|
const fooState = { foo: "bar" };
|
|
5
5
|
|
|
6
6
|
const initialState = false;
|
|
7
7
|
|
|
8
|
-
describe("reducers:
|
|
8
|
+
describe("reducers: resultsUploading", () => {
|
|
9
9
|
it("should provide the initial state", () => {
|
|
10
|
-
expect(
|
|
10
|
+
expect(resultsUploading(undefined, {})).toEqual(initialState);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it("should handle the uploadResults.TRIGGER action", () => {
|
|
14
14
|
expect(
|
|
15
|
-
|
|
15
|
+
resultsUploading(fooState, {
|
|
16
16
|
type: uploadResults.TRIGGER,
|
|
17
17
|
})
|
|
18
18
|
).toBeTruthy();
|
|
@@ -20,7 +20,7 @@ describe("reducers: uploadingResults", () => {
|
|
|
20
20
|
|
|
21
21
|
it("should handle the uploadResults.FULFILL action", () => {
|
|
22
22
|
expect(
|
|
23
|
-
|
|
23
|
+
resultsUploading(fooState, {
|
|
24
24
|
type: uploadResults.FULFILL,
|
|
25
25
|
})
|
|
26
26
|
).toBeFalsy();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import { clearRuleImplementations, fetchRuleImplementation } from "../routines";
|
|
3
|
+
|
|
4
|
+
const initialState = {};
|
|
5
|
+
|
|
6
|
+
const implementationActions = (state = initialState, { type, payload }) => {
|
|
7
|
+
switch (type) {
|
|
8
|
+
case fetchRuleImplementation.SUCCESS:
|
|
9
|
+
return _.pathOr(initialState, "_actions")(payload);
|
|
10
|
+
case clearRuleImplementations.TRIGGER:
|
|
11
|
+
return initialState;
|
|
12
|
+
default:
|
|
13
|
+
return state;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { implementationActions };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import { deleteRelation } from "@truedat/lm/routines";
|
|
3
|
+
import { clearRuleImplementation, fetchRuleImplementation } from "../routines";
|
|
4
|
+
|
|
5
|
+
const initialState = [];
|
|
6
|
+
|
|
7
|
+
const implementationLinks = (state = initialState, { type, payload }) => {
|
|
8
|
+
switch (type) {
|
|
9
|
+
case clearRuleImplementation.TRIGGER:
|
|
10
|
+
return initialState;
|
|
11
|
+
case fetchRuleImplementation.TRIGGER:
|
|
12
|
+
return initialState;
|
|
13
|
+
case fetchRuleImplementation.SUCCESS:
|
|
14
|
+
return _.pathOr([], "data.links")(payload);
|
|
15
|
+
case deleteRelation.SUCCESS:
|
|
16
|
+
return _.reject(payload)(state);
|
|
17
|
+
default:
|
|
18
|
+
return state;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { implementationLinks };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearRuleImplementations,
|
|
3
|
+
searchRuleImplementations,
|
|
4
|
+
} from "../routines";
|
|
5
|
+
|
|
6
|
+
export const initialState = null;
|
|
7
|
+
|
|
8
|
+
export const implementationsActions = (
|
|
9
|
+
state = initialState,
|
|
10
|
+
{ type, payload }
|
|
11
|
+
) => {
|
|
12
|
+
switch (type) {
|
|
13
|
+
case clearRuleImplementations.TRIGGER:
|
|
14
|
+
return initialState;
|
|
15
|
+
case searchRuleImplementations.TRIGGER:
|
|
16
|
+
return initialState;
|
|
17
|
+
case searchRuleImplementations.SUCCESS:
|
|
18
|
+
return payload?.data?._actions || initialState;
|
|
19
|
+
default:
|
|
20
|
+
return state;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default implementationsActions;
|
package/src/reducers/index.js
CHANGED
|
@@ -3,9 +3,13 @@ import { conceptRulesActions } from "./conceptRulesActions";
|
|
|
3
3
|
import { conceptRulesLoading } from "./conceptRulesLoading";
|
|
4
4
|
import { deletionQuery } from "./deletionQuery";
|
|
5
5
|
import { dqMessage } from "./dqMessage";
|
|
6
|
-
import { previousRuleImplementationQuery } from "./previousRuleImplementationQuery";
|
|
7
|
-
import { executionGroupLoading } from "./executionGroupLoading";
|
|
8
6
|
import { executionGroup } from "./executionGroup";
|
|
7
|
+
import { implementationLinks } from "./implementationLinks";
|
|
8
|
+
import { implementationActions } from "./implementationActions";
|
|
9
|
+
import { executionGroupLoading } from "./executionGroupLoading";
|
|
10
|
+
import { implementationsActions } from "./implementationsActions";
|
|
11
|
+
import { previousRuleImplementationQuery } from "./previousRuleImplementationQuery";
|
|
12
|
+
import { resultsUploading } from "./resultsUploading";
|
|
9
13
|
import { rule } from "./rule";
|
|
10
14
|
import { ruleActions } from "./ruleActions";
|
|
11
15
|
import { ruleActiveFilters } from "./ruleActiveFilters";
|
|
@@ -14,6 +18,7 @@ import { ruleCreating } from "./ruleCreating";
|
|
|
14
18
|
import { ruleFilters } from "./ruleFilters";
|
|
15
19
|
import { ruleFiltersLoading } from "./ruleFiltersLoading";
|
|
16
20
|
import { ruleImplementation } from "./ruleImplementation";
|
|
21
|
+
import { ruleImplementationActiveFilters } from "./ruleImplementationActiveFilters";
|
|
17
22
|
import { ruleImplementationCount } from "./ruleImplementationCount";
|
|
18
23
|
import { ruleImplementationCreating } from "./ruleImplementationCreating";
|
|
19
24
|
import { ruleImplementationFilters } from "./ruleImplementationFilters";
|
|
@@ -26,7 +31,6 @@ import { ruleImplementationSaving } from "./ruleImplementationSaving";
|
|
|
26
31
|
import { ruleImplementationSelectedFilter } from "./ruleImplementationSelectedFilter";
|
|
27
32
|
import { ruleImplementations } from "./ruleImplementations";
|
|
28
33
|
import { ruleImplementationsDownloading } from "./ruleImplementationsDownloading";
|
|
29
|
-
import { ruleImplementationActiveFilters } from "./ruleImplementationActiveFilters";
|
|
30
34
|
import { ruleImplementationsLoading } from "./ruleImplementationsLoading";
|
|
31
35
|
import { ruleImplementationsPageSize } from "./ruleImplementationsPageSize";
|
|
32
36
|
import { ruleLoading } from "./ruleLoading";
|
|
@@ -39,10 +43,9 @@ import { rulesLoading } from "./rulesLoading";
|
|
|
39
43
|
import { rulesPageSize } from "./rulesPageSize";
|
|
40
44
|
import { uploadingImplementationsFile } from "./uploadingImplementationsFile";
|
|
41
45
|
import { uploadingRulesFile } from "./uploadingRulesFile";
|
|
46
|
+
import { userImplementationsPermissions } from "./userImplementationsPermissions";
|
|
42
47
|
import { userRulePermissions } from "./userRulePermissions";
|
|
43
48
|
import { userRulesPermissions } from "./userRulesPermissions";
|
|
44
|
-
import { userImplementationsPermissions } from "./userImplementationsPermissions";
|
|
45
|
-
import { uploadingResults } from "./uploadingResults";
|
|
46
49
|
|
|
47
50
|
export {
|
|
48
51
|
conceptRules,
|
|
@@ -50,9 +53,13 @@ export {
|
|
|
50
53
|
conceptRulesLoading,
|
|
51
54
|
deletionQuery,
|
|
52
55
|
dqMessage,
|
|
53
|
-
previousRuleImplementationQuery,
|
|
54
|
-
executionGroupLoading,
|
|
55
56
|
executionGroup,
|
|
57
|
+
implementationLinks,
|
|
58
|
+
implementationActions,
|
|
59
|
+
executionGroupLoading,
|
|
60
|
+
implementationsActions,
|
|
61
|
+
previousRuleImplementationQuery,
|
|
62
|
+
resultsUploading,
|
|
56
63
|
rule,
|
|
57
64
|
ruleActions,
|
|
58
65
|
ruleActiveFilters,
|
|
@@ -84,10 +91,9 @@ export {
|
|
|
84
91
|
rules,
|
|
85
92
|
rulesLoading,
|
|
86
93
|
rulesPageSize,
|
|
87
|
-
uploadingRulesFile,
|
|
88
94
|
uploadingImplementationsFile,
|
|
95
|
+
uploadingRulesFile,
|
|
96
|
+
userImplementationsPermissions,
|
|
89
97
|
userRulePermissions,
|
|
90
98
|
userRulesPermissions,
|
|
91
|
-
userImplementationsPermissions,
|
|
92
|
-
uploadingResults,
|
|
93
99
|
};
|
|
@@ -2,7 +2,7 @@ import { uploadResults } from "../routines";
|
|
|
2
2
|
|
|
3
3
|
const initialState = false;
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const resultsUploading = (state = initialState, { type }) => {
|
|
6
6
|
switch (type) {
|
|
7
7
|
case uploadResults.TRIGGER:
|
|
8
8
|
return true;
|
|
@@ -13,4 +13,4 @@ export const uploadingResults = (state = initialState, { type }) => {
|
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export default
|
|
16
|
+
export default resultsUploading;
|