@truedat/dq 4.44.1 → 4.44.4

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 (55) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/package.json +5 -5
  3. package/src/components/EditRule.js +1 -1
  4. package/src/components/ExecutionForm.js +68 -78
  5. package/src/components/ExecutionPopup.js +10 -6
  6. package/src/components/NewRule.js +1 -1
  7. package/src/components/NewRuleImplementation.js +91 -111
  8. package/src/components/RemediationForm.js +32 -43
  9. package/src/components/RuleForm.js +102 -103
  10. package/src/components/RuleImplementation.js +29 -13
  11. package/src/components/RuleImplementationActions.js +11 -21
  12. package/src/components/RuleImplementationProperties.js +0 -1
  13. package/src/components/RuleImplementationResultTabs.js +20 -25
  14. package/src/components/RuleImplementationResultsLink.js +1 -6
  15. package/src/components/RuleImplementationsActions.js +1 -1
  16. package/src/components/RuleResultSegmentRow.js +0 -3
  17. package/src/components/RuleResultSegments.js +2 -6
  18. package/src/components/RuleResultsRoutes.js +41 -56
  19. package/src/components/RuleRoutes.js +40 -56
  20. package/src/components/RulesRoutes.js +0 -5
  21. package/src/components/__tests__/ExecutionForm.spec.js +7 -1
  22. package/src/components/__tests__/ExecutionPopup.spec.js +3 -2
  23. package/src/components/__tests__/ImplementationResultBar.spec.js +44 -63
  24. package/src/components/__tests__/InformationSummary.spec.js +2 -6
  25. package/src/components/__tests__/NewRuleImplementation.spec.js +4 -6
  26. package/src/components/__tests__/RemediationForm.spec.js +47 -58
  27. package/src/components/__tests__/RuleForm.spec.js +80 -207
  28. package/src/components/__tests__/RuleImplementation.spec.js +45 -22
  29. package/src/components/__tests__/RuleImplementationsActions.spec.js +0 -1
  30. package/src/components/__tests__/RuleImplementationsOptions.spec.js +1 -10
  31. package/src/components/__tests__/RuleResultsUpload.spec.js +1 -5
  32. package/src/components/__tests__/RuleSummary.spec.js +6 -11
  33. package/src/components/__tests__/__snapshots__/EditRule.spec.js.snap +1 -1
  34. package/src/components/__tests__/__snapshots__/ExecutionForm.spec.js.snap +1 -2
  35. package/src/components/__tests__/__snapshots__/NewRule.spec.js.snap +1 -1
  36. package/src/components/__tests__/__snapshots__/RemediationForm.spec.js.snap +2 -3
  37. package/src/components/__tests__/__snapshots__/RuleForm.spec.js.snap +699 -385
  38. package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +71 -5
  39. package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +1 -1
  40. package/src/components/index.js +0 -2
  41. package/src/components/ruleImplementationForm/InformationForm.js +40 -76
  42. package/src/components/ruleImplementationForm/RuleImplementationForm.js +40 -40
  43. package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +63 -101
  44. package/src/components/ruleImplementationForm/__tests__/LimitsForm.spec.js +9 -35
  45. package/src/components/ruleImplementationForm/__tests__/RuleImplementationForm.spec.js +23 -50
  46. package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +2 -2
  47. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +86 -19
  48. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationRawForm.spec.js.snap +7 -1
  49. package/src/messages/en.js +3 -6
  50. package/src/messages/es.js +3 -6
  51. package/src/sagas/__tests__/deleteRuleResult.spec.js +3 -5
  52. package/src/sagas/deleteRuleResult.js +2 -7
  53. package/src/components/DynamicRuleForm.js +0 -78
  54. package/src/components/__tests__/DynamicRuleForm.spec.js +0 -51
  55. package/src/components/__tests__/__snapshots__/DynamicRuleForm.spec.js.snap +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.44.3] 2022-05-11
4
+
5
+ ### Added
6
+
7
+ - [TD-4045] Implementation execution button in implementation view
8
+
9
+ ## [4.44.2] 2022-05-11
10
+
11
+ ### Fixed
12
+
13
+ - [TD-4089] Segments tab was not displaying segments
14
+
3
15
  ## [4.44.1] 2022-05-11
4
16
 
5
17
  ### Added
@@ -10,7 +22,8 @@
10
22
 
11
23
  # Added
12
24
 
13
- - [TD-4538] Add more coding for segments configuration and segment results for implementations
25
+ - [TD-4538] Add more coding for segments configuration and segment results for
26
+ implementations
14
27
 
15
28
  ## [4.43.3] 2022-05-04
16
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.44.1",
3
+ "version": "4.44.4",
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.44.1",
34
+ "@truedat/test": "4.44.4",
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.44.1",
86
- "@truedat/df": "4.44.1",
85
+ "@truedat/core": "4.44.4",
86
+ "@truedat/df": "4.44.4",
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": "20d38381ed4cb6658d1122a4bff08a13fedc2d59"
106
+ "gitHead": "36fb183e1d22181e6a15b3bac2c01b39214eacdb"
107
107
  }
@@ -15,7 +15,7 @@ export const EditRule = ({ rule, updateRule }) =>
15
15
  <FormattedMessage id="quality.actions.edit" />
16
16
  </Header.Content>
17
17
  </Header>
18
- <RuleForm handleSubmit={updateRule} rule={rule} editMode />
18
+ <RuleForm onSubmit={updateRule} rule={rule} editMode />
19
19
  </Container>
20
20
  );
21
21
 
@@ -1,48 +1,35 @@
1
1
  import _ from "lodash/fp";
2
- import React, { Suspense, useState } from "react";
2
+ import React, { useState } from "react";
3
+ import { Button, Form, Header } from "semantic-ui-react";
3
4
  import PropTypes from "prop-types";
4
- import { connect } from "react-redux";
5
5
  import { useIntl } from "react-intl";
6
- import { Button, Form, Header } from "semantic-ui-react";
6
+ import { TemplateSelector } from "@truedat/core/components";
7
7
  import { validateContent } from "@truedat/df/utils";
8
- import { selectTemplate } from "@truedat/df/routines";
9
-
10
- const TemplateSelector = React.lazy(() =>
11
- import("@truedat/df/templates/components/TemplateSelector")
12
- );
13
-
14
- const TemplateLoader = React.lazy(() =>
15
- import("@truedat/df/templates/components/TemplateLoader")
16
- );
17
8
 
18
9
  const DynamicForm = React.lazy(() =>
19
10
  import("@truedat/df/components/DynamicForm")
20
11
  );
21
12
 
22
- export const ExecutionForm = ({
23
- count,
24
- selectTemplate,
25
- template,
26
- templates,
27
- handleSubmit,
28
- onCancel,
29
- }) => {
13
+ export const ExecutionForm = ({ count, onSubmit, onCancel }) => {
30
14
  const { formatMessage } = useIntl();
31
15
  const [content, setContent] = useState({});
16
+ const [template, setTemplate] = useState();
17
+ const [templatesLoading, setTemplatesLoading] = useState(true);
32
18
 
33
19
  const handleContentChange = (content) => setContent(content);
34
20
 
35
- const handleTemplateSelected = (e, { value }) =>
36
- selectTemplate({ id: value });
21
+ const handleTemplatesLoaded = ({ templates }) => {
22
+ setTemplatesLoading(false);
23
+ if (templates?.length === 1) {
24
+ setTemplate(templates[0]);
25
+ }
26
+ };
27
+
28
+ const handleTemplateSelected = (e, { template }) => setTemplate(template);
37
29
 
38
30
  const isInvalid = () =>
39
31
  template && !_.isEmpty(validateContent(template)(content));
40
32
 
41
- if (_.size(templates) == 1) {
42
- const id = _.flow(_.head, _.prop("id"))(templates);
43
- selectTemplate({ id });
44
- }
45
-
46
33
  return (
47
34
  <>
48
35
  <Header
@@ -51,66 +38,69 @@ export const ExecutionForm = ({
51
38
  id: "implementations.actions.execution.confirmation.header",
52
39
  })}
53
40
  />
54
- <Suspense fallback={null}>
55
- <Form>
56
- <TemplateLoader scope="qe" />
57
- {_.size(templates) > 1 && (
58
- <TemplateSelector
59
- name="template"
60
- selectedValue={_.prop("id")(template)}
61
- onChange={handleTemplateSelected}
62
- isOptional={true}
41
+ <Form loading={templatesLoading}>
42
+ <TemplateSelector
43
+ scope="qe"
44
+ selectedValue={template?.id}
45
+ onChange={handleTemplateSelected}
46
+ onLoad={handleTemplatesLoaded}
47
+ clearable
48
+ />
49
+ {template?.id ? (
50
+ <>
51
+ <Header
52
+ as="h3"
53
+ content={formatMessage({
54
+ id: "implementations.actions.execution.confirmation.legend",
55
+ })}
63
56
  />
64
- )}
65
- {template && template.id && (
66
- <>
67
- <Header
68
- as="h3"
69
- content={formatMessage({
70
- id: "implementations.actions.execution.confirmation.legend",
71
- })}
57
+ <div
58
+ style={{
59
+ maxHeight: "calc(100vh - 550px)",
60
+ overflowY: "auto",
61
+ }}
62
+ >
63
+ <DynamicForm
64
+ onChange={handleContentChange}
65
+ content={content}
66
+ template={template}
72
67
  />
73
- <div
74
- style={{ maxHeight: "calc(100vh - 550px)", overflowY: "auto" }}
75
- >
76
- <DynamicForm onChange={handleContentChange} content={content} />
77
- </div>
78
- </>
68
+ </div>
69
+ </>
70
+ ) : null}
71
+ <p>
72
+ {formatMessage(
73
+ {
74
+ id:
75
+ count === 1
76
+ ? "implementation.actions.execution.confirmation.content"
77
+ : "implementations.actions.execution.confirmation.content",
78
+ },
79
+ { implementations_count: count }
79
80
  )}
80
- <p>
81
- {formatMessage(
82
- { id: "implementations.actions.execution.confirmation.content" },
83
- { implementations_count: count }
84
- )}
85
- </p>
86
- <div className="actions">
87
- <Button
88
- secondary
89
- onClick={onCancel}
90
- content={formatMessage({ id: "actions.cancel" })}
91
- />
92
- <Button
93
- primary
94
- disabled={isInvalid()}
95
- onClick={() => handleSubmit(content)}
96
- content={formatMessage({ id: "actions.create" })}
97
- />
98
- </div>
99
- </Form>
100
- </Suspense>
81
+ </p>
82
+ <div className="actions">
83
+ <Button
84
+ secondary
85
+ onClick={onCancel}
86
+ content={formatMessage({ id: "actions.cancel" })}
87
+ />
88
+ <Button
89
+ primary
90
+ disabled={isInvalid()}
91
+ onClick={() => onSubmit(content)}
92
+ content={formatMessage({ id: "actions.create" })}
93
+ />
94
+ </div>
95
+ </Form>
101
96
  </>
102
97
  );
103
98
  };
104
99
 
105
100
  ExecutionForm.propTypes = {
106
101
  count: PropTypes.number,
107
- template: PropTypes.object,
108
- templates: PropTypes.array,
109
- selectTemplate: PropTypes.func,
110
- handleSubmit: PropTypes.func,
102
+ onSubmit: PropTypes.func,
111
103
  onCancel: PropTypes.func,
112
104
  };
113
105
 
114
- const mapStateToProps = _.pick(["templates", "template"]);
115
-
116
- export default connect(mapStateToProps, { selectTemplate })(ExecutionForm);
106
+ export default ExecutionForm;
@@ -1,4 +1,3 @@
1
- import _ from "lodash/fp";
2
1
  import React, { useState } from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { connect } from "react-redux";
@@ -10,7 +9,7 @@ export const ExecutionPopup = ({
10
9
  disabled,
11
10
  executionGroupLoading,
12
11
  count,
13
- handleSubmit,
12
+ onSubmit,
14
13
  }) => {
15
14
  const { formatMessage } = useIntl();
16
15
  const [open, setOpen] = useState(false);
@@ -32,14 +31,17 @@ export const ExecutionPopup = ({
32
31
  disabled={disabled}
33
32
  loading={executionGroupLoading}
34
33
  content={formatMessage({
35
- id: "implementations.actions.do_execution",
34
+ id:
35
+ count === 1
36
+ ? "implementation.actions.do_execution"
37
+ : "implementations.actions.do_execution",
36
38
  })}
37
39
  />
38
40
  }
39
41
  >
40
42
  <ExecutionForm
41
43
  count={count}
42
- handleSubmit={handleSubmit}
44
+ onSubmit={onSubmit}
43
45
  onCancel={() => setOpen(false)}
44
46
  />
45
47
  </Popup>
@@ -50,9 +52,11 @@ ExecutionPopup.propTypes = {
50
52
  count: PropTypes.number,
51
53
  disabled: PropTypes.bool,
52
54
  executionGroupLoading: PropTypes.bool,
53
- handleSubmit: PropTypes.func,
55
+ onSubmit: PropTypes.func,
54
56
  };
55
57
 
56
- const mapStateToProps = _.pick(["executionGroupLoading"]);
58
+ const mapStateToProps = ({ executionGroupLoading }) => ({
59
+ executionGroupLoading,
60
+ });
57
61
 
58
62
  export default connect(mapStateToProps)(ExecutionPopup);
@@ -21,7 +21,7 @@ export const NewRule = ({ rule, createRule }) => (
21
21
  </Header.Content>
22
22
  </Header>
23
23
  <DomainsLoader actions="manage_quality_rule" />
24
- <RuleForm handleSubmit={createRule} />
24
+ <RuleForm onSubmit={createRule} />
25
25
  </Container>
26
26
  );
27
27
 
@@ -17,10 +17,6 @@ import RuleImplementationForm from "./ruleImplementationForm/RuleImplementationF
17
17
  import RuleImplementationRawForm from "./ruleImplementationForm/RuleImplementationRawForm";
18
18
  import ImplementationSummary from "./ImplementationSummary";
19
19
 
20
- const TemplateLoader = React.lazy(() =>
21
- import("@truedat/df/templates/components/TemplateLoader")
22
- );
23
-
24
20
  const updateDatasetKey = (data) =>
25
21
  _.reduce.convert({ cap: false })(
26
22
  (acc, value, key) =>
@@ -248,8 +244,6 @@ export const NewRuleImplementation = ({
248
244
  structuresFields,
249
245
  structuresSiblings,
250
246
  operators,
251
- template,
252
- applyTemplate,
253
247
  implementationType = "",
254
248
  }) => {
255
249
  const precalculatedDataset = _.flow(
@@ -257,17 +251,16 @@ export const NewRuleImplementation = ({
257
251
  withDefaultAlias
258
252
  )(ruleImplementationProps);
259
253
 
254
+ const [template, setTemplate] = useState(null);
260
255
  const [ruleImplementation, setRuleImplementation] = useState(
261
256
  edition
262
257
  ? {
263
- id: clone ? null : _.prop("id")(ruleImplementationProps),
258
+ id: clone ? null : ruleImplementationProps.id,
264
259
  executable: ruleImplementationProps.executable,
265
260
  implementationKey: clone
266
261
  ? ""
267
- : _.prop("implementation_key")(ruleImplementationProps),
268
- implementationType: _.prop("implementation_type")(
269
- ruleImplementationProps
270
- ),
262
+ : ruleImplementationProps.implementation_key,
263
+ implementationType: ruleImplementationProps.implementation_type,
271
264
  dataset: precalculatedDataset,
272
265
  populations: _.flow(
273
266
  _.pathOr([], "populations"),
@@ -308,10 +301,8 @@ export const NewRuleImplementation = ({
308
301
  precalculatedDataset
309
302
  ),
310
303
 
311
- rawContent: {
312
- ..._.prop("raw_content")(ruleImplementationProps),
313
- },
314
- dfName: _.prop("df_name")(ruleImplementationProps),
304
+ rawContent: ruleImplementationProps.raw_content,
305
+ dfName: ruleImplementationProps.df_name,
315
306
  dfContent: ruleImplementationProps.df_content,
316
307
  result_type: ruleImplementationProps.result_type,
317
308
  minimum: ruleImplementationProps.minimum,
@@ -378,17 +369,13 @@ export const NewRuleImplementation = ({
378
369
  _.map(_.prop("data_structure_id"))
379
370
  )(structuresFields);
380
371
 
381
- const belongsToDataset = (structureId) => {
382
- return _.includes(structureId)(all_fields);
383
- };
372
+ const belongsToDataset = (structureId) =>
373
+ _.includes(structureId)(all_fields);
384
374
 
385
- const valueInDataset = (val) => {
386
- return (
387
- _.pathEq("operator.value_type_filter", "any")(val) ||
388
- _.isNil(_.path("value[0].id")(val)) ||
389
- belongsToDataset(_.path("value[0].id")(val))
390
- );
391
- };
375
+ const valueInDataset = (val) =>
376
+ _.pathEq("operator.value_type_filter", "any")(val) ||
377
+ _.isNil(_.path("value[0].id")(val)) ||
378
+ belongsToDataset(_.path("value[0].id")(val));
392
379
 
393
380
  const validations_within_dataset = _.flow(
394
381
  _.prop("validations"),
@@ -466,27 +453,26 @@ export const NewRuleImplementation = ({
466
453
  setRuleImplementation({ ...ruleImplementation, rawContent });
467
454
 
468
455
  useEffect(() => {
469
- if (!_.isEmpty(template)) {
470
- onChange("dfContent", applyTemplate(ruleImplementation.dfContent));
456
+ if (template) {
457
+ onChange(
458
+ "dfContent",
459
+ applyTemplate(template)(ruleImplementation.dfContent)
460
+ );
471
461
  }
472
462
  /* eslint-disable react-hooks/exhaustive-deps */
473
463
  }, [template]);
474
464
 
475
465
  const doSubmit = () => {
476
- const populations = _.filter(_.negate(_.isEmpty))(
477
- ruleImplementation.populations
478
- );
479
- const validations = _.filter(_.negate(_.isEmpty))(
480
- ruleImplementation.validations
481
- );
482
- const segments = _.filter(_.negate(_.isEmpty))(ruleImplementation.segments);
466
+ const populations = _.reject(_.isEmpty)(ruleImplementation.populations);
467
+ const validations = _.reject(_.isEmpty)(ruleImplementation.validations);
468
+ const segments = _.reject(_.isEmpty)(ruleImplementation.segments);
483
469
 
484
470
  const dfContent = _.flow(
485
471
  _.prop("dfContent"),
486
- applyTemplate
472
+ applyTemplate(template)
487
473
  )(ruleImplementation);
488
474
 
489
- const df_name = _.getOr(null, "name")(template);
475
+ const df_name = template?.name || ruleImplementation?.dfName || null;
490
476
 
491
477
  const raw_content = _.prop("rawContent")(ruleImplementation);
492
478
  const source_id = _.prop("source_id")(raw_content);
@@ -496,9 +482,8 @@ export const NewRuleImplementation = ({
496
482
  ruleImplementation.implementationType == "raw"
497
483
  ? {
498
484
  executable: ruleImplementation.executable,
499
- implementation_key: _.prop("implementationKey")(ruleImplementation),
500
- implementation_type:
501
- _.prop("implementationType")(ruleImplementation),
485
+ implementation_key: ruleImplementation.implementationKey,
486
+ implementation_type: ruleImplementation.implementationType,
502
487
  df_name,
503
488
  df_content: dfContent,
504
489
  rule_id: rule ? rule.id : ruleImplementation.rule_id,
@@ -510,13 +495,12 @@ export const NewRuleImplementation = ({
510
495
  }
511
496
  : {
512
497
  executable: ruleImplementation.executable,
513
- dataset: datasetAttributes(_.prop("dataset")(ruleImplementation)),
498
+ dataset: datasetAttributes(ruleImplementation.dataset),
514
499
  populations: populationsAttributes(populations),
515
500
  validations: conditionAttributes(validations),
516
501
  segments,
517
- implementation_key: _.prop("implementationKey")(ruleImplementation),
518
- implementation_type:
519
- _.prop("implementationType")(ruleImplementation),
502
+ implementation_key: ruleImplementation.implementationKey,
503
+ implementation_type: ruleImplementation.implementationType,
520
504
  df_name,
521
505
  df_content: dfContent,
522
506
  rule_id: rule ? rule.id : ruleImplementation.rule_id,
@@ -539,84 +523,81 @@ export const NewRuleImplementation = ({
539
523
  };
540
524
 
541
525
  return (
542
- <>
543
- <TemplateLoader />
544
- <Grid divided className="full-height">
545
- <Grid.Column width="11">
546
- <Grid.Row>
547
- <Header as="h2">
548
- <Header.Content>
549
- <FormattedMessage
550
- id={
551
- clone
552
- ? "ruleImplementations.actions.create"
553
- : edition
554
- ? "ruleImplementations.actions.edit"
555
- : "ruleImplementations.actions.create"
556
- }
557
- />
558
- </Header.Content>
559
- </Header>
560
- <Divider hidden />
561
- </Grid.Row>
562
- <Grid.Row stretched>
563
- {ruleImplementation.implementationType == "raw" ? (
564
- <RuleImplementationRawForm
565
- mode={clone ? "clone" : edition ? "edition" : ""}
566
- implementationKey={_.prop("implementationKey")(
567
- ruleImplementation
568
- )}
569
- rawContent={_.prop("rawContent")(ruleImplementation)}
570
- setImplementationKey={setImplementationKey}
571
- setImplementationRawContent={setImplementationRawContent}
572
- ruleImplementation={ruleImplementation}
573
- onChange={onChange}
574
- handleSubmit={doSubmit}
575
- sources={sources}
576
- sourcesLoading={sourcesLoading}
577
- />
578
- ) : (
579
- <RuleImplementationForm
580
- ruleImplementation={ruleImplementation}
581
- setStructures={setDataset}
582
- addPopulation={addPopulation}
583
- setPopulations={setPopulations}
584
- setValidations={setValidations}
585
- addSegments={addSegments}
586
- setSegments={setSegments}
587
- operators={operators}
588
- setImplementationKey={setImplementationKey}
589
- onChange={onChange}
590
- handleSubmit={doSubmit}
526
+ <Grid divided className="full-height">
527
+ <Grid.Column width="11">
528
+ <Grid.Row>
529
+ <Header as="h2">
530
+ <Header.Content>
531
+ <FormattedMessage
532
+ id={
533
+ clone
534
+ ? "ruleImplementations.actions.create"
535
+ : edition
536
+ ? "ruleImplementations.actions.edit"
537
+ : "ruleImplementations.actions.create"
538
+ }
591
539
  />
592
- )}
593
- </Grid.Row>
594
- </Grid.Column>
595
- <Grid.Column width="5">
596
- {ruleImplementation.implementationType != "raw" && (
597
- <ImplementationSummary ruleImplementation={ruleImplementation} />
540
+ </Header.Content>
541
+ </Header>
542
+ <Divider hidden />
543
+ </Grid.Row>
544
+ <Grid.Row stretched>
545
+ {ruleImplementation.implementationType == "raw" ? (
546
+ <RuleImplementationRawForm
547
+ mode={clone ? "clone" : edition ? "edition" : ""}
548
+ implementationKey={ruleImplementation.implementationKey}
549
+ rawContent={ruleImplementation.rawContent}
550
+ setImplementationKey={setImplementationKey}
551
+ setImplementationRawContent={setImplementationRawContent}
552
+ ruleImplementation={ruleImplementation}
553
+ onChange={onChange}
554
+ onSubmit={doSubmit}
555
+ sources={sources}
556
+ sourcesLoading={sourcesLoading}
557
+ template={template}
558
+ setTemplate={setTemplate}
559
+ />
560
+ ) : (
561
+ <RuleImplementationForm
562
+ addPopulation={addPopulation}
563
+ addSegments={addSegments}
564
+ onSubmit={doSubmit}
565
+ onChange={onChange}
566
+ operators={operators}
567
+ ruleImplementation={ruleImplementation}
568
+ setImplementationKey={setImplementationKey}
569
+ setPopulations={setPopulations}
570
+ setSegments={setSegments}
571
+ setStructures={setDataset}
572
+ setTemplate={setTemplate}
573
+ setValidations={setValidations}
574
+ template={template}
575
+ />
598
576
  )}
599
- </Grid.Column>
600
- </Grid>
601
- </>
577
+ </Grid.Row>
578
+ </Grid.Column>
579
+ <Grid.Column width="5">
580
+ {ruleImplementation.implementationType === "raw" ? null : (
581
+ <ImplementationSummary ruleImplementation={ruleImplementation} />
582
+ )}
583
+ </Grid.Column>
584
+ </Grid>
602
585
  );
603
586
  };
604
587
 
605
588
  NewRuleImplementation.propTypes = {
606
589
  clone: PropTypes.bool,
607
590
  createRuleImplementation: PropTypes.func.isRequired,
608
- updateRuleImplementation: PropTypes.func,
609
591
  edition: PropTypes.bool,
592
+ implementationType: PropTypes.string,
593
+ operators: PropTypes.object,
610
594
  rule: PropTypes.object,
611
595
  ruleImplementationProps: PropTypes.object,
612
- structuresFields: PropTypes.object,
613
- structuresSiblings: PropTypes.object,
614
- operators: PropTypes.object,
615
- template: PropTypes.object,
616
- applyTemplate: PropTypes.func,
617
596
  sources: PropTypes.array,
618
597
  sourcesLoading: PropTypes.bool,
619
- implementationType: PropTypes.string,
598
+ structuresFields: PropTypes.object,
599
+ structuresSiblings: PropTypes.object,
600
+ updateRuleImplementation: PropTypes.func,
620
601
  };
621
602
 
622
603
  export const SOURCES_WITH_CONFIG = gql`
@@ -630,9 +611,10 @@ export const SOURCES_WITH_CONFIG = gql`
630
611
  `;
631
612
 
632
613
  export const NewRuleImplementationLoader = (props) => {
633
- const { data, loading } = useQuery(SOURCES_WITH_CONFIG, {
614
+ const { data, error, loading } = useQuery(SOURCES_WITH_CONFIG, {
634
615
  variables: { jobTypes: "quality" },
635
616
  });
617
+ if (error) return null;
636
618
  if (loading) return <Loading />;
637
619
  const sources = data?.sources || [];
638
620
  return (
@@ -654,8 +636,6 @@ const mapStateToProps = (state) => ({
654
636
  structuresFields: state.structuresFields,
655
637
  structuresSiblings: state.structuresSiblings,
656
638
  operators: getRuleImplementationOperators(state),
657
- template: _.defaultTo({})(state.template),
658
- applyTemplate: applyTemplate(state.template),
659
639
  });
660
640
 
661
641
  export default connect(mapStateToProps, {