@truedat/dq 4.43.0 → 4.43.1
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.
- package/CHANGELOG.md +6 -0
- package/package.json +5 -5
- package/src/api.js +2 -0
- package/src/components/ConditionSummary.js +1 -0
- package/src/components/FieldSummary.js +86 -0
- package/src/components/ImplementationSummary.js +11 -1
- package/src/components/NewRemediation.js +27 -20
- package/src/components/NewRuleImplementation.js +42 -6
- package/src/components/RemediationPlan.js +47 -78
- package/src/components/RuleImplementationProperties.js +2 -1
- package/src/components/RuleImplementationResultTabs.js +113 -0
- package/src/components/RuleImplementationResults.js +1 -1
- package/src/components/RuleResult.js +108 -0
- package/src/components/{ExecutionDetails.js → RuleResultDetails.js} +4 -21
- package/src/components/RuleResultRemediationLoader.js +44 -0
- package/src/components/RuleResultRemediations.js +47 -0
- package/src/components/RuleResultRow.js +0 -3
- package/src/components/RuleResultSegmentRow.js +83 -0
- package/src/components/RuleResultSegments.js +102 -0
- package/src/components/RuleResultSegmentsLoader.js +34 -0
- package/src/components/RuleResultsRoutes.js +73 -0
- package/src/components/RuleRoutes.js +4 -14
- package/src/components/__test_samples__/NewRuleImplementationProps.js +22 -2
- package/src/components/__tests__/ExecutionDetails.spec.js +5 -5
- package/src/components/__tests__/NewRuleImplementation.spec.js +27 -7
- package/src/components/__tests__/RuleResultSegmentsLoader.spec.js +32 -0
- package/src/components/__tests__/__snapshots__/ExecutionDetails.spec.js.snap +2 -30
- package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +1211 -1217
- package/src/components/__tests__/__snapshots__/RuleImplementationProperties.spec.js.snap +1 -0
- package/src/components/index.js +2 -2
- package/src/components/ruleImplementationForm/FieldsGrid.js +57 -0
- package/src/components/ruleImplementationForm/FieldsGroup.js +107 -0
- package/src/components/ruleImplementationForm/RuleImplementationForm.js +45 -0
- package/src/components/ruleImplementationForm/SegmentsForm.js +35 -0
- package/src/components/ruleImplementationForm/__tests__/RuleImplementationForm.spec.js +27 -10
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +315 -91
- package/src/messages/en.js +7 -0
- package/src/messages/es.js +7 -0
- package/src/reducers/__tests__/segmentResult.spec.js +46 -0
- package/src/reducers/index.js +2 -0
- package/src/reducers/ruleImplementation.js +1 -0
- package/src/reducers/segmentResults.js +19 -0
- package/src/routines.js +3 -0
- package/src/sagas/__tests__/fetchSegmentResults.spec.js +78 -0
- package/src/sagas/fetchSegmentResults.js +30 -0
- package/src/sagas/index.js +3 -0
- package/src/services/encodeRawContent.js +5 -5
- package/src/styles/remediationPlan.less +5 -0
- package/src/styles/ruleImplementationForm/DatasetForm.less +5 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.43.
|
|
3
|
+
"version": "4.43.1",
|
|
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.43.
|
|
34
|
+
"@truedat/test": "4.43.1",
|
|
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.43.
|
|
86
|
-
"@truedat/df": "4.43.
|
|
85
|
+
"@truedat/core": "4.43.1",
|
|
86
|
+
"@truedat/df": "4.43.1",
|
|
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": "
|
|
106
|
+
"gitHead": "7ea6f37972e3a70706913ada33751b955313801f"
|
|
107
107
|
}
|
package/src/api.js
CHANGED
|
@@ -22,6 +22,7 @@ const API_RULE_IMPLEMENTATION_FILTERS_SEARCH =
|
|
|
22
22
|
const API_RULE_IMPLEMENTATIONS_UPLOAD = "/api/rule_implementations/upload";
|
|
23
23
|
const API_RULE_RESULT = "/api/rule_results/:id";
|
|
24
24
|
const API_RULE_RESULTS = "/api/rule_results";
|
|
25
|
+
const API_SEGMENT_RESULTS = "/api/rule_results/:rule_result_id/segment_results";
|
|
25
26
|
const API_SUBSCRIPTIONS_SEARCH = "/api/subscriptions/user/me/search";
|
|
26
27
|
const API_SUBSCRIPTION = "/api/subscriptions/:id";
|
|
27
28
|
const API_SUBSCRIPTIONS = "/api/subscriptions";
|
|
@@ -47,6 +48,7 @@ export {
|
|
|
47
48
|
API_RULE_IMPLEMENTATIONS_UPLOAD,
|
|
48
49
|
API_RULE_RESULT,
|
|
49
50
|
API_RULE_RESULTS,
|
|
51
|
+
API_SEGMENT_RESULTS,
|
|
50
52
|
API_SUBSCRIPTIONS_SEARCH,
|
|
51
53
|
API_SUBSCRIPTION,
|
|
52
54
|
API_SUBSCRIPTIONS,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { Header, Icon, Segment, Table } from "semantic-ui-react";
|
|
5
|
+
import { Link } from "react-router-dom";
|
|
6
|
+
import { FormattedMessage } from "react-intl";
|
|
7
|
+
import { linkTo } from "@truedat/core/routes";
|
|
8
|
+
|
|
9
|
+
export const empty = (rows) =>
|
|
10
|
+
rows && _.every((r) => _.isEmpty(r) || _.isNil(r))(rows);
|
|
11
|
+
|
|
12
|
+
const ConditionCell = ({ row, alias }) => {
|
|
13
|
+
const alias_text = _.flow(
|
|
14
|
+
_.find({ index: row.structure?.parent_index }),
|
|
15
|
+
_.propOr(null, "text")
|
|
16
|
+
)(alias);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Table.Row>
|
|
20
|
+
<Table.Cell width={5}>
|
|
21
|
+
{_.has("structure")(row) && (
|
|
22
|
+
<>
|
|
23
|
+
<Link
|
|
24
|
+
to={linkTo.STRUCTURE({
|
|
25
|
+
id: _.path("structure.id")(row),
|
|
26
|
+
})}
|
|
27
|
+
>
|
|
28
|
+
<span className="highlighted">
|
|
29
|
+
{alias_text && `(${alias_text}).`}{" "}
|
|
30
|
+
{`"${_.pathOr("", "structure.name")(row)}"`}
|
|
31
|
+
</span>
|
|
32
|
+
</Link>
|
|
33
|
+
</>
|
|
34
|
+
)}
|
|
35
|
+
</Table.Cell>
|
|
36
|
+
</Table.Row>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
ConditionCell.propTypes = {
|
|
41
|
+
row: PropTypes.object,
|
|
42
|
+
alias: PropTypes.array,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const FieldSummary = ({ rows, type, icon, alias }) => {
|
|
46
|
+
const wrappedRows = [rows];
|
|
47
|
+
return empty(rows) ? null : (
|
|
48
|
+
<>
|
|
49
|
+
<Header as="h3">
|
|
50
|
+
<Icon name={icon} size="small" />
|
|
51
|
+
<Header.Content>
|
|
52
|
+
<FormattedMessage
|
|
53
|
+
id={`ruleImplementations.summary.headers.${type}`}
|
|
54
|
+
/>
|
|
55
|
+
</Header.Content>
|
|
56
|
+
</Header>
|
|
57
|
+
{wrappedRows.map((rows, i) => (
|
|
58
|
+
<Segment key={i}>
|
|
59
|
+
<Table basic="very">
|
|
60
|
+
<Table.Header>
|
|
61
|
+
<Table.Row>
|
|
62
|
+
<Table.HeaderCell>
|
|
63
|
+
<FormattedMessage id={`ruleImplementation.summary.field`} />
|
|
64
|
+
</Table.HeaderCell>
|
|
65
|
+
</Table.Row>
|
|
66
|
+
</Table.Header>
|
|
67
|
+
<Table.Body>
|
|
68
|
+
{rows.map((row, i) => (
|
|
69
|
+
<ConditionCell key={i} row={row} alias={alias} />
|
|
70
|
+
))}
|
|
71
|
+
</Table.Body>
|
|
72
|
+
</Table>
|
|
73
|
+
</Segment>
|
|
74
|
+
))}
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
FieldSummary.propTypes = {
|
|
80
|
+
icon: PropTypes.string,
|
|
81
|
+
rows: PropTypes.array,
|
|
82
|
+
type: PropTypes.string,
|
|
83
|
+
alias: PropTypes.array,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default FieldSummary;
|
|
@@ -6,6 +6,7 @@ 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 FieldSummary from "./FieldSummary";
|
|
9
10
|
import InformationSummary from "./InformationSummary";
|
|
10
11
|
import "../styles/ImplementationSummary.less";
|
|
11
12
|
|
|
@@ -15,6 +16,7 @@ const defaults = [
|
|
|
15
16
|
"dataset",
|
|
16
17
|
"populations",
|
|
17
18
|
"validations",
|
|
19
|
+
"segments",
|
|
18
20
|
];
|
|
19
21
|
|
|
20
22
|
const FormattedLink = ({ value, operator = {} }) =>
|
|
@@ -130,7 +132,7 @@ DatasetSummary.propTypes = {
|
|
|
130
132
|
|
|
131
133
|
export const ImplementationSummary = ({ ruleImplementation, activeSteps }) => {
|
|
132
134
|
const steps = _.isEmpty(activeSteps) ? defaults : activeSteps;
|
|
133
|
-
const { dataset, populations, validations } =
|
|
135
|
+
const { dataset, populations, validations, segments } =
|
|
134
136
|
_.pick(steps)(ruleImplementation);
|
|
135
137
|
const alias = _.map(_.propOr({}, "alias"))(dataset);
|
|
136
138
|
return (
|
|
@@ -158,6 +160,14 @@ export const ImplementationSummary = ({ ruleImplementation, activeSteps }) => {
|
|
|
158
160
|
alias={alias}
|
|
159
161
|
/>
|
|
160
162
|
)}
|
|
163
|
+
{segments && _.includes("segments")(steps) && (
|
|
164
|
+
<FieldSummary
|
|
165
|
+
type="segments"
|
|
166
|
+
icon="grid layout"
|
|
167
|
+
rows={segments}
|
|
168
|
+
alias={alias}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
161
171
|
</>
|
|
162
172
|
);
|
|
163
173
|
};
|
|
@@ -2,11 +2,13 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
|
-
import { Button, Header, Icon, Segment } from "semantic-ui-react";
|
|
5
|
+
import { Button, Header, Icon, Container, Segment } from "semantic-ui-react";
|
|
6
6
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
7
7
|
import { createRemediation, fetchRuleImplementation } from "../routines";
|
|
8
8
|
import RemediationForm from "./RemediationForm";
|
|
9
9
|
|
|
10
|
+
import "../styles/remediationPlan.less";
|
|
11
|
+
|
|
10
12
|
export const NewRemediation = ({
|
|
11
13
|
manageRemediations,
|
|
12
14
|
onSaveRemediation,
|
|
@@ -23,25 +25,30 @@ export const NewRemediation = ({
|
|
|
23
25
|
|
|
24
26
|
return !manageRemediations || _.isEmpty(templates) ? null : (
|
|
25
27
|
<>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
<Container className="new-remedation-container" fluid>
|
|
29
|
+
{!isEdit ? (
|
|
30
|
+
<Button
|
|
31
|
+
primary
|
|
32
|
+
onClick={() => setIsEdit(!isEdit)}
|
|
33
|
+
content={formatMessage({ id: "remediation.actions.create" })}
|
|
34
|
+
/>
|
|
35
|
+
) : (
|
|
36
|
+
<>
|
|
37
|
+
<Header as="h2">
|
|
38
|
+
<Icon name="plug" />
|
|
39
|
+
<Header.Content>
|
|
40
|
+
<FormattedMessage id="remediation.actions.create" />
|
|
41
|
+
</Header.Content>
|
|
42
|
+
</Header>
|
|
43
|
+
<Segment>
|
|
44
|
+
<RemediationForm
|
|
45
|
+
onSave={onSave}
|
|
46
|
+
latestResultId={latestResultId}
|
|
47
|
+
/>
|
|
48
|
+
</Segment>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
</Container>
|
|
45
52
|
</>
|
|
46
53
|
);
|
|
47
54
|
};
|
|
@@ -224,8 +224,8 @@ const updateStructureParentIndex = (structures) => (structure) => {
|
|
|
224
224
|
return structure;
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
-
const withConditionDefaultAlias = (conditions, structures) =>
|
|
228
|
-
_.map((p) => {
|
|
227
|
+
const withConditionDefaultAlias = (conditions, structures) => {
|
|
228
|
+
return _.map((p) => {
|
|
229
229
|
return {
|
|
230
230
|
...p,
|
|
231
231
|
structure: updateStructureParentIndex(structures)(p.structure),
|
|
@@ -235,6 +235,7 @@ const withConditionDefaultAlias = (conditions, structures) =>
|
|
|
235
235
|
: p.value,
|
|
236
236
|
};
|
|
237
237
|
})(conditions);
|
|
238
|
+
};
|
|
238
239
|
|
|
239
240
|
export const NewRuleImplementation = ({
|
|
240
241
|
canManageRaw,
|
|
@@ -296,6 +297,18 @@ export const NewRuleImplementation = ({
|
|
|
296
297
|
),
|
|
297
298
|
precalculatedDataset
|
|
298
299
|
),
|
|
300
|
+
segments: withConditionDefaultAlias(
|
|
301
|
+
addFieldType(
|
|
302
|
+
ruleImplementationProps,
|
|
303
|
+
structuresFields,
|
|
304
|
+
structuresSiblings,
|
|
305
|
+
"segments",
|
|
306
|
+
"segment",
|
|
307
|
+
{ name: "" }
|
|
308
|
+
),
|
|
309
|
+
precalculatedDataset
|
|
310
|
+
),
|
|
311
|
+
|
|
299
312
|
rawContent: {
|
|
300
313
|
..._.prop("raw_content")(ruleImplementationProps),
|
|
301
314
|
},
|
|
@@ -313,12 +326,14 @@ export const NewRuleImplementation = ({
|
|
|
313
326
|
population: [],
|
|
314
327
|
populations: [],
|
|
315
328
|
validations: [{}],
|
|
329
|
+
segments: [{}],
|
|
316
330
|
rawContent: {
|
|
317
331
|
database: "",
|
|
318
332
|
source_id: null,
|
|
319
333
|
dataset: "",
|
|
320
334
|
population: "",
|
|
321
335
|
validations: "",
|
|
336
|
+
segments: "",
|
|
322
337
|
},
|
|
323
338
|
dfName: "",
|
|
324
339
|
dfContent: {},
|
|
@@ -380,6 +395,12 @@ export const NewRuleImplementation = ({
|
|
|
380
395
|
_.filter((val) => valueInDataset(val))
|
|
381
396
|
)(ruleImplementation);
|
|
382
397
|
|
|
398
|
+
const segments_within_dataset = _.flow(
|
|
399
|
+
_.prop("segments"),
|
|
400
|
+
_.filter((val) => belongsToDataset(_.path("structure.id")(val))),
|
|
401
|
+
_.filter((val) => valueInDataset(val))
|
|
402
|
+
)(ruleImplementation);
|
|
403
|
+
|
|
383
404
|
const population_within_dataset = _.flow(
|
|
384
405
|
_.prop("population"),
|
|
385
406
|
_.filter((val) => belongsToDataset(_.path("structure.id")(val))),
|
|
@@ -395,16 +416,15 @@ export const NewRuleImplementation = ({
|
|
|
395
416
|
validations: _.isEmpty(validations_within_dataset)
|
|
396
417
|
? [{}]
|
|
397
418
|
: validations_within_dataset,
|
|
419
|
+
segments: _.isEmpty(segments_within_dataset)
|
|
420
|
+
? []
|
|
421
|
+
: segments_within_dataset,
|
|
398
422
|
});
|
|
399
423
|
};
|
|
400
424
|
|
|
401
425
|
const onChange = (prop, value) =>
|
|
402
426
|
setRuleImplementation({ ...ruleImplementation, [prop]: value });
|
|
403
427
|
|
|
404
|
-
const setPopulation = (population) => {
|
|
405
|
-
setRuleImplementation({ ...ruleImplementation, population });
|
|
406
|
-
};
|
|
407
|
-
|
|
408
428
|
const addPopulation = () => {
|
|
409
429
|
const populations = _.concat(
|
|
410
430
|
_.pathOr([], "populations")(ruleImplementation)
|
|
@@ -426,6 +446,18 @@ export const NewRuleImplementation = ({
|
|
|
426
446
|
setRuleImplementation({ ...ruleImplementation, validations });
|
|
427
447
|
};
|
|
428
448
|
|
|
449
|
+
const addSegments = () => {
|
|
450
|
+
const segments = _.concat(_.pathOr([], "segments")(ruleImplementation))([
|
|
451
|
+
{},
|
|
452
|
+
]);
|
|
453
|
+
setRuleImplementation({ ...ruleImplementation, segments });
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
const setSegments = (segments) => {
|
|
457
|
+
const newSegments = _.isEqual([{}])(segments) ? [] : segments;
|
|
458
|
+
setRuleImplementation({ ...ruleImplementation, segments: newSegments });
|
|
459
|
+
};
|
|
460
|
+
|
|
429
461
|
const setImplementationKey = (implementationKey) =>
|
|
430
462
|
setRuleImplementation({ ...ruleImplementation, implementationKey });
|
|
431
463
|
|
|
@@ -449,6 +481,7 @@ export const NewRuleImplementation = ({
|
|
|
449
481
|
const validations = _.filter(_.negate(_.isEmpty))(
|
|
450
482
|
ruleImplementation.validations
|
|
451
483
|
);
|
|
484
|
+
const segments = _.filter(_.negate(_.isEmpty))(ruleImplementation.segments);
|
|
452
485
|
|
|
453
486
|
const dfContent = _.flow(
|
|
454
487
|
_.prop("dfContent"),
|
|
@@ -481,6 +514,7 @@ export const NewRuleImplementation = ({
|
|
|
481
514
|
dataset: datasetAttributes(_.prop("dataset")(ruleImplementation)),
|
|
482
515
|
populations: populationsAttributes(populations),
|
|
483
516
|
validations: conditionAttributes(validations),
|
|
517
|
+
segments,
|
|
484
518
|
implementation_key: _.prop("implementationKey")(ruleImplementation),
|
|
485
519
|
implementation_type:
|
|
486
520
|
_.prop("implementationType")(ruleImplementation),
|
|
@@ -562,6 +596,8 @@ export const NewRuleImplementation = ({
|
|
|
562
596
|
addPopulation={addPopulation}
|
|
563
597
|
setPopulations={setPopulations}
|
|
564
598
|
setValidations={setValidations}
|
|
599
|
+
addSegments={addSegments}
|
|
600
|
+
setSegments={setSegments}
|
|
565
601
|
operators={operators}
|
|
566
602
|
setImplementationKey={setImplementationKey}
|
|
567
603
|
onChange={onChange}
|
|
@@ -4,17 +4,14 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { useParams } from "react-router-dom";
|
|
7
|
-
import { Button,
|
|
7
|
+
import { Button, Grid, Container } from "semantic-ui-react";
|
|
8
8
|
import { FormattedMessage } from "react-intl";
|
|
9
9
|
import { Loading } from "@truedat/core/components";
|
|
10
10
|
import { ConfirmModal } from "@truedat/core/components";
|
|
11
|
-
import {
|
|
12
|
-
fetchRemediation,
|
|
13
|
-
clearRemediation,
|
|
14
|
-
deleteRemediation,
|
|
15
|
-
} from "../routines";
|
|
11
|
+
import { deleteRemediation } from "../routines";
|
|
16
12
|
import NewRemediation from "./NewRemediation";
|
|
17
13
|
import RemediationForm from "./RemediationForm";
|
|
14
|
+
|
|
18
15
|
import "../styles/remediationPlan.less";
|
|
19
16
|
|
|
20
17
|
const DynamicFormViewer = React.lazy(() =>
|
|
@@ -23,10 +20,7 @@ const DynamicFormViewer = React.lazy(() =>
|
|
|
23
20
|
|
|
24
21
|
export const RemediationPlan = ({
|
|
25
22
|
isLoading,
|
|
26
|
-
className,
|
|
27
23
|
deleteRemediation,
|
|
28
|
-
fetchRemediation,
|
|
29
|
-
clearRemediation,
|
|
30
24
|
remediation,
|
|
31
25
|
templates,
|
|
32
26
|
latestResultId,
|
|
@@ -44,17 +38,6 @@ export const RemediationPlan = ({
|
|
|
44
38
|
setRuleResultId(paramsRuleResultId || latestResultId);
|
|
45
39
|
}, [paramsRuleResultId, latestResultId]);
|
|
46
40
|
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
ruleResultId && fetchRemediation({ rule_result_id: ruleResultId });
|
|
49
|
-
}, [fetchRemediation, ruleResultId]);
|
|
50
|
-
|
|
51
|
-
useEffect(
|
|
52
|
-
() => () => {
|
|
53
|
-
clearRemediation();
|
|
54
|
-
},
|
|
55
|
-
[clearRemediation]
|
|
56
|
-
);
|
|
57
|
-
|
|
58
41
|
const onSave = () => {
|
|
59
42
|
setIsEdit(false);
|
|
60
43
|
};
|
|
@@ -70,67 +53,58 @@ export const RemediationPlan = ({
|
|
|
70
53
|
<>
|
|
71
54
|
{!_.isEmpty(remediation) ? (
|
|
72
55
|
<>
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
56
|
+
{manageRemediations ? (
|
|
57
|
+
<div className="ui actions remediation">
|
|
58
|
+
<ConfirmModal
|
|
59
|
+
icon="trash"
|
|
60
|
+
trigger={<Button secondary icon="trash" basic color="red" />}
|
|
61
|
+
header={
|
|
62
|
+
<FormattedMessage id="remediation.actions.delete.confirmation.header" />
|
|
63
|
+
}
|
|
64
|
+
content={
|
|
65
|
+
<FormattedMessage
|
|
66
|
+
id="remediation.actions.delete.confirmation.content"
|
|
67
|
+
values={{ ruleResultId: <b>{ruleResultId}</b> }}
|
|
68
|
+
/>
|
|
69
|
+
}
|
|
70
|
+
onConfirm={() =>
|
|
71
|
+
deleteRemediation({
|
|
72
|
+
implementation_id: implementationId,
|
|
73
|
+
rule_result_id: ruleResultId,
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
/>
|
|
77
|
+
<Button
|
|
78
|
+
className="button-edit-remediation"
|
|
79
|
+
primary
|
|
80
|
+
onClick={() => setIsEdit(!isEdit)}
|
|
81
|
+
content={formatMessage({
|
|
82
|
+
id: !isEdit ? "actions.edit" : "actions.cancel",
|
|
83
|
+
})}
|
|
78
84
|
/>
|
|
79
|
-
</
|
|
80
|
-
|
|
85
|
+
</div>
|
|
86
|
+
) : null}
|
|
81
87
|
|
|
82
|
-
<
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
content={
|
|
92
|
-
<FormattedMessage
|
|
93
|
-
id="remediation.actions.delete.confirmation.content"
|
|
94
|
-
values={{ ruleResultId: <b>{ruleResultId}</b> }}
|
|
95
|
-
/>
|
|
96
|
-
}
|
|
97
|
-
onConfirm={() =>
|
|
98
|
-
deleteRemediation({
|
|
99
|
-
implementation_id: implementationId,
|
|
100
|
-
rule_result_id: ruleResultId,
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
/>
|
|
104
|
-
<Button
|
|
105
|
-
className="button-edit-remediation"
|
|
106
|
-
primary
|
|
107
|
-
onClick={() => setIsEdit(!isEdit)}
|
|
108
|
-
content={formatMessage({
|
|
109
|
-
id: !isEdit ? "actions.edit" : "actions.cancel",
|
|
110
|
-
})}
|
|
88
|
+
<Grid>
|
|
89
|
+
<Grid.Column width={8}>
|
|
90
|
+
{!isEdit && remediation?.df_name ? (
|
|
91
|
+
<DynamicFormViewer
|
|
92
|
+
template={_.find(_.propEq("name", remediation.df_name))(
|
|
93
|
+
templates
|
|
94
|
+
)}
|
|
95
|
+
content={remediation.df_content}
|
|
111
96
|
/>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<Grid>
|
|
116
|
-
<Grid.Column width={8}>
|
|
117
|
-
{!isEdit && remediation?.df_name ? (
|
|
118
|
-
<DynamicFormViewer
|
|
119
|
-
template={_.find(_.propEq("name", remediation.df_name))(
|
|
120
|
-
templates
|
|
121
|
-
)}
|
|
122
|
-
content={remediation.df_content}
|
|
123
|
-
/>
|
|
124
|
-
) : (
|
|
97
|
+
) : (
|
|
98
|
+
<Container className="new-remedation-container" fluid>
|
|
125
99
|
<RemediationForm
|
|
126
100
|
onSave={onSave}
|
|
127
101
|
remediation={remediation}
|
|
128
102
|
latestResultId={latestResultId}
|
|
129
103
|
/>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
</Grid>
|
|
133
|
-
</
|
|
104
|
+
</Container>
|
|
105
|
+
)}
|
|
106
|
+
</Grid.Column>
|
|
107
|
+
</Grid>
|
|
134
108
|
</>
|
|
135
109
|
) : null}
|
|
136
110
|
</>
|
|
@@ -139,10 +113,7 @@ export const RemediationPlan = ({
|
|
|
139
113
|
|
|
140
114
|
RemediationPlan.propTypes = {
|
|
141
115
|
isLoading: PropTypes.bool,
|
|
142
|
-
className: PropTypes.string,
|
|
143
116
|
deleteRemediation: PropTypes.func,
|
|
144
|
-
clearRemediation: PropTypes.func,
|
|
145
|
-
fetchRemediation: PropTypes.func,
|
|
146
117
|
remediation: PropTypes.object,
|
|
147
118
|
templates: PropTypes.array,
|
|
148
119
|
latestResultId: PropTypes.number,
|
|
@@ -164,6 +135,4 @@ const mapStateToProps = ({
|
|
|
164
135
|
|
|
165
136
|
export default connect(mapStateToProps, {
|
|
166
137
|
deleteRemediation,
|
|
167
|
-
fetchRemediation,
|
|
168
|
-
clearRemediation,
|
|
169
138
|
})(RemediationPlan);
|
|
@@ -12,7 +12,7 @@ const DynamicFormViewer = React.lazy(() =>
|
|
|
12
12
|
import("@truedat/df/components/DynamicFormViewer")
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
const summarySteps = ["dataset", "populations", "validations"];
|
|
15
|
+
const summarySteps = ["dataset", "populations", "validations", "segments"];
|
|
16
16
|
|
|
17
17
|
export const RuleImplementationProperties = ({
|
|
18
18
|
ruleImplementation,
|
|
@@ -75,6 +75,7 @@ const mapStateToProps = ({
|
|
|
75
75
|
ruleImplementation: _.pick([
|
|
76
76
|
...summarySteps,
|
|
77
77
|
"populations",
|
|
78
|
+
"segments",
|
|
78
79
|
"executable",
|
|
79
80
|
"event_type",
|
|
80
81
|
"event_message",
|