@truedat/dq 4.33.7 → 4.34.0

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 (76) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/package.json +5 -5
  3. package/src/components/ConditionSummary.js +23 -21
  4. package/src/components/ExecutionDetails.js +11 -14
  5. package/src/components/ExecutionForm.js +116 -0
  6. package/src/components/ExecutionGroup.js +24 -15
  7. package/src/components/ExecutionPopup.js +58 -0
  8. package/src/components/ImplementationResultBar.js +80 -0
  9. package/src/components/ImplementationSummary.js +33 -72
  10. package/src/components/ImplementationsRoutes.js +15 -5
  11. package/src/components/InformationSummary.js +68 -0
  12. package/src/components/NewRuleImplementation.js +12 -0
  13. package/src/components/RuleForm.js +0 -178
  14. package/src/components/RuleImplementation.js +10 -6
  15. package/src/components/RuleImplementationProperties.js +31 -64
  16. package/src/components/RuleImplementationResults.js +87 -53
  17. package/src/components/RuleImplementationsActions.js +10 -46
  18. package/src/components/RuleProperties.js +1 -10
  19. package/src/components/RuleResultDecorator.js +43 -26
  20. package/src/components/RuleResultRow.js +4 -1
  21. package/src/components/RuleRoutes.js +0 -13
  22. package/src/components/RuleSummary.js +15 -2
  23. package/src/components/__tests__/ExecutionForm.spec.js +25 -0
  24. package/src/components/__tests__/ExecutionGroup.spec.js +11 -7
  25. package/src/components/__tests__/ExecutionPopup.spec.js +20 -0
  26. package/src/components/__tests__/ImplementationResultBar.spec.js +98 -0
  27. package/src/components/__tests__/ImplementationSummary.spec.js +9 -26
  28. package/src/components/__tests__/InformationSummary.spec.js +35 -0
  29. package/src/components/__tests__/NewRuleImplementation.spec.js +1 -1
  30. package/src/components/__tests__/RuleForm.spec.js +0 -191
  31. package/src/components/__tests__/RuleImplementation.spec.js +1 -0
  32. package/src/components/__tests__/RuleImplementationProperties.spec.js +23 -33
  33. package/src/components/__tests__/RuleImplementationsActions.spec.js +10 -32
  34. package/src/components/__tests__/RuleProperties.spec.js +7 -9
  35. package/src/components/__tests__/RuleResultDecorator.spec.js +17 -11
  36. package/src/components/__tests__/RuleResultRow.spec.js +25 -46
  37. package/src/components/__tests__/RuleRow.spec.js +0 -4
  38. package/src/components/__tests__/RuleSummary.spec.js +6 -6
  39. package/src/components/__tests__/Rules.spec.js +15 -39
  40. package/src/components/__tests__/__snapshots__/ConditionSummary.spec.js.snap +55 -51
  41. package/src/components/__tests__/__snapshots__/ExecutionForm.spec.js.snap +33 -0
  42. package/src/components/__tests__/__snapshots__/ExecutionGroup.spec.js.snap +5 -4
  43. package/src/components/__tests__/__snapshots__/ExecutionPopup.spec.js.snap +11 -0
  44. package/src/components/__tests__/__snapshots__/ImplementationResultBar.spec.js.snap +141 -0
  45. package/src/components/__tests__/__snapshots__/ImplementationSummary.spec.js.snap +194 -457
  46. package/src/components/__tests__/__snapshots__/InformationSummary.spec.js.snap +185 -0
  47. package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +6 -0
  48. package/src/components/__tests__/__snapshots__/RuleForm.spec.js.snap +0 -148
  49. package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +20 -0
  50. package/src/components/__tests__/__snapshots__/RuleImplementationProperties.spec.js.snap +43 -49
  51. package/src/components/__tests__/__snapshots__/RuleImplementationResults.spec.js.snap +63 -61
  52. package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +4 -49
  53. package/src/components/__tests__/__snapshots__/RuleProperties.spec.js.snap +0 -1
  54. package/src/components/__tests__/__snapshots__/RuleRow.spec.js.snap +0 -28
  55. package/src/components/__tests__/__snapshots__/Rules.spec.js.snap +0 -101
  56. package/src/components/ruleImplementationForm/InformationForm.js +5 -5
  57. package/src/components/ruleImplementationForm/LimitsForm.js +142 -0
  58. package/src/components/ruleImplementationForm/RuleImplementationForm.js +14 -4
  59. package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +16 -6
  60. package/src/components/ruleImplementationForm/__tests__/LimitsForm.spec.js +186 -0
  61. package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +42 -35
  62. package/src/components/ruleImplementationForm/__tests__/__snapshots__/LimitsForm.spec.js.snap +1104 -0
  63. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +4 -1
  64. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationRawForm.spec.js.snap +12 -1
  65. package/src/components/ruleImplementationForm/limitsValidation.js +72 -0
  66. package/src/messages/en.js +131 -71
  67. package/src/messages/es.js +254 -180
  68. package/src/reducers/__tests__/rule.spec.js +2 -4
  69. package/src/reducers/__tests__/ruleImplementation.spec.js +2 -0
  70. package/src/reducers/__tests__/ruleImplementations.spec.js +12 -8
  71. package/src/reducers/rule.js +0 -3
  72. package/src/reducers/ruleImplementation.js +3 -0
  73. package/src/reducers/ruleImplementations.js +3 -0
  74. package/src/selectors/getRuleImplementationColumns.js +38 -3
  75. package/src/selectors/ruleColumnsSelector.js +0 -31
  76. package/src/styles/ruleSummary.less +17 -10
@@ -3,8 +3,9 @@ import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { useIntl } from "react-intl";
5
5
  import { connect } from "react-redux";
6
- import { Table, Message } from "semantic-ui-react";
6
+ import { Table, Message, Divider } from "semantic-ui-react";
7
7
  import { columnDecorator } from "@truedat/core/services";
8
+ import Moment from "react-moment";
8
9
  import { getRuleResultsColumns } from "../selectors";
9
10
  import RuleResultRow from "./RuleResultRow";
10
11
 
@@ -25,65 +26,98 @@ export const RuleImplementationResults = ({
25
26
  customColumns,
26
27
  isAdmin,
27
28
  }) => {
28
- const { formatMessage } = useIntl();
29
+ const { formatMessage, locale } = useIntl();
29
30
 
30
31
  if (_.isEmpty(rule) || _.isEmpty(ruleImplementation)) return null;
31
32
 
32
33
  const ruleResults = ruleImplementation.results;
33
34
  const optionalColumns = getOptionalColumnsWithData(ruleResults);
34
35
 
35
- return _.isEmpty(ruleResults) ? (
36
- <Message
37
- style={{ marginTop: "14px" }}
38
- header={formatMessage({ id: "rule.ruleImplementation.results.empty" })}
39
- />
40
- ) : (
41
- <Table className="implementation-results small" selectable>
42
- <Table.Header>
43
- <Table.Row>
44
- <Table.HeaderCell
45
- content={formatMessage({ id: "ruleResult.props.quality" })}
36
+ return (
37
+ <>
38
+ {ruleImplementation.event_type === "FAILED" && (
39
+ <Message negative style={{ marginTop: "14px" }}>
40
+ <Message.Header>
41
+ {formatMessage({
42
+ id: "quality.error",
43
+ })}
44
+ </Message.Header>
45
+ <Divider />
46
+ <Moment
47
+ style={{
48
+ position: "absolute",
49
+ top: "14px",
50
+ right: "21px",
51
+ }}
52
+ locale={locale}
53
+ date={ruleImplementation.event_inserted_at}
54
+ format="YYYY-MM-DD HH:mm"
46
55
  />
47
- <Table.HeaderCell
48
- content={formatMessage({ id: "ruleResult.props.date" })}
49
- />
50
- {_.includes("records")(optionalColumns) && (
51
- <Table.HeaderCell
52
- content={formatMessage({ id: "ruleResult.props.records" })}
53
- />
54
- )}
55
- {_.includes("errors")(optionalColumns) && (
56
- <Table.HeaderCell
57
- content={formatMessage({ id: "ruleResult.props.errors" })}
58
- />
59
- )}
60
- {customColumns.map((column, index) => (
61
- <Table.HeaderCell
62
- key={index}
63
- content={formatMessage({
64
- id: `ruleResult.props.${column.name}`,
65
- defaultMessage: column.name,
66
- })}
67
- />
68
- ))}
69
- {<Table.HeaderCell />}
70
- {isAdmin && <Table.HeaderCell />}
71
- </Table.Row>
72
- </Table.Header>
73
- <Table.Body>
74
- {ruleResults.map((result, i) => (
75
- <RuleResultRow
76
- key={i}
77
- optionalColumns={optionalColumns}
78
- ruleResult={result}
79
- customColumns={customColumns}
80
- isAdmin={isAdmin}
81
- ruleImplementation={ruleImplementation}
82
- rule={rule}
83
- />
84
- ))}
85
- </Table.Body>
86
- </Table>
56
+ <p
57
+ style={{
58
+ whiteSpace: "pre-wrap",
59
+ }}
60
+ >
61
+ {ruleImplementation.event_message}
62
+ </p>
63
+ </Message>
64
+ )}
65
+ {_.isEmpty(ruleResults) ? (
66
+ <Message
67
+ style={{ marginTop: "14px" }}
68
+ header={formatMessage({
69
+ id: "rule.ruleImplementation.results.empty",
70
+ })}
71
+ />
72
+ ) : (
73
+ <Table className="implementation-results small" selectable>
74
+ <Table.Header>
75
+ <Table.Row>
76
+ <Table.HeaderCell
77
+ content={formatMessage({ id: "ruleResult.props.quality" })}
78
+ />
79
+ <Table.HeaderCell
80
+ content={formatMessage({ id: "ruleResult.props.date" })}
81
+ />
82
+ {_.includes("records")(optionalColumns) && (
83
+ <Table.HeaderCell
84
+ content={formatMessage({ id: "ruleResult.props.records" })}
85
+ />
86
+ )}
87
+ {_.includes("errors")(optionalColumns) && (
88
+ <Table.HeaderCell
89
+ content={formatMessage({ id: "ruleResult.props.errors" })}
90
+ />
91
+ )}
92
+ {customColumns.map((column, index) => (
93
+ <Table.HeaderCell
94
+ key={index}
95
+ content={formatMessage({
96
+ id: `ruleResult.props.${column.name}`,
97
+ defaultMessage: column.name,
98
+ })}
99
+ />
100
+ ))}
101
+ {<Table.HeaderCell />}
102
+ {isAdmin && <Table.HeaderCell />}
103
+ </Table.Row>
104
+ </Table.Header>
105
+ <Table.Body>
106
+ {ruleResults.map((result, i) => (
107
+ <RuleResultRow
108
+ key={i}
109
+ optionalColumns={optionalColumns}
110
+ ruleResult={result}
111
+ customColumns={customColumns}
112
+ isAdmin={isAdmin}
113
+ ruleImplementation={ruleImplementation}
114
+ rule={rule}
115
+ />
116
+ ))}
117
+ </Table.Body>
118
+ </Table>
119
+ )}
120
+ </>
87
121
  );
88
122
  };
89
123
 
@@ -4,8 +4,6 @@ import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Button, Checkbox } from "semantic-ui-react";
6
6
  import { useIntl } from "react-intl";
7
- import { FormattedMessage } from "react-intl";
8
- import { ConfirmModal } from "@truedat/core/components";
9
7
  import { downloadImplementations } from "../routines";
10
8
  import { getImplementationsExecution } from "../selectors";
11
9
  import {
@@ -14,6 +12,7 @@ import {
14
12
  removeImplementationFilter,
15
13
  createExecutionGroup,
16
14
  } from "../routines";
15
+ import ExecutionPopup from "./ExecutionPopup";
17
16
 
18
17
  const staticHeaderLabels = [
19
18
  "implementation_key",
@@ -39,20 +38,6 @@ const staticContentLabels = [
39
38
  "executable.false",
40
39
  ];
41
40
 
42
- const actions = (handleSubmit) => [
43
- {
44
- key: "no",
45
- secondary: true,
46
- content: <FormattedMessage id="confirmation.no" />,
47
- },
48
- {
49
- key: "yes",
50
- primary: true,
51
- content: <FormattedMessage id="confirmation.yes" />,
52
- onClick: handleSubmit,
53
- },
54
- ];
55
-
56
41
  export const RuleImplementationsActions = ({
57
42
  addImplementationFilter,
58
43
  canExecute,
@@ -60,7 +45,6 @@ export const RuleImplementationsActions = ({
60
45
  executeImplementationsOn,
61
46
  toggleImplementationFilterValue,
62
47
  removeImplementationFilter,
63
- executionGroupLoading,
64
48
  createExecutionGroup,
65
49
  selectedImplementations,
66
50
  implementationQuery,
@@ -99,11 +83,11 @@ export const RuleImplementationsActions = ({
99
83
  checked ? showExecutableInfo() : hideExecutableInfo();
100
84
  };
101
85
 
102
- const handleSubmit = () => {
86
+ const handleSubmit = (df_content) => {
103
87
  const query = _.isEmpty(selectedImplementations)
104
88
  ? implementationQuery
105
89
  : { filters: { id: selectedImplementations } };
106
- createExecutionGroup({ ...query });
90
+ createExecutionGroup({ ...query, df_content });
107
91
  };
108
92
  return (
109
93
  <div style={{ float: "right" }}>
@@ -117,32 +101,14 @@ export const RuleImplementationsActions = ({
117
101
  checked={executeImplementationsOn}
118
102
  style={{ top: "6px", marginRight: "7.5px" }}
119
103
  />
120
- <ConfirmModal
121
- actions={actions(handleSubmit)}
122
- trigger={
123
- <Button
124
- id="execute_button"
125
- secondary
126
- disabled={!executeImplementationsOn}
127
- loading={executionGroupLoading}
128
- content={
129
- <FormattedMessage id="implementations.actions.do_execution" />
130
- }
131
- />
132
- }
133
- header={
134
- <FormattedMessage id="implementations.actions.execution.confirmation.header" />
135
- }
136
- content={
137
- <FormattedMessage
138
- id="implementations.actions.execution.confirmation.content"
139
- values={{
140
- implementations_count: _.isEmpty(selectedImplementations)
141
- ? ruleImplementationCount
142
- : selectedImplementations.length,
143
- }}
144
- />
104
+ <ExecutionPopup
105
+ disabled={!executeImplementationsOn}
106
+ count={
107
+ _.isEmpty(selectedImplementations)
108
+ ? ruleImplementationCount
109
+ : selectedImplementations.length
145
110
  }
111
+ handleSubmit={handleSubmit}
146
112
  />
147
113
  </>
148
114
  )}
@@ -170,7 +136,6 @@ RuleImplementationsActions.propTypes = {
170
136
  canExecute: PropTypes.bool,
171
137
  createExecutionGroup: PropTypes.func,
172
138
  executeImplementationsOn: PropTypes.bool,
173
- executionGroupLoading: PropTypes.bool,
174
139
  implementationsExecution: PropTypes.bool,
175
140
  implementationQuery: PropTypes.object,
176
141
  removeImplementationFilter: PropTypes.func,
@@ -184,7 +149,6 @@ RuleImplementationsActions.propTypes = {
184
149
 
185
150
  const mapStateToProps = (state) => ({
186
151
  canExecute: _.propOr(false, "userImplementationsPermissions.execute")(state),
187
- executionGroupLoading: state.executionGroupLoading,
188
152
  ruleImplementationCount: state.ruleImplementationCount,
189
153
  implementationsExecution: getImplementationsExecution(state),
190
154
  ruleImplementationsDownloading: state.ruleImplementationsDownloading,
@@ -3,12 +3,10 @@ import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { FormattedMessage } from "react-intl";
5
5
  import { connect } from "react-redux";
6
- import { useHistory, Link } from "react-router-dom";
6
+ import { Link } from "react-router-dom";
7
7
  import { List, Label } from "semantic-ui-react";
8
8
  import "rc-slider/assets/index.css";
9
9
  import { linkTo } from "@truedat/core/routes";
10
- import RuleRangeNumber from "./RuleRangeNumber";
11
- import RuleRangePercentage from "./RuleRangePercentage";
12
10
 
13
11
  const RichTextEditor = React.lazy(() =>
14
12
  import("@truedat/core/components/RichTextEditor")
@@ -27,7 +25,6 @@ export const RuleProperties = ({
27
25
  domain,
28
26
  domain_id,
29
27
  active,
30
- result_type,
31
28
  }) => {
32
29
  return (
33
30
  <List size="big" relaxed>
@@ -67,11 +64,6 @@ export const RuleProperties = ({
67
64
  </Link>
68
65
  </List.Item>
69
66
  )}
70
- {["percentage", "deviation"].includes(result_type) ? (
71
- <RuleRangePercentage />
72
- ) : (
73
- <RuleRangeNumber />
74
- )}
75
67
  </List>
76
68
  );
77
69
  };
@@ -83,7 +75,6 @@ RuleProperties.propTypes = {
83
75
  description: PropTypes.object,
84
76
  domain: PropTypes.object,
85
77
  domain_id: PropTypes.number,
86
- result_type: PropTypes.string,
87
78
  };
88
79
 
89
80
  const mapStateToProps = ({ rule }) => rule;
@@ -10,31 +10,30 @@ const nilResult = (ruleResult) =>
10
10
  isNil(ruleResult) ||
11
11
  (has("result_text")(ruleResult) && isNil(ruleResult?.result_text));
12
12
 
13
- export const RuleResultDecorator = ({ ruleResult, rule, date }) => {
14
- const { formatMessage, formatNumber: _formatNumber } = useIntl();
13
+ export const calculateResultDecoration = ({
14
+ ruleResult,
15
+ ruleImplementation,
16
+ date,
17
+ intl: { formatMessage, formatNumber: _formatNumber },
18
+ }) => {
15
19
  const formatNumber = (num) => (isNil(num) ? num : _formatNumber(num));
16
- if (nilResult(ruleResult) && isNil(date)) {
17
- return null;
18
- }
20
+
19
21
  if (ruleResult?.result_text === "quality_result.failed") {
20
- return (
21
- <>
22
- <Icon
23
- name="warning circle"
24
- color="red"
25
- title={formatMessage({ id: "quality_result.failed" })}
26
- />
27
- {formatMessage({ id: "quality_result.failed" })}
28
- </>
29
- );
22
+ const resultText = formatMessage({ id: "quality_result.failed" });
23
+ return {
24
+ iconName: "warning circle",
25
+ resultText: resultText,
26
+ color: "red",
27
+ resultText,
28
+ };
30
29
  }
31
- const resultText = ruleResult?.result_text;
32
- const resultType = rule?.result_type;
30
+
31
+ const resultType = ruleImplementation?.result_type;
33
32
  const result =
34
33
  resultType === "errors_number"
35
34
  ? formatNumber(ruleResult?.errors)
36
35
  : ruleResult?.result;
37
- const resultTitle = isNil(result)
36
+ const resultText = isNil(result)
38
37
  ? formatMessage({ id: "quality.result.no.data" })
39
38
  : date
40
39
  ? formatMessage(
@@ -45,23 +44,41 @@ export const RuleResultDecorator = ({ ruleResult, rule, date }) => {
45
44
  { id: `quality.result.${resultType}.description` },
46
45
  { result }
47
46
  );
48
- const color = selectColor({ ...rule, ...ruleResult });
47
+ const color = selectColor({ ...ruleImplementation, ...ruleResult });
48
+ const iconTitle = ruleResult?.result_text
49
+ ? formatMessage({ id: ruleResult?.result_text })
50
+ : null;
51
+
52
+ return { iconName: "circle", color, resultText, iconTitle };
53
+ };
54
+
55
+ export const RuleResultDecorator = ({
56
+ ruleResult,
57
+ ruleImplementation,
58
+ date,
59
+ }) => {
60
+ const intl = useIntl();
61
+ if (nilResult(ruleResult) && isNil(date)) {
62
+ return null;
63
+ }
64
+ const { iconName, color, resultText, iconTitle } = calculateResultDecoration({
65
+ ruleResult,
66
+ ruleImplementation,
67
+ date,
68
+ intl,
69
+ });
49
70
 
50
71
  return (
51
72
  <>
52
- <Icon
53
- name="circle"
54
- title={resultText ? formatMessage({ id: resultText }) : null}
55
- color={color}
56
- />
57
- {resultTitle}
73
+ <Icon name={iconName} title={iconTitle} color={color} />
74
+ {resultText}
58
75
  </>
59
76
  );
60
77
  };
61
78
 
62
79
  RuleResultDecorator.propTypes = {
63
80
  ruleResult: PropTypes.object,
64
- rule: PropTypes.object,
81
+ ruleImplementation: PropTypes.object,
65
82
  date: PropTypes.string,
66
83
  };
67
84
 
@@ -41,7 +41,10 @@ export const RuleResultRow = ({
41
41
  }
42
42
  >
43
43
  <Table.Cell>
44
- <Icon name="circle" color={selectColor({ ...rule, ...ruleResult })} />
44
+ <Icon
45
+ name="circle"
46
+ color={selectColor({ ...ruleImplementation, ...ruleResult })}
47
+ />
45
48
  {`${parseFloat(ruleResult.result)} %`}
46
49
  </Table.Cell>
47
50
  <Table.Cell>
@@ -66,7 +66,6 @@ const RuleRoutes = ({
66
66
  templatesLoaded,
67
67
  template,
68
68
  structuresAliasesLoading,
69
- templateImpl,
70
69
  ruleImplementation,
71
70
  }) => {
72
71
  const latest = _.head(ruleImplementation.results);
@@ -227,14 +226,6 @@ const RuleRoutes = ({
227
226
  <RuleImplementationProperties />
228
227
  </RuleImplementation>
229
228
  )}
230
- {!_.isEmpty(templateImpl) && ruleImplementationLoaded && (
231
- <Segment attached="bottom">
232
- <DynamicFormViewer
233
- template={templateImpl}
234
- content={ruleImplementation.df_content}
235
- />
236
- </Segment>
237
- )}
238
229
  </Segment>
239
230
  </>
240
231
  )}
@@ -305,7 +296,6 @@ RuleRoutes.propTypes = {
305
296
  implementationStructures: PropTypes.array,
306
297
  ruleLoaded: PropTypes.bool,
307
298
  template: PropTypes.object,
308
- templateImpl: PropTypes.object,
309
299
  ruleImplementation: PropTypes.object,
310
300
  ruleImplementationLoaded: PropTypes.bool,
311
301
  implementationStructuresLoaded: PropTypes.bool,
@@ -325,9 +315,6 @@ const mapStateToProps = (state) => ({
325
315
  templatesLoaded: !state.templatesLoading && !_.isEmpty(state.templates),
326
316
  template: _.find(_.propEq("name", state.rule.df_name))(state.templates),
327
317
  structuresAliasesLoading: state.structuresAliasesLoading,
328
- templateImpl: _.find(_.propEq("name", state.ruleImplementation.df_name))(
329
- state.templates
330
- ),
331
318
  ruleImplementation: state.ruleImplementation,
332
319
  });
333
320
 
@@ -22,8 +22,12 @@ const mapSummary = (implementations) => {
22
22
  const failed = _.size(failedImplementations);
23
23
  const quality = _.reduce(
24
24
  (summary, implementation) => {
25
- const { errors, result } = implementation.execution_result_info;
26
- const { goal, minimum, result_type } = implementation.rule;
25
+ const {
26
+ goal,
27
+ minimum,
28
+ result_type,
29
+ execution_result_info: { errors, result },
30
+ } = implementation;
27
31
  const color = selectColor({ errors, result, minimum, goal, result_type });
28
32
  return _.set(color, summary[color] + 1)(summary);
29
33
  },
@@ -71,6 +75,15 @@ const SummaryBar = ({
71
75
  </>
72
76
  );
73
77
 
78
+ SummaryBar.propTypes = {
79
+ key: PropTypes.string,
80
+ className: PropTypes.string,
81
+ summary: PropTypes.object,
82
+ percentages: PropTypes.array,
83
+ showPercentages: PropTypes.bool,
84
+ tooltip: PropTypes.string,
85
+ };
86
+
74
87
  const SummaryBars = (props) => {
75
88
  return (
76
89
  <div className="rule-summary">
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { render } from "@truedat/test/render";
3
+ import { ExecutionForm } from "../ExecutionForm";
4
+
5
+ describe("<ExecutionForm />", () => {
6
+ const handleSubmit = jest.fn();
7
+ const selectTemplate = jest.fn();
8
+ const props = { count: 1, templates: [], handleSubmit, selectTemplate };
9
+ const renderOpts = {
10
+ messages: {
11
+ en: {
12
+ "actions.cancel": "cancel",
13
+ "actions.create": "create",
14
+ "implementations.actions.execution.confirmation.content": "content",
15
+ "implementations.actions.execution.confirmation.header": "header",
16
+ "implementations.actions.execution.confirmation.legend": "legend",
17
+ },
18
+ },
19
+ };
20
+
21
+ it("matches the latest snapshot", () => {
22
+ const { container } = render(<ExecutionForm {...props} />, renderOpts);
23
+ expect(container).toMatchSnapshot();
24
+ });
25
+ });
@@ -11,11 +11,15 @@ describe("<ExecutionGroup />", () => {
11
11
  const rule = {
12
12
  id: 1,
13
13
  name: "rule_name",
14
+ };
15
+ const implementation = {
16
+ id: 1,
17
+ implementation_key: "foo",
18
+ rule_id: 1,
14
19
  result_type: "percentage",
15
20
  minimum: 10,
16
- goal: 20
21
+ goal: 20,
17
22
  };
18
- const implementation = { id: 1, implementation_key: "foo", rule_id: 1 };
19
23
  const result = {
20
24
  id: 1,
21
25
  implementation_key: "foo",
@@ -25,7 +29,7 @@ describe("<ExecutionGroup />", () => {
25
29
  errors: 30,
26
30
  result_type: "percentage",
27
31
  minimum: 10,
28
- goal: 20
32
+ goal: 20,
29
33
  };
30
34
  const quality_events = [
31
35
  {
@@ -33,14 +37,14 @@ describe("<ExecutionGroup />", () => {
33
37
  execution_id: 1,
34
38
  id: 1,
35
39
  type: "SUCCESS",
36
- message: ""
37
- }
40
+ message: "",
41
+ },
38
42
  ];
39
43
  const executions = [
40
- { id: 1, _embedded: { rule, implementation, result, quality_events } }
44
+ { id: 1, _embedded: { rule, implementation, result, quality_events } },
41
45
  ];
42
46
  const props = {
43
- executionGroup: { id: 1, _embedded: { executions } }
47
+ executionGroup: { id: 1, _embedded: { executions } },
44
48
  };
45
49
 
46
50
  it("matches the latest snapshot", () => {
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { render } from "@truedat/test/render";
3
+ import { ExecutionPopup } from "../ExecutionPopup";
4
+
5
+ describe("<ExecutionPopup />", () => {
6
+ const handleSubmit = jest.fn();
7
+ const props = { count: 1, handleSubmit };
8
+ const renderOpts = {
9
+ messages: {
10
+ en: {
11
+ "implementations.actions.do_execution": "do_execution",
12
+ },
13
+ },
14
+ };
15
+
16
+ it("matches the latest snapshot", () => {
17
+ const { container } = render(<ExecutionPopup {...props} />, renderOpts);
18
+ expect(container).toMatchSnapshot();
19
+ });
20
+ });