@truedat/dq 4.45.4 → 4.45.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +5 -5
  3. package/src/api/mutations.js +25 -0
  4. package/src/components/ImplementationActions.js +147 -0
  5. package/src/components/ImplementationFiltersLoader.js +2 -1
  6. package/src/components/{RuleImplementations.js → ImplementationSearchResults.js} +68 -53
  7. package/src/components/Implementations.js +16 -120
  8. package/src/components/ImplementationsRoutes.js +45 -57
  9. package/src/components/NewRuleImplementation.js +4 -1
  10. package/src/components/QualityRoutes.js +12 -1
  11. package/src/components/RuleFormImplementations.js +8 -63
  12. package/src/components/RuleImplementation.js +13 -204
  13. package/src/components/RuleImplementationProperties.js +9 -2
  14. package/src/components/RuleImplementationRow.js +0 -10
  15. package/src/components/RuleImplementationsActions.js +6 -31
  16. package/src/components/RuleImplementationsFromRuleLoader.js +3 -6
  17. package/src/components/RuleImplementationsTable.js +31 -44
  18. package/src/components/Subscription.js +11 -0
  19. package/src/components/__tests__/ExecutionForm.spec.js +1 -1
  20. package/src/components/__tests__/ImplementationActions.spec.js +21 -0
  21. package/src/components/__tests__/ImplementationFiltersLoader.spec.js +20 -0
  22. package/src/components/__tests__/{RuleImplementations.spec.js → ImplementationSearchResults.spec.js} +6 -6
  23. package/src/components/__tests__/Implementations.spec.js +12 -112
  24. package/src/components/__tests__/NewRuleImplementation.spec.js +3 -2
  25. package/src/components/__tests__/RemediationForm.spec.js +1 -1
  26. package/src/components/__tests__/RemediationPlan.spec.js +1 -1
  27. package/src/components/__tests__/RuleForm.spec.js +2 -2
  28. package/src/components/__tests__/RuleFormImplementations.spec.js +2 -10
  29. package/src/components/__tests__/RuleImplementationProperties.spec.js +3 -2
  30. package/src/components/__tests__/RuleImplementationsActions.spec.js +10 -5
  31. package/src/components/__tests__/RuleImplementationsFromRuleLoader.spec.js +3 -16
  32. package/src/components/__tests__/RuleProperties.spec.js +1 -1
  33. package/src/components/__tests__/__snapshots__/ImplementationActions.spec.js.snap +71 -0
  34. package/src/components/__tests__/__snapshots__/ImplementationSearchResults.spec.js.snap +90 -0
  35. package/src/components/__tests__/__snapshots__/Implementations.spec.js.snap +159 -53
  36. package/src/components/__tests__/__snapshots__/RuleForm.spec.js.snap +6 -6
  37. package/src/components/__tests__/__snapshots__/RuleFormImplementations.spec.js.snap +6 -48
  38. package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +19 -19
  39. package/src/components/__tests__/__snapshots__/RuleImplementationProperties.spec.js.snap +2 -4
  40. package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +37 -0
  41. package/src/components/__tests__/__snapshots__/RuleImplementationsFromRuleLoader.spec.js.snap +0 -1
  42. package/src/components/__tests__/__snapshots__/RuleImplementationsTable.spec.js.snap +0 -3
  43. package/src/components/__tests__/__snapshots__/Subscription.spec.js.snap +19 -0
  44. package/src/components/index.js +0 -2
  45. package/src/components/ruleImplementationForm/InformationForm.js +1 -0
  46. package/src/components/ruleImplementationForm/RuleImplementationForm.js +7 -3
  47. package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +11 -2
  48. package/src/components/ruleImplementationForm/__tests__/RuleImplementationForm.spec.js +2 -2
  49. package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +6 -4
  50. package/src/messages/en.js +11 -6
  51. package/src/messages/es.js +13 -10
  52. package/src/reducers/__tests__/implementationsActions.spec.js +0 -9
  53. package/src/reducers/__tests__/ruleImplementationRedirect.spec.js +4 -13
  54. package/src/reducers/__tests__/ruleRedirect.spec.js +47 -67
  55. package/src/reducers/implementationsActions.js +0 -2
  56. package/src/reducers/index.js +0 -4
  57. package/src/reducers/ruleImplementation.js +7 -5
  58. package/src/reducers/ruleImplementationRedirect.js +6 -5
  59. package/src/reducers/ruleRedirect.js +14 -9
  60. package/src/routines.js +76 -76
  61. package/src/sagas/__tests__/deleteImplementation.spec.js +92 -0
  62. package/src/sagas/__tests__/publishImplementation.spec.js +80 -0
  63. package/src/sagas/__tests__/rejectImplementation.spec.js +80 -0
  64. package/src/sagas/__tests__/submitImplementation.spec.js +80 -0
  65. package/src/sagas/deleteImplementation.js +28 -0
  66. package/src/sagas/index.js +12 -3
  67. package/src/sagas/publishImplementation.js +24 -0
  68. package/src/sagas/rejectImplementation.js +24 -0
  69. package/src/sagas/submitImplementation.js +24 -0
  70. package/src/selectors/getExecutionQuery.js +4 -11
  71. package/src/components/__tests__/__snapshots__/RuleImplementations.spec.js.snap +0 -130
  72. package/src/reducers/__tests__/deletionQuery.spec.js +0 -24
  73. package/src/reducers/deletionQuery.js +0 -23
  74. package/src/reducers/userImplementationsPermissions.js +0 -23
  75. package/src/sagas/__tests__/setRuleImplementationStatus.spec.js +0 -165
  76. package/src/sagas/setRuleImplementationStatus.js +0 -53
@@ -22,18 +22,16 @@ import {
22
22
  IMPLEMENTATION_STRUCTURES,
23
23
  IMPLEMENTATION,
24
24
  IMPLEMENTATIONS,
25
+ IMPLEMENTATIONS_PENDING,
25
26
  } from "@truedat/core/routes";
26
27
  import {
27
28
  getImplementationStructures,
28
29
  getImplementationStructuresLoaded,
29
30
  } from "../selectors";
30
31
  import ImplementationCrumbs from "./ImplementationCrumbs";
31
- import ImplementationFiltersLoader from "./ImplementationFiltersLoader";
32
- import RuleImplementations from "./RuleImplementations";
33
- import RuleImplementationsLoader from "./RuleImplementationsLoader";
34
-
35
32
  import ImplementationStructures from "./ImplementationStructures";
36
33
  import ImplementationStructuresNew from "./ImplementationStructuresNew";
34
+ import Implementations from "./Implementations";
37
35
  import MoveImplementation from "./MoveImplementation";
38
36
  import NewRuleImplementation from "./NewRuleImplementation";
39
37
  import RuleImplementation from "./RuleImplementation";
@@ -42,16 +40,13 @@ import RuleImplementationLoader from "./RuleImplementationLoader";
42
40
  import RuleImplementationProperties from "./RuleImplementationProperties";
43
41
  import RuleImplementationResults from "./RuleImplementationResults";
44
42
  import RuleResultDetails from "./RuleResultDetails";
45
- import RuleResultsRoutes from "./RuleResultsRoutes";
46
43
  import RuleResultRemediationLoader from "./RuleResultRemediationLoader";
44
+ import RuleResultsRoutes from "./RuleResultsRoutes";
47
45
  import RuleSubscriptionLoader from "./RuleSubscriptionLoader";
48
46
 
49
47
  const TemplatesLoader = React.lazy(() =>
50
48
  import("@truedat/df/templates/components/TemplatesLoader")
51
49
  );
52
- const UserSearchFiltersLoader = React.lazy(() =>
53
- import("@truedat/dd/components/UserSearchFiltersLoader")
54
- );
55
50
  const DomainsLoader = React.lazy(() =>
56
51
  import("@truedat/bg/taxonomy/components/DomainsLoader")
57
52
  );
@@ -74,9 +69,7 @@ const ImplementationEventsLoader = () => {
74
69
  return <EventsLoader resource_id={id} resource_type="implementation" />;
75
70
  };
76
71
 
77
- const ImplementationTemplatesLoader = () => <TemplatesLoader scope="ri" />;
78
-
79
- const ImplementationsRoutes = ({
72
+ export const ImplementationsRoutes = ({
80
73
  structuresAliasesLoading,
81
74
  systemsLoading,
82
75
  ruleImplementationLoaded,
@@ -101,7 +94,6 @@ const ImplementationsRoutes = ({
101
94
  ]}
102
95
  filter="all"
103
96
  />
104
- <TemplatesLoader scope="ri" />
105
97
  {!structuresAliasesLoading && !systemsLoading && (
106
98
  <NewRuleImplementation edition={false} />
107
99
  )}
@@ -133,7 +125,6 @@ const ImplementationsRoutes = ({
133
125
  <>
134
126
  <RuleImplementationLoader />
135
127
  <RuleSubscriptionLoader />
136
-
137
128
  <Route
138
129
  exact
139
130
  path={IMPLEMENTATION}
@@ -141,17 +132,15 @@ const ImplementationsRoutes = ({
141
132
  <>
142
133
  <ImplementationCrumbs />
143
134
  <Segment>
144
- <ImplementationTemplatesLoader />
145
- {ruleImplementationLoaded && (
135
+ {ruleImplementationLoaded ? (
146
136
  <RuleImplementation>
147
137
  <RuleImplementationProperties />
148
138
  </RuleImplementation>
149
- )}
139
+ ) : null}
150
140
  </Segment>
151
141
  </>
152
142
  )}
153
143
  />
154
-
155
144
  <Route
156
145
  exact
157
146
  path={IMPLEMENTATION_EVENTS}
@@ -160,16 +149,15 @@ const ImplementationsRoutes = ({
160
149
  <ImplementationCrumbs />
161
150
  <Segment>
162
151
  <ImplementationEventsLoader />
163
- {ruleImplementationLoaded && (
152
+ {ruleImplementationLoaded ? (
164
153
  <RuleImplementation>
165
154
  <RuleImplementationEvents />
166
155
  </RuleImplementation>
167
- )}
156
+ ) : null}
168
157
  </Segment>
169
158
  </>
170
159
  )}
171
160
  />
172
-
173
161
  <Route
174
162
  exact
175
163
  path={IMPLEMENTATION_CLONE}
@@ -186,18 +174,16 @@ const ImplementationsRoutes = ({
186
174
  filter="all"
187
175
  />
188
176
  ) : null}
189
-
190
- <ImplementationTemplatesLoader />
191
- {ruleImplementationLoaded && (
177
+ {ruleImplementationLoaded ? (
192
178
  <ImplementationStructuresLoader
193
179
  structureIds={implementationStructures}
194
180
  />
195
- )}
181
+ ) : null}
196
182
  {!structuresAliasesLoading &&
197
- ruleImplementationLoaded &&
198
- implementationStructuresLoaded && (
199
- <NewRuleImplementation edition={true} clone={true} />
200
- )}
183
+ ruleImplementationLoaded &&
184
+ implementationStructuresLoaded ? (
185
+ <NewRuleImplementation edition clone />
186
+ ) : null}
201
187
  </>
202
188
  )}
203
189
  />
@@ -217,22 +203,19 @@ const ImplementationsRoutes = ({
217
203
  filter="all"
218
204
  />
219
205
  ) : null}
220
-
221
- <ImplementationTemplatesLoader />
222
- {ruleImplementationLoaded && (
206
+ {ruleImplementationLoaded ? (
223
207
  <ImplementationStructuresLoader
224
208
  structureIds={implementationStructures}
225
209
  />
226
- )}
210
+ ) : null}
227
211
  {!structuresAliasesLoading &&
228
- ruleImplementationLoaded &&
229
- implementationStructuresLoaded && (
230
- <NewRuleImplementation edition />
231
- )}
212
+ ruleImplementationLoaded &&
213
+ implementationStructuresLoaded ? (
214
+ <NewRuleImplementation edition />
215
+ ) : null}
232
216
  </>
233
217
  )}
234
218
  />
235
-
236
219
  <Route
237
220
  exact
238
221
  path={IMPLEMENTATION_MOVE}
@@ -256,11 +239,11 @@ const ImplementationsRoutes = ({
256
239
  <>
257
240
  <ImplementationCrumbs />
258
241
  <Segment>
259
- {ruleImplementationLoaded && (
242
+ {ruleImplementationLoaded ? (
260
243
  <RuleImplementation>
261
244
  <ImplementationLinks />
262
245
  </RuleImplementation>
263
- )}
246
+ ) : null}
264
247
  </Segment>
265
248
  </>
266
249
  )}
@@ -272,11 +255,11 @@ const ImplementationsRoutes = ({
272
255
  <>
273
256
  <ImplementationCrumbs />
274
257
  <Segment>
275
- {ruleImplementationLoaded && (
258
+ {ruleImplementationLoaded ? (
276
259
  <RuleImplementation>
277
260
  <ImplementationRelationForm />
278
261
  </RuleImplementation>
279
- )}
262
+ ) : null}
280
263
  </Segment>
281
264
  </>
282
265
  )}
@@ -288,11 +271,11 @@ const ImplementationsRoutes = ({
288
271
  <>
289
272
  <ImplementationCrumbs />
290
273
  <Segment>
291
- {ruleImplementationLoaded && (
274
+ {ruleImplementationLoaded ? (
292
275
  <RuleImplementation>
293
276
  <ImplementationStructures />
294
277
  </RuleImplementation>
295
- )}
278
+ ) : null}
296
279
  </Segment>
297
280
  </>
298
281
  )}
@@ -304,11 +287,11 @@ const ImplementationsRoutes = ({
304
287
  <>
305
288
  <ImplementationCrumbs />
306
289
  <Segment>
307
- {ruleImplementationLoaded && (
290
+ {ruleImplementationLoaded ? (
308
291
  <RuleImplementation>
309
292
  <ImplementationStructuresNew />
310
293
  </RuleImplementation>
311
- )}
294
+ ) : null}
312
295
  </Segment>
313
296
  </>
314
297
  )}
@@ -320,16 +303,15 @@ const ImplementationsRoutes = ({
320
303
  <>
321
304
  <ImplementationCrumbs />
322
305
  <Segment>
323
- {ruleImplementationLoaded && (
306
+ {ruleImplementationLoaded ? (
324
307
  <RuleImplementation>
325
308
  <RuleImplementationResults ruleResult={latest} />
326
309
  </RuleImplementation>
327
- )}
310
+ ) : null}
328
311
  </Segment>
329
312
  </>
330
313
  )}
331
314
  />
332
-
333
315
  <Route
334
316
  exact
335
317
  path={IMPLEMENTATION_RESULTS_DETAILS}
@@ -337,11 +319,11 @@ const ImplementationsRoutes = ({
337
319
  <>
338
320
  <ImplementationCrumbs />
339
321
  <Segment>
340
- {ruleImplementationLoaded && (
322
+ {ruleImplementationLoaded ? (
341
323
  <RuleImplementation>
342
324
  <RuleResultDetails ruleResultId={latest.id} />
343
325
  </RuleImplementation>
344
- )}
326
+ ) : null}
345
327
  </Segment>
346
328
  </>
347
329
  )}
@@ -362,15 +344,21 @@ const ImplementationsRoutes = ({
362
344
  )}
363
345
  />
364
346
  <Route
347
+ exact
365
348
  path={IMPLEMENTATIONS}
366
349
  render={() => (
367
- <>
368
- <RuleImplementationsLoader />
369
- <ImplementationFiltersLoader />
370
- <TemplatesLoader scope="qe" />
371
- <UserSearchFiltersLoader scope="rule_implementation" />
372
- <RuleImplementations exact />
373
- </>
350
+ <Implementations defaultFilters={{ status: ["published"] }} />
351
+ )}
352
+ />
353
+ <Route
354
+ exact
355
+ path={IMPLEMENTATIONS_PENDING}
356
+ render={() => (
357
+ <Implementations
358
+ defaultFilters={{
359
+ status: ["draft", "pending_approval", "rejected"],
360
+ }}
361
+ />
374
362
  )}
375
363
  />
376
364
  </Switch>
@@ -307,6 +307,7 @@ export const NewRuleImplementation = ({
307
307
  goal: ruleImplementationProps.goal,
308
308
  rule_id: ruleImplementationProps.rule_id,
309
309
  domain_id: ruleImplementationProps.domain_id,
310
+ status: ruleImplementationProps.status,
310
311
  }
311
312
  : {
312
313
  executable: true,
@@ -450,7 +451,7 @@ export const NewRuleImplementation = ({
450
451
  const setImplementationRawContent = (rawContent) =>
451
452
  setRuleImplementation({ ...ruleImplementation, rawContent });
452
453
 
453
- const doSubmit = () => {
454
+ const doSubmit = (props = {}) => {
454
455
  const populations = _.reject(_.isEmpty)(ruleImplementation.populations);
455
456
  const validations = _.reject(_.isEmpty)(ruleImplementation.validations);
456
457
  const segments = _.reject(_.isEmpty)(ruleImplementation.segments);
@@ -473,6 +474,7 @@ export const NewRuleImplementation = ({
473
474
  minimum: ruleImplementation.minimum,
474
475
  goal: ruleImplementation.goal,
475
476
  domain_id: ruleImplementation.domain_id,
477
+ status: props?.status,
476
478
  }
477
479
  : {
478
480
  executable: ruleImplementation.executable,
@@ -489,6 +491,7 @@ export const NewRuleImplementation = ({
489
491
  minimum: ruleImplementation.minimum,
490
492
  goal: ruleImplementation.goal,
491
493
  domain_id: ruleImplementation.domain_id,
494
+ status: props?.status,
492
495
  };
493
496
 
494
497
  clone || !edition
@@ -2,7 +2,12 @@ import React from "react";
2
2
  import { Route } from "react-router-dom";
3
3
  import { Unauthorized } from "@truedat/core/components";
4
4
  import { useAuthorized } from "@truedat/core/hooks";
5
- import { EXECUTION_GROUP, IMPLEMENTATIONS, RULES } from "@truedat/core/routes";
5
+ import {
6
+ EXECUTION_GROUP,
7
+ IMPLEMENTATIONS,
8
+ IMPLEMENTATIONS_PENDING,
9
+ RULES,
10
+ } from "@truedat/core/routes";
6
11
  import ExecutionGroup from "./ExecutionGroup";
7
12
  import ExecutionGroupLoader from "./ExecutionGroupLoader";
8
13
  import ImplementationsRoutes from "./ImplementationsRoutes";
@@ -36,6 +41,12 @@ const QualityRoutes = () => {
36
41
  authorized ? <ImplementationsRoutes /> : <Unauthorized />
37
42
  }
38
43
  />
44
+ <Route
45
+ path={IMPLEMENTATIONS_PENDING}
46
+ render={() =>
47
+ authorized ? <ImplementationsRoutes /> : <Unauthorized />
48
+ }
49
+ />
39
50
  </>
40
51
  );
41
52
  };
@@ -1,82 +1,27 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useState } from "react";
2
+ import React from "react";
3
3
  import PropTypes from "prop-types";
4
- import { useIntl } from "react-intl";
5
4
  import { connect } from "react-redux";
6
- import { Button, Container, Icon, Popup, Label } from "semantic-ui-react";
7
- import { updateDeletionQuery } from "../routines";
8
- import Implementations from "./Implementations";
5
+ import { Container } from "semantic-ui-react";
6
+ import RuleImplementationsTable from "./RuleImplementationsTable";
9
7
  import RuleImplementationActions from "./RuleImplementationActions";
10
8
 
11
- export const RuleFormImplementations = ({ updateDeletionQuery, rule }) => {
12
- const { formatMessage } = useIntl();
13
- const [deletedRender, setMode] = useState(false);
14
- if (_.isEmpty(rule)) return null;
15
- return (
9
+ export const RuleFormImplementations = ({ rule }) =>
10
+ _.isEmpty(rule) ? null : (
16
11
  <Container fluid>
17
12
  <div className="inline">
18
- {deletedRender && (
19
- <Label basic className="alert left">
20
- <Icon name={"warning circle"} color={"red"} />
21
- {formatMessage({ id: "rule.implementations.deprecated" })}
22
- </Label>
23
- )}
24
13
  <div className="implementation-actions">
25
- <Button.Group>
26
- <Button
27
- active={!deletedRender}
28
- icon
29
- data-tooltip={formatMessage({
30
- id: "ruleImplementations.actions.active.tooltip",
31
- })}
32
- onClick={() => {
33
- setMode(false);
34
- updateDeletionQuery({
35
- id: rule?.id,
36
- deleted: false,
37
- });
38
- }}
39
- >
40
- <Icon name="list ul" />
41
- </Button>
42
- <Popup
43
- content={formatMessage({
44
- id: "ruleImplementations.actions.popup.deprecated",
45
- })}
46
- trigger={
47
- <Button
48
- active={deletedRender}
49
- icon
50
- onClick={() => {
51
- setMode(true);
52
- updateDeletionQuery({
53
- id: rule?.id,
54
- deleted: true,
55
- });
56
- }}
57
- >
58
- <Icon name="folder open outline" />
59
- </Button>
60
- }
61
- />
62
- </Button.Group>
63
14
  <RuleImplementationActions />
64
15
  </div>
65
16
  </div>
66
- <Implementations rule={rule} deletedRender={deletedRender} />
17
+ <RuleImplementationsTable withoutColumns={["rule", "business_concept"]} />
67
18
  </Container>
68
19
  );
69
- };
70
20
 
71
- const mapStateToProps = ({ rule }) => ({
72
- rule,
73
- });
21
+ const mapStateToProps = ({ rule }) => ({ rule });
74
22
 
75
23
  RuleFormImplementations.propTypes = {
76
- updateDeletionQuery: PropTypes.func,
77
24
  rule: PropTypes.object,
78
25
  };
79
26
 
80
- export default connect(mapStateToProps, { updateDeletionQuery })(
81
- RuleFormImplementations
82
- );
27
+ export default connect(mapStateToProps)(RuleFormImplementations);
@@ -1,190 +1,17 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
- import { Link } from "react-router-dom";
4
3
  import PropTypes from "prop-types";
5
4
  import { useIntl } from "react-intl";
6
5
  import { connect } from "react-redux";
7
- import { Header, Label, Menu, Grid, Icon } from "semantic-ui-react";
8
- import { ConfirmModal, GroupActions } from "@truedat/core/components";
9
- import { useAuthorized } from "@truedat/core/hooks";
10
- import { linkTo } from "@truedat/core/routes";
11
- import { createExecutionGroup, setRuleImplementationStatus } from "../routines";
12
- import RuleImplementationTabs from "./RuleImplementationTabs";
6
+ import { Header, Label, Grid, Icon } from "semantic-ui-react";
7
+ import ImplementationActions from "./ImplementationActions";
13
8
  import ImplementationResultBar from "./ImplementationResultBar";
14
- import ExecutionPopup from "./ExecutionPopup";
9
+ import RuleImplementationTabs from "./RuleImplementationTabs";
15
10
  import Subscription from "./Subscription";
16
11
 
17
- const getAvailableActions = (props, formatMessage) => {
18
- const contentActions = _.isEmpty(props?.ruleImplementation)
19
- ? []
20
- : [
21
- {
22
- key: "delete",
23
- value: "delete",
24
- as: OptionModal,
25
- headerMessage:
26
- "ruleImplementation.actions.delete.confirmation.header",
27
- contentMessage:
28
- "ruleImplementation.actions.delete.confirmation.content",
29
- iconName: "trash alternate outline",
30
- iconColor: "red",
31
- option: "ruleImplementation.actions.delete",
32
- selected: false,
33
- active: false,
34
- filter: !_.prop("activeMode")(props),
35
- ...props,
36
- },
37
- {
38
- key: "softDelete",
39
- value: "softDelete",
40
- as: OptionModal,
41
- headerMessage:
42
- "ruleImplementation.actions.delete.confirmation.header",
43
- contentMessage:
44
- "ruleImplementation.actions.delete.confirmation.content",
45
- iconName: "folder open outline",
46
- iconColor: "black",
47
- option: "ruleImplementation.actions.deprecate",
48
- selected: false,
49
- active: false,
50
- filter: _.prop("activeMode")(props),
51
- ...props,
52
- },
53
- {
54
- key: "restore",
55
- iconName: "undo",
56
- option: "ruleImplementation.actions.restore",
57
- value: "restore",
58
- as: OptionModal,
59
- headerMessage:
60
- "ruleImplementation.actions.restore.confirmation.header",
61
- contentMessage:
62
- "ruleImplementation.actions.restore.confirmation.content",
63
- selected: false,
64
- active: false,
65
- filter: !_.prop("activeMode")(props),
66
- restore: true,
67
- ...props,
68
- },
69
- {
70
- key: "edit",
71
- icon: "edit outline",
72
- text: formatMessage({ id: "ruleImplementation.actions.edit" }),
73
- value: "edit",
74
- as: Link,
75
- to: linkTo.IMPLEMENTATION_EDIT({
76
- implementation_id: _.path("ruleImplementation.id")(props),
77
- }),
78
- filter: props.canEdit,
79
- selected: false,
80
- active: false,
81
- },
82
- {
83
- key: "move",
84
- icon: "share square",
85
- text: formatMessage({ id: "ruleImplementation.actions.move" }),
86
- value: "move",
87
- as: Link,
88
- to: linkTo.IMPLEMENTATION_MOVE({
89
- implementation_id: _.path("ruleImplementation.id")(props),
90
- }),
91
- filter: props?.authorized,
92
- selected: false,
93
- active: false,
94
- },
95
- {
96
- key: "clone",
97
- icon: "copy outline",
98
- text: formatMessage({ id: "ruleImplementation.actions.clone" }),
99
- value: "clone",
100
- as: Link,
101
- to: linkTo.IMPLEMENTATION_CLONE({
102
- implementation_id: _.path("ruleImplementation.id")(props),
103
- }),
104
- filter: true,
105
- selected: false,
106
- active: false,
107
- },
108
- ];
109
-
110
- return _.flow(_.filter("filter"), _.map(_.omit(["filter"])))(contentActions);
111
- };
112
-
113
- const OptionModal = ({
114
- activeMode,
115
- contentMessage,
116
- headerMessage,
117
- iconColor,
118
- iconName,
119
- option,
120
- restore,
121
- ruleImplementation,
122
- setRuleImplementationStatus,
123
- }) => {
124
- const { formatMessage } = useIntl();
125
- const payload = restore ? { restore } : { softDelete: activeMode };
126
- return (
127
- <ConfirmModal
128
- trigger={
129
- <Menu.Item
130
- icon={{ name: iconName, color: iconColor }}
131
- content={formatMessage({ id: option })}
132
- />
133
- }
134
- header={formatMessage({ id: headerMessage })}
135
- content={formatMessage({ id: contentMessage })}
136
- onConfirm={() =>
137
- setRuleImplementationStatus({
138
- id: ruleImplementation.id,
139
- ...payload,
140
- })
141
- }
142
- onOpen={(e) => e.stopPropagation()}
143
- onClose={(e) => e.stopPropagation()}
144
- />
145
- );
146
- };
147
-
148
- OptionModal.propTypes = {
149
- activeMode: PropTypes.bool,
150
- contentMessage: PropTypes.string,
151
- headerMessage: PropTypes.string,
152
- iconColor: PropTypes.string,
153
- iconName: PropTypes.string,
154
- option: PropTypes.string,
155
- restore: PropTypes.bool,
156
- ruleImplementation: PropTypes.object,
157
- setRuleImplementationStatus: PropTypes.func,
158
- };
159
-
160
- export const RuleImplementation = ({
161
- children,
162
- createExecutionGroup,
163
- canExecute,
164
- setRuleImplementationStatus,
165
- ruleImplementation,
166
- canEdit,
167
- canManage,
168
- }) => {
169
- const authorized = useAuthorized();
12
+ export const RuleImplementation = ({ children, ruleImplementation }) => {
170
13
  const { formatMessage } = useIntl();
171
14
  const deletedAt = _.prop("deleted_at")(ruleImplementation);
172
- const activeMode = _.isNil(deletedAt);
173
- const availableActions = getAvailableActions(
174
- {
175
- activeMode,
176
- authorized,
177
- ruleImplementation,
178
- setRuleImplementationStatus,
179
- canEdit,
180
- },
181
- formatMessage
182
- );
183
-
184
- const handleSubmit = (df_content) => {
185
- const query = { filters: { id: [ruleImplementation?.id] } };
186
- createExecutionGroup({ ...query, df_content });
187
- };
188
15
 
189
16
  return (
190
17
  <>
@@ -200,14 +27,7 @@ export const RuleImplementation = ({
200
27
  </Grid.Column>
201
28
  <Grid.Column width={8} textAlign="right">
202
29
  <>
203
- {canExecute && ruleImplementation.executable ? (
204
- <ExecutionPopup onSubmit={handleSubmit} count={1} />
205
- ) : null}
206
- <Subscription
207
- resource={ruleImplementation}
208
- resourceType="implementation"
209
- />
210
- {deletedAt && (
30
+ {deletedAt ? (
211
31
  <Label
212
32
  className="alert warning"
213
33
  content={formatMessage({
@@ -215,10 +35,13 @@ export const RuleImplementation = ({
215
35
  })}
216
36
  icon={{ name: "warning circle", color: "red" }}
217
37
  />
38
+ ) : (
39
+ <Subscription
40
+ resource={ruleImplementation}
41
+ resourceType="implementation"
42
+ />
218
43
  )}
219
- {canManage && !_.isEmpty(availableActions) && (
220
- <GroupActions availableActions={availableActions} />
221
- )}
44
+ <ImplementationActions />
222
45
  </>
223
46
  </Grid.Column>
224
47
  </Grid>
@@ -229,24 +52,10 @@ export const RuleImplementation = ({
229
52
  };
230
53
 
231
54
  RuleImplementation.propTypes = {
232
- createExecutionGroup: PropTypes.func,
233
- canExecute: PropTypes.bool,
234
- ruleImplementation: PropTypes.object.isRequired,
235
- setRuleImplementationStatus: PropTypes.func,
236
55
  ruleImplementation: PropTypes.object,
237
- canEdit: PropTypes.bool,
238
- canManage: PropTypes.bool,
239
56
  children: PropTypes.node,
240
57
  };
241
58
 
242
- const mapStateToProps = ({ ruleImplementation, implementationActions }) => ({
243
- ruleImplementation,
244
- canExecute: !!implementationActions?.execute,
245
- canEdit: !!implementationActions?.edit,
246
- canManage: !!implementationActions?.manage,
247
- });
59
+ const mapStateToProps = ({ ruleImplementation }) => ({ ruleImplementation });
248
60
 
249
- export default connect(mapStateToProps, {
250
- createExecutionGroup,
251
- setRuleImplementationStatus,
252
- })(RuleImplementation);
61
+ export default connect(mapStateToProps)(RuleImplementation);