@truedat/audit 8.2.2 → 8.2.3
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 +3 -3
- package/src/components/SubscriptionForm.js +60 -5
- package/src/components/Subscriptions.js +1 -0
- package/src/components/__tests__/__snapshots__/SubscriptionEdit.spec.js.snap +19 -0
- package/src/components/__tests__/__snapshots__/SubscriptionForm.spec.js.snap +19 -0
- package/src/components/__tests__/__snapshots__/SubscriptionNew.spec.js.snap +19 -0
- package/src/components/__tests__/__snapshots__/SubscriptionRoutes.spec.js.snap +37 -0
- package/src/components/__tests__/__snapshots__/Subscriptions.spec.js.snap +18 -0
- package/src/subscriptionConstants.js +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/audit",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.3",
|
|
4
4
|
"description": "Truedat Web Audit Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "8.2.
|
|
51
|
+
"@truedat/test": "8.2.3",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
81
81
|
"swr": "^2.3.3"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "8e3f74fa7c3c0e071d3c46d161dde80454c26a15"
|
|
84
84
|
}
|
|
@@ -36,6 +36,10 @@ const SourceSelector = lazy(
|
|
|
36
36
|
() => import("@truedat/cx/sources/components/SourceSelector")
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
+
const QualityControlSelector = lazy(
|
|
40
|
+
() => import("@truedat/qx/components/qualityControls/QualityControlSelector")
|
|
41
|
+
);
|
|
42
|
+
|
|
39
43
|
const SUBSCRIBER_TYPES = ["role", "taxonomy_role", "email", "user"];
|
|
40
44
|
const PERIODICITIES = ["daily", "minutely", "hourly"];
|
|
41
45
|
const RESOURCE_TYPES = [
|
|
@@ -45,6 +49,7 @@ const RESOURCE_TYPES = [
|
|
|
45
49
|
"data_structure",
|
|
46
50
|
"source",
|
|
47
51
|
"rule",
|
|
52
|
+
"quality_control",
|
|
48
53
|
];
|
|
49
54
|
const DEFAULT_VALUES = {
|
|
50
55
|
periodicity: null,
|
|
@@ -80,7 +85,11 @@ const withoutFilters = ({ filtersEnabled, ...data }) =>
|
|
|
80
85
|
: _.set("scope.filters", null)(data);
|
|
81
86
|
const withResourceName = (resource) => (data) =>
|
|
82
87
|
resource &&
|
|
83
|
-
_.includes(data?.scope?.resource_type)([
|
|
88
|
+
_.includes(data?.scope?.resource_type)([
|
|
89
|
+
"data_structure",
|
|
90
|
+
"source",
|
|
91
|
+
"quality_control",
|
|
92
|
+
])
|
|
84
93
|
? {
|
|
85
94
|
...data,
|
|
86
95
|
scope: {
|
|
@@ -90,6 +99,7 @@ const withResourceName = (resource) => (data) =>
|
|
|
90
99
|
},
|
|
91
100
|
}
|
|
92
101
|
: data;
|
|
102
|
+
|
|
93
103
|
const doPayload = (data, resource) =>
|
|
94
104
|
_.flow(withoutFilters, withResourceName(resource))(data);
|
|
95
105
|
|
|
@@ -112,9 +122,25 @@ export const SubscriptionForm = ({
|
|
|
112
122
|
});
|
|
113
123
|
const { isDirty, errors } = formState;
|
|
114
124
|
|
|
115
|
-
const [
|
|
125
|
+
const [
|
|
126
|
+
subscriberType,
|
|
127
|
+
resourceType,
|
|
128
|
+
events,
|
|
129
|
+
subscriberIdentifier,
|
|
130
|
+
resourceId,
|
|
131
|
+
periodicity,
|
|
132
|
+
scopeStatus,
|
|
133
|
+
] = useWatch({
|
|
116
134
|
control,
|
|
117
|
-
name: [
|
|
135
|
+
name: [
|
|
136
|
+
"subscriber.type",
|
|
137
|
+
"scope.resource_type",
|
|
138
|
+
"scope.events",
|
|
139
|
+
"subscriber.identifier",
|
|
140
|
+
"scope.resource_id",
|
|
141
|
+
"periodicity",
|
|
142
|
+
"scope.status",
|
|
143
|
+
],
|
|
118
144
|
});
|
|
119
145
|
|
|
120
146
|
const isEditForm = !!subscription?.id;
|
|
@@ -123,6 +149,8 @@ export const SubscriptionForm = ({
|
|
|
123
149
|
|
|
124
150
|
useEffect(() => {
|
|
125
151
|
const exclusiveEvents = [
|
|
152
|
+
"score_status_updated",
|
|
153
|
+
"quality_control_version_status_updated",
|
|
126
154
|
"rule_result_created",
|
|
127
155
|
"implementation_status_updated",
|
|
128
156
|
"grant_request_group_creation",
|
|
@@ -147,6 +175,17 @@ export const SubscriptionForm = ({
|
|
|
147
175
|
_.flatten
|
|
148
176
|
)(STATUSES_BY_EVENT);
|
|
149
177
|
|
|
178
|
+
const isFormFilled =
|
|
179
|
+
!!resourceType &&
|
|
180
|
+
notEmpty(subscriberIdentifier) &&
|
|
181
|
+
(isEditForm || !!resourceId) &&
|
|
182
|
+
!!periodicity &&
|
|
183
|
+
notEmpty(events) &&
|
|
184
|
+
(_.isEmpty(statuses) || notEmpty(scopeStatus));
|
|
185
|
+
|
|
186
|
+
const disabled =
|
|
187
|
+
isLoading || notEmpty(errors) || (isEditForm ? !isDirty : !isFormFilled);
|
|
188
|
+
|
|
150
189
|
const doHandleSubmit = handleSubmit((data) => {
|
|
151
190
|
const payload = doPayload(data, resource);
|
|
152
191
|
onSubmit(payload);
|
|
@@ -173,8 +212,6 @@ export const SubscriptionForm = ({
|
|
|
173
212
|
onChange(value);
|
|
174
213
|
};
|
|
175
214
|
|
|
176
|
-
const disabled = isLoading || !isDirty || notEmpty(errors);
|
|
177
|
-
|
|
178
215
|
return (
|
|
179
216
|
<Form onSubmit={doHandleSubmit}>
|
|
180
217
|
<Controller
|
|
@@ -385,6 +422,24 @@ export const SubscriptionForm = ({
|
|
|
385
422
|
)}
|
|
386
423
|
/>
|
|
387
424
|
)}
|
|
425
|
+
{resourceType === "quality_control" && !isEditForm && (
|
|
426
|
+
<Controller
|
|
427
|
+
control={control}
|
|
428
|
+
name="scope.resource_id"
|
|
429
|
+
rules={{ required: true }}
|
|
430
|
+
render={({ field: { onChange } }) => (
|
|
431
|
+
<QualityControlSelector
|
|
432
|
+
disabled={isEditForm}
|
|
433
|
+
defaultFilters={{ latest: [true] }}
|
|
434
|
+
pageSize={7}
|
|
435
|
+
onSelect={({ quality_control_id, name }) => {
|
|
436
|
+
onChange(quality_control_id);
|
|
437
|
+
setResource({ id: quality_control_id, name });
|
|
438
|
+
}}
|
|
439
|
+
/>
|
|
440
|
+
)}
|
|
441
|
+
/>
|
|
442
|
+
)}
|
|
388
443
|
<Controller
|
|
389
444
|
control={control}
|
|
390
445
|
name="periodicity"
|
|
@@ -299,6 +299,25 @@ exports[`<SubscriptionEdit /> matches the latest snapshot 1`] = `
|
|
|
299
299
|
rule
|
|
300
300
|
</label>
|
|
301
301
|
</div>
|
|
302
|
+
<div
|
|
303
|
+
class="ui radio checkbox"
|
|
304
|
+
>
|
|
305
|
+
<input
|
|
306
|
+
class="hidden"
|
|
307
|
+
readonly=""
|
|
308
|
+
role="radio"
|
|
309
|
+
tabindex="0"
|
|
310
|
+
type="radio"
|
|
311
|
+
value="quality_control"
|
|
312
|
+
/>
|
|
313
|
+
<label>
|
|
314
|
+
<i
|
|
315
|
+
aria-hidden="true"
|
|
316
|
+
class="archive icon"
|
|
317
|
+
/>
|
|
318
|
+
quality_control
|
|
319
|
+
</label>
|
|
320
|
+
</div>
|
|
302
321
|
</div>
|
|
303
322
|
<div
|
|
304
323
|
class="required field"
|
|
@@ -274,6 +274,25 @@ exports[`<SubscriptionForm /> matches the latest snapshot 1`] = `
|
|
|
274
274
|
rule
|
|
275
275
|
</label>
|
|
276
276
|
</div>
|
|
277
|
+
<div
|
|
278
|
+
class="ui radio checkbox"
|
|
279
|
+
>
|
|
280
|
+
<input
|
|
281
|
+
class="hidden"
|
|
282
|
+
readonly=""
|
|
283
|
+
role="radio"
|
|
284
|
+
tabindex="0"
|
|
285
|
+
type="radio"
|
|
286
|
+
value="quality_control"
|
|
287
|
+
/>
|
|
288
|
+
<label>
|
|
289
|
+
<i
|
|
290
|
+
aria-hidden="true"
|
|
291
|
+
class="archive icon"
|
|
292
|
+
/>
|
|
293
|
+
quality_control
|
|
294
|
+
</label>
|
|
295
|
+
</div>
|
|
277
296
|
</div>
|
|
278
297
|
<div
|
|
279
298
|
class="required field"
|
|
@@ -289,6 +289,25 @@ exports[`<SubscriptionNew /> matches the latest snapshot 1`] = `
|
|
|
289
289
|
rule
|
|
290
290
|
</label>
|
|
291
291
|
</div>
|
|
292
|
+
<div
|
|
293
|
+
class="ui radio checkbox"
|
|
294
|
+
>
|
|
295
|
+
<input
|
|
296
|
+
class="hidden"
|
|
297
|
+
readonly=""
|
|
298
|
+
role="radio"
|
|
299
|
+
tabindex="0"
|
|
300
|
+
type="radio"
|
|
301
|
+
value="quality_control"
|
|
302
|
+
/>
|
|
303
|
+
<label>
|
|
304
|
+
<i
|
|
305
|
+
aria-hidden="true"
|
|
306
|
+
class="archive icon"
|
|
307
|
+
/>
|
|
308
|
+
quality_control
|
|
309
|
+
</label>
|
|
310
|
+
</div>
|
|
292
311
|
</div>
|
|
293
312
|
<div
|
|
294
313
|
class="required field"
|
|
@@ -293,6 +293,25 @@ exports[`<SubscriptionRoutes /> matches the latest snapshot for route SUBSCRIPTI
|
|
|
293
293
|
rule
|
|
294
294
|
</label>
|
|
295
295
|
</div>
|
|
296
|
+
<div
|
|
297
|
+
class="ui radio checkbox"
|
|
298
|
+
>
|
|
299
|
+
<input
|
|
300
|
+
class="hidden"
|
|
301
|
+
readonly=""
|
|
302
|
+
role="radio"
|
|
303
|
+
tabindex="0"
|
|
304
|
+
type="radio"
|
|
305
|
+
value="quality_control"
|
|
306
|
+
/>
|
|
307
|
+
<label>
|
|
308
|
+
<i
|
|
309
|
+
aria-hidden="true"
|
|
310
|
+
class="archive icon"
|
|
311
|
+
/>
|
|
312
|
+
quality_control
|
|
313
|
+
</label>
|
|
314
|
+
</div>
|
|
296
315
|
</div>
|
|
297
316
|
<div
|
|
298
317
|
class="required field"
|
|
@@ -671,6 +690,24 @@ exports[`<SubscriptionRoutes /> matches the latest snapshot for route SUBSCRIPTI
|
|
|
671
690
|
source
|
|
672
691
|
</label>
|
|
673
692
|
</div>
|
|
693
|
+
<div
|
|
694
|
+
class="ui checked checkbox"
|
|
695
|
+
>
|
|
696
|
+
<input
|
|
697
|
+
checked=""
|
|
698
|
+
class="hidden"
|
|
699
|
+
readonly=""
|
|
700
|
+
tabindex="0"
|
|
701
|
+
type="checkbox"
|
|
702
|
+
/>
|
|
703
|
+
<label>
|
|
704
|
+
<i
|
|
705
|
+
aria-hidden="true"
|
|
706
|
+
class="archive icon"
|
|
707
|
+
/>
|
|
708
|
+
quality_control
|
|
709
|
+
</label>
|
|
710
|
+
</div>
|
|
674
711
|
</div>
|
|
675
712
|
</form>
|
|
676
713
|
<div
|
|
@@ -250,6 +250,24 @@ exports[`<Subscriptions /> matches the latest snapshot 1`] = `
|
|
|
250
250
|
source
|
|
251
251
|
</label>
|
|
252
252
|
</div>
|
|
253
|
+
<div
|
|
254
|
+
class="ui checked checkbox"
|
|
255
|
+
>
|
|
256
|
+
<input
|
|
257
|
+
checked=""
|
|
258
|
+
class="hidden"
|
|
259
|
+
readonly=""
|
|
260
|
+
tabindex="0"
|
|
261
|
+
type="checkbox"
|
|
262
|
+
/>
|
|
263
|
+
<label>
|
|
264
|
+
<i
|
|
265
|
+
aria-hidden="true"
|
|
266
|
+
class="archive icon"
|
|
267
|
+
/>
|
|
268
|
+
quality_control
|
|
269
|
+
</label>
|
|
270
|
+
</div>
|
|
253
271
|
</div>
|
|
254
272
|
</form>
|
|
255
273
|
<div
|
|
@@ -17,6 +17,7 @@ export const RESOURCE_TYPE_ICONS = {
|
|
|
17
17
|
implementation: "tags",
|
|
18
18
|
data_structure: "block layout",
|
|
19
19
|
source: "plug",
|
|
20
|
+
quality_control: "archive",
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export const CONCEPT_EVENTS = [
|
|
@@ -61,6 +62,13 @@ export const IMPLEMENTATION_EVENTS = [
|
|
|
61
62
|
|
|
62
63
|
export const SOURCE_EVENTS = ["status_changed"];
|
|
63
64
|
|
|
65
|
+
export const QUALITY_CONTROL_EVENTS = [
|
|
66
|
+
"score_status_updated",
|
|
67
|
+
"quality_control_version_status_updated",
|
|
68
|
+
"quality_control_version_draft_created",
|
|
69
|
+
"quality_control_version_deleted",
|
|
70
|
+
];
|
|
71
|
+
|
|
64
72
|
export const DOMAIN_EVENTS = [
|
|
65
73
|
...CONCEPT_EVENTS,
|
|
66
74
|
...RULE_EVENTS,
|
|
@@ -77,6 +85,8 @@ export const DOMAIN_EVENTS = [
|
|
|
77
85
|
"grant_request_status_cancellation",
|
|
78
86
|
"grant_request_status_failure",
|
|
79
87
|
"ingest_sent_for_approval",
|
|
88
|
+
"quality_control_created",
|
|
89
|
+
...QUALITY_CONTROL_EVENTS,
|
|
80
90
|
];
|
|
81
91
|
|
|
82
92
|
export const EVENTS_BY_TYPE = {
|
|
@@ -87,6 +97,7 @@ export const EVENTS_BY_TYPE = {
|
|
|
87
97
|
rule: RULE_EVENTS,
|
|
88
98
|
implementation: IMPLEMENTATION_EVENTS,
|
|
89
99
|
source: SOURCE_EVENTS,
|
|
100
|
+
quality_control: QUALITY_CONTROL_EVENTS,
|
|
90
101
|
};
|
|
91
102
|
|
|
92
103
|
export const STATUSES_BY_EVENT = {
|
|
@@ -113,6 +124,21 @@ export const STATUSES_BY_EVENT = {
|
|
|
113
124
|
{ name: "versioned" },
|
|
114
125
|
{ name: "deprecated" },
|
|
115
126
|
],
|
|
127
|
+
quality_control_version_status_updated: [
|
|
128
|
+
{ name: "deprecated" },
|
|
129
|
+
{ name: "draft" },
|
|
130
|
+
{ name: "pending_approval" },
|
|
131
|
+
{ name: "published" },
|
|
132
|
+
{ name: "rejected" },
|
|
133
|
+
{ name: "versioned" },
|
|
134
|
+
],
|
|
135
|
+
score_status_updated: [
|
|
136
|
+
{ name: "no_results", color: "grey" },
|
|
137
|
+
{ name: "meets_goal", color: "green" },
|
|
138
|
+
{ name: "under_goal", color: "yellow" },
|
|
139
|
+
{ name: "under_threshold", color: "yellow" },
|
|
140
|
+
{ name: "failed", color: "red" },
|
|
141
|
+
],
|
|
116
142
|
};
|
|
117
143
|
|
|
118
144
|
export const isSubset = (first, second) =>
|