@truedat/dq 4.52.0 → 4.52.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.52.1] 2022-09-21
4
+
5
+ ### Fixed
6
+
7
+ - [TD-5164] RuleEventDecorator exception if quality_events is empty
8
+
3
9
  ## [4.52.0] 2022-09-20
4
10
 
5
11
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.52.0",
3
+ "version": "4.52.1",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -114,5 +114,5 @@
114
114
  "react-dom": ">= 16.8.6 < 17",
115
115
  "semantic-ui-react": ">= 0.88.2 < 2.1"
116
116
  },
117
- "gitHead": "1d43cb9b9b8531eb6c054c7f430741976d59f592"
117
+ "gitHead": "3eea3b93dcb8dc264af0779fd621971216f0e8aa"
118
118
  }
@@ -1,26 +1,30 @@
1
- import { flow, last, prop, sortBy } from "lodash/fp";
1
+ import { flow, last, prop, propOr, sortBy } from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Icon } from "semantic-ui-react";
5
5
 
6
+ const PENDING = { name: "info circle", color: "green" };
7
+
6
8
  export const icons = {
7
- PENDING: { name: "info circle", color: "green" },
9
+ PENDING,
8
10
  STARTED: { name: "play circle outline", color: "green" },
9
11
  SUCCEEDED: { name: "check circle outline", color: "green" },
10
- FAILED: { name: "warning circle", color: "red" }
12
+ FAILED: { name: "warning circle", color: "red" },
11
13
  };
12
- export const RuleResultDecorator = ({ _embedded }) => {
14
+
15
+ export const RuleEventDecorator = ({ _embedded }) => {
13
16
  const event = flow(
17
+ propOr([], "quality_events"),
14
18
  sortBy("inserted_at"),
15
19
  last,
16
20
  prop("type")
17
- )(_embedded.quality_events);
18
- const icon = icons[event] || { name: "question circle outline" };
21
+ )(_embedded);
22
+ const icon = propOr(PENDING, event)(icons);
19
23
  return <Icon size="large" {...icon} />;
20
24
  };
21
25
 
22
- RuleResultDecorator.propTypes = {
23
- _embedded: PropTypes.object
26
+ RuleEventDecorator.propTypes = {
27
+ _embedded: PropTypes.object,
24
28
  };
25
29
 
26
- export default RuleResultDecorator;
30
+ export default RuleEventDecorator;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { render } from "@truedat/test/render";
3
+ import { RuleEventDecorator } from "../RuleEventDecorator";
4
+
5
+ describe("<RuleEventDecorator />", () => {
6
+ it("matches latest snapshot (no events)", () => {
7
+ const { container } = render(<RuleEventDecorator />);
8
+ expect(container).toMatchSnapshot();
9
+ });
10
+ });
@@ -92,7 +92,7 @@ exports[`<ExecutionGroup /> matches the latest snapshot 1`] = `
92
92
  >
93
93
  <i
94
94
  aria-hidden="true"
95
- class="question circle outline large icon"
95
+ class="green info circle large icon"
96
96
  />
97
97
  </td>
98
98
  <td
@@ -0,0 +1,10 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<RuleEventDecorator /> matches latest snapshot (no events) 1`] = `
4
+ <div>
5
+ <i
6
+ aria-hidden="true"
7
+ class="green info circle large icon"
8
+ />
9
+ </div>
10
+ `;