@truedat/audit 8.2.3 → 8.2.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/audit",
3
- "version": "8.2.3",
3
+ "version": "8.2.4",
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.3",
51
+ "@truedat/test": "8.2.4",
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": "8e3f74fa7c3c0e071d3c46d161dde80454c26a15"
83
+ "gitHead": "b98f63284093c90c57faa1794b6ccc1fcf761d89"
84
84
  }
@@ -9,6 +9,8 @@ import {
9
9
  CONCEPT_EVENTS,
10
10
  DEFAULT_ICON,
11
11
  EVENTS_BY_TYPE,
12
+ isQualityControlSubscriptionsEnabled,
13
+ RESOURCE_TYPES,
12
14
  RESOURCE_TYPE_ICONS,
13
15
  STATUSES_BY_EVENT,
14
16
  SUBSCRIBER_TYPE_ICONS,
@@ -42,15 +44,6 @@ const QualityControlSelector = lazy(
42
44
 
43
45
  const SUBSCRIBER_TYPES = ["role", "taxonomy_role", "email", "user"];
44
46
  const PERIODICITIES = ["daily", "minutely", "hourly"];
45
- const RESOURCE_TYPES = [
46
- "domain",
47
- "domains",
48
- "concept",
49
- "data_structure",
50
- "source",
51
- "rule",
52
- "quality_control",
53
- ];
54
47
  const DEFAULT_VALUES = {
55
48
  periodicity: null,
56
49
  subscriber: {
@@ -422,24 +415,26 @@ export const SubscriptionForm = ({
422
415
  )}
423
416
  />
424
417
  )}
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
- )}
418
+ {resourceType === "quality_control" &&
419
+ isQualityControlSubscriptionsEnabled() &&
420
+ !isEditForm && (
421
+ <Controller
422
+ control={control}
423
+ name="scope.resource_id"
424
+ rules={{ required: true }}
425
+ render={({ field: { onChange } }) => (
426
+ <QualityControlSelector
427
+ disabled={isEditForm}
428
+ defaultFilters={{ latest: [true] }}
429
+ pageSize={7}
430
+ onSelect={({ quality_control_id, name }) => {
431
+ onChange(quality_control_id);
432
+ setResource({ id: quality_control_id, name });
433
+ }}
434
+ />
435
+ )}
436
+ />
437
+ )}
443
438
  <Controller
444
439
  control={control}
445
440
  name="periodicity"
@@ -18,21 +18,12 @@ import {
18
18
  } from "semantic-ui-react";
19
19
  import {
20
20
  DEFAULT_ICON,
21
+ RESOURCE_TYPES,
21
22
  RESOURCE_TYPE_ICONS,
22
23
  SUBSCRIBER_TYPE_ICONS,
23
24
  } from "../subscriptionConstants";
24
25
 
25
26
  const SUBSCRIBER_TYPES = ["role", "email", "user", "taxonomy_role"];
26
- const RESOURCE_TYPES = [
27
- "data_structure",
28
- "domain",
29
- "domains",
30
- "concept",
31
- "rule",
32
- "implementation",
33
- "source",
34
- "quality_control",
35
- ];
36
27
 
37
28
  export const SubscriptionsHeader = () => {
38
29
  const { formatMessage } = useIntl();
@@ -184,6 +184,25 @@ exports[`<SubscriptionEdit /> matches the latest snapshot 1`] = `
184
184
  <label>
185
185
  subscriptions.resource
186
186
  </label>
187
+ <div
188
+ class="ui radio checkbox"
189
+ >
190
+ <input
191
+ class="hidden"
192
+ readonly=""
193
+ role="radio"
194
+ tabindex="0"
195
+ type="radio"
196
+ value="data_structure"
197
+ />
198
+ <label>
199
+ <i
200
+ aria-hidden="true"
201
+ class="block layout icon"
202
+ />
203
+ data_structure
204
+ </label>
205
+ </div>
187
206
  <div
188
207
  class="ui radio checkbox"
189
208
  >
@@ -242,22 +261,23 @@ exports[`<SubscriptionEdit /> matches the latest snapshot 1`] = `
242
261
  </label>
243
262
  </div>
244
263
  <div
245
- class="ui radio checkbox"
264
+ class="ui disabled radio checkbox"
246
265
  >
247
266
  <input
248
267
  class="hidden"
268
+ disabled=""
249
269
  readonly=""
250
270
  role="radio"
251
- tabindex="0"
271
+ tabindex="-1"
252
272
  type="radio"
253
- value="data_structure"
273
+ value="rule"
254
274
  />
255
275
  <label>
256
276
  <i
257
277
  aria-hidden="true"
258
- class="block layout icon"
278
+ class="clipboard check icon"
259
279
  />
260
- data_structure
280
+ rule
261
281
  </label>
262
282
  </div>
263
283
  <div
@@ -269,34 +289,33 @@ exports[`<SubscriptionEdit /> matches the latest snapshot 1`] = `
269
289
  role="radio"
270
290
  tabindex="0"
271
291
  type="radio"
272
- value="source"
292
+ value="implementation"
273
293
  />
274
294
  <label>
275
295
  <i
276
296
  aria-hidden="true"
277
- class="plug icon"
297
+ class="tags icon"
278
298
  />
279
- source
299
+ implementation
280
300
  </label>
281
301
  </div>
282
302
  <div
283
- class="ui disabled radio checkbox"
303
+ class="ui radio checkbox"
284
304
  >
285
305
  <input
286
306
  class="hidden"
287
- disabled=""
288
307
  readonly=""
289
308
  role="radio"
290
- tabindex="-1"
309
+ tabindex="0"
291
310
  type="radio"
292
- value="rule"
311
+ value="source"
293
312
  />
294
313
  <label>
295
314
  <i
296
315
  aria-hidden="true"
297
- class="clipboard check icon"
316
+ class="plug icon"
298
317
  />
299
- rule
318
+ source
300
319
  </label>
301
320
  </div>
302
321
  <div
@@ -158,6 +158,25 @@ exports[`<SubscriptionForm /> matches the latest snapshot 1`] = `
158
158
  <label>
159
159
  subscriptions.resource
160
160
  </label>
161
+ <div
162
+ class="ui radio checkbox"
163
+ >
164
+ <input
165
+ class="hidden"
166
+ readonly=""
167
+ role="radio"
168
+ tabindex="0"
169
+ type="radio"
170
+ value="data_structure"
171
+ />
172
+ <label>
173
+ <i
174
+ aria-hidden="true"
175
+ class="block layout icon"
176
+ />
177
+ data_structure
178
+ </label>
179
+ </div>
161
180
  <div
162
181
  class="ui radio checkbox"
163
182
  >
@@ -216,42 +235,42 @@ exports[`<SubscriptionForm /> matches the latest snapshot 1`] = `
216
235
  </label>
217
236
  </div>
218
237
  <div
219
- class="ui radio checkbox"
238
+ class="ui disabled radio checkbox"
220
239
  >
221
240
  <input
222
241
  class="hidden"
242
+ disabled=""
223
243
  readonly=""
224
244
  role="radio"
225
- tabindex="0"
245
+ tabindex="-1"
226
246
  type="radio"
227
- value="data_structure"
247
+ value="rule"
228
248
  />
229
249
  <label>
230
250
  <i
231
251
  aria-hidden="true"
232
- class="block layout icon"
252
+ class="clipboard check icon"
233
253
  />
234
- data_structure
254
+ rule
235
255
  </label>
236
256
  </div>
237
257
  <div
238
- class="ui disabled radio checkbox"
258
+ class="ui radio checkbox"
239
259
  >
240
260
  <input
241
261
  class="hidden"
242
- disabled=""
243
262
  readonly=""
244
263
  role="radio"
245
- tabindex="-1"
264
+ tabindex="0"
246
265
  type="radio"
247
- value="source"
266
+ value="implementation"
248
267
  />
249
268
  <label>
250
269
  <i
251
270
  aria-hidden="true"
252
- class="plug icon"
271
+ class="tags icon"
253
272
  />
254
- source
273
+ implementation
255
274
  </label>
256
275
  </div>
257
276
  <div
@@ -264,14 +283,14 @@ exports[`<SubscriptionForm /> matches the latest snapshot 1`] = `
264
283
  role="radio"
265
284
  tabindex="-1"
266
285
  type="radio"
267
- value="rule"
286
+ value="source"
268
287
  />
269
288
  <label>
270
289
  <i
271
290
  aria-hidden="true"
272
- class="clipboard check icon"
291
+ class="plug icon"
273
292
  />
274
- rule
293
+ source
275
294
  </label>
276
295
  </div>
277
296
  <div
@@ -173,6 +173,25 @@ exports[`<SubscriptionNew /> matches the latest snapshot 1`] = `
173
173
  <label>
174
174
  subscriptions.resource
175
175
  </label>
176
+ <div
177
+ class="ui radio checkbox"
178
+ >
179
+ <input
180
+ class="hidden"
181
+ readonly=""
182
+ role="radio"
183
+ tabindex="0"
184
+ type="radio"
185
+ value="data_structure"
186
+ />
187
+ <label>
188
+ <i
189
+ aria-hidden="true"
190
+ class="block layout icon"
191
+ />
192
+ data_structure
193
+ </label>
194
+ </div>
176
195
  <div
177
196
  class="ui radio checkbox"
178
197
  >
@@ -231,42 +250,42 @@ exports[`<SubscriptionNew /> matches the latest snapshot 1`] = `
231
250
  </label>
232
251
  </div>
233
252
  <div
234
- class="ui radio checkbox"
253
+ class="ui disabled radio checkbox"
235
254
  >
236
255
  <input
237
256
  class="hidden"
257
+ disabled=""
238
258
  readonly=""
239
259
  role="radio"
240
- tabindex="0"
260
+ tabindex="-1"
241
261
  type="radio"
242
- value="data_structure"
262
+ value="rule"
243
263
  />
244
264
  <label>
245
265
  <i
246
266
  aria-hidden="true"
247
- class="block layout icon"
267
+ class="clipboard check icon"
248
268
  />
249
- data_structure
269
+ rule
250
270
  </label>
251
271
  </div>
252
272
  <div
253
- class="ui disabled radio checkbox"
273
+ class="ui radio checkbox"
254
274
  >
255
275
  <input
256
276
  class="hidden"
257
- disabled=""
258
277
  readonly=""
259
278
  role="radio"
260
- tabindex="-1"
279
+ tabindex="0"
261
280
  type="radio"
262
- value="source"
281
+ value="implementation"
263
282
  />
264
283
  <label>
265
284
  <i
266
285
  aria-hidden="true"
267
- class="plug icon"
286
+ class="tags icon"
268
287
  />
269
- source
288
+ implementation
270
289
  </label>
271
290
  </div>
272
291
  <div
@@ -279,14 +298,14 @@ exports[`<SubscriptionNew /> matches the latest snapshot 1`] = `
279
298
  role="radio"
280
299
  tabindex="-1"
281
300
  type="radio"
282
- value="rule"
301
+ value="source"
283
302
  />
284
303
  <label>
285
304
  <i
286
305
  aria-hidden="true"
287
- class="clipboard check icon"
306
+ class="plug icon"
288
307
  />
289
- rule
308
+ source
290
309
  </label>
291
310
  </div>
292
311
  <div
@@ -177,6 +177,25 @@ exports[`<SubscriptionRoutes /> matches the latest snapshot for route SUBSCRIPTI
177
177
  <label>
178
178
  subscriptions.resource
179
179
  </label>
180
+ <div
181
+ class="ui radio checkbox"
182
+ >
183
+ <input
184
+ class="hidden"
185
+ readonly=""
186
+ role="radio"
187
+ tabindex="0"
188
+ type="radio"
189
+ value="data_structure"
190
+ />
191
+ <label>
192
+ <i
193
+ aria-hidden="true"
194
+ class="block layout icon"
195
+ />
196
+ data_structure
197
+ </label>
198
+ </div>
180
199
  <div
181
200
  class="ui radio checkbox"
182
201
  >
@@ -235,42 +254,42 @@ exports[`<SubscriptionRoutes /> matches the latest snapshot for route SUBSCRIPTI
235
254
  </label>
236
255
  </div>
237
256
  <div
238
- class="ui radio checkbox"
257
+ class="ui disabled radio checkbox"
239
258
  >
240
259
  <input
241
260
  class="hidden"
261
+ disabled=""
242
262
  readonly=""
243
263
  role="radio"
244
- tabindex="0"
264
+ tabindex="-1"
245
265
  type="radio"
246
- value="data_structure"
266
+ value="rule"
247
267
  />
248
268
  <label>
249
269
  <i
250
270
  aria-hidden="true"
251
- class="block layout icon"
271
+ class="clipboard check icon"
252
272
  />
253
- data_structure
273
+ rule
254
274
  </label>
255
275
  </div>
256
276
  <div
257
- class="ui disabled radio checkbox"
277
+ class="ui radio checkbox"
258
278
  >
259
279
  <input
260
280
  class="hidden"
261
- disabled=""
262
281
  readonly=""
263
282
  role="radio"
264
- tabindex="-1"
283
+ tabindex="0"
265
284
  type="radio"
266
- value="source"
285
+ value="implementation"
267
286
  />
268
287
  <label>
269
288
  <i
270
289
  aria-hidden="true"
271
- class="plug icon"
290
+ class="tags icon"
272
291
  />
273
- source
292
+ implementation
274
293
  </label>
275
294
  </div>
276
295
  <div
@@ -283,14 +302,14 @@ exports[`<SubscriptionRoutes /> matches the latest snapshot for route SUBSCRIPTI
283
302
  role="radio"
284
303
  tabindex="-1"
285
304
  type="radio"
286
- value="rule"
305
+ value="source"
287
306
  />
288
307
  <label>
289
308
  <i
290
309
  aria-hidden="true"
291
- class="clipboard check icon"
310
+ class="plug icon"
292
311
  />
293
- rule
312
+ source
294
313
  </label>
295
314
  </div>
296
315
  <div
@@ -1,5 +1,11 @@
1
1
  import _ from "lodash/fp";
2
2
 
3
+ const HIDE_QUALITY_CONTROL_SUBSCRIPTIONS =
4
+ process.env.REACT_APP_HIDE_QUALITY_CONTROLS === "true";
5
+
6
+ export const isQualityControlSubscriptionsEnabled = () =>
7
+ !HIDE_QUALITY_CONTROL_SUBSCRIPTIONS;
8
+
3
9
  export const SUBSCRIBER_TYPE_ICONS = {
4
10
  user: "user",
5
11
  email: "envelope",
@@ -67,9 +73,10 @@ export const QUALITY_CONTROL_EVENTS = [
67
73
  "quality_control_version_status_updated",
68
74
  "quality_control_version_draft_created",
69
75
  "quality_control_version_deleted",
76
+ "quality_control_created",
70
77
  ];
71
78
 
72
- export const DOMAIN_EVENTS = [
79
+ const DOMAIN_EVENTS_WITHOUT_QC = [
73
80
  ...CONCEPT_EVENTS,
74
81
  ...RULE_EVENTS,
75
82
  ...IMPLEMENTATION_EVENTS,
@@ -85,11 +92,13 @@ export const DOMAIN_EVENTS = [
85
92
  "grant_request_status_cancellation",
86
93
  "grant_request_status_failure",
87
94
  "ingest_sent_for_approval",
88
- "quality_control_created",
89
- ...QUALITY_CONTROL_EVENTS,
90
95
  ];
91
96
 
92
- export const EVENTS_BY_TYPE = {
97
+ export const DOMAIN_EVENTS = HIDE_QUALITY_CONTROL_SUBSCRIPTIONS
98
+ ? DOMAIN_EVENTS_WITHOUT_QC
99
+ : [...DOMAIN_EVENTS_WITHOUT_QC, ...QUALITY_CONTROL_EVENTS];
100
+
101
+ const EVENTS_BY_TYPE_BASE = {
93
102
  concept: CONCEPT_EVENTS,
94
103
  data_structure: STRUCTURE_EVENTS,
95
104
  domains: DOMAIN_EVENTS,
@@ -97,7 +106,28 @@ export const EVENTS_BY_TYPE = {
97
106
  rule: RULE_EVENTS,
98
107
  implementation: IMPLEMENTATION_EVENTS,
99
108
  source: SOURCE_EVENTS,
100
- quality_control: QUALITY_CONTROL_EVENTS,
109
+ };
110
+
111
+ export const EVENTS_BY_TYPE = HIDE_QUALITY_CONTROL_SUBSCRIPTIONS
112
+ ? EVENTS_BY_TYPE_BASE
113
+ : { ...EVENTS_BY_TYPE_BASE, quality_control: QUALITY_CONTROL_EVENTS };
114
+
115
+ const STATUSES_BY_EVENT_QC = {
116
+ quality_control_version_status_updated: [
117
+ { name: "deprecated" },
118
+ { name: "draft" },
119
+ { name: "pending_approval" },
120
+ { name: "published" },
121
+ { name: "rejected" },
122
+ { name: "versioned" },
123
+ ],
124
+ score_status_updated: [
125
+ { name: "no_results", color: "grey" },
126
+ { name: "meets_goal", color: "green" },
127
+ { name: "under_goal", color: "yellow" },
128
+ { name: "under_threshold", color: "yellow" },
129
+ { name: "failed", color: "red" },
130
+ ],
101
131
  };
102
132
 
103
133
  export const STATUSES_BY_EVENT = {
@@ -124,22 +154,22 @@ export const STATUSES_BY_EVENT = {
124
154
  { name: "versioned" },
125
155
  { name: "deprecated" },
126
156
  ],
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
- ],
157
+ ...(HIDE_QUALITY_CONTROL_SUBSCRIPTIONS ? {} : STATUSES_BY_EVENT_QC),
142
158
  };
143
159
 
160
+ const BASE_RESOURCE_TYPES = [
161
+ "data_structure",
162
+ "domain",
163
+ "domains",
164
+ "concept",
165
+ "rule",
166
+ "implementation",
167
+ "source",
168
+ ];
169
+
170
+ export const RESOURCE_TYPES = HIDE_QUALITY_CONTROL_SUBSCRIPTIONS
171
+ ? BASE_RESOURCE_TYPES
172
+ : [...BASE_RESOURCE_TYPES, "quality_control"];
173
+
144
174
  export const isSubset = (first, second) =>
145
175
  !_.isEmpty(first) && _.difference(first, second).length === 0;