@truedat/dq 4.45.8 → 4.46.0

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.46.0] 2022-06-13
4
+
5
+ ### Fixed
6
+
7
+ - [TD-4918] Implementations workflow permissions
8
+
3
9
  ## [4.45.7] 2022-06-07
4
10
 
5
11
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.45.8",
3
+ "version": "4.46.0",
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.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.45.8",
37
+ "@truedat/test": "4.46.0",
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",
@@ -88,8 +88,8 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.6.4",
91
- "@truedat/core": "4.45.8",
92
- "@truedat/df": "4.45.8",
91
+ "@truedat/core": "4.46.0",
92
+ "@truedat/df": "4.46.0",
93
93
  "axios": "^0.19.2",
94
94
  "graphql": "^15.5.3",
95
95
  "path-to-regexp": "^1.7.0",
@@ -110,5 +110,5 @@
110
110
  "react-dom": ">= 16.8.6 < 17",
111
111
  "semantic-ui-react": ">= 0.88.2 < 2.1"
112
112
  },
113
- "gitHead": "1b5acb1dc1233181e5a47353fd8a5da1424e7a47"
113
+ "gitHead": "ed9e54123f20ee10a528c865653da09022457327"
114
114
  }
@@ -17,38 +17,41 @@ import {
17
17
  import ExecutionPopup from "./ExecutionPopup";
18
18
 
19
19
  export const implementationActions = ({
20
+ actions,
20
21
  id,
21
22
  deleteImplementation,
22
23
  formatMessage,
23
- }) => [
24
- {
25
- key: "clone",
26
- icon: "copy outline",
27
- text: formatMessage({ id: "ruleImplementation.actions.clone" }),
28
- value: "clone",
29
- as: Link,
30
- to: linkTo.IMPLEMENTATION_CLONE({ implementation_id: id }),
31
- },
32
- {
33
- key: "move",
34
- icon: "share square",
35
- text: formatMessage({ id: "ruleImplementation.actions.move" }),
36
- value: "move",
37
- as: Link,
38
- to: linkTo.IMPLEMENTATION_MOVE({ implementation_id: id }),
39
- },
40
- {
41
- key: "delete",
42
- value: "delete",
43
- as: OptionModal,
44
- headerMessage: "ruleImplementation.actions.delete.confirmation.header",
45
- contentMessage: "ruleImplementation.actions.delete.confirmation.content",
46
- iconName: "trash alternate outline",
47
- iconColor: "red",
48
- option: "ruleImplementation.actions.delete",
49
- onConfirm: () => deleteImplementation({ id, redirectUrl: IMPLEMENTATIONS }),
50
- },
51
- ];
24
+ }) =>
25
+ _.filter(({ key }) => _.flow(Object.keys, _.includes(key))(actions))([
26
+ {
27
+ key: "clone",
28
+ icon: "copy outline",
29
+ text: formatMessage({ id: "ruleImplementation.actions.clone" }),
30
+ value: "clone",
31
+ as: Link,
32
+ to: linkTo.IMPLEMENTATION_CLONE({ implementation_id: id }),
33
+ },
34
+ {
35
+ key: "move",
36
+ icon: "share square",
37
+ text: formatMessage({ id: "ruleImplementation.actions.move" }),
38
+ value: "move",
39
+ as: Link,
40
+ to: linkTo.IMPLEMENTATION_MOVE({ implementation_id: id }),
41
+ },
42
+ {
43
+ key: "delete",
44
+ value: "delete",
45
+ as: OptionModal,
46
+ headerMessage: "ruleImplementation.actions.delete.confirmation.header",
47
+ contentMessage: "ruleImplementation.actions.delete.confirmation.content",
48
+ iconName: "trash alternate outline",
49
+ iconColor: "red",
50
+ option: "ruleImplementation.actions.delete",
51
+ onConfirm: () =>
52
+ deleteImplementation({ id, redirectUrl: IMPLEMENTATIONS }),
53
+ },
54
+ ]);
52
55
 
53
56
  export const ImplementationActions = ({
54
57
  actions,
@@ -66,6 +69,7 @@ export const ImplementationActions = ({
66
69
  createExecutionGroup({ ...query, df_content });
67
70
  };
68
71
  const secondaryActions = implementationActions({
72
+ actions,
69
73
  id,
70
74
  deleteImplementation,
71
75
  formatMessage,
@@ -116,7 +120,9 @@ export const ImplementationActions = ({
116
120
  />
117
121
  ) : null}
118
122
  {actions?.execute ? <ExecutionPopup onSubmit={handleExecute} /> : null}
119
- <GroupActions availableActions={secondaryActions} />
123
+ {_.isEmpty(secondaryActions) ? null : (
124
+ <GroupActions availableActions={secondaryActions} />
125
+ )}
120
126
  </>
121
127
  );
122
128
  };
@@ -101,7 +101,9 @@ export const ImplementationSearchResults = ({
101
101
  selectedImplementations
102
102
  );
103
103
  };
104
-
104
+ const withoutColumns = useActiveRoute(IMPLEMENTATIONS_PENDING)
105
+ ? []
106
+ : ["status"];
105
107
  return (
106
108
  <Segment>
107
109
  <ImplementationSearchResultsHeader />
@@ -130,6 +132,7 @@ export const ImplementationSearchResults = ({
130
132
  executeImplementationsOn={executeImplementationsOn}
131
133
  isRowChecked={isRowChecked}
132
134
  selectedImplementations={selectedImplementations}
135
+ withoutColumns={withoutColumns}
133
136
  />
134
137
  <RuleImplementationsPagination />
135
138
  </Dimmer.Dimmable>
@@ -14,7 +14,7 @@ import ImplementationsRoutes from "./ImplementationsRoutes";
14
14
  import RulesRoutes from "./RulesRoutes";
15
15
 
16
16
  const QualityRoutes = () => {
17
- const authorized = useAuthorized("data_quality");
17
+ const authorized = useAuthorized("quality");
18
18
 
19
19
  return (
20
20
  <>
@@ -37,9 +37,9 @@ RuleImplementationActions.propTypes = {
37
37
  canCreateRaw: PropTypes.bool,
38
38
  };
39
39
 
40
- const mapStateToProps = ({ userRulePermissions }) => ({
41
- canCreate: !!userRulePermissions?.manage_quality_rule_implementations,
42
- canCreateRaw: !!userRulePermissions?.manage_raw_quality_rule_implementations,
40
+ const mapStateToProps = ({ implementationActions }) => ({
41
+ canCreate: !!implementationActions?.create,
42
+ canCreateRaw: !!implementationActions?.createRaw,
43
43
  });
44
44
 
45
45
  export default connect(mapStateToProps)(RuleImplementationActions);
@@ -82,7 +82,7 @@ export const RuleImplementationsActions = ({
82
82
  />
83
83
  </>
84
84
  ) : null}
85
- {actions?.createRaw ? (
85
+ {actions?.createRawRuleLess ? (
86
86
  <Button
87
87
  as={Link}
88
88
  to={IMPLEMENTATION_NEW_RAW}
@@ -91,7 +91,7 @@ export const RuleImplementationsActions = ({
91
91
  })}
92
92
  />
93
93
  ) : null}
94
- {actions?.create ? (
94
+ {actions?.createRuleLess ? (
95
95
  <Button
96
96
  primary
97
97
  as={Link}
@@ -9,6 +9,9 @@ const renderOpts = {
9
9
  },
10
10
  implementationActions: {
11
11
  execute: { method: "POST" },
12
+ move: { method: "POST" },
13
+ clone: { method: "POST" },
14
+ delete: { method: "POST" },
12
15
  },
13
16
  },
14
17
  };
@@ -2,6 +2,13 @@ import React from "react";
2
2
  import { shallow } from "enzyme";
3
3
  import { ImplementationSearchResults } from "../ImplementationSearchResults";
4
4
 
5
+ jest.mock("@truedat/core/hooks", () => ({
6
+ useAuthorized: jest.fn(() => true),
7
+ useActiveRoute: jest.fn((param) =>
8
+ param === "/pendingImplementations" ? true : false
9
+ ),
10
+ }));
11
+
5
12
  describe("<ImplementationSearchResults />", () => {
6
13
  it("matches the latest snapshot", () => {
7
14
  const props = {
@@ -19,6 +19,9 @@ const stateExecutePermission = {
19
19
  manage: true,
20
20
  link_concept: true,
21
21
  execute: true,
22
+ move: true,
23
+ clone: true,
24
+ delete: true,
22
25
  },
23
26
  };
24
27
 
@@ -28,6 +31,9 @@ const stateNoExecutePermission = {
28
31
  manage: true,
29
32
  link_concept: true,
30
33
  execute: false,
34
+ move: true,
35
+ clone: true,
36
+ delete: true,
31
37
  },
32
38
  };
33
39
 
@@ -13,8 +13,8 @@ describe("<RuleImplementationsActions />", () => {
13
13
  const props = {
14
14
  actions: {
15
15
  uploadResults: {},
16
- create: {},
17
- createRaw: {},
16
+ createRuleLess: {},
17
+ createRawRuleLess: {},
18
18
  download: {},
19
19
  execute: {},
20
20
  },
@@ -33,6 +33,7 @@ exports[`<ImplementationSearchResults /> matches the latest snapshot 1`] = `
33
33
  executeImplementationsOn={false}
34
34
  isRowChecked={[Function]}
35
35
  selectedImplementations={Array []}
36
+ withoutColumns={Array []}
36
37
  />
37
38
  <Connect(Pagination) />
38
39
  </DimmerDimmable>
@@ -82,6 +83,7 @@ exports[`<ImplementationSearchResults /> renders executions on when executionEna
82
83
  executeImplementationsOn={true}
83
84
  isRowChecked={[Function]}
84
85
  selectedImplementations={Array []}
86
+ withoutColumns={Array []}
85
87
  />
86
88
  <Connect(Pagination) />
87
89
  </DimmerDimmable>
@@ -6,6 +6,8 @@ import { render } from "@truedat/test/render";
6
6
  import { multipleTemplatesMock } from "@truedat/test/mocks";
7
7
  import RuleImplementationRawForm from "../RuleImplementationRawForm";
8
8
 
9
+ jest.setTimeout(30000);
10
+
9
11
  const renderOpts = {
10
12
  mocks: [multipleTemplatesMock({ scope: "ri", domainIds: [1] })],
11
13
  state: {
@@ -1,13 +1,20 @@
1
1
  import _ from "lodash/fp";
2
- import { clearRuleImplementations, fetchRuleImplementation } from "../routines";
2
+ import {
3
+ clearRuleImplementation,
4
+ clearRuleImplementations,
5
+ fetchRuleImplementation,
6
+ fetchRuleImplementations,
7
+ } from "../routines";
3
8
 
4
9
  const initialState = {};
5
10
 
6
11
  const implementationActions = (state = initialState, { type, payload }) => {
7
12
  switch (type) {
8
13
  case fetchRuleImplementation.SUCCESS:
14
+ case fetchRuleImplementations.SUCCESS:
9
15
  return _.pathOr(initialState, "_actions")(payload);
10
16
  case clearRuleImplementations.TRIGGER:
17
+ case clearRuleImplementation.TRIGGER:
11
18
  return initialState;
12
19
  default:
13
20
  return state;
@@ -26,6 +26,7 @@ const pickFields = _.pick([
26
26
  "goal",
27
27
  "dataset",
28
28
  "valdations",
29
+ "status",
29
30
  ]);
30
31
 
31
32
  const ruleImplementations = (state = initialState, { type, payload }) => {
@@ -28,6 +28,13 @@ export const defaultImplementationColumns = [
28
28
  fieldDecorator: RuleLink,
29
29
  width: 2,
30
30
  },
31
+ {
32
+ name: "status",
33
+ fieldDecorator: (value) =>
34
+ translateDecorator(`ruleImplementation.status.${value}`),
35
+ sort: { name: "status" },
36
+ width: 2,
37
+ },
31
38
  {
32
39
  name: "business_concept",
33
40
  fieldSelector: _.path("current_business_concept_version.name"),