@truedat/dq 4.40.1 → 4.40.4
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 +6 -0
- package/package.json +5 -5
- package/src/components/RuleImplementationTabs.js +28 -3
- package/src/components/RuleImplementationsTable.js +5 -2
- package/src/components/RuleRoutes.js +48 -5
- package/src/components/__tests__/RuleImplementation.spec.js +10 -8
- package/src/components/__tests__/RuleImplementationTabs.spec.js +31 -0
- package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +6 -0
- package/src/components/__tests__/__snapshots__/RuleImplementationTabs.spec.js.snap +34 -0
- 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/implementationActions.js +17 -0
- package/src/reducers/implementationLinks.js +22 -0
- package/src/reducers/index.js +4 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.40.
|
|
3
|
+
"version": "4.40.4",
|
|
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.4",
|
|
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.4",
|
|
86
|
+
"@truedat/df": "4.40.4",
|
|
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": "e9f62f91507d810f91963967a5f3afa20100c1b9"
|
|
107
107
|
}
|
|
@@ -8,14 +8,20 @@ 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,
|
|
16
17
|
} from "@truedat/core/routes";
|
|
17
18
|
|
|
18
|
-
export const RuleImplementationTabs = ({
|
|
19
|
+
export const RuleImplementationTabs = ({
|
|
20
|
+
rule,
|
|
21
|
+
ruleImplementation,
|
|
22
|
+
match,
|
|
23
|
+
canCreateLink,
|
|
24
|
+
}) => {
|
|
19
25
|
const latest_rule_id = _.flow(
|
|
20
26
|
_.pathOr([], "results"),
|
|
21
27
|
_.head,
|
|
@@ -37,6 +43,19 @@ export const RuleImplementationTabs = ({ rule, ruleImplementation, match }) => {
|
|
|
37
43
|
>
|
|
38
44
|
<FormattedMessage id="tabs.dq.ruleImplementation" />
|
|
39
45
|
</Menu.Item>
|
|
46
|
+
|
|
47
|
+
{canCreateLink && (
|
|
48
|
+
<Menu.Item
|
|
49
|
+
active={match.path === IMPLEMENTATION_CONCEPT_LINKS}
|
|
50
|
+
as={Link}
|
|
51
|
+
to={linkTo.IMPLEMENTATION_CONCEPT_LINKS({
|
|
52
|
+
id: rule.id,
|
|
53
|
+
implementation_id: ruleImplementation.id,
|
|
54
|
+
})}
|
|
55
|
+
>
|
|
56
|
+
<FormattedMessage id="tabs.dq.implementation.links" />
|
|
57
|
+
</Menu.Item>
|
|
58
|
+
)}
|
|
40
59
|
<Menu.Item
|
|
41
60
|
active={match.path === RULE_IMPLEMENTATION_RESULTS}
|
|
42
61
|
as={Link}
|
|
@@ -78,11 +97,17 @@ RuleImplementationTabs.propTypes = {
|
|
|
78
97
|
rule: PropTypes.object,
|
|
79
98
|
ruleImplementation: PropTypes.object,
|
|
80
99
|
match: PropTypes.object,
|
|
100
|
+
canCreateLink: PropTypes.bool,
|
|
81
101
|
};
|
|
82
102
|
|
|
83
|
-
const mapStateToProps = ({
|
|
103
|
+
const mapStateToProps = ({
|
|
104
|
+
rule,
|
|
105
|
+
ruleImplementation,
|
|
106
|
+
implementationActions,
|
|
107
|
+
}) => ({
|
|
84
108
|
rule,
|
|
85
109
|
ruleImplementation,
|
|
110
|
+
canCreateLink: _.propOr(false, "link_concept")(implementationActions),
|
|
86
111
|
});
|
|
87
112
|
|
|
88
113
|
export default compose(
|
|
@@ -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
|
});
|
|
@@ -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}
|
|
@@ -14,21 +14,23 @@ const state = {
|
|
|
14
14
|
manage_quality_rule_implementations: true,
|
|
15
15
|
manage_quality_rules: true,
|
|
16
16
|
},
|
|
17
|
+
implementationActions: { link_concept: true },
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
const renderOpts = {
|
|
20
21
|
messages: {
|
|
21
22
|
en: {
|
|
22
|
-
"
|
|
23
|
-
"tabs.dq.ruleImplementation": "implementation",
|
|
24
|
-
"tabs.dq.ruleImplementation.audit": "events",
|
|
23
|
+
"quality.result.no.data": "No information about quality",
|
|
25
24
|
"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
25
|
"ruleImplementation.actions.delete.confirmation.content": "confirm",
|
|
31
|
-
"
|
|
26
|
+
"ruleImplementation.actions.delete.confirmation.header": "header",
|
|
27
|
+
"ruleImplementation.actions.deprecate": "archive",
|
|
28
|
+
"ruleImplementation.actions.edit": "edit",
|
|
29
|
+
"ruleImplementation.actions.move": "move",
|
|
30
|
+
"tabs.dq.implementation.links": "Related concepts",
|
|
31
|
+
"tabs.dq.ruleImplementation.audit": "events",
|
|
32
|
+
"tabs.dq.ruleImplementation.results": "results",
|
|
33
|
+
"tabs.dq.ruleImplementation": "implementation",
|
|
32
34
|
},
|
|
33
35
|
},
|
|
34
36
|
state,
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
canCreateLink: true,
|
|
23
|
+
};
|
|
24
|
+
it("matches the latest snapshot", () => {
|
|
25
|
+
const { container } = render(
|
|
26
|
+
<RuleImplementationTabs {...props} />,
|
|
27
|
+
renderOpts
|
|
28
|
+
);
|
|
29
|
+
expect(container).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -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
|
+
`;
|
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,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 };
|
package/src/reducers/index.js
CHANGED
|
@@ -4,6 +4,8 @@ import { conceptRulesLoading } from "./conceptRulesLoading";
|
|
|
4
4
|
import { deletionQuery } from "./deletionQuery";
|
|
5
5
|
import { dqMessage } from "./dqMessage";
|
|
6
6
|
import { executionGroup } from "./executionGroup";
|
|
7
|
+
import { implementationLinks } from "./implementationLinks";
|
|
8
|
+
import { implementationActions } from "./implementationActions";
|
|
7
9
|
import { executionGroupLoading } from "./executionGroupLoading";
|
|
8
10
|
import { implementationsActions } from "./implementationsActions";
|
|
9
11
|
import { previousRuleImplementationQuery } from "./previousRuleImplementationQuery";
|
|
@@ -52,6 +54,8 @@ export {
|
|
|
52
54
|
deletionQuery,
|
|
53
55
|
dqMessage,
|
|
54
56
|
executionGroup,
|
|
57
|
+
implementationLinks,
|
|
58
|
+
implementationActions,
|
|
55
59
|
executionGroupLoading,
|
|
56
60
|
implementationsActions,
|
|
57
61
|
previousRuleImplementationQuery,
|