@truedat/dq 4.43.6 → 4.44.2

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 (52) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +5 -5
  3. package/src/components/ImplementationCrumbs.js +91 -0
  4. package/src/components/ImplementationResultBar.js +1 -2
  5. package/src/components/ImplementationStructures.js +1 -3
  6. package/src/components/Implementations.js +9 -2
  7. package/src/components/ImplementationsRoutes.js +386 -17
  8. package/src/components/NewRuleImplementation.js +11 -27
  9. package/src/components/RemediationCrumbs.js +1 -2
  10. package/src/components/RuleCrumbs.js +6 -63
  11. package/src/components/RuleImplementation.js +15 -36
  12. package/src/components/RuleImplementationActions.js +18 -12
  13. package/src/components/RuleImplementationLink.js +2 -3
  14. package/src/components/RuleImplementationProperties.js +13 -14
  15. package/src/components/RuleImplementationResultTabs.js +27 -35
  16. package/src/components/RuleImplementationResults.js +1 -6
  17. package/src/components/RuleImplementationResultsLink.js +3 -9
  18. package/src/components/RuleImplementationTabs.js +13 -18
  19. package/src/components/RuleImplementationsActions.js +47 -1
  20. package/src/components/RuleLink.js +3 -4
  21. package/src/components/RuleResultRow.js +1 -6
  22. package/src/components/RuleResultSegmentRow.js +0 -3
  23. package/src/components/RuleResultSegments.js +2 -6
  24. package/src/components/RuleResultsRoutes.js +10 -10
  25. package/src/components/RuleRoutes.js +8 -285
  26. package/src/components/__tests__/__snapshots__/ImplementationResultBar.spec.js.snap +5 -5
  27. package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +3 -0
  28. package/src/components/__tests__/__snapshots__/RuleCrumbs.spec.js.snap +2 -73
  29. package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +7 -86
  30. package/src/components/__tests__/__snapshots__/RuleImplementationResultTabs.spec.js.snap +1 -1
  31. package/src/components/__tests__/__snapshots__/RuleImplementationResults.spec.js.snap +0 -7
  32. package/src/components/__tests__/__snapshots__/RuleImplementationResultsLink.spec.js.snap +1 -1
  33. package/src/components/__tests__/__snapshots__/RuleImplementationTabs.spec.js.snap +5 -5
  34. package/src/components/ruleImplementationForm/InformationForm.js +14 -1
  35. package/src/components/ruleImplementationForm/RuleImplementationForm.js +16 -11
  36. package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +16 -0
  37. package/src/components/ruleImplementationForm/__tests__/RuleImplementationForm.spec.js +4 -2
  38. package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +40 -0
  39. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +4 -0
  40. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationRawForm.spec.js.snap +5 -0
  41. package/src/messages/en.js +4 -0
  42. package/src/messages/es.js +4 -0
  43. package/src/reducers/__tests__/ruleImplementationRedirect.spec.js +2 -2
  44. package/src/reducers/__tests__/ruleRedirect.spec.js +3 -3
  45. package/src/reducers/ruleImplementation.js +3 -0
  46. package/src/reducers/ruleImplementationRedirect.js +7 -6
  47. package/src/reducers/ruleRedirect.js +4 -2
  48. package/src/reducers/userRulePermissions.js +3 -1
  49. package/src/sagas/__tests__/deleteRuleResult.spec.js +3 -5
  50. package/src/sagas/__tests__/setRuleImplementationStatus.spec.js +7 -4
  51. package/src/sagas/deleteRuleResult.js +2 -7
  52. package/src/sagas/setRuleImplementationStatus.js +7 -1
@@ -2,7 +2,7 @@ import _ from "lodash/fp";
2
2
  import React, { useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
- import { Button, Divider, Header, Grid } from "semantic-ui-react";
5
+ import { Divider, Header, Grid } from "semantic-ui-react";
6
6
  import { FormattedMessage } from "react-intl";
7
7
  import { gql, useQuery } from "@apollo/client";
8
8
  import { Loading } from "@truedat/core/components";
@@ -237,7 +237,6 @@ const withConditionDefaultAlias = (conditions, structures) =>
237
237
  })(conditions);
238
238
 
239
239
  export const NewRuleImplementation = ({
240
- canManageRaw,
241
240
  clone,
242
241
  createRuleImplementation,
243
242
  updateRuleImplementation,
@@ -251,6 +250,7 @@ export const NewRuleImplementation = ({
251
250
  operators,
252
251
  template,
253
252
  applyTemplate,
253
+ implementationType = "",
254
254
  }) => {
255
255
  const precalculatedDataset = _.flow(
256
256
  _.propOr([{}], "dataset"),
@@ -316,11 +316,13 @@ export const NewRuleImplementation = ({
316
316
  result_type: ruleImplementationProps.result_type,
317
317
  minimum: ruleImplementationProps.minimum,
318
318
  goal: ruleImplementationProps.goal,
319
+ rule_id: ruleImplementationProps.rule_id,
320
+ domain_id: ruleImplementationProps.domain_id,
319
321
  }
320
322
  : {
321
323
  executable: true,
322
324
  implementationKey: "",
323
- implementationType: "default",
325
+ implementationType,
324
326
  dataset: [{}],
325
327
  population: [],
326
328
  populations: [],
@@ -460,9 +462,6 @@ export const NewRuleImplementation = ({
460
462
  const setImplementationKey = (implementationKey) =>
461
463
  setRuleImplementation({ ...ruleImplementation, implementationKey });
462
464
 
463
- const setImplementationType = (implementationType) =>
464
- setRuleImplementation({ ...ruleImplementation, implementationType });
465
-
466
465
  const setImplementationRawContent = (rawContent) =>
467
466
  setRuleImplementation({ ...ruleImplementation, rawContent });
468
467
 
@@ -502,11 +501,12 @@ export const NewRuleImplementation = ({
502
501
  _.prop("implementationType")(ruleImplementation),
503
502
  df_name,
504
503
  df_content: dfContent,
505
- rule_id: rule.id,
504
+ rule_id: rule ? rule.id : ruleImplementation.rule_id,
506
505
  raw_content: { ...raw_content, source },
507
506
  result_type: ruleImplementation.result_type,
508
507
  minimum: ruleImplementation.minimum,
509
508
  goal: ruleImplementation.goal,
509
+ domain_id: ruleImplementation.domain_id,
510
510
  }
511
511
  : {
512
512
  executable: ruleImplementation.executable,
@@ -519,10 +519,11 @@ export const NewRuleImplementation = ({
519
519
  _.prop("implementationType")(ruleImplementation),
520
520
  df_name,
521
521
  df_content: dfContent,
522
- rule_id: rule.id,
522
+ rule_id: rule ? rule.id : ruleImplementation.rule_id,
523
523
  result_type: ruleImplementation.result_type,
524
524
  minimum: ruleImplementation.minimum,
525
525
  goal: ruleImplementation.goal,
526
+ domain_id: ruleImplementation.domain_id,
526
527
  };
527
528
 
528
529
  clone || !edition
@@ -543,20 +544,6 @@ export const NewRuleImplementation = ({
543
544
  <Grid divided className="full-height">
544
545
  <Grid.Column width="11">
545
546
  <Grid.Row>
546
- {!edition && canManageRaw && (
547
- <Button.Group floated="right">
548
- <Button
549
- active={ruleImplementation.implementationType != "raw"}
550
- icon="tasks"
551
- onClick={() => setImplementationType("")}
552
- />
553
- <Button
554
- active={ruleImplementation.implementationType == "raw"}
555
- icon="file alternate outline"
556
- onClick={() => setImplementationType("raw")}
557
- />
558
- </Button.Group>
559
- )}
560
547
  <Header as="h2">
561
548
  <Header.Content>
562
549
  <FormattedMessage
@@ -616,7 +603,6 @@ export const NewRuleImplementation = ({
616
603
  };
617
604
 
618
605
  NewRuleImplementation.propTypes = {
619
- canManageRaw: PropTypes.bool,
620
606
  clone: PropTypes.bool,
621
607
  createRuleImplementation: PropTypes.func.isRequired,
622
608
  updateRuleImplementation: PropTypes.func,
@@ -630,6 +616,7 @@ NewRuleImplementation.propTypes = {
630
616
  applyTemplate: PropTypes.func,
631
617
  sources: PropTypes.array,
632
618
  sourcesLoading: PropTypes.bool,
619
+ implementationType: PropTypes.string,
633
620
  };
634
621
 
635
622
  export const SOURCES_WITH_CONFIG = gql`
@@ -643,7 +630,7 @@ export const SOURCES_WITH_CONFIG = gql`
643
630
  `;
644
631
 
645
632
  export const NewRuleImplementationLoader = (props) => {
646
- const { data, error, loading } = useQuery(SOURCES_WITH_CONFIG, {
633
+ const { data, loading } = useQuery(SOURCES_WITH_CONFIG, {
647
634
  variables: { jobTypes: "quality" },
648
635
  });
649
636
  if (loading) return <Loading />;
@@ -666,9 +653,6 @@ const mapStateToProps = (state) => ({
666
653
  ruleImplementationRaw: state.ruleImplementationRaw,
667
654
  structuresFields: state.structuresFields,
668
655
  structuresSiblings: state.structuresSiblings,
669
- canManageRaw: _.prop("manage_raw_quality_rule_implementations")(
670
- state.userRulePermissions
671
- ),
672
656
  operators: getRuleImplementationOperators(state),
673
657
  template: _.defaultTo({})(state.template),
674
658
  applyTemplate: applyTemplate(state.template),
@@ -37,8 +37,7 @@ export const RemediationCrumbs = ({ rule, ruleImplementation }) => {
37
37
  {ruleResultId ? (
38
38
  <Breadcrumb.Section
39
39
  as={Link}
40
- to={linkTo.RULE_IMPLEMENTATION({
41
- id: rule.id,
40
+ to={linkTo.IMPLEMENTATION({
42
41
  implementation_id: ruleImplementation.id,
43
42
  })}
44
43
  active={_.isEmpty(ruleImplementation)}
@@ -1,83 +1,26 @@
1
- import _ from "lodash/fp";
2
1
  import React from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { Breadcrumb } from "semantic-ui-react";
5
4
  import { connect } from "react-redux";
6
- import { Link, useParams } from "react-router-dom";
5
+ import { Link } from "react-router-dom";
7
6
  import { FormattedMessage } from "react-intl";
8
- import { RULES, linkTo } from "@truedat/core/routes";
9
- import { DateTime } from "@truedat/core/components";
10
-
11
- export const RuleCrumbs = ({ rule, ruleImplementation }) => {
12
- const { rule_result_id } = useParams();
13
-
14
- const ruleResultDate = _.flow(
15
- _.propOr([], "results"),
16
- _.find(_.propEq("id", _.toNumber(rule_result_id))),
17
- _.pathOr("0000-00-00 00:00", "date")
18
- )(ruleImplementation);
7
+ import { RULES } from "@truedat/core/routes";
19
8
 
9
+ export const RuleCrumbs = ({ rule }) => {
20
10
  return rule.name ? (
21
11
  <Breadcrumb>
22
12
  <Breadcrumb.Section as={Link} to={RULES} active={false}>
23
13
  <FormattedMessage id="rules.crumbs.top" />
24
14
  </Breadcrumb.Section>
25
- {rule.name && (
26
- <>
27
- <Breadcrumb.Divider icon="right angle" />
28
- {ruleImplementation.id ? (
29
- <Breadcrumb.Section
30
- as={Link}
31
- to={linkTo.RULE({ id: rule.id })}
32
- active={_.isEmpty(ruleImplementation)}
33
- >
34
- {rule.name}
35
- </Breadcrumb.Section>
36
- ) : (
37
- <Breadcrumb.Section active>{rule.name}</Breadcrumb.Section>
38
- )}
39
- </>
40
- )}
41
- {ruleImplementation.id && (
42
- <>
43
- <Breadcrumb.Divider icon="right angle" />
44
- {rule_result_id ? (
45
- <Breadcrumb.Section
46
- as={Link}
47
- to={linkTo.RULE_IMPLEMENTATION({
48
- id: rule.id,
49
- implementation_id: ruleImplementation.id,
50
- })}
51
- active={_.isEmpty(ruleImplementation)}
52
- >
53
- {ruleImplementation.implementation_key}
54
- </Breadcrumb.Section>
55
- ) : (
56
- <Breadcrumb.Section active>
57
- {ruleImplementation.implementation_key}
58
- </Breadcrumb.Section>
59
- )}
60
- </>
61
- )}
62
- {rule_result_id && (
63
- <>
64
- <Breadcrumb.Divider icon="right angle" />
65
- <Breadcrumb.Section active>
66
- {<DateTime value={ruleResultDate} />}
67
- </Breadcrumb.Section>
68
- </>
69
- )}
15
+ <Breadcrumb.Divider icon="right angle" />
16
+ <Breadcrumb.Section active>{rule.name}</Breadcrumb.Section>
70
17
  </Breadcrumb>
71
18
  ) : null;
72
19
  };
73
20
 
74
21
  RuleCrumbs.propTypes = {
75
22
  rule: PropTypes.object,
76
- ruleImplementation: PropTypes.object,
77
23
  };
78
24
 
79
- const mapStateToProps = ({ rule, ruleImplementation }) => ({
80
- rule,
81
- ruleImplementation,
82
- });
25
+ const mapStateToProps = ({ rule }) => ({ rule });
83
26
  export default connect(mapStateToProps)(RuleCrumbs);
@@ -70,13 +70,10 @@ const getAvailableActions = (props, formatMessage) => {
70
70
  text: formatMessage({ id: "ruleImplementation.actions.edit" }),
71
71
  value: "edit",
72
72
  as: Link,
73
- to: linkTo.RULE_IMPLEMENTATION_EDIT({
74
- id: _.path("rule.id")(props),
73
+ to: linkTo.IMPLEMENTATION_EDIT({
75
74
  implementation_id: _.path("ruleImplementation.id")(props),
76
75
  }),
77
- filter:
78
- props.authManageSegments ||
79
- _.isEmpty(props.ruleImplementation.segments),
76
+ filter: props.editPermission,
80
77
  selected: false,
81
78
  active: false,
82
79
  },
@@ -86,8 +83,7 @@ const getAvailableActions = (props, formatMessage) => {
86
83
  text: formatMessage({ id: "ruleImplementation.actions.move" }),
87
84
  value: "move",
88
85
  as: Link,
89
- to: linkTo.RULE_IMPLEMENTATION_MOVE({
90
- id: _.path("rule.id")(props),
86
+ to: linkTo.IMPLEMENTATION_MOVE({
91
87
  implementation_id: _.path("ruleImplementation.id")(props),
92
88
  }),
93
89
  filter: props?.authorized,
@@ -100,8 +96,7 @@ const getAvailableActions = (props, formatMessage) => {
100
96
  text: formatMessage({ id: "ruleImplementation.actions.clone" }),
101
97
  value: "clone",
102
98
  as: Link,
103
- to: linkTo.RULE_IMPLEMENTATION_CLONE({
104
- id: _.path("rule.id")(props),
99
+ to: linkTo.IMPLEMENTATION_CLONE({
105
100
  implementation_id: _.path("ruleImplementation.id")(props),
106
101
  }),
107
102
  filter: true,
@@ -121,7 +116,6 @@ const OptionModal = ({
121
116
  iconName,
122
117
  option,
123
118
  restore,
124
- rule,
125
119
  ruleImplementation,
126
120
  setRuleImplementationStatus,
127
121
  }) => {
@@ -139,7 +133,6 @@ const OptionModal = ({
139
133
  content={formatMessage({ id: contentMessage })}
140
134
  onConfirm={() =>
141
135
  setRuleImplementationStatus({
142
- ruleId: rule.id,
143
136
  id: ruleImplementation.id,
144
137
  ...payload,
145
138
  })
@@ -158,7 +151,6 @@ OptionModal.propTypes = {
158
151
  iconName: PropTypes.string,
159
152
  option: PropTypes.string,
160
153
  restore: PropTypes.bool,
161
- rule: PropTypes.object,
162
154
  ruleImplementation: PropTypes.object,
163
155
  setRuleImplementationStatus: PropTypes.func,
164
156
  };
@@ -166,10 +158,9 @@ OptionModal.propTypes = {
166
158
  export const RuleImplementation = ({
167
159
  children,
168
160
  setRuleImplementationStatus,
169
- rule,
170
161
  ruleImplementation,
171
- userRulePermissions,
172
- authManageSegments,
162
+ editPermission,
163
+ managePermission,
173
164
  }) => {
174
165
  const authorized = useAuthorized();
175
166
  const { formatMessage } = useIntl();
@@ -179,10 +170,9 @@ export const RuleImplementation = ({
179
170
  {
180
171
  activeMode,
181
172
  authorized,
182
- rule,
183
173
  ruleImplementation,
184
174
  setRuleImplementationStatus,
185
- authManageSegments,
175
+ editPermission,
186
176
  },
187
177
  formatMessage
188
178
  );
@@ -209,12 +199,9 @@ export const RuleImplementation = ({
209
199
  icon={{ name: "warning circle", color: "red" }}
210
200
  />
211
201
  )}
212
- {_.prop("manage_quality_rule_implementations")(
213
- userRulePermissions
214
- ) &&
215
- !_.isEmpty(availableActions) && (
216
- <GroupActions availableActions={availableActions} />
217
- )}
202
+ {managePermission && !_.isEmpty(availableActions) && (
203
+ <GroupActions availableActions={availableActions} />
204
+ )}
218
205
  </>
219
206
  </Grid.Column>
220
207
  </Grid>
@@ -227,24 +214,16 @@ export const RuleImplementation = ({
227
214
  RuleImplementation.propTypes = {
228
215
  ruleImplementation: PropTypes.object.isRequired,
229
216
  setRuleImplementationStatus: PropTypes.func,
230
- rule: PropTypes.object,
231
217
  ruleImplementation: PropTypes.object,
232
- userRulePermissions: PropTypes.object,
233
- authManageSegments: PropTypes.bool,
218
+ editPermission: PropTypes.bool,
219
+ managePermission: PropTypes.bool,
234
220
  children: PropTypes.node,
235
221
  };
236
222
 
237
- const mapStateToProps = ({
238
- rule,
239
- ruleImplementation,
240
- userRulePermissions,
241
- implementationActions,
242
- }) => ({
243
- rule,
223
+ const mapStateToProps = ({ ruleImplementation, implementationActions }) => ({
244
224
  ruleImplementation,
245
- userRulePermissions,
246
- authManageSegments:
247
- _.pathOr(false, "manage_segments.method")(implementationActions) === "POST",
225
+ editPermission: !!_.pathOr(false, "edit")(implementationActions),
226
+ managePermission: !!_.pathOr(false, "manage")(implementationActions),
248
227
  });
249
228
 
250
229
  export default connect(mapStateToProps, { setRuleImplementationStatus })(
@@ -7,23 +7,26 @@ import { Link, useParams } from "react-router-dom";
7
7
  import { Button } from "semantic-ui-react";
8
8
  import { linkTo } from "@truedat/core/routes";
9
9
 
10
- const createRuleImplementationUrl = linkTo.RULE_IMPLEMENTATION_NEW;
11
-
12
- const getCreateRuleImplementationUrl = ({ id }) =>
13
- createRuleImplementationUrl({ id });
14
-
15
10
  const RuleImplementationActions = ({
16
11
  manageRuleImplementationAction,
17
- rule: { id }
12
+ manageRawRuleImplementationAction,
18
13
  }) => {
19
14
  const params = useParams();
20
15
  return (
21
16
  <>
17
+ {manageRawRuleImplementationAction && (
18
+ <Button
19
+ as={Link}
20
+ to={linkTo.RULE_IMPLEMENTATION_NEW_RAW(params)}
21
+ className="primary_action"
22
+ content={<FormattedMessage id="quality.rule.actions.create_raw" />}
23
+ />
24
+ )}
22
25
  {manageRuleImplementationAction && (
23
26
  <Button
24
27
  primary
25
28
  as={Link}
26
- to={getCreateRuleImplementationUrl(params, id)}
29
+ to={linkTo.RULE_IMPLEMENTATION_NEW(params)}
27
30
  className="primary_action"
28
31
  content={<FormattedMessage id="quality.rule.actions.create" />}
29
32
  />
@@ -33,17 +36,20 @@ const RuleImplementationActions = ({
33
36
  };
34
37
 
35
38
  RuleImplementationActions.propTypes = {
36
- rule: PropTypes.object.isRequired,
37
- manageRuleImplementationAction: PropTypes.bool
39
+ manageRuleImplementationAction: PropTypes.bool,
40
+ manageRawRuleImplementationAction: PropTypes.bool,
38
41
  };
39
42
 
40
- const mapStateToProps = ({ rule, userRulePermissions }) => ({
41
- rule,
43
+ const mapStateToProps = ({ userRulePermissions }) => ({
42
44
  userRulePermissions: userRulePermissions,
43
45
  manageRuleImplementationAction: _.propOr(
44
46
  false,
45
47
  "manage_quality_rule_implementations"
46
- )(userRulePermissions)
48
+ )(userRulePermissions),
49
+ manageRawRuleImplementationAction: _.propOr(
50
+ false,
51
+ "manage_raw_quality_rule_implementations"
52
+ )(userRulePermissions),
47
53
  });
48
54
 
49
55
  export default connect(mapStateToProps)(RuleImplementationActions);
@@ -3,8 +3,8 @@ import PropTypes from "prop-types";
3
3
  import { Link } from "react-router-dom";
4
4
  import { linkTo } from "@truedat/core/routes";
5
5
 
6
- export const RuleImplementationLink = ({ id, implementation_key, rule_id }) => (
7
- <Link to={linkTo.RULE_IMPLEMENTATION({ id: rule_id, implementation_id: id })}>
6
+ export const RuleImplementationLink = ({ id, implementation_key }) => (
7
+ <Link to={linkTo.IMPLEMENTATION({ implementation_id: id })}>
8
8
  {implementation_key}
9
9
  </Link>
10
10
  );
@@ -12,7 +12,6 @@ export const RuleImplementationLink = ({ id, implementation_key, rule_id }) => (
12
12
  RuleImplementationLink.propTypes = {
13
13
  id: PropTypes.number,
14
14
  implementation_key: PropTypes.string,
15
- rule_id: PropTypes.number
16
15
  };
17
16
 
18
17
  export default RuleImplementationLink;
@@ -3,7 +3,7 @@ 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 { Grid, Label, Segment } from "semantic-ui-react";
6
+ import { Grid, Label, Segment, List } from "semantic-ui-react";
7
7
  import InformationSummary from "./InformationSummary";
8
8
  import ImplementationSummary from "./ImplementationSummary";
9
9
  import RawContent from "./RawContent";
@@ -33,6 +33,17 @@ export const RuleImplementationProperties = ({
33
33
  </Label>
34
34
  </Grid.Column>
35
35
  </Grid.Row>
36
+ {!_.isNil(ruleImplementation?.domain) && (
37
+ <List size="big" relaxed>
38
+ <List.Item>
39
+ <List.Header>
40
+ <FormattedMessage id="quality.domain" />
41
+ </List.Header>
42
+
43
+ <List.Content>{ruleImplementation?.domain.name}</List.Content>
44
+ </List.Item>
45
+ </List>
46
+ )}
36
47
  <Grid.Row>
37
48
  <Grid.Column width={10}>
38
49
  <InformationSummary ruleImplementation={ruleImplementation} />
@@ -72,19 +83,7 @@ const mapStateToProps = ({
72
83
  templates,
73
84
  ruleImplementationLoading,
74
85
  }) => ({
75
- ruleImplementation: _.pick([
76
- ...summarySteps,
77
- "populations",
78
- "segments",
79
- "executable",
80
- "event_type",
81
- "event_message",
82
- "event_inserted_at",
83
- "result_type",
84
- "minimum",
85
- "goal",
86
- "df_content",
87
- ])(ruleImplementation),
86
+ ruleImplementation,
88
87
  ruleImplementationRaw,
89
88
  templateImpl: _.find(_.propEq("name", ruleImplementation.df_name))(templates),
90
89
  ruleImplementationLoaded:
@@ -7,14 +7,13 @@ import { compose } from "redux";
7
7
  import { connect } from "react-redux";
8
8
  import { FormattedMessage } from "react-intl";
9
9
  import {
10
- RULE_IMPLEMENTATION_RESULT_DETAILS,
11
- RULE_IMPLEMENTATION_RESULT_SEGMENTS_RESULTS,
12
- RULE_IMPLEMENTATION_RESULT_REMEDIATION_PLAN,
10
+ IMPLEMENTATION_RESULT_DETAILS,
11
+ IMPLEMENTATION_RESULT_SEGMENTS_RESULTS,
12
+ IMPLEMENTATION_RESULT_REMEDIATION_PLAN,
13
13
  linkTo,
14
14
  } from "@truedat/core/routes";
15
15
 
16
16
  export const RuleImplementationResultTabs = ({
17
- rule,
18
17
  ruleImplementation,
19
18
  ruleResult,
20
19
  match,
@@ -24,10 +23,9 @@ export const RuleImplementationResultTabs = ({
24
23
  const renderSegmentResult = () => {
25
24
  return ruleResult.has_segments ? (
26
25
  <Menu.Item
27
- active={match.path === RULE_IMPLEMENTATION_RESULT_SEGMENTS_RESULTS}
26
+ active={match.path === IMPLEMENTATION_RESULT_SEGMENTS_RESULTS}
28
27
  as={Link}
29
- to={linkTo.RULE_IMPLEMENTATION_RESULT_SEGMENTS_RESULTS({
30
- id: rule.id,
28
+ to={linkTo.IMPLEMENTATION_RESULT_SEGMENTS_RESULTS({
31
29
  implementation_id: ruleImplementation.id,
32
30
  rule_result_id: ruleResult.id,
33
31
  })}
@@ -43,10 +41,9 @@ export const RuleImplementationResultTabs = ({
43
41
 
44
42
  return renderCondition ? (
45
43
  <Menu.Item
46
- active={match.path === RULE_IMPLEMENTATION_RESULT_REMEDIATION_PLAN}
44
+ active={match.path === IMPLEMENTATION_RESULT_REMEDIATION_PLAN}
47
45
  as={Link}
48
- to={linkTo.RULE_IMPLEMENTATION_RESULT_REMEDIATION_PLAN({
49
- id: rule.id,
46
+ to={linkTo.IMPLEMENTATION_RESULT_REMEDIATION_PLAN({
50
47
  implementation_id: ruleImplementation.id,
51
48
  rule_result_id: ruleResult.id,
52
49
  })}
@@ -56,29 +53,25 @@ export const RuleImplementationResultTabs = ({
56
53
  ) : null;
57
54
  };
58
55
 
59
- return _.isEmpty(ruleImplementation) || _.isEmpty(rule) ? null : (
60
- <>
61
- <Menu attached="top" pointing secondary tabular>
62
- <Menu.Item
63
- active={match.path === RULE_IMPLEMENTATION_RESULT_DETAILS}
64
- as={Link}
65
- to={linkTo.RULE_IMPLEMENTATION_RESULT_DETAILS({
66
- id: rule.id,
67
- implementation_id: ruleImplementation.id,
68
- rule_result_id: ruleResult.id,
69
- })}
70
- >
71
- <FormattedMessage id="tabs.dq.ruleImplementationResult.info" />
72
- </Menu.Item>
73
- {renderSegmentResult()}
74
- {renderRemediationPlan()}
75
- </Menu>
76
- </>
56
+ return _.isEmpty(ruleImplementation) ? null : (
57
+ <Menu attached="top" pointing secondary tabular>
58
+ <Menu.Item
59
+ active={match.path === IMPLEMENTATION_RESULT_DETAILS}
60
+ as={Link}
61
+ to={linkTo.IMPLEMENTATION_RESULT_DETAILS({
62
+ implementation_id: ruleImplementation.id,
63
+ rule_result_id: ruleResult.id,
64
+ })}
65
+ >
66
+ <FormattedMessage id="tabs.dq.ruleImplementationResult.info" />
67
+ </Menu.Item>
68
+ {renderSegmentResult()}
69
+ {renderRemediationPlan()}
70
+ </Menu>
77
71
  );
78
72
  };
79
73
 
80
74
  RuleImplementationResultTabs.propTypes = {
81
- rule: PropTypes.object,
82
75
  ruleResult: PropTypes.object,
83
76
  ruleImplementation: PropTypes.object,
84
77
  match: PropTypes.object,
@@ -86,12 +79,11 @@ RuleImplementationResultTabs.propTypes = {
86
79
  templates: PropTypes.array,
87
80
  };
88
81
 
89
- const mapStateToProps = (
90
- { rule, ruleImplementation, remediationActions, templates },
91
- ownProps
92
- ) => ({
93
- rule,
94
- ruleResult: ownProps.ruleResult,
82
+ const mapStateToProps = ({
83
+ ruleImplementation,
84
+ remediationActions,
85
+ templates,
86
+ }) => ({
95
87
  ruleImplementation,
96
88
  authCreateRemediation: _.has("create")(remediationActions),
97
89
  templates,
@@ -21,14 +21,13 @@ export const getCustomColumnsWithData = (ruleResults, columns) =>
21
21
  )(columns);
22
22
 
23
23
  export const RuleImplementationResults = ({
24
- rule,
25
24
  ruleImplementation,
26
25
  customColumns,
27
26
  isAdmin,
28
27
  }) => {
29
28
  const { formatMessage, locale } = useIntl();
30
29
 
31
- if (_.isEmpty(rule) || _.isEmpty(ruleImplementation)) return null;
30
+ if (_.isEmpty(ruleImplementation)) return null;
32
31
 
33
32
  const ruleResults = ruleImplementation.results;
34
33
  const optionalColumns = getOptionalColumnsWithData(ruleResults);
@@ -111,7 +110,6 @@ export const RuleImplementationResults = ({
111
110
  customColumns={customColumns}
112
111
  isAdmin={isAdmin}
113
112
  ruleImplementation={ruleImplementation}
114
- rule={rule}
115
113
  />
116
114
  ))}
117
115
  </Table.Body>
@@ -123,14 +121,11 @@ export const RuleImplementationResults = ({
123
121
 
124
122
  RuleImplementationResults.propTypes = {
125
123
  ruleImplementation: PropTypes.object,
126
- rule: PropTypes.object,
127
124
  customColumns: PropTypes.array,
128
125
  isAdmin: PropTypes.bool,
129
- ruleResult: PropTypes.object,
130
126
  };
131
127
 
132
128
  const mapStateToProps = (state) => ({
133
- rule: state.rule,
134
129
  ruleImplementation: state.ruleImplementation,
135
130
  customColumns: getCustomColumnsWithData(
136
131
  state.ruleImplementation?.results,
@@ -3,15 +3,10 @@ import PropTypes from "prop-types";
3
3
  import { Link } from "react-router-dom";
4
4
  import { linkTo } from "@truedat/core/routes";
5
5
 
6
- export const RuleImplementationResultsLink = ({
7
- id,
8
- implementation_key,
9
- rule_id
10
- }) => (
6
+ export const RuleImplementationResultsLink = ({ id, implementation_key }) => (
11
7
  <Link
12
- to={linkTo.RULE_IMPLEMENTATION_RESULTS({
13
- id: rule_id,
14
- implementation_id: id
8
+ to={linkTo.IMPLEMENTATION_RESULTS({
9
+ implementation_id: id,
15
10
  })}
16
11
  >
17
12
  {implementation_key}
@@ -21,7 +16,6 @@ export const RuleImplementationResultsLink = ({
21
16
  RuleImplementationResultsLink.propTypes = {
22
17
  id: PropTypes.number,
23
18
  implementation_key: PropTypes.string,
24
- rule_id: PropTypes.number
25
19
  };
26
20
 
27
21
  export default RuleImplementationResultsLink;