@truedat/dq 4.44.2 → 4.44.5

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 (58) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/package.json +24 -17
  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/NewRule.js +1 -1
  7. package/src/components/NewRuleImplementation.js +85 -128
  8. package/src/components/RemediationForm.js +26 -64
  9. package/src/components/RemediationPlan.js +1 -1
  10. package/src/components/RuleFilters.js +1 -5
  11. package/src/components/RuleForm.js +76 -116
  12. package/src/components/RuleImplementation.js +29 -13
  13. package/src/components/RuleImplementationActions.js +11 -21
  14. package/src/components/RuleImplementationFilters.js +1 -5
  15. package/src/components/RuleImplementationsActions.js +1 -1
  16. package/src/components/RuleResultsRoutes.js +41 -56
  17. package/src/components/RuleRoutes.js +40 -56
  18. package/src/components/RulesRoutes.js +0 -5
  19. package/src/components/__tests__/ExecutionForm.spec.js +20 -12
  20. package/src/components/__tests__/ExecutionPopup.spec.js +3 -2
  21. package/src/components/__tests__/ImplementationResultBar.spec.js +44 -63
  22. package/src/components/__tests__/InformationSummary.spec.js +2 -6
  23. package/src/components/__tests__/NewRuleImplementation.spec.js +27 -17
  24. package/src/components/__tests__/RemediationForm.spec.js +16 -62
  25. package/src/components/__tests__/RemediationPlan.spec.js +49 -73
  26. package/src/components/__tests__/RuleForm.spec.js +54 -211
  27. package/src/components/__tests__/RuleImplementation.spec.js +45 -22
  28. package/src/components/__tests__/RuleImplementationsActions.spec.js +0 -1
  29. package/src/components/__tests__/RuleImplementationsOptions.spec.js +1 -10
  30. package/src/components/__tests__/RuleProperties.spec.js +39 -27
  31. package/src/components/__tests__/RuleResultsUpload.spec.js +1 -5
  32. package/src/components/__tests__/RuleSummary.spec.js +6 -11
  33. package/src/components/__tests__/__snapshots__/EditRule.spec.js.snap +1 -1
  34. package/src/components/__tests__/__snapshots__/ExecutionForm.spec.js.snap +74 -5
  35. package/src/components/__tests__/__snapshots__/NewRule.spec.js.snap +1 -1
  36. package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +202 -2
  37. package/src/components/__tests__/__snapshots__/RemediationForm.spec.js.snap +79 -6
  38. package/src/components/__tests__/__snapshots__/RemediationPlan.spec.js.snap +40 -1
  39. package/src/components/__tests__/__snapshots__/RuleForm.spec.js.snap +846 -382
  40. package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +71 -5
  41. package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +1 -1
  42. package/src/components/__tests__/__snapshots__/RuleImplementationsSearch.spec.js.snap +1 -1
  43. package/src/components/__tests__/__snapshots__/RuleProperties.spec.js.snap +68 -56
  44. package/src/components/__tests__/__snapshots__/RuleSearch.spec.js.snap +1 -1
  45. package/src/components/index.js +0 -2
  46. package/src/components/ruleImplementationForm/InformationForm.js +26 -81
  47. package/src/components/ruleImplementationForm/RuleImplementationForm.js +41 -45
  48. package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +54 -111
  49. package/src/components/ruleImplementationForm/__tests__/LimitsForm.spec.js +9 -35
  50. package/src/components/ruleImplementationForm/__tests__/RuleImplementationForm.spec.js +30 -53
  51. package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +175 -156
  52. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +161 -19
  53. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationRawForm.spec.js.snap +412 -159
  54. package/src/messages/en.js +3 -6
  55. package/src/messages/es.js +3 -6
  56. package/src/components/DynamicRuleForm.js +0 -78
  57. package/src/components/__tests__/DynamicRuleForm.spec.js +0 -51
  58. package/src/components/__tests__/__snapshots__/DynamicRuleForm.spec.js.snap +0 -3
@@ -1,78 +0,0 @@
1
- import _ from "lodash/fp";
2
- import React from "react";
3
- import PropTypes from "prop-types";
4
- import { connect } from "react-redux";
5
- import { selectTemplate } from "@truedat/df/routines";
6
-
7
- const DynamicForm = React.lazy(() =>
8
- import("@truedat/df/components/DynamicForm")
9
- );
10
- const TemplateLoader = React.lazy(() =>
11
- import("@truedat/df/templates/components/TemplateLoader")
12
- );
13
- const TemplateSelector = React.lazy(() =>
14
- import("@truedat/df/templates/components/TemplateSelector")
15
- );
16
-
17
- const initialState = {
18
- df_content: {},
19
- df_name: null,
20
- };
21
-
22
- export class DynamicRuleForm extends React.Component {
23
- state = initialState;
24
-
25
- componentDidMount() {
26
- const { templateId, selectTemplate } = this.props;
27
- if (!_.isNil(templateId)) selectTemplate({ id: templateId });
28
- }
29
-
30
- handleTemplateSelected = (e, data) => {
31
- const { value } = data;
32
- const { selectTemplate } = this.props;
33
- selectTemplate({ id: value });
34
- };
35
-
36
- render() {
37
- const { template, dfContent, handleContentChange } = this.props;
38
-
39
- return (
40
- <>
41
- <TemplateLoader />
42
- <TemplateSelector
43
- selectedValue={template.id}
44
- onChange={this.handleTemplateSelected}
45
- />
46
- {!_.isEmpty(template) && (
47
- <DynamicForm onChange={handleContentChange} content={dfContent} />
48
- )}
49
- </>
50
- );
51
- }
52
- }
53
-
54
- DynamicRuleForm.propTypes = {
55
- templateId: PropTypes.number,
56
- template: PropTypes.object,
57
- dfContent: PropTypes.object,
58
- handleContentChange: PropTypes.func,
59
- selectTemplate: PropTypes.func,
60
- };
61
-
62
- const findTemplate = ({ templates, rule: { df_name } = {} }) =>
63
- _.flow(
64
- _.find(_.propEq("name", df_name)),
65
- _.defaultTo(_.head(templates)),
66
- _.prop("id")
67
- )(templates);
68
-
69
- const mapStateToProps = (state) => {
70
- return {
71
- rule: state.rule,
72
- templates: state.templates,
73
- template: state.template,
74
- templateId: findTemplate(state),
75
- };
76
- };
77
-
78
- export default connect(mapStateToProps, { selectTemplate })(DynamicRuleForm);
@@ -1,51 +0,0 @@
1
- import React, { Suspense } from "react";
2
- import { waitFor } from "@testing-library/react";
3
- import userEvent from "@testing-library/user-event";
4
- import { render } from "@truedat/test/render";
5
- import { DynamicRuleForm } from "../DynamicRuleForm";
6
-
7
- describe("<DynamicRuleForm />", () => {
8
- const templateId = 1;
9
- const templates = [
10
- {
11
- id: 1,
12
- label: "foo",
13
- },
14
- {
15
- id: 2,
16
- label: "bar",
17
- },
18
- {
19
- id: 3,
20
- label: "baz",
21
- },
22
- ];
23
- const dfContent = { foo: "bar" };
24
- const selectTemplate = jest.fn();
25
- const template = { id: 1 };
26
- const state = {
27
- templates,
28
- };
29
- const renderOpts = {
30
- messages: {
31
- en: {
32
- "template.selector.label": "label",
33
- "template.form.validation.empty_required": "required",
34
- "template.selector.placeholder": "placeholder",
35
- },
36
- },
37
- state,
38
- };
39
-
40
- const props = { template, templateId, dfContent, selectTemplate };
41
-
42
- it("matches the latest snapshot", () => {
43
- const { container } = render(
44
- <Suspense fallback={null}>
45
- <DynamicRuleForm {...props} />
46
- </Suspense>,
47
- renderOpts
48
- );
49
- expect(container).toMatchSnapshot();
50
- });
51
- });
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<DynamicRuleForm /> matches the latest snapshot 1`] = `<div />`;