@truedat/dq 4.33.10 → 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 (66) hide show
  1. package/CHANGELOG.md +7 -0
  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/ExecutionGroup.js +24 -15
  6. package/src/components/ImplementationResultBar.js +80 -0
  7. package/src/components/ImplementationSummary.js +33 -72
  8. package/src/components/InformationSummary.js +68 -0
  9. package/src/components/NewRuleImplementation.js +12 -0
  10. package/src/components/RuleForm.js +0 -178
  11. package/src/components/RuleImplementation.js +10 -6
  12. package/src/components/RuleImplementationProperties.js +31 -64
  13. package/src/components/RuleImplementationResults.js +87 -53
  14. package/src/components/RuleProperties.js +1 -10
  15. package/src/components/RuleResultDecorator.js +43 -26
  16. package/src/components/RuleResultRow.js +4 -1
  17. package/src/components/RuleRoutes.js +0 -13
  18. package/src/components/RuleSummary.js +15 -2
  19. package/src/components/__tests__/ExecutionGroup.spec.js +11 -7
  20. package/src/components/__tests__/ImplementationResultBar.spec.js +98 -0
  21. package/src/components/__tests__/ImplementationSummary.spec.js +9 -26
  22. package/src/components/__tests__/InformationSummary.spec.js +35 -0
  23. package/src/components/__tests__/NewRuleImplementation.spec.js +1 -1
  24. package/src/components/__tests__/RuleForm.spec.js +0 -191
  25. package/src/components/__tests__/RuleImplementation.spec.js +1 -0
  26. package/src/components/__tests__/RuleImplementationProperties.spec.js +23 -33
  27. package/src/components/__tests__/RuleProperties.spec.js +7 -9
  28. package/src/components/__tests__/RuleResultDecorator.spec.js +17 -11
  29. package/src/components/__tests__/RuleResultRow.spec.js +25 -46
  30. package/src/components/__tests__/RuleRow.spec.js +0 -4
  31. package/src/components/__tests__/RuleSummary.spec.js +6 -6
  32. package/src/components/__tests__/Rules.spec.js +15 -39
  33. package/src/components/__tests__/__snapshots__/ConditionSummary.spec.js.snap +55 -51
  34. package/src/components/__tests__/__snapshots__/ExecutionGroup.spec.js.snap +5 -4
  35. package/src/components/__tests__/__snapshots__/ImplementationResultBar.spec.js.snap +141 -0
  36. package/src/components/__tests__/__snapshots__/ImplementationSummary.spec.js.snap +194 -457
  37. package/src/components/__tests__/__snapshots__/InformationSummary.spec.js.snap +185 -0
  38. package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +6 -0
  39. package/src/components/__tests__/__snapshots__/RuleForm.spec.js.snap +0 -148
  40. package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +20 -0
  41. package/src/components/__tests__/__snapshots__/RuleImplementationProperties.spec.js.snap +43 -49
  42. package/src/components/__tests__/__snapshots__/RuleImplementationResults.spec.js.snap +63 -61
  43. package/src/components/__tests__/__snapshots__/RuleProperties.spec.js.snap +0 -1
  44. package/src/components/__tests__/__snapshots__/RuleRow.spec.js.snap +0 -28
  45. package/src/components/__tests__/__snapshots__/Rules.spec.js.snap +0 -101
  46. package/src/components/ruleImplementationForm/InformationForm.js +5 -5
  47. package/src/components/ruleImplementationForm/LimitsForm.js +142 -0
  48. package/src/components/ruleImplementationForm/RuleImplementationForm.js +14 -4
  49. package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +16 -6
  50. package/src/components/ruleImplementationForm/__tests__/LimitsForm.spec.js +186 -0
  51. package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +42 -35
  52. package/src/components/ruleImplementationForm/__tests__/__snapshots__/LimitsForm.spec.js.snap +1104 -0
  53. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +4 -1
  54. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationRawForm.spec.js.snap +12 -1
  55. package/src/components/ruleImplementationForm/limitsValidation.js +72 -0
  56. package/src/messages/en.js +130 -71
  57. package/src/messages/es.js +253 -180
  58. package/src/reducers/__tests__/rule.spec.js +2 -4
  59. package/src/reducers/__tests__/ruleImplementation.spec.js +2 -0
  60. package/src/reducers/__tests__/ruleImplementations.spec.js +12 -8
  61. package/src/reducers/rule.js +0 -3
  62. package/src/reducers/ruleImplementation.js +3 -0
  63. package/src/reducers/ruleImplementations.js +3 -0
  64. package/src/selectors/getRuleImplementationColumns.js +38 -3
  65. package/src/selectors/ruleColumnsSelector.js +0 -31
  66. package/src/styles/ruleSummary.less +17 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.34.0] 2021-12-02
4
+
5
+ ### Changed
6
+
7
+ - [TD-4270] Move goal and threshold from Rule to Implementation
8
+ - [TD-4295] Changed how implementation Information section is displayed
9
+
3
10
  ## [4.33.10] 2021-11-30
4
11
 
5
12
  - [TD-4306] Fix popups inside execution popup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.33.10",
3
+ "version": "4.34.0",
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.33.10",
34
+ "@truedat/test": "4.34.0",
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.33.10",
86
- "@truedat/df": "4.33.10",
85
+ "@truedat/core": "4.34.0",
86
+ "@truedat/df": "4.34.0",
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": "b316406207a0b4621b8fffb33e6348712416b0c2"
106
+ "gitHead": "b1fe4f405c612bd342510cf34e8e9d89de0280fb"
107
107
  }
@@ -1,7 +1,7 @@
1
1
  import _ from "lodash/fp";
2
2
  import React, { Fragment } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Header, Icon, Table } from "semantic-ui-react";
4
+ import { Header, Icon, Segment, Table } from "semantic-ui-react";
5
5
  import { Link } from "react-router-dom";
6
6
  import { FormattedMessage } from "react-intl";
7
7
  import { linkTo } from "@truedat/core/routes";
@@ -168,26 +168,28 @@ export const ConditionSummary = ({ rows, type, icon }) =>
168
168
  />
169
169
  </Header.Content>
170
170
  </Header>
171
- <Table basic="very">
172
- <Table.Header>
173
- <Table.Row>
174
- <Table.HeaderCell>
175
- <FormattedMessage id={`ruleImplementation.summary.field`} />
176
- </Table.HeaderCell>
177
- <Table.HeaderCell>
178
- <FormattedMessage id={`ruleImplementation.summary.operator`} />
179
- </Table.HeaderCell>
180
- <Table.HeaderCell>
181
- <FormattedMessage id={`ruleImplementation.summary.values`} />
182
- </Table.HeaderCell>
183
- </Table.Row>
184
- </Table.Header>
185
- <Table.Body>
186
- {rows.map((row, i) => (
187
- <ConditionCell key={i} row={row} />
188
- ))}
189
- </Table.Body>
190
- </Table>
171
+ <Segment>
172
+ <Table basic="very">
173
+ <Table.Header>
174
+ <Table.Row>
175
+ <Table.HeaderCell>
176
+ <FormattedMessage id={`ruleImplementation.summary.field`} />
177
+ </Table.HeaderCell>
178
+ <Table.HeaderCell>
179
+ <FormattedMessage id={`ruleImplementation.summary.operator`} />
180
+ </Table.HeaderCell>
181
+ <Table.HeaderCell>
182
+ <FormattedMessage id={`ruleImplementation.summary.values`} />
183
+ </Table.HeaderCell>
184
+ </Table.Row>
185
+ </Table.Header>
186
+ <Table.Body>
187
+ {rows.map((row, i) => (
188
+ <ConditionCell key={i} row={row} />
189
+ ))}
190
+ </Table.Body>
191
+ </Table>
192
+ </Segment>
191
193
  </>
192
194
  );
193
195
 
@@ -8,7 +8,7 @@ import { Table, Message, Icon } from "semantic-ui-react";
8
8
  import { DateTime } from "@truedat/core/components";
9
9
  import { selectColor } from "../functions/selectors";
10
10
 
11
- const GeneralInformation = ({ rule, ruleResult }) => {
11
+ const GeneralInformation = ({ ruleImplementation, ruleResult }) => {
12
12
  const { formatMessage, formatNumber: _formatNumber } = useIntl();
13
13
  const formatNumber = (num) => (_.isNil(num) ? num : _formatNumber(num));
14
14
  return (
@@ -18,7 +18,10 @@ const GeneralInformation = ({ rule, ruleResult }) => {
18
18
  {formatMessage({ id: "ruleResult.props.quality" })}
19
19
  </Table.Cell>
20
20
  <Table.Cell>
21
- <Icon name="circle" color={selectColor({ ...rule, ...ruleResult })} />
21
+ <Icon
22
+ name="circle"
23
+ color={selectColor({ ...ruleImplementation, ...ruleResult })}
24
+ />
22
25
  {`${parseFloat(ruleResult.result)} %`}
23
26
  </Table.Cell>
24
27
  </Table.Row>
@@ -50,7 +53,7 @@ const GeneralInformation = ({ rule, ruleResult }) => {
50
53
  };
51
54
 
52
55
  GeneralInformation.propTypes = {
53
- rule: PropTypes.object,
56
+ ruleImplementation: PropTypes.object,
54
57
  ruleResult: PropTypes.object,
55
58
  };
56
59
 
@@ -70,11 +73,7 @@ const DetailRow = ({ details }) => {
70
73
  )(details);
71
74
  };
72
75
 
73
- export const ExecutionDetails = ({
74
- rule,
75
- ruleImplementation,
76
- rule_result_id,
77
- }) => {
76
+ export const ExecutionDetails = ({ ruleImplementation, rule_result_id }) => {
78
77
  const { formatMessage } = useIntl();
79
78
  const { rule_result_id: id } = useParams();
80
79
 
@@ -104,7 +103,10 @@ export const ExecutionDetails = ({
104
103
  </Table.Row>
105
104
  </Table.Header>
106
105
  <Table.Body>
107
- <GeneralInformation rule={rule} ruleResult={ruleResult} />
106
+ <GeneralInformation
107
+ ruleImplementation={ruleImplementation}
108
+ ruleResult={ruleResult}
109
+ />
108
110
  </Table.Body>
109
111
 
110
112
  <Table.Header>
@@ -126,16 +128,11 @@ export const ExecutionDetails = ({
126
128
 
127
129
  ExecutionDetails.propTypes = {
128
130
  ruleImplementation: PropTypes.object,
129
- rule: PropTypes.object,
130
- customColumns: PropTypes.array,
131
- isAdmin: PropTypes.bool,
132
131
  rule_result_id: PropTypes.number,
133
132
  };
134
133
 
135
134
  const mapStateToProps = (state) => ({
136
- rule: state.rule,
137
135
  ruleImplementation: state.ruleImplementation,
138
- isAdmin: state.authentication.role === "admin",
139
136
  });
140
137
 
141
138
  export default connect(mapStateToProps)(ExecutionDetails);
@@ -1,4 +1,4 @@
1
- import { flow, pick, reject, size, sortBy } from "lodash/fp";
1
+ import { flow, pick, filter, reject, size, prop, sortBy } from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
@@ -15,41 +15,41 @@ const columns = [
15
15
  {
16
16
  name: "ruleImplementations.props.status",
17
17
  fieldDecorator: RuleEventDecorator,
18
- fieldSelector: pick(["_embedded.quality_events"])
18
+ fieldSelector: pick(["_embedded.quality_events"]),
19
19
  },
20
20
  {
21
21
  name: "ruleImplementations.props.implementation_key",
22
22
  fieldSelector: "_embedded.implementation",
23
- fieldDecorator: RuleImplementationResultsLink
23
+ fieldDecorator: RuleImplementationResultsLink,
24
24
  },
25
25
  {
26
26
  name: "rule.props.name",
27
- fieldSelector: "_embedded.rule.name"
27
+ fieldSelector: "_embedded.rule.name",
28
28
  },
29
29
  {
30
30
  name: "ruleResult.props.date",
31
31
  fieldDecorator: DateTime,
32
32
  textAlign: "center",
33
- fieldSelector: ({ _embedded }) => ({ value: _embedded?.result?.date })
33
+ fieldSelector: ({ _embedded }) => ({ value: _embedded?.result?.date }),
34
34
  },
35
35
  {
36
36
  name: "ruleResult.props.records",
37
37
  textAlign: "right",
38
- fieldSelector: "_embedded.result.records"
38
+ fieldSelector: "_embedded.result.records",
39
39
  },
40
40
  {
41
41
  name: "ruleResult.props.errors",
42
42
  textAlign: "right",
43
- fieldSelector: "_embedded.result.errors"
43
+ fieldSelector: "_embedded.result.errors",
44
44
  },
45
45
  {
46
46
  name: "ruleResult.props.quality",
47
47
  fieldSelector: ({ _embedded }) => ({
48
48
  ruleResult: _embedded?.result,
49
- rule: _embedded?.rule
49
+ ruleImplementation: _embedded?.implementation,
50
50
  }),
51
- fieldDecorator: RuleResultDecorator
52
- }
51
+ fieldDecorator: RuleResultDecorator,
52
+ },
53
53
  ];
54
54
 
55
55
  export const ExecutionRow = ({ execution }) => (
@@ -65,7 +65,7 @@ export const ExecutionRow = ({ execution }) => (
65
65
  );
66
66
 
67
67
  ExecutionRow.propTypes = {
68
- execution: PropTypes.object
68
+ execution: PropTypes.object,
69
69
  };
70
70
 
71
71
  export const ExecutionGroup = ({ executionGroup, executionGroupLoading }) => {
@@ -74,10 +74,19 @@ export const ExecutionGroup = ({ executionGroup, executionGroupLoading }) => {
74
74
  executionGroup?._embedded?.executions
75
75
  );
76
76
  const count = size(executions);
77
- const pendingCount = flow(reject("_embedded.result"), size)(executions);
77
+ const missingResultCount = flow(reject("_embedded.result"), size)(executions);
78
+ const errorCount = flow(
79
+ filter(flow(prop("_embedded.quality_events"), size)),
80
+ size
81
+ )(executions);
82
+
78
83
  return executionGroupLoading ? null : (
79
84
  <>
80
- <ExecutionGroupMessage count={count} pending={pendingCount} />
85
+ <ExecutionGroupMessage
86
+ count={count}
87
+ pending={missingResultCount - errorCount}
88
+ error={errorCount}
89
+ />
81
90
  <Table>
82
91
  <Table.Header>
83
92
  <Table.Row>
@@ -102,12 +111,12 @@ export const ExecutionGroup = ({ executionGroup, executionGroupLoading }) => {
102
111
 
103
112
  ExecutionGroup.propTypes = {
104
113
  executionGroup: PropTypes.object,
105
- executionGroupLoading: PropTypes.bool
114
+ executionGroupLoading: PropTypes.bool,
106
115
  };
107
116
 
108
117
  export const mapStateToProps = ({ executionGroup, executionGroupLoading }) => ({
109
118
  executionGroup,
110
- executionGroupLoading
119
+ executionGroupLoading,
111
120
  });
112
121
 
113
122
  export default connect(mapStateToProps)(ExecutionGroup);
@@ -0,0 +1,80 @@
1
+ import _ from "lodash/fp";
2
+ import React from "react";
3
+ import PropTypes from "prop-types";
4
+ import { Popup } from "semantic-ui-react";
5
+ import { Link } from "react-router-dom";
6
+ import { FormattedMessage, useIntl } from "react-intl";
7
+ import { linkTo } from "@truedat/core/routes";
8
+ import { calculateResultDecoration } from "./RuleResultDecorator";
9
+ import "../styles/ruleSummary.less";
10
+
11
+ export default function ImplementationResultBar({ implementation }) {
12
+ const intl = useIntl();
13
+ const ruleResult = _.head(implementation?.results);
14
+ const { color, resultText } =
15
+ implementation.event_type === "FAILED"
16
+ ? {
17
+ color: "failed",
18
+ resultText: intl.formatMessage({ id: "quality.error" }),
19
+ }
20
+ : calculateResultDecoration({
21
+ ruleResult,
22
+ ruleImplementation: implementation,
23
+ date: ruleResult?.date,
24
+ intl,
25
+ });
26
+
27
+ const propsByColor = {
28
+ red: {
29
+ className: "under-minimum-color",
30
+ tooltip: "under_minimum",
31
+ },
32
+ yellow: {
33
+ className: "under-goal-color",
34
+ tooltip: "under_goal",
35
+ },
36
+ green: {
37
+ className: "over-goal-color",
38
+ tooltip: "over_goal",
39
+ },
40
+ grey: {
41
+ className: "not-executed-color",
42
+ tooltip: "no_execution",
43
+ },
44
+ failed: {
45
+ className: "failed-color",
46
+ tooltip: "failed",
47
+ },
48
+ };
49
+ const summaryProps = propsByColor[color];
50
+ return (
51
+ <div className="rule-summary-wrapper">
52
+ <Link
53
+ as="div"
54
+ className="rule-summary pointer"
55
+ to={linkTo.RULE_IMPLEMENTATION_RESULTS({
56
+ id: implementation.rule_id,
57
+ implementation_id: implementation.id,
58
+ })}
59
+ >
60
+ <Popup
61
+ position="bottom center"
62
+ basic
63
+ on="hover"
64
+ content={
65
+ <FormattedMessage id={`quality_result.${summaryProps.tooltip}`} />
66
+ }
67
+ trigger={
68
+ <span className={summaryProps.className} style={{ width: "100%" }}>
69
+ <span className="value">{resultText}</span>
70
+ </span>
71
+ }
72
+ />
73
+ </Link>
74
+ </div>
75
+ );
76
+ }
77
+
78
+ ImplementationResultBar.propTypes = {
79
+ implementation: PropTypes.object.isRequired,
80
+ };
@@ -1,11 +1,12 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Header, Icon, Label, Grid, Table } from "semantic-ui-react";
4
+ import { Header, Icon, Table, Segment } from "semantic-ui-react";
5
5
  import { Link } from "react-router-dom";
6
6
  import { FormattedMessage } from "react-intl";
7
7
  import { linkTo } from "@truedat/core/routes";
8
8
  import ConditionSummary, { empty, path } from "./ConditionSummary";
9
+ import InformationSummary from "./InformationSummary";
9
10
 
10
11
  const defaults = [
11
12
  "executable",
@@ -38,45 +39,6 @@ FormattedLink.propTypes = {
38
39
  operator: PropTypes.object,
39
40
  };
40
41
 
41
- const GeneralSummary = ({ executable, implementationKey }) => (
42
- <>
43
- <Header as="h3">
44
- <Icon name="database" size="small" />
45
- <Header.Content>
46
- <FormattedMessage id="ruleImplementations.summary.headers.implementation" />
47
- </Header.Content>
48
- </Header>
49
- <Grid>
50
- <Grid.Row>
51
- <Grid.Column>
52
- <Label color={executable ? "olive" : "teal"}>
53
- <FormattedMessage
54
- id={`ruleImplementation.props.executable.${executable}`}
55
- />
56
- </Label>
57
- </Grid.Column>
58
- </Grid.Row>
59
- {implementationKey && (
60
- <Grid.Row columns={2}>
61
- <Grid.Column width={4}>
62
- <FormattedMessage
63
- id={`ruleImplementation.summary.implementation_key`}
64
- />
65
- </Grid.Column>
66
- <Grid.Column width={12}>
67
- <span className="highlighted">{`"${implementationKey}"`}</span>
68
- </Grid.Column>
69
- </Grid.Row>
70
- )}
71
- </Grid>
72
- </>
73
- );
74
-
75
- GeneralSummary.propTypes = {
76
- executable: PropTypes.bool,
77
- implementationKey: PropTypes.string,
78
- };
79
-
80
42
  const DatasetSummary = ({ rows }) =>
81
43
  empty(rows) ? null : (
82
44
  <>
@@ -86,34 +48,36 @@ const DatasetSummary = ({ rows }) =>
86
48
  <FormattedMessage id="ruleImplementations.summary.headers.dataset" />
87
49
  </Header.Content>
88
50
  </Header>
89
- <Table basic="very">
90
- <Table.Header>
91
- <Table.Row>
92
- <Table.HeaderCell>
93
- <FormattedMessage id={`ruleImplementation.summary.structure`} />
94
- </Table.HeaderCell>
95
- </Table.Row>
96
- </Table.Header>
97
- <Table.Body>
98
- {rows.map((row, i) => (
99
- <Table.Row key={i}>
100
- {_.has("structure")(row) && (
101
- <Table.Cell key={i}>
102
- <Link
103
- to={linkTo.STRUCTURE({
104
- id: _.pathOr("", "structure.id")(row),
105
- })}
106
- >
107
- <span key={i} className="highlighted">{`"${path(
108
- _.propOr({}, "structure")(row)
109
- )}"`}</span>
110
- </Link>
111
- </Table.Cell>
112
- )}
51
+ <Segment>
52
+ <Table basic="very">
53
+ <Table.Header>
54
+ <Table.Row>
55
+ <Table.HeaderCell>
56
+ <FormattedMessage id={`ruleImplementation.summary.structure`} />
57
+ </Table.HeaderCell>
113
58
  </Table.Row>
114
- ))}
115
- </Table.Body>
116
- </Table>
59
+ </Table.Header>
60
+ <Table.Body>
61
+ {rows.map((row, i) => (
62
+ <Table.Row key={i}>
63
+ {_.has("structure")(row) && (
64
+ <Table.Cell key={i}>
65
+ <Link
66
+ to={linkTo.STRUCTURE({
67
+ id: _.pathOr("", "structure.id")(row),
68
+ })}
69
+ >
70
+ <span key={i} className="highlighted">{`"${path(
71
+ _.propOr({}, "structure")(row)
72
+ )}"`}</span>
73
+ </Link>
74
+ </Table.Cell>
75
+ )}
76
+ </Table.Row>
77
+ ))}
78
+ </Table.Body>
79
+ </Table>
80
+ </Segment>
117
81
  </>
118
82
  );
119
83
 
@@ -123,16 +87,13 @@ DatasetSummary.propTypes = {
123
87
 
124
88
  export const ImplementationSummary = ({ ruleImplementation, activeSteps }) => {
125
89
  const steps = _.isEmpty(activeSteps) ? defaults : activeSteps;
126
- const { executable, implementationKey, dataset, population, validations } =
90
+ const { dataset, population, validations } =
127
91
  _.pick(steps)(ruleImplementation);
128
92
  return (
129
93
  <>
130
94
  {(_.includes("implementationKey")(steps) ||
131
95
  _.includes("executable")(steps)) && (
132
- <GeneralSummary
133
- executable={executable}
134
- implementationKey={implementationKey}
135
- />
96
+ <InformationSummary ruleImplementation={ruleImplementation} />
136
97
  )}
137
98
  {dataset && _.includes("dataset")(steps) && (
138
99
  <DatasetSummary rows={dataset} />
@@ -0,0 +1,68 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { FormattedMessage } from "react-intl";
4
+ import { Header, Icon, Segment, List } from "semantic-ui-react";
5
+
6
+ export default function InformationSummary({ ruleImplementation }) {
7
+ return (
8
+ <>
9
+ <Header as="h3">
10
+ <Icon name="info" size="small" />
11
+ <Header.Content>
12
+ <FormattedMessage id="ruleImplementationForm.step.information" />
13
+ </Header.Content>
14
+ </Header>
15
+ <Segment>
16
+ <List>
17
+ <List.Item>
18
+ <List.Header>
19
+ <FormattedMessage id="quality.thresholds" />
20
+ </List.Header>
21
+ <List.Content>
22
+ <List.Description>
23
+ <FormattedMessage
24
+ id={`ruleImplementations.props.result_type.${ruleImplementation.result_type}`}
25
+ />
26
+ </List.Description>
27
+ </List.Content>
28
+ </List.Item>
29
+ <List.Item>
30
+ <Icon name="circle" color="yellow" />
31
+ <List.Content>
32
+ <List.Header>
33
+ <FormattedMessage id="quality.threshold" />
34
+ </List.Header>
35
+ <List.Description>
36
+ {ruleImplementation.minimum &&
37
+ `${ruleImplementation.minimum} ${
38
+ ruleImplementation.result_type !== "errors_number"
39
+ ? "%"
40
+ : ""
41
+ }`}
42
+ </List.Description>
43
+ </List.Content>
44
+ </List.Item>
45
+ <List.Item>
46
+ <Icon name="circle" color="green" />
47
+ <List.Content>
48
+ <List.Header>
49
+ <FormattedMessage id="quality.goal" />
50
+ </List.Header>
51
+ <List.Description>
52
+ {ruleImplementation.goal &&
53
+ `${ruleImplementation.goal} ${
54
+ ruleImplementation.result_type !== "errors_number"
55
+ ? "%"
56
+ : ""
57
+ }`}
58
+ </List.Description>
59
+ </List.Content>
60
+ </List.Item>
61
+ </List>
62
+ </Segment>
63
+ </>
64
+ );
65
+ }
66
+ InformationSummary.propTypes = {
67
+ ruleImplementation: PropTypes.object.isRequired,
68
+ };
@@ -220,6 +220,9 @@ export const NewRuleImplementation = ({
220
220
  },
221
221
  dfName: _.prop("df_name")(ruleImplementationProps),
222
222
  dfContent: ruleImplementationProps.df_content,
223
+ result_type: ruleImplementationProps.result_type,
224
+ minimum: ruleImplementationProps.minimum,
225
+ goal: ruleImplementationProps.goal,
223
226
  }
224
227
  : {
225
228
  executable: true,
@@ -237,6 +240,9 @@ export const NewRuleImplementation = ({
237
240
  },
238
241
  dfName: "",
239
242
  dfContent: {},
243
+ result_type: "percentage",
244
+ minimum: null,
245
+ goal: null,
240
246
  }
241
247
  );
242
248
 
@@ -343,6 +349,9 @@ export const NewRuleImplementation = ({
343
349
  df_content: dfContent,
344
350
  rule_id: rule.id,
345
351
  raw_content: { ...raw_content, source },
352
+ result_type: ruleImplementation.result_type,
353
+ minimum: ruleImplementation.minimum,
354
+ goal: ruleImplementation.goal,
346
355
  }
347
356
  : {
348
357
  executable: ruleImplementation.executable,
@@ -355,6 +364,9 @@ export const NewRuleImplementation = ({
355
364
  df_name,
356
365
  df_content: dfContent,
357
366
  rule_id: rule.id,
367
+ result_type: ruleImplementation.result_type,
368
+ minimum: ruleImplementation.minimum,
369
+ goal: ruleImplementation.goal,
358
370
  };
359
371
 
360
372
  clone || !edition