@truedat/dq 4.40.7 → 4.40.8

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 (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +5 -5
  3. package/src/api.js +2 -0
  4. package/src/components/ExecutionDetails.js +65 -40
  5. package/src/components/ImplementationResultBar.js +1 -1
  6. package/src/components/NewRemediation.js +62 -0
  7. package/src/components/RemediationCrumbs.js +76 -0
  8. package/src/components/RemediationForm.js +129 -0
  9. package/src/components/RemediationPlan.js +161 -0
  10. package/src/components/RuleImplementation.js +1 -1
  11. package/src/components/RuleImplementationResults.js +2 -1
  12. package/src/components/RuleResultRow.js +4 -1
  13. package/src/components/RuleRoutes.js +324 -296
  14. package/src/components/__tests__/ExecutionDetails.spec.js +17 -5
  15. package/src/components/__tests__/RemediationForm.spec.js +68 -0
  16. package/src/components/__tests__/RemediationPlan.spec.js +106 -0
  17. package/src/components/__tests__/__snapshots__/ExecutionDetails.spec.js.snap +104 -0
  18. package/src/components/__tests__/__snapshots__/RemediationForm.spec.js.snap +19 -0
  19. package/src/components/__tests__/__snapshots__/RemediationPlan.spec.js.snap +3 -0
  20. package/src/messages/en.js +7 -0
  21. package/src/messages/es.js +7 -0
  22. package/src/reducers/__tests__/remediation.spec.js +83 -0
  23. package/src/reducers/__tests__/remediationActions.spec.js +46 -0
  24. package/src/reducers/__tests__/remediationLoading.spec.js +50 -0
  25. package/src/reducers/dqMessage.js +8 -2
  26. package/src/reducers/index.js +6 -0
  27. package/src/reducers/remediation.js +35 -0
  28. package/src/reducers/remediationActions.js +19 -0
  29. package/src/reducers/remediationLoading.js +29 -0
  30. package/src/routines.js +6 -0
  31. package/src/sagas/__tests__/createRemediation.spec.js +83 -0
  32. package/src/sagas/__tests__/deleteRemediation.spec.js +82 -0
  33. package/src/sagas/__tests__/fetchRemediation.spec.js +78 -0
  34. package/src/sagas/__tests__/fetchRuleImplementation.spec.js +1 -1
  35. package/src/sagas/__tests__/updateRemediation.spec.js +81 -0
  36. package/src/sagas/createRemediation.js +31 -0
  37. package/src/sagas/deleteRemediation.js +29 -0
  38. package/src/sagas/fetchRemediation.js +30 -0
  39. package/src/sagas/index.js +12 -0
  40. package/src/sagas/updateRemediation.js +29 -0
  41. package/src/styles/executionDetails.less +3 -0
  42. package/src/styles/remediationPlan.less +8 -0
@@ -1,7 +1,7 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Route, Switch, useRouteMatch } from "react-router-dom";
4
+ import { Route, useRouteMatch } from "react-router-dom";
5
5
  import { connect } from "react-redux";
6
6
  import { Segment } from "semantic-ui-react";
7
7
  import { Unauthorized } from "@truedat/core/components";
@@ -95,324 +95,352 @@ export const RuleRoutes = ({
95
95
  template,
96
96
  structuresAliasesLoading,
97
97
  ruleImplementation,
98
+ }) => {
99
+ return (
100
+ <>
101
+ <Route
102
+ exact
103
+ path={RULE_NEW}
104
+ render={() => (
105
+ <>
106
+ <DomainsLoader actions="manage_quality_rule" />
107
+ <QualityTemplatesLoader />
108
+ <NewRule />
109
+ </>
110
+ )}
111
+ />
112
+
113
+ <Route
114
+ path={RULE}
115
+ render={() => (
116
+ <>
117
+ <RuleLoader />
118
+
119
+ <Route
120
+ exact
121
+ path={RULE}
122
+ render={() => (
123
+ <>
124
+ <RuleCrumbs />
125
+ <Segment>
126
+ <RuleSubscriptionLoader />
127
+ <QualityTemplatesLoader />
128
+ <RuleImplementationsFromRuleLoader />
129
+ {ruleLoaded && <Rule />}
130
+ {ruleLoaded && <RuleProperties />}
131
+ {templatesLoaded && template && (
132
+ <DynamicFormViewer
133
+ template={template}
134
+ content={rule.df_content}
135
+ />
136
+ )}
137
+ </Segment>
138
+ </>
139
+ )}
140
+ />
141
+
142
+ <Route
143
+ exact
144
+ path={RULE_EDIT}
145
+ render={() => (
146
+ <>
147
+ <DomainsLoader actions="manage_quality_rule" />
148
+ <QualityTemplatesLoader />
149
+ <EditRule />
150
+ </>
151
+ )}
152
+ />
153
+
154
+ <Route
155
+ exact
156
+ path={RULE_EVENTS}
157
+ render={() => (
158
+ <>
159
+ <RuleCrumbs />
160
+ <Segment>
161
+ <RuleEventsLoader />
162
+ {ruleLoaded && <Rule />}
163
+ {ruleLoaded && <RuleEvents />}
164
+ </Segment>
165
+ </>
166
+ )}
167
+ />
168
+
169
+ <Route
170
+ exact
171
+ path={RULE_IMPLEMENTATIONS}
172
+ render={() => (
173
+ <>
174
+ <RuleCrumbs />
175
+ <Segment>
176
+ <RuleSubscriptionLoader />
177
+ <RuleImplementationsFromRuleLoader />
178
+ {ruleLoaded && <Rule />}
179
+ {ruleLoaded && <RuleFormImplementations />}
180
+ </Segment>
181
+ </>
182
+ )}
183
+ />
184
+
185
+ <Route
186
+ exact
187
+ path={RULE_IMPLEMENTATION_NEW}
188
+ render={() => (
189
+ <>
190
+ <ImplementationTemplatesLoader />
191
+ {!structuresAliasesLoading && !systemsLoading && (
192
+ <NewRuleImplementation edition={false} />
193
+ )}
194
+ </>
195
+ )}
196
+ />
197
+
198
+ <ImplementationRoutes
199
+ {...{
200
+ ruleLoaded,
201
+ ruleImplementationLoaded,
202
+ implementationStructures,
203
+ implementationStructuresLoaded,
204
+ structuresAliasesLoading,
205
+ ruleImplementation,
206
+ }}
207
+ />
208
+ </>
209
+ )}
210
+ />
211
+ </>
212
+ );
213
+ };
214
+
215
+ const ImplementationRoutes = ({
216
+ ruleLoaded,
217
+ ruleImplementationLoaded,
218
+ implementationStructures,
219
+ implementationStructuresLoaded,
220
+ structuresAliasesLoading,
221
+ ruleImplementation,
98
222
  }) => {
99
223
  const latest = _.head(ruleImplementation.results);
100
224
  const authorized = useAuthorized();
101
225
  return (
102
226
  <>
103
- <Route path={RULE} render={() => <RuleLoader />} />
104
- <Switch>
105
- <Route
106
- exact
107
- path={RULE_NEW}
108
- render={() => (
109
- <>
110
- <DomainsLoader actions="manage_quality_rule" />
111
- <QualityTemplatesLoader />
112
- <NewRule />
113
- </>
114
- )}
115
- />
116
- <Route
117
- path={RULE}
118
- render={() => (
119
- <>
120
- <RuleLoader />
121
- <Switch>
122
- <Route
123
- exact
124
- path={RULE_EDIT}
125
- render={() => (
126
- <>
127
- <DomainsLoader actions="manage_quality_rule" />
128
- <QualityTemplatesLoader />
129
- <EditRule />
130
- </>
131
- )}
132
- />
133
- <Route
134
- exact
135
- path={RULE}
136
- render={() => (
137
- <>
138
- <RuleCrumbs />
139
- <Segment>
140
- <RuleSubscriptionLoader />
141
- <QualityTemplatesLoader />
142
- <RuleImplementationsFromRuleLoader />
143
- {ruleLoaded && <Rule />}
144
- {ruleLoaded && <RuleProperties />}
145
- {templatesLoaded && template && (
146
- <DynamicFormViewer
147
- template={template}
148
- content={rule.df_content}
149
- />
150
- )}
151
- </Segment>
152
- </>
153
- )}
154
- />
227
+ <Route
228
+ path={RULE_IMPLEMENTATION}
229
+ render={() => (
230
+ <>
231
+ <RuleImplementationLoader />
155
232
 
156
- <Route
157
- exact
158
- path={RULE_EVENTS}
159
- render={() => (
160
- <>
161
- <RuleCrumbs />
162
- <Segment>
163
- <RuleEventsLoader />
164
- {ruleLoaded && <Rule />}
165
- {ruleLoaded && <RuleEvents />}
166
- </Segment>
167
- </>
168
- )}
169
- />
233
+ <Route
234
+ exact
235
+ path={RULE_IMPLEMENTATION}
236
+ render={() => (
237
+ <>
238
+ <RuleCrumbs />
239
+ <Segment>
240
+ <ImplementationTemplatesLoader />
241
+ {ruleLoaded && ruleImplementationLoaded && (
242
+ <RuleImplementation>
243
+ <RuleImplementationProperties />
244
+ </RuleImplementation>
245
+ )}
246
+ </Segment>
247
+ </>
248
+ )}
249
+ />
170
250
 
171
- <Route
172
- exact
173
- path={RULE_IMPLEMENTATIONS}
174
- render={() => (
175
- <>
176
- <RuleCrumbs />
177
- <Segment>
178
- <RuleSubscriptionLoader />
179
- <RuleImplementationLoader />
180
- <RuleImplementationsFromRuleLoader />
181
- {ruleLoaded && <Rule />}
182
- {ruleLoaded && <RuleFormImplementations />}
183
- </Segment>
184
- </>
185
- )}
186
- />
187
- <Route
188
- exact
189
- path={RULE_IMPLEMENTATION_EVENTS}
190
- render={() => (
191
- <>
192
- <RuleCrumbs />
193
- <Segment>
194
- <ImplementationEventsLoader />
195
- <RuleImplementationLoader />
196
- {ruleLoaded && ruleImplementationLoaded && (
197
- <RuleImplementation>
198
- <RuleImplementationEvents />
199
- </RuleImplementation>
200
- )}
201
- </Segment>
202
- </>
203
- )}
204
- />
251
+ <Route
252
+ exact
253
+ path={RULE_IMPLEMENTATION_EVENTS}
254
+ render={() => (
255
+ <>
256
+ <RuleCrumbs />
257
+ <Segment>
258
+ <ImplementationEventsLoader />
259
+ {ruleLoaded && ruleImplementationLoaded && (
260
+ <RuleImplementation>
261
+ <RuleImplementationEvents />
262
+ </RuleImplementation>
263
+ )}
264
+ </Segment>
265
+ </>
266
+ )}
267
+ />
205
268
 
206
- <Route
207
- exact
208
- path={RULE_IMPLEMENTATION_NEW}
209
- render={() => (
210
- <>
211
- <ImplementationTemplatesLoader />
212
- {!structuresAliasesLoading && !systemsLoading && (
213
- <NewRuleImplementation edition={false} />
214
- )}
215
- </>
216
- )}
217
- />
218
- <Route
219
- exact
220
- path={RULE_IMPLEMENTATION_CLONE}
221
- render={() => (
222
- <>
223
- <RuleImplementationLoader />
224
- <ImplementationTemplatesLoader />
225
- {ruleImplementationLoaded && (
226
- <ImplementationStructuresLoader
227
- structureIds={implementationStructures}
228
- />
229
- )}
230
- {!structuresAliasesLoading &&
231
- ruleImplementationLoaded &&
232
- implementationStructuresLoaded && (
233
- <NewRuleImplementation edition={true} clone={true} />
234
- )}
235
- </>
269
+ <Route
270
+ exact
271
+ path={RULE_IMPLEMENTATION_CLONE}
272
+ render={() => (
273
+ <>
274
+ <ImplementationTemplatesLoader />
275
+ {ruleImplementationLoaded && (
276
+ <ImplementationStructuresLoader
277
+ structureIds={implementationStructures}
278
+ />
236
279
  )}
237
- />
238
- <Route
239
- exact
240
- path={RULE_IMPLEMENTATION_EDIT}
241
- render={() => (
242
- <>
243
- <RuleImplementationLoader />
244
- <ImplementationTemplatesLoader />
245
- {ruleImplementationLoaded && (
246
- <ImplementationStructuresLoader
247
- structureIds={implementationStructures}
248
- />
249
- )}
250
- {!structuresAliasesLoading &&
251
- ruleImplementationLoaded &&
252
- implementationStructuresLoaded && (
253
- <NewRuleImplementation edition />
254
- )}
255
- </>
256
- )}
257
- />
258
- <Route
259
- exact
260
- path={RULE_IMPLEMENTATION_MOVE}
261
- render={() => (
262
- <>
263
- <RuleCrumbs />
264
- <Segment>
265
- <RuleImplementationLoader />
266
- {ruleLoaded && ruleImplementationLoaded ? (
267
- <RuleImplementation>
268
- {authorized ? (
269
- <MoveImplementation />
270
- ) : (
271
- <Unauthorized />
272
- )}
273
- </RuleImplementation>
274
- ) : null}
275
- </Segment>
276
- </>
280
+ {!structuresAliasesLoading &&
281
+ ruleImplementationLoaded &&
282
+ implementationStructuresLoaded && (
283
+ <NewRuleImplementation edition={true} clone={true} />
284
+ )}
285
+ </>
286
+ )}
287
+ />
288
+ <Route
289
+ exact
290
+ path={RULE_IMPLEMENTATION_EDIT}
291
+ render={() => (
292
+ <>
293
+ <ImplementationTemplatesLoader />
294
+ {ruleImplementationLoaded && (
295
+ <ImplementationStructuresLoader
296
+ structureIds={implementationStructures}
297
+ />
277
298
  )}
278
- />
279
- <Route
280
- exact
281
- path={RULE_IMPLEMENTATION}
282
- render={() => (
283
- <>
284
- <RuleCrumbs />
285
- <Segment>
286
- <RuleImplementationLoader />
287
- <ImplementationTemplatesLoader />
288
- {ruleLoaded && ruleImplementationLoaded && (
289
- <RuleImplementation>
290
- <RuleImplementationProperties />
291
- </RuleImplementation>
292
- )}
293
- </Segment>
294
- </>
295
- )}
296
- />
297
- <Route
298
- exact
299
- path={IMPLEMENTATION_CONCEPT_LINKS}
300
- render={() => (
301
- <>
302
- <RuleCrumbs />
303
- <Segment>
304
- <RuleImplementationLoader />
305
- {ruleLoaded && ruleImplementationLoaded && (
306
- <RuleImplementation>
307
- <ImplementationLinks />
308
- </RuleImplementation>
309
- )}
310
- </Segment>
311
- </>
312
- )}
313
- />
314
- <Route
315
- exact
316
- path={IMPLEMENTATION_CONCEPT_LINKS_NEW}
317
- render={() => (
318
- <>
319
- <RuleCrumbs />
320
- <Segment>
321
- <RuleImplementationLoader />
322
- {ruleLoaded && ruleImplementationLoaded && (
323
- <RuleImplementation>
324
- <ImplementationRelationForm />
325
- </RuleImplementation>
326
- )}
327
- </Segment>
328
- </>
329
- )}
330
- />
331
- <Route
332
- exact
333
- path={RULE_IMPLEMENTATION_RESULTS}
334
- render={() => (
335
- <>
336
- <RuleCrumbs />
337
- <Segment>
338
- <RuleImplementationLoader />
339
- {ruleLoaded && ruleImplementationLoaded && (
340
- <RuleImplementation>
341
- <RuleImplementationResults />
342
- </RuleImplementation>
343
- )}
344
- </Segment>
345
- </>
346
- )}
347
- />
348
- <Route
349
- exact
350
- path={RULE_IMPLEMENTATION_RESULTS_DETAILS}
351
- render={() => (
299
+ {!structuresAliasesLoading &&
300
+ ruleImplementationLoaded &&
301
+ implementationStructuresLoaded && (
302
+ <NewRuleImplementation edition />
303
+ )}
304
+ </>
305
+ )}
306
+ />
307
+
308
+ <Route
309
+ exact
310
+ path={RULE_IMPLEMENTATION_MOVE}
311
+ render={() => (
312
+ <>
313
+ <RuleCrumbs />
314
+ <Segment>
315
+ {ruleLoaded && ruleImplementationLoaded ? (
316
+ <RuleImplementation>
317
+ {authorized ? <MoveImplementation /> : <Unauthorized />}
318
+ </RuleImplementation>
319
+ ) : null}
320
+ </Segment>
321
+ </>
322
+ )}
323
+ />
324
+ <Route
325
+ exact
326
+ path={IMPLEMENTATION_CONCEPT_LINKS}
327
+ render={() => (
328
+ <>
329
+ <RuleCrumbs />
330
+ <Segment>
331
+ {ruleLoaded && ruleImplementationLoaded && (
332
+ <RuleImplementation>
333
+ <ImplementationLinks />
334
+ </RuleImplementation>
335
+ )}
336
+ </Segment>
337
+ </>
338
+ )}
339
+ />
340
+ <Route
341
+ exact
342
+ path={IMPLEMENTATION_CONCEPT_LINKS_NEW}
343
+ render={() => (
344
+ <>
345
+ <RuleCrumbs />
346
+ <Segment>
347
+ {ruleLoaded && ruleImplementationLoaded && (
348
+ <RuleImplementation>
349
+ <ImplementationRelationForm />
350
+ </RuleImplementation>
351
+ )}
352
+ </Segment>
353
+ </>
354
+ )}
355
+ />
356
+ <Route
357
+ exact
358
+ path={RULE_IMPLEMENTATION_RESULTS}
359
+ render={() => (
360
+ <>
361
+ <RuleCrumbs />
362
+ <Segment>
363
+ {ruleLoaded && ruleImplementationLoaded && (
364
+ <RuleImplementation>
365
+ <RuleImplementationResults ruleResult={latest} />
366
+ </RuleImplementation>
367
+ )}
368
+ </Segment>
369
+ </>
370
+ )}
371
+ />
372
+
373
+ <Route
374
+ exact
375
+ path={RULE_IMPLEMENTATION_RESULTS_DETAILS}
376
+ render={() => (
377
+ <>
378
+ <RuleCrumbs />
379
+ <Segment>
380
+ {ruleLoaded && ruleImplementationLoaded && (
381
+ <RuleImplementation>
382
+ <ExecutionDetails ruleResultId={latest.id} />
383
+ </RuleImplementation>
384
+ )}
385
+ </Segment>
386
+ </>
387
+ )}
388
+ />
389
+
390
+ <Route
391
+ exact
392
+ path={RULE_IMPLEMENTATION_RESULT_DETAILS}
393
+ render={() => (
394
+ <>
395
+ <Segment>
352
396
  <>
353
397
  <RuleCrumbs />
354
- <Segment>
355
- <RuleImplementationLoader />
356
- {ruleLoaded && ruleImplementationLoaded && (
357
- <RuleImplementation>
358
- <ExecutionDetails ruleResultId={latest.id} />
359
- </RuleImplementation>
360
- )}
361
- </Segment>
362
- </>
363
- )}
364
- />
365
- <Route
366
- exact
367
- path={RULE_IMPLEMENTATION_RESULT_DETAILS}
368
- render={() => (
369
- <>
370
- <Segment>
371
- <RuleImplementationLoader />
372
- {ruleLoaded && ruleImplementationLoaded && (
373
- <>
374
- <RuleCrumbs />
375
- <ExecutionDetails />
376
- </>
377
- )}
378
- </Segment>
398
+ <ExecutionDetails />
379
399
  </>
380
- )}
381
- />
382
- </Switch>
383
- </>
384
- )}
385
- />
386
- </Switch>
400
+ </Segment>
401
+ </>
402
+ )}
403
+ />
404
+ </>
405
+ )}
406
+ />
387
407
  </>
388
408
  );
389
409
  };
390
410
 
391
- RuleRoutes.propTypes = {
392
- rule: PropTypes.object,
393
- implementationStructures: PropTypes.array,
411
+ const implementationPropTypes = {
394
412
  ruleLoaded: PropTypes.bool,
395
- template: PropTypes.object,
396
- ruleImplementation: PropTypes.object,
397
413
  ruleImplementationLoaded: PropTypes.bool,
414
+ implementationStructures: PropTypes.array,
398
415
  implementationStructuresLoaded: PropTypes.bool,
416
+ structuresAliasesLoading: PropTypes.bool,
417
+ ruleImplementation: PropTypes.object,
418
+ };
419
+
420
+ ImplementationRoutes.propTypes = implementationPropTypes;
421
+
422
+ RuleRoutes.propTypes = {
423
+ rule: PropTypes.object,
424
+ template: PropTypes.object,
399
425
  systemsLoading: PropTypes.bool,
400
426
  templatesLoaded: PropTypes.bool,
401
- structuresAliasesLoading: PropTypes.bool,
427
+ ...implementationPropTypes,
402
428
  };
403
429
 
404
- const mapStateToProps = (state) => ({
405
- rule: state.rule,
406
- ruleLoaded: !_.isEmpty(state.rule),
407
- ruleImplementationLoaded:
408
- !state.ruleImplementationLoading && !_.isEmpty(state.ruleImplementation),
409
- implementationStructures: getImplementationStructures(state),
410
- implementationStructuresLoaded: getImplementationStructuresLoaded(state),
411
- systemsLoading: state.systemsLoading,
412
- templatesLoaded: !state.templatesLoading && !_.isEmpty(state.templates),
413
- template: _.find(_.propEq("name", state.rule.df_name))(state.templates),
414
- structuresAliasesLoading: state.structuresAliasesLoading,
415
- ruleImplementation: state.ruleImplementation,
416
- });
430
+ const mapStateToProps = (state) => {
431
+ return {
432
+ rule: state.rule,
433
+ ruleLoaded: !_.isEmpty(state.rule),
434
+ ruleImplementationLoaded:
435
+ !state.ruleImplementationLoading && !_.isEmpty(state.ruleImplementation),
436
+ implementationStructures: getImplementationStructures(state),
437
+ implementationStructuresLoaded: getImplementationStructuresLoaded(state),
438
+ systemsLoading: state.systemsLoading,
439
+ templatesLoaded: !state.templatesLoading && !_.isEmpty(state.templates),
440
+ template: _.find(_.propEq("name", state.rule.df_name))(state.templates),
441
+ structuresAliasesLoading: state.structuresAliasesLoading,
442
+ ruleImplementation: state.ruleImplementation,
443
+ };
444
+ };
417
445
 
418
446
  export default connect(mapStateToProps)(RuleRoutes);