@truedat/dq 5.9.5 → 5.9.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "5.9.5",
3
+ "version": "5.9.7",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.5",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "5.9.5",
37
+ "@truedat/test": "5.9.7",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -92,8 +92,8 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@apollo/client": "^3.7.1",
95
- "@truedat/core": "5.9.5",
96
- "@truedat/df": "5.9.5",
95
+ "@truedat/core": "5.9.7",
96
+ "@truedat/df": "5.9.7",
97
97
  "decode-uri-component": "^0.2.2",
98
98
  "graphql": "^15.5.3",
99
99
  "moment": "^2.29.4",
@@ -118,5 +118,5 @@
118
118
  "react-dom": ">= 16.8.6 < 17",
119
119
  "semantic-ui-react": ">= 2.0.3 < 2.2"
120
120
  },
121
- "gitHead": "e5921f6b5e5a2142ac6be90ad269d5e1fecb1e2c"
121
+ "gitHead": "9970ccde5058eacef7d2950af845b43a625e218f"
122
122
  }
@@ -1,4 +1,4 @@
1
- import { defaultTo, has, isNil } from "lodash/fp";
1
+ import _, { defaultTo, has, isNil } from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Icon } from "semantic-ui-react";
@@ -38,6 +38,34 @@ export const calculateResultDecoration = ({
38
38
  }
39
39
 
40
40
  const { resultType, result_type } = ruleImplementation;
41
+ const { errors, records, result: ruleResultPercentage } = ruleResult || {};
42
+
43
+ const executionInfoIsObject = _.flow(
44
+ _.prop("execution_result_info"),
45
+ _.isObject
46
+ );
47
+ const notEmptyResults = _.flow(
48
+ _.prop("results"),
49
+ (results) => _.isArray(results) && !_.isEmpty(results)
50
+ );
51
+ const firstResult = _.flow(_.prop("results"), _.first);
52
+ const defaultValue = { goal: null, minimum: null };
53
+
54
+ const { goal, minimum } = _.cond([
55
+ [executionInfoIsObject, _.prop("execution_result_info")],
56
+ [notEmptyResults, firstResult],
57
+ [_.stubTrue, () => defaultValue],
58
+ ])(ruleImplementation);
59
+
60
+ const colorParams = {
61
+ errors: errors,
62
+ result: ruleResultPercentage,
63
+ minimum: minimum,
64
+ goal: goal,
65
+ result_type: result_type,
66
+ records: records,
67
+ };
68
+
41
69
  const type = defaultTo(result_type)(resultType);
42
70
  const result =
43
71
  type === "errors_number"
@@ -51,7 +79,9 @@ export const calculateResultDecoration = ({
51
79
  { result, date: <DateTime value={date} /> }
52
80
  )
53
81
  : formatMessage({ id: `quality.result.${type}.description` }, { result });
54
- const color = selectColor({ ...ruleImplementation, ...ruleResult });
82
+
83
+ const color = selectColor(colorParams);
84
+
55
85
  const iconTitle = ruleResult?.result_text
56
86
  ? formatMessage({
57
87
  id: ruleResult?.result_text,
@@ -5,9 +5,11 @@ import ImplementationResultBar from "../ImplementationResultBar";
5
5
  const implementation = {
6
6
  id: 1,
7
7
  rule_id: 8,
8
- goal: 80,
9
- minimum: 50,
10
8
  result_type: "percentage",
9
+ execution_result_info: {
10
+ goal: 80,
11
+ minimum: 50,
12
+ },
11
13
  };
12
14
 
13
15
  describe("<ImplementationResultBar />", () => {
@@ -41,7 +43,9 @@ describe("<ImplementationResultBar />", () => {
41
43
  const props = {
42
44
  implementation: {
43
45
  ...implementation,
44
- results: [{ date: "2021-07-19T00:01:20Z", result: "40" }],
46
+ results: [
47
+ { date: "2021-07-19T00:01:20Z", result: "40", goal: 80, minimum: 50 },
48
+ ],
45
49
  },
46
50
  };
47
51
  const { container } = render(<ImplementationResultBar {...props} />);
@@ -14,7 +14,7 @@ exports[`<RuleResultDecorator /> decorates a percentage result 1`] = `
14
14
  <div>
15
15
  <i
16
16
  aria-hidden="true"
17
- class="green circle icon"
17
+ class="grey circle icon"
18
18
  title="Something happened"
19
19
  />
20
20
  42%
@@ -25,7 +25,7 @@ exports[`<RuleResultDecorator /> decorates an error count result 1`] = `
25
25
  <div>
26
26
  <i
27
27
  aria-hidden="true"
28
- class="green circle icon"
28
+ class="grey circle icon"
29
29
  title="Something happened"
30
30
  />
31
31
  1,234 errors
@@ -540,6 +540,7 @@ export default {
540
540
  "ruleImplementations.events.action_versioned": "Implementation versioned",
541
541
  "ruleImplementations.or": "OR",
542
542
  "ruleImplementations.props.business_concept": "Concept",
543
+ "ruleImplementations.props.business_concepts": "Concepts",
543
544
  "ruleImplementations.props.domain": "Domain",
544
545
  "ruleImplementations.props.executable": "Executable",
545
546
  "ruleImplementations.props.executable.false": "Internal",
@@ -556,6 +556,7 @@ export default {
556
556
  "ruleImplementations.events.action_versioned": "Implementación versionada",
557
557
  "ruleImplementations.or": "OR",
558
558
  "ruleImplementations.props.business_concept": "Concepto",
559
+ "ruleImplementations.props.business_concepts": "Conceptos",
559
560
  "ruleImplementations.props.domain": "Dominio",
560
561
  "ruleImplementations.props.executable": "Ejecutable",
561
562
  "ruleImplementations.props.executable.false": "Interna",
@@ -8,7 +8,7 @@ import {
8
8
  const initialState = [];
9
9
 
10
10
  const pickFields = _.pick([
11
- "current_business_concept_version",
11
+ "concepts",
12
12
  "execution_result_info",
13
13
  "id",
14
14
  "implementation_key",
@@ -4,6 +4,7 @@ import { createSelector } from "reselect";
4
4
  import { FormattedMessage } from "react-intl";
5
5
  import DateTime from "@truedat/core/components/DateTime";
6
6
  import { formatNumber } from "@truedat/core/services/format";
7
+ import ArrayDecorator from "@truedat/core/components/ArrayDecorator";
7
8
  import RuleResultDecorator from "../components/RuleResultDecorator";
8
9
  import RuleImplementationLink from "../components/RuleImplementationLink";
9
10
  import RuleLink from "../components/RuleLink";
@@ -39,9 +40,10 @@ export const defaultImplementationColumns = [
39
40
  width: 2,
40
41
  },
41
42
  {
42
- name: "business_concept",
43
- fieldSelector: _.path("current_business_concept_version.name"),
44
- sort: { name: "current_business_concept_version.name.raw" },
43
+ name: "business_concepts",
44
+ fieldSelector: _.path("concepts"),
45
+ fieldDecorator: ArrayDecorator(1, ", "),
46
+ sort: { name: "concepts.raw" },
45
47
  width: 2,
46
48
  },
47
49
  {