@truedat/dq 4.44.0 → 4.44.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/package.json +5 -5
  3. package/src/components/EditRule.js +1 -1
  4. package/src/components/ExecutionForm.js +68 -78
  5. package/src/components/ExecutionPopup.js +10 -6
  6. package/src/components/ImplementationCrumbs.js +91 -0
  7. package/src/components/ImplementationResultBar.js +1 -2
  8. package/src/components/ImplementationStructures.js +1 -3
  9. package/src/components/Implementations.js +9 -2
  10. package/src/components/ImplementationsRoutes.js +386 -17
  11. package/src/components/NewRule.js +1 -1
  12. package/src/components/NewRuleImplementation.js +99 -135
  13. package/src/components/RemediationCrumbs.js +1 -2
  14. package/src/components/RemediationForm.js +32 -43
  15. package/src/components/RuleCrumbs.js +6 -63
  16. package/src/components/RuleForm.js +102 -103
  17. package/src/components/RuleImplementation.js +35 -40
  18. package/src/components/RuleImplementationActions.js +19 -23
  19. package/src/components/RuleImplementationLink.js +2 -3
  20. package/src/components/RuleImplementationProperties.js +13 -14
  21. package/src/components/RuleImplementationResultTabs.js +27 -35
  22. package/src/components/RuleImplementationResults.js +1 -6
  23. package/src/components/RuleImplementationResultsLink.js +3 -9
  24. package/src/components/RuleImplementationTabs.js +13 -18
  25. package/src/components/RuleImplementationsActions.js +48 -2
  26. package/src/components/RuleLink.js +3 -4
  27. package/src/components/RuleResultRow.js +1 -6
  28. package/src/components/RuleResultSegmentRow.js +0 -3
  29. package/src/components/RuleResultSegments.js +2 -6
  30. package/src/components/RuleResultsRoutes.js +45 -60
  31. package/src/components/RuleRoutes.js +41 -334
  32. package/src/components/RulesRoutes.js +0 -5
  33. package/src/components/__tests__/ExecutionForm.spec.js +7 -1
  34. package/src/components/__tests__/ExecutionPopup.spec.js +3 -2
  35. package/src/components/__tests__/ImplementationResultBar.spec.js +44 -63
  36. package/src/components/__tests__/InformationSummary.spec.js +2 -6
  37. package/src/components/__tests__/NewRuleImplementation.spec.js +4 -6
  38. package/src/components/__tests__/RemediationForm.spec.js +47 -58
  39. package/src/components/__tests__/RuleForm.spec.js +80 -207
  40. package/src/components/__tests__/RuleImplementation.spec.js +45 -22
  41. package/src/components/__tests__/RuleImplementationsActions.spec.js +0 -1
  42. package/src/components/__tests__/RuleImplementationsOptions.spec.js +1 -10
  43. package/src/components/__tests__/RuleResultsUpload.spec.js +1 -5
  44. package/src/components/__tests__/RuleSummary.spec.js +6 -11
  45. package/src/components/__tests__/__snapshots__/EditRule.spec.js.snap +1 -1
  46. package/src/components/__tests__/__snapshots__/ExecutionForm.spec.js.snap +1 -2
  47. package/src/components/__tests__/__snapshots__/ImplementationResultBar.spec.js.snap +5 -5
  48. package/src/components/__tests__/__snapshots__/NewRule.spec.js.snap +1 -1
  49. package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +3 -0
  50. package/src/components/__tests__/__snapshots__/RemediationForm.spec.js.snap +2 -3
  51. package/src/components/__tests__/__snapshots__/RuleCrumbs.spec.js.snap +2 -73
  52. package/src/components/__tests__/__snapshots__/RuleForm.spec.js.snap +699 -385
  53. package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +20 -33
  54. package/src/components/__tests__/__snapshots__/RuleImplementationResultTabs.spec.js.snap +1 -1
  55. package/src/components/__tests__/__snapshots__/RuleImplementationResults.spec.js.snap +0 -7
  56. package/src/components/__tests__/__snapshots__/RuleImplementationResultsLink.spec.js.snap +1 -1
  57. package/src/components/__tests__/__snapshots__/RuleImplementationTabs.spec.js.snap +5 -5
  58. package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +1 -1
  59. package/src/components/index.js +0 -2
  60. package/src/components/ruleImplementationForm/InformationForm.js +51 -74
  61. package/src/components/ruleImplementationForm/RuleImplementationForm.js +52 -47
  62. package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +76 -98
  63. package/src/components/ruleImplementationForm/__tests__/LimitsForm.spec.js +9 -35
  64. package/src/components/ruleImplementationForm/__tests__/RuleImplementationForm.spec.js +26 -51
  65. package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +42 -2
  66. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +88 -17
  67. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationRawForm.spec.js.snap +12 -1
  68. package/src/messages/en.js +7 -6
  69. package/src/messages/es.js +7 -6
  70. package/src/reducers/__tests__/ruleImplementationRedirect.spec.js +2 -2
  71. package/src/reducers/__tests__/ruleRedirect.spec.js +3 -3
  72. package/src/reducers/ruleImplementation.js +3 -0
  73. package/src/reducers/ruleImplementationRedirect.js +7 -6
  74. package/src/reducers/ruleRedirect.js +4 -2
  75. package/src/reducers/userRulePermissions.js +3 -1
  76. package/src/sagas/__tests__/deleteRuleResult.spec.js +3 -5
  77. package/src/sagas/__tests__/setRuleImplementationStatus.spec.js +7 -4
  78. package/src/sagas/deleteRuleResult.js +2 -7
  79. package/src/sagas/setRuleImplementationStatus.js +7 -1
  80. package/src/components/DynamicRuleForm.js +0 -78
  81. package/src/components/__tests__/DynamicRuleForm.spec.js +0 -51
  82. package/src/components/__tests__/__snapshots__/DynamicRuleForm.spec.js.snap +0 -3
package/CHANGELOG.md CHANGED
@@ -1,10 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.44.3] 2022-05-11
4
+
5
+ ### Added
6
+
7
+ - [TD-4045] Implementation execution button in implementation view
8
+
9
+ ## [4.44.2] 2022-05-11
10
+
11
+ ### Fixed
12
+
13
+ - [TD-4089] Segments tab was not displaying segments
14
+
15
+ ## [4.44.1] 2022-05-11
16
+
17
+ ### Added
18
+
19
+ - [TD-4089] Support for Implementations without Rules
20
+
3
21
  ## [4.43.5] 2022-05-05
4
22
 
5
23
  # Added
6
24
 
7
- - [TD-4538] Add more coding for segments configuration and segment results for implementations
25
+ - [TD-4538] Add more coding for segments configuration and segment results for
26
+ implementations
8
27
 
9
28
  ## [4.43.3] 2022-05-04
10
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.44.0",
3
+ "version": "4.44.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.44.0",
34
+ "@truedat/test": "4.44.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.44.0",
86
- "@truedat/df": "4.44.0",
85
+ "@truedat/core": "4.44.3",
86
+ "@truedat/df": "4.44.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": "55fd4a8be70ca0d1bd4f3cb7b5eaf073b0350029"
106
+ "gitHead": "d5e72d523389c6e66d6f7168d7e3546b5d2ffdda"
107
107
  }
@@ -15,7 +15,7 @@ export const EditRule = ({ rule, updateRule }) =>
15
15
  <FormattedMessage id="quality.actions.edit" />
16
16
  </Header.Content>
17
17
  </Header>
18
- <RuleForm handleSubmit={updateRule} rule={rule} editMode />
18
+ <RuleForm onSubmit={updateRule} rule={rule} editMode />
19
19
  </Container>
20
20
  );
21
21
 
@@ -1,48 +1,35 @@
1
1
  import _ from "lodash/fp";
2
- import React, { Suspense, useState } from "react";
2
+ import React, { useState } from "react";
3
+ import { Button, Form, Header } from "semantic-ui-react";
3
4
  import PropTypes from "prop-types";
4
- import { connect } from "react-redux";
5
5
  import { useIntl } from "react-intl";
6
- import { Button, Form, Header } from "semantic-ui-react";
6
+ import { TemplateSelector } from "@truedat/core/components";
7
7
  import { validateContent } from "@truedat/df/utils";
8
- import { selectTemplate } from "@truedat/df/routines";
9
-
10
- const TemplateSelector = React.lazy(() =>
11
- import("@truedat/df/templates/components/TemplateSelector")
12
- );
13
-
14
- const TemplateLoader = React.lazy(() =>
15
- import("@truedat/df/templates/components/TemplateLoader")
16
- );
17
8
 
18
9
  const DynamicForm = React.lazy(() =>
19
10
  import("@truedat/df/components/DynamicForm")
20
11
  );
21
12
 
22
- export const ExecutionForm = ({
23
- count,
24
- selectTemplate,
25
- template,
26
- templates,
27
- handleSubmit,
28
- onCancel,
29
- }) => {
13
+ export const ExecutionForm = ({ count, onSubmit, onCancel }) => {
30
14
  const { formatMessage } = useIntl();
31
15
  const [content, setContent] = useState({});
16
+ const [template, setTemplate] = useState();
17
+ const [templatesLoading, setTemplatesLoading] = useState(true);
32
18
 
33
19
  const handleContentChange = (content) => setContent(content);
34
20
 
35
- const handleTemplateSelected = (e, { value }) =>
36
- selectTemplate({ id: value });
21
+ const handleTemplatesLoaded = ({ templates }) => {
22
+ setTemplatesLoading(false);
23
+ if (templates?.length === 1) {
24
+ setTemplate(templates[0]);
25
+ }
26
+ };
27
+
28
+ const handleTemplateSelected = (e, { template }) => setTemplate(template);
37
29
 
38
30
  const isInvalid = () =>
39
31
  template && !_.isEmpty(validateContent(template)(content));
40
32
 
41
- if (_.size(templates) == 1) {
42
- const id = _.flow(_.head, _.prop("id"))(templates);
43
- selectTemplate({ id });
44
- }
45
-
46
33
  return (
47
34
  <>
48
35
  <Header
@@ -51,66 +38,69 @@ export const ExecutionForm = ({
51
38
  id: "implementations.actions.execution.confirmation.header",
52
39
  })}
53
40
  />
54
- <Suspense fallback={null}>
55
- <Form>
56
- <TemplateLoader scope="qe" />
57
- {_.size(templates) > 1 && (
58
- <TemplateSelector
59
- name="template"
60
- selectedValue={_.prop("id")(template)}
61
- onChange={handleTemplateSelected}
62
- isOptional={true}
41
+ <Form loading={templatesLoading}>
42
+ <TemplateSelector
43
+ scope="qe"
44
+ selectedValue={template?.id}
45
+ onChange={handleTemplateSelected}
46
+ onLoad={handleTemplatesLoaded}
47
+ clearable
48
+ />
49
+ {template?.id ? (
50
+ <>
51
+ <Header
52
+ as="h3"
53
+ content={formatMessage({
54
+ id: "implementations.actions.execution.confirmation.legend",
55
+ })}
63
56
  />
64
- )}
65
- {template && template.id && (
66
- <>
67
- <Header
68
- as="h3"
69
- content={formatMessage({
70
- id: "implementations.actions.execution.confirmation.legend",
71
- })}
57
+ <div
58
+ style={{
59
+ maxHeight: "calc(100vh - 550px)",
60
+ overflowY: "auto",
61
+ }}
62
+ >
63
+ <DynamicForm
64
+ onChange={handleContentChange}
65
+ content={content}
66
+ template={template}
72
67
  />
73
- <div
74
- style={{ maxHeight: "calc(100vh - 550px)", overflowY: "auto" }}
75
- >
76
- <DynamicForm onChange={handleContentChange} content={content} />
77
- </div>
78
- </>
68
+ </div>
69
+ </>
70
+ ) : null}
71
+ <p>
72
+ {formatMessage(
73
+ {
74
+ id:
75
+ count === 1
76
+ ? "implementation.actions.execution.confirmation.content"
77
+ : "implementations.actions.execution.confirmation.content",
78
+ },
79
+ { implementations_count: count }
79
80
  )}
80
- <p>
81
- {formatMessage(
82
- { id: "implementations.actions.execution.confirmation.content" },
83
- { implementations_count: count }
84
- )}
85
- </p>
86
- <div className="actions">
87
- <Button
88
- secondary
89
- onClick={onCancel}
90
- content={formatMessage({ id: "actions.cancel" })}
91
- />
92
- <Button
93
- primary
94
- disabled={isInvalid()}
95
- onClick={() => handleSubmit(content)}
96
- content={formatMessage({ id: "actions.create" })}
97
- />
98
- </div>
99
- </Form>
100
- </Suspense>
81
+ </p>
82
+ <div className="actions">
83
+ <Button
84
+ secondary
85
+ onClick={onCancel}
86
+ content={formatMessage({ id: "actions.cancel" })}
87
+ />
88
+ <Button
89
+ primary
90
+ disabled={isInvalid()}
91
+ onClick={() => onSubmit(content)}
92
+ content={formatMessage({ id: "actions.create" })}
93
+ />
94
+ </div>
95
+ </Form>
101
96
  </>
102
97
  );
103
98
  };
104
99
 
105
100
  ExecutionForm.propTypes = {
106
101
  count: PropTypes.number,
107
- template: PropTypes.object,
108
- templates: PropTypes.array,
109
- selectTemplate: PropTypes.func,
110
- handleSubmit: PropTypes.func,
102
+ onSubmit: PropTypes.func,
111
103
  onCancel: PropTypes.func,
112
104
  };
113
105
 
114
- const mapStateToProps = _.pick(["templates", "template"]);
115
-
116
- export default connect(mapStateToProps, { selectTemplate })(ExecutionForm);
106
+ export default ExecutionForm;
@@ -1,4 +1,3 @@
1
- import _ from "lodash/fp";
2
1
  import React, { useState } from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { connect } from "react-redux";
@@ -10,7 +9,7 @@ export const ExecutionPopup = ({
10
9
  disabled,
11
10
  executionGroupLoading,
12
11
  count,
13
- handleSubmit,
12
+ onSubmit,
14
13
  }) => {
15
14
  const { formatMessage } = useIntl();
16
15
  const [open, setOpen] = useState(false);
@@ -32,14 +31,17 @@ export const ExecutionPopup = ({
32
31
  disabled={disabled}
33
32
  loading={executionGroupLoading}
34
33
  content={formatMessage({
35
- id: "implementations.actions.do_execution",
34
+ id:
35
+ count === 1
36
+ ? "implementation.actions.do_execution"
37
+ : "implementations.actions.do_execution",
36
38
  })}
37
39
  />
38
40
  }
39
41
  >
40
42
  <ExecutionForm
41
43
  count={count}
42
- handleSubmit={handleSubmit}
44
+ onSubmit={onSubmit}
43
45
  onCancel={() => setOpen(false)}
44
46
  />
45
47
  </Popup>
@@ -50,9 +52,11 @@ ExecutionPopup.propTypes = {
50
52
  count: PropTypes.number,
51
53
  disabled: PropTypes.bool,
52
54
  executionGroupLoading: PropTypes.bool,
53
- handleSubmit: PropTypes.func,
55
+ onSubmit: PropTypes.func,
54
56
  };
55
57
 
56
- const mapStateToProps = _.pick(["executionGroupLoading"]);
58
+ const mapStateToProps = ({ executionGroupLoading }) => ({
59
+ executionGroupLoading,
60
+ });
57
61
 
58
62
  export default connect(mapStateToProps)(ExecutionPopup);
@@ -0,0 +1,91 @@
1
+ import _ from "lodash/fp";
2
+ import React from "react";
3
+ import PropTypes from "prop-types";
4
+ import { Breadcrumb } from "semantic-ui-react";
5
+ import { connect } from "react-redux";
6
+ import { Link, useParams } from "react-router-dom";
7
+ import { FormattedMessage } from "react-intl";
8
+ import { RULES, IMPLEMENTATIONS, linkTo } from "@truedat/core/routes";
9
+ import { DateTime } from "@truedat/core/components";
10
+
11
+ export const ImplementationCrumbs = ({ ruleImplementation }) => {
12
+ const { rule_result_id } = useParams();
13
+ const rule = _.get("rule")(ruleImplementation);
14
+
15
+ const ruleResultDate = _.flow(
16
+ _.propOr([], "results"),
17
+ _.find(_.propEq("id", _.toNumber(rule_result_id))),
18
+ _.pathOr("0000-00-00 00:00", "date")
19
+ )(ruleImplementation);
20
+
21
+ return (
22
+ <Breadcrumb>
23
+ {rule ? (
24
+ <>
25
+ <Breadcrumb.Section as={Link} to={RULES} active={false}>
26
+ <FormattedMessage id="rules.crumbs.top" />
27
+ </Breadcrumb.Section>
28
+ {rule.name && (
29
+ <>
30
+ <Breadcrumb.Divider icon="right angle" />
31
+ {ruleImplementation.id ? (
32
+ <Breadcrumb.Section
33
+ as={Link}
34
+ to={linkTo.RULE({ id: ruleImplementation.rule_id })}
35
+ active={_.isEmpty(ruleImplementation)}
36
+ >
37
+ {rule.name}
38
+ </Breadcrumb.Section>
39
+ ) : (
40
+ <Breadcrumb.Section active>{rule.name}</Breadcrumb.Section>
41
+ )}
42
+ </>
43
+ )}
44
+ </>
45
+ ) : (
46
+ <Breadcrumb.Section as={Link} to={IMPLEMENTATIONS} active={false}>
47
+ <FormattedMessage id="implementations.crumbs.top" />
48
+ </Breadcrumb.Section>
49
+ )}
50
+
51
+ {ruleImplementation.id && (
52
+ <>
53
+ <Breadcrumb.Divider icon="right angle" />
54
+ {rule_result_id ? (
55
+ <Breadcrumb.Section
56
+ as={Link}
57
+ to={linkTo.IMPLEMENTATION({
58
+ implementation_id: ruleImplementation.id,
59
+ })}
60
+ active={_.isEmpty(ruleImplementation)}
61
+ >
62
+ {ruleImplementation.implementation_key}
63
+ </Breadcrumb.Section>
64
+ ) : (
65
+ <Breadcrumb.Section active>
66
+ {ruleImplementation.implementation_key}
67
+ </Breadcrumb.Section>
68
+ )}
69
+ </>
70
+ )}
71
+ {rule_result_id && (
72
+ <>
73
+ <Breadcrumb.Divider icon="right angle" />
74
+ <Breadcrumb.Section active>
75
+ {<DateTime value={ruleResultDate} />}
76
+ </Breadcrumb.Section>
77
+ </>
78
+ )}
79
+ </Breadcrumb>
80
+ );
81
+ };
82
+
83
+ ImplementationCrumbs.propTypes = {
84
+ ruleImplementation: PropTypes.object,
85
+ };
86
+
87
+ const mapStateToProps = ({ rule, ruleImplementation }) => ({
88
+ rule,
89
+ ruleImplementation,
90
+ });
91
+ export default connect(mapStateToProps)(ImplementationCrumbs);
@@ -52,8 +52,7 @@ export default function ImplementationResultBar({ implementation }) {
52
52
  <Link
53
53
  as="div"
54
54
  className="rule-summary pointer"
55
- to={linkTo.RULE_IMPLEMENTATION_RESULTS({
56
- id: implementation.rule_id,
55
+ to={linkTo.IMPLEMENTATION_RESULTS({
57
56
  implementation_id: implementation.id,
58
57
  })}
59
58
  >
@@ -74,20 +74,18 @@ export const ImplementationStructures = ({ implementation, canCreateLink }) => {
74
74
  />
75
75
  ));
76
76
 
77
- const id = _.prop("rule_id")(implementation);
78
77
  const implementation_id = _.prop("id")(implementation);
79
78
 
80
79
  return (
81
80
  <Segment attached="bottom">
82
81
  <Grid>
83
- {id && canCreateLink && (
82
+ {implementation_id && canCreateLink && (
84
83
  <Grid.Column width={16}>
85
84
  <Button
86
85
  floated="right"
87
86
  primary
88
87
  as={Link}
89
88
  to={linkTo.IMPLEMENTATION_STRUCTURES_NEW({
90
- id,
91
89
  implementation_id,
92
90
  })}
93
91
  content={<FormattedMessage id="links.actions.create" />}
@@ -78,9 +78,10 @@ export const Implementations = ({
78
78
  deletedRender,
79
79
  setRuleImplementationStatus,
80
80
  manageRuleImplementationAction,
81
+ rule,
81
82
  }) => {
82
83
  const handleStatusChange = (id, mode) =>
83
- setRuleImplementationStatus({ id, ...mode });
84
+ setRuleImplementationStatus({ id, ruleId: rule?.id, ...mode });
84
85
  const additionalColumns = manageRuleImplementationAction
85
86
  ? [<Table.HeaderCell key={"status"} width={1} />]
86
87
  : [];
@@ -107,13 +108,19 @@ Implementations.propTypes = {
107
108
  deletedRender: PropTypes.bool,
108
109
  setRuleImplementationStatus: PropTypes.func,
109
110
  manageRuleImplementationAction: PropTypes.bool,
111
+ rule: PropTypes.object,
110
112
  };
111
113
 
112
- const mapStateToProps = ({ ruleImplementations, userRulePermissions }) => ({
114
+ const mapStateToProps = ({
115
+ ruleImplementations,
116
+ userRulePermissions,
117
+ rule,
118
+ }) => ({
113
119
  ruleImplementations,
114
120
  manageRuleImplementationAction: _.prop("manage_quality_rule_implementations")(
115
121
  userRulePermissions
116
122
  ),
123
+ rule,
117
124
  });
118
125
 
119
126
  export default connect(mapStateToProps, { setRuleImplementationStatus })(