@truedat/audit 7.5.9 → 7.5.10
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 +45 -71
- package/src/components/ContentFilters.js +3 -1
- package/src/components/NotificationEvent.js +2 -2
- package/src/components/NotificationsMenu.js +2 -10
- package/src/components/ShareLinkForm.js +33 -32
- package/src/components/ShareLinkPopup.js +1 -1
- package/src/components/Subscription.js +0 -1
- package/src/components/SubscriptionActions.js +1 -2
- package/src/components/SubscriptionCrumbs.js +2 -3
- package/src/components/SubscriptionEdit.js +0 -1
- package/src/components/SubscriptionForm.js +305 -310
- package/src/components/SubscriptionLoader.js +2 -2
- package/src/components/SubscriptionNew.js +0 -1
- package/src/components/SubscriptionRoutes.js +58 -56
- package/src/components/SubscriptionWatchForm.js +0 -1
- package/src/components/Subscriptions.js +4 -7
- package/src/components/SubscriptionsLoader.js +1 -1
- package/src/components/__tests__/NotificationEvent.spec.js +1 -4
- package/src/components/__tests__/NotificationsMenu.spec.js +0 -1
- package/src/components/__tests__/ShareLinkForm.spec.js +23 -17
- package/src/components/__tests__/ShareLinkPopup.spec.js +0 -1
- package/src/components/__tests__/Subscription.spec.js +0 -1
- package/src/components/__tests__/SubscriptionActions.spec.js +0 -1
- package/src/components/__tests__/SubscriptionCrumbs.spec.js +5 -5
- package/src/components/__tests__/SubscriptionEdit.spec.js +9 -8
- package/src/components/__tests__/SubscriptionForm.spec.js +141 -125
- package/src/components/__tests__/SubscriptionLoader.spec.js +0 -1
- package/src/components/__tests__/SubscriptionNew.spec.js +5 -5
- package/src/components/__tests__/SubscriptionRoutes.spec.js +44 -6
- package/src/components/__tests__/SubscriptionWatchForm.spec.js +37 -34
- package/src/components/__tests__/Subscriptions.spec.js +0 -1
- package/src/components/__tests__/SubscriptionsLoader.spec.js +0 -1
- package/src/components/__tests__/__snapshots__/NotificationEvent.spec.js.snap +6 -6
- package/src/components/__tests__/__snapshots__/NotificationsMenu.spec.js.snap +7 -7
- package/src/components/__tests__/__snapshots__/ShareLinkForm.spec.js.snap +6 -6
- package/src/components/__tests__/__snapshots__/Subscription.spec.js.snap +4 -5
- package/src/components/__tests__/__snapshots__/SubscriptionActions.spec.js.snap +0 -1
- package/src/components/__tests__/__snapshots__/SubscriptionCrumbs.spec.js.snap +20 -30
- package/src/components/__tests__/__snapshots__/SubscriptionEdit.spec.js.snap +75 -25
- package/src/components/__tests__/__snapshots__/SubscriptionForm.spec.js.snap +23 -23
- package/src/components/__tests__/__snapshots__/SubscriptionNew.spec.js.snap +64 -25
- package/src/components/__tests__/__snapshots__/SubscriptionRoutes.spec.js.snap +710 -23
- package/src/components/__tests__/__snapshots__/SubscriptionWatchForm.spec.js.snap +83 -80
- package/src/components/__tests__/__snapshots__/Subscriptions.spec.js.snap +28 -37
- package/src/index.js +1 -2
- package/src/reducers/__tests__/auditMessage.spec.js +3 -3
- package/src/reducers/__tests__/auditRedirect.spec.js +2 -2
- package/src/reducers/__tests__/events.spec.js +1 -1
- package/src/reducers/__tests__/searchSubscription.spec.js +5 -5
- package/src/reducers/__tests__/subscription.spec.js +1 -1
- package/src/reducers/__tests__/subscriptionUpdating.spec.js +6 -6
- package/src/reducers/__tests__/subscriptions.spec.js +1 -1
- package/src/reducers/auditMessage.js +1 -1
- package/src/reducers/events.js +1 -1
- package/src/sagas/__tests__/deleteSubscription.spec.js +7 -7
- package/src/sagas/__tests__/fetchSubscription.spec.js +2 -2
- package/src/sagas/__tests__/readNotification.spec.js +2 -2
- package/src/sagas/__tests__/updateSubscription.spec.js +8 -8
- package/src/sagas/createSubscription.js +3 -3
- package/src/sagas/deleteSubscription.js +1 -1
- package/src/sagas/readNotification.js +1 -1
- package/src/sagas/updateSubscription.js +4 -4
- package/src/selectors/__tests__/getRecipients.spec.js +0 -32
- package/src/selectors/getRecipients.js +0 -34
- package/src/selectors/index.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { lazy, useState, useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
5
|
import { useForm, useWatch, Controller } from "react-hook-form";
|
|
@@ -16,24 +16,24 @@ import {
|
|
|
16
16
|
} from "../subscriptionConstants";
|
|
17
17
|
import ContentFilters from "./ContentFilters";
|
|
18
18
|
|
|
19
|
-
const ConceptSelector =
|
|
20
|
-
import("@truedat/bg/concepts/relations/components/ConceptSelector")
|
|
19
|
+
const ConceptSelector = lazy(
|
|
20
|
+
() => import("@truedat/bg/concepts/relations/components/ConceptSelector")
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const UserSelector =
|
|
24
|
-
import("@truedat/auth/users/components/UserSelector")
|
|
23
|
+
const UserSelector = lazy(
|
|
24
|
+
() => import("@truedat/auth/users/components/UserSelector")
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
const RoleSelector =
|
|
28
|
-
import("@truedat/auth/roles/components/RoleSelector")
|
|
27
|
+
const RoleSelector = lazy(
|
|
28
|
+
() => import("@truedat/auth/roles/components/RoleSelector")
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
-
const StructureSelector =
|
|
32
|
-
import("@truedat/dd/components/StructureSelector")
|
|
31
|
+
const StructureSelector = lazy(
|
|
32
|
+
() => import("@truedat/dd/components/StructureSelector")
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
const SourceSelector =
|
|
36
|
-
import("@truedat/cx/sources/components/SourceSelector")
|
|
35
|
+
const SourceSelector = lazy(
|
|
36
|
+
() => import("@truedat/cx/sources/components/SourceSelector")
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
const SUBSCRIBER_TYPES = ["role", "taxonomy_role", "email", "user"];
|
|
@@ -132,8 +132,8 @@ export const SubscriptionForm = ({
|
|
|
132
132
|
!_.isEmpty(_.intersection(exclusiveEvents)(events))
|
|
133
133
|
? events
|
|
134
134
|
: !_.isEmpty(events)
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
? _.difference(eventsbytype)(exclusiveEvents)
|
|
136
|
+
: eventsbytype
|
|
137
137
|
);
|
|
138
138
|
}, [resourceType, events]);
|
|
139
139
|
|
|
@@ -176,249 +176,287 @@ export const SubscriptionForm = ({
|
|
|
176
176
|
const disabled = isLoading || !isDirty || notEmpty(errors);
|
|
177
177
|
|
|
178
178
|
return (
|
|
179
|
-
<
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
<
|
|
187
|
-
<
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
role="radio"
|
|
193
|
-
onBlur={onBlur}
|
|
194
|
-
key={idx}
|
|
195
|
-
disabled={isEditForm}
|
|
196
|
-
label={
|
|
197
|
-
<label>
|
|
198
|
-
<Icon name={subscriberIcon(type)} />
|
|
199
|
-
<FormattedMessage
|
|
200
|
-
id={`subscription.subscriber_type.${type}`}
|
|
201
|
-
defaultMessage={type}
|
|
202
|
-
/>
|
|
203
|
-
</label>
|
|
204
|
-
}
|
|
205
|
-
name={type}
|
|
206
|
-
value={type}
|
|
207
|
-
checked={value == type}
|
|
208
|
-
onChange={onChangeSubscriberType(onChange)}
|
|
209
|
-
/>
|
|
210
|
-
))}
|
|
211
|
-
</Form.Field>
|
|
212
|
-
)}
|
|
213
|
-
/>
|
|
214
|
-
{_.includes(subscriberType)(["role", "taxonomy_role"]) && (
|
|
215
|
-
<Controller
|
|
216
|
-
control={control}
|
|
217
|
-
name="subscriber.identifier"
|
|
218
|
-
rules={{ required: true }}
|
|
219
|
-
render={({
|
|
220
|
-
field: { onBlur, onChange, value },
|
|
221
|
-
fieldState: { error },
|
|
222
|
-
}) => (
|
|
223
|
-
<RoleSelector
|
|
224
|
-
disabled={isEditForm}
|
|
225
|
-
error={!!error}
|
|
179
|
+
<Form onSubmit={doHandleSubmit}>
|
|
180
|
+
<Controller
|
|
181
|
+
control={control}
|
|
182
|
+
name="subscriber.type"
|
|
183
|
+
rules={{ required: true }}
|
|
184
|
+
render={({ field: { onBlur, onChange, value } }) => (
|
|
185
|
+
<Form.Field className="subscription-form-radio-group" required>
|
|
186
|
+
<label>
|
|
187
|
+
<FormattedMessage id="subscriptions.subscriber" />
|
|
188
|
+
</label>
|
|
189
|
+
{SUBSCRIBER_TYPES.map((type, idx) => (
|
|
190
|
+
<Radio
|
|
191
|
+
role="radio"
|
|
226
192
|
onBlur={onBlur}
|
|
227
|
-
|
|
228
|
-
value={value}
|
|
229
|
-
/>
|
|
230
|
-
)}
|
|
231
|
-
/>
|
|
232
|
-
)}
|
|
233
|
-
{subscriberType === "email" && (
|
|
234
|
-
<Controller
|
|
235
|
-
control={control}
|
|
236
|
-
name="subscriber.identifier"
|
|
237
|
-
shouldUnregister
|
|
238
|
-
rules={{
|
|
239
|
-
required: true,
|
|
240
|
-
pattern: { value: /^\S+@\S+\.\S+$/ },
|
|
241
|
-
}}
|
|
242
|
-
render={({
|
|
243
|
-
field: { onBlur, onChange, value },
|
|
244
|
-
fieldState: { error },
|
|
245
|
-
}) => (
|
|
246
|
-
<Form.Input
|
|
247
|
-
disabled={isEditForm}
|
|
248
|
-
error={!!error}
|
|
249
|
-
onBlur={onBlur}
|
|
250
|
-
onChange={(_e, { value }) => onChange(value)}
|
|
251
|
-
value={value}
|
|
252
|
-
data-testid="email-input"
|
|
253
|
-
/>
|
|
254
|
-
)}
|
|
255
|
-
/>
|
|
256
|
-
)}
|
|
257
|
-
{subscriberType === "user" && (
|
|
258
|
-
<Controller
|
|
259
|
-
control={control}
|
|
260
|
-
name="subscriber.identifier"
|
|
261
|
-
rules={{ required: true }}
|
|
262
|
-
render={({
|
|
263
|
-
field: { onBlur, onChange, value },
|
|
264
|
-
fieldState: { error },
|
|
265
|
-
}) => (
|
|
266
|
-
<UserSelector
|
|
193
|
+
key={idx}
|
|
267
194
|
disabled={isEditForm}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
195
|
+
label={
|
|
196
|
+
<label>
|
|
197
|
+
<Icon name={subscriberIcon(type)} />
|
|
198
|
+
<FormattedMessage
|
|
199
|
+
id={`subscription.subscriber_type.${type}`}
|
|
200
|
+
defaultMessage={type}
|
|
201
|
+
/>
|
|
202
|
+
</label>
|
|
203
|
+
}
|
|
204
|
+
name={type}
|
|
205
|
+
value={type}
|
|
206
|
+
checked={value == type}
|
|
207
|
+
onChange={onChangeSubscriberType(onChange)}
|
|
272
208
|
/>
|
|
273
|
-
)}
|
|
274
|
-
|
|
209
|
+
))}
|
|
210
|
+
</Form.Field>
|
|
275
211
|
)}
|
|
212
|
+
/>
|
|
213
|
+
{_.includes(subscriberType)(["role", "taxonomy_role"]) && (
|
|
276
214
|
<Controller
|
|
277
215
|
control={control}
|
|
278
|
-
name="
|
|
216
|
+
name="subscriber.identifier"
|
|
279
217
|
rules={{ required: true }}
|
|
280
|
-
render={({
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
{
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
(subscriberType === "taxonomy_role" &&
|
|
292
|
-
type !== "domains") ||
|
|
293
|
-
((subscriberType === "taxonomy_role" ||
|
|
294
|
-
subscriberType === "role") &&
|
|
295
|
-
type === "source")
|
|
296
|
-
}
|
|
297
|
-
onBlur={onBlur}
|
|
298
|
-
key={idx}
|
|
299
|
-
label={
|
|
300
|
-
<label>
|
|
301
|
-
<Icon name={resourceIcon(type)} />
|
|
302
|
-
<FormattedMessage
|
|
303
|
-
id={`subscriptions.resource.type.${type}`}
|
|
304
|
-
defaultMessage={type}
|
|
305
|
-
/>
|
|
306
|
-
</label>
|
|
307
|
-
}
|
|
308
|
-
value={type}
|
|
309
|
-
checked={value == type}
|
|
310
|
-
onChange={onChangeResourceType(onChange)}
|
|
311
|
-
/>
|
|
312
|
-
))}
|
|
313
|
-
</Form.Field>
|
|
218
|
+
render={({
|
|
219
|
+
field: { onBlur, onChange, value },
|
|
220
|
+
fieldState: { error },
|
|
221
|
+
}) => (
|
|
222
|
+
<RoleSelector
|
|
223
|
+
disabled={isEditForm}
|
|
224
|
+
error={!!error}
|
|
225
|
+
onBlur={onBlur}
|
|
226
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
227
|
+
value={value}
|
|
228
|
+
/>
|
|
314
229
|
)}
|
|
315
230
|
/>
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
render={({ field: { onChange, value } }) => (
|
|
343
|
-
<DomainSelector
|
|
344
|
-
action="manageSubscriptions"
|
|
345
|
-
disabled={isEditForm}
|
|
346
|
-
label={formatMessage({ id: "domain.selector.label" })}
|
|
347
|
-
required
|
|
348
|
-
labels
|
|
349
|
-
value={value}
|
|
350
|
-
onChange={(_e, { value }) => onChange(value)}
|
|
351
|
-
/>
|
|
352
|
-
)}
|
|
353
|
-
/>
|
|
354
|
-
)}
|
|
355
|
-
{resourceType === "data_structure" && !isEditForm && (
|
|
356
|
-
<Controller
|
|
357
|
-
control={control}
|
|
358
|
-
name="scope.resource_id"
|
|
359
|
-
rules={{ required: true }}
|
|
360
|
-
render={({ field: { onChange } }) => (
|
|
361
|
-
<StructureSelector
|
|
362
|
-
onSelect={({ id, name, domain_id }) => {
|
|
363
|
-
onChange(id);
|
|
364
|
-
setResource({ name, domain_id });
|
|
365
|
-
}}
|
|
366
|
-
/>
|
|
367
|
-
)}
|
|
368
|
-
/>
|
|
369
|
-
)}
|
|
370
|
-
{resourceType === "source" && !isEditForm && (
|
|
371
|
-
<Controller
|
|
372
|
-
control={control}
|
|
373
|
-
name="scope.resource_id"
|
|
374
|
-
rules={{ required: true }}
|
|
375
|
-
render={({ field: { onChange, value } }) => (
|
|
376
|
-
<SourceSelector
|
|
377
|
-
disabled={isEditForm}
|
|
378
|
-
value={value}
|
|
379
|
-
onChange={(_e, { value, options }) => {
|
|
380
|
-
onChange(value);
|
|
381
|
-
setResource({
|
|
382
|
-
id: value,
|
|
383
|
-
name: _.path("text")(_.find({ key: value })(options)),
|
|
384
|
-
});
|
|
385
|
-
}}
|
|
386
|
-
/>
|
|
387
|
-
)}
|
|
388
|
-
/>
|
|
389
|
-
)}
|
|
231
|
+
)}
|
|
232
|
+
{subscriberType === "email" && (
|
|
233
|
+
<Controller
|
|
234
|
+
control={control}
|
|
235
|
+
name="subscriber.identifier"
|
|
236
|
+
shouldUnregister
|
|
237
|
+
rules={{
|
|
238
|
+
required: true,
|
|
239
|
+
pattern: { value: /^\S+@\S+\.\S+$/ },
|
|
240
|
+
}}
|
|
241
|
+
render={({
|
|
242
|
+
field: { onBlur, onChange, value },
|
|
243
|
+
fieldState: { error },
|
|
244
|
+
}) => (
|
|
245
|
+
<Form.Input
|
|
246
|
+
disabled={isEditForm}
|
|
247
|
+
error={!!error}
|
|
248
|
+
onBlur={onBlur}
|
|
249
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
250
|
+
value={value}
|
|
251
|
+
data-testid="email-input"
|
|
252
|
+
/>
|
|
253
|
+
)}
|
|
254
|
+
/>
|
|
255
|
+
)}
|
|
256
|
+
{subscriberType === "user" && (
|
|
390
257
|
<Controller
|
|
391
258
|
control={control}
|
|
392
|
-
name="
|
|
259
|
+
name="subscriber.identifier"
|
|
393
260
|
rules={{ required: true }}
|
|
394
261
|
render={({
|
|
395
262
|
field: { onBlur, onChange, value },
|
|
396
263
|
fieldState: { error },
|
|
397
264
|
}) => (
|
|
398
|
-
<
|
|
265
|
+
<UserSelector
|
|
266
|
+
disabled={isEditForm}
|
|
399
267
|
error={!!error}
|
|
400
|
-
selection
|
|
401
|
-
clearable
|
|
402
|
-
label={formatMessage({ id: "subscriptions.periodicity" })}
|
|
403
268
|
onBlur={onBlur}
|
|
404
269
|
onChange={(_e, { value }) => onChange(value)}
|
|
405
|
-
placeholder={formatMessage({ id: "subscriptions.periodicity" })}
|
|
406
270
|
value={value}
|
|
271
|
+
/>
|
|
272
|
+
)}
|
|
273
|
+
/>
|
|
274
|
+
)}
|
|
275
|
+
<Controller
|
|
276
|
+
control={control}
|
|
277
|
+
name="scope.resource_type"
|
|
278
|
+
rules={{ required: true }}
|
|
279
|
+
render={({ field: { onBlur, onChange, value } }) => (
|
|
280
|
+
<Form.Field className="subscription-form-radio-group" required>
|
|
281
|
+
<label>
|
|
282
|
+
<FormattedMessage id="subscriptions.resource" />
|
|
283
|
+
</label>
|
|
284
|
+
{RESOURCE_TYPES.map((type, idx) => (
|
|
285
|
+
<Radio
|
|
286
|
+
role="radio"
|
|
287
|
+
disabled={
|
|
288
|
+
isEditForm ||
|
|
289
|
+
type == "rule" ||
|
|
290
|
+
(subscriberType === "taxonomy_role" && type !== "domains") ||
|
|
291
|
+
((subscriberType === "taxonomy_role" ||
|
|
292
|
+
subscriberType === "role") &&
|
|
293
|
+
type === "source")
|
|
294
|
+
}
|
|
295
|
+
onBlur={onBlur}
|
|
296
|
+
key={idx}
|
|
297
|
+
label={
|
|
298
|
+
<label>
|
|
299
|
+
<Icon name={resourceIcon(type)} />
|
|
300
|
+
<FormattedMessage
|
|
301
|
+
id={`subscriptions.resource.type.${type}`}
|
|
302
|
+
defaultMessage={type}
|
|
303
|
+
/>
|
|
304
|
+
</label>
|
|
305
|
+
}
|
|
306
|
+
value={type}
|
|
307
|
+
checked={value == type}
|
|
308
|
+
onChange={onChangeResourceType(onChange)}
|
|
309
|
+
/>
|
|
310
|
+
))}
|
|
311
|
+
</Form.Field>
|
|
312
|
+
)}
|
|
313
|
+
/>
|
|
314
|
+
{isEditForm && (
|
|
315
|
+
<Form.Input disabled value={_.get("resource.name")(subscription)} />
|
|
316
|
+
)}
|
|
317
|
+
{resourceType === "concept" && !isEditForm && (
|
|
318
|
+
<Controller
|
|
319
|
+
control={control}
|
|
320
|
+
name="scope.resource_id"
|
|
321
|
+
rules={{ required: true }}
|
|
322
|
+
render={({ field: { onChange, value } }) => (
|
|
323
|
+
<ConceptSelector
|
|
324
|
+
showTitle={false}
|
|
325
|
+
handleConceptSelected={(concept) => {
|
|
326
|
+
setSelectedConceptType(_.prop("type")(concept));
|
|
327
|
+
onChange(concept.business_concept_id);
|
|
328
|
+
}}
|
|
329
|
+
businessConceptId={value}
|
|
330
|
+
defaultFilters={defaultFilters}
|
|
331
|
+
/>
|
|
332
|
+
)}
|
|
333
|
+
/>
|
|
334
|
+
)}
|
|
335
|
+
{_.includes(resourceType)(["domains", "domain"]) && !isEditForm && (
|
|
336
|
+
<Controller
|
|
337
|
+
control={control}
|
|
338
|
+
name="scope.resource_id"
|
|
339
|
+
rules={{ required: true }}
|
|
340
|
+
render={({ field: { onChange, value } }) => (
|
|
341
|
+
<DomainSelector
|
|
342
|
+
action="manageSubscriptions"
|
|
343
|
+
disabled={isEditForm}
|
|
344
|
+
label={formatMessage({ id: "domain.selector.label" })}
|
|
407
345
|
required
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
346
|
+
labels
|
|
347
|
+
value={value}
|
|
348
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
349
|
+
/>
|
|
350
|
+
)}
|
|
351
|
+
/>
|
|
352
|
+
)}
|
|
353
|
+
{resourceType === "data_structure" && !isEditForm && (
|
|
354
|
+
<Controller
|
|
355
|
+
control={control}
|
|
356
|
+
name="scope.resource_id"
|
|
357
|
+
rules={{ required: true }}
|
|
358
|
+
render={({ field: { onChange } }) => (
|
|
359
|
+
<StructureSelector
|
|
360
|
+
onSelect={({ id, name, domain_id }) => {
|
|
361
|
+
onChange(id);
|
|
362
|
+
setResource({ name, domain_id });
|
|
363
|
+
}}
|
|
364
|
+
/>
|
|
365
|
+
)}
|
|
366
|
+
/>
|
|
367
|
+
)}
|
|
368
|
+
{resourceType === "source" && !isEditForm && (
|
|
369
|
+
<Controller
|
|
370
|
+
control={control}
|
|
371
|
+
name="scope.resource_id"
|
|
372
|
+
rules={{ required: true }}
|
|
373
|
+
render={({ field: { onChange, value } }) => (
|
|
374
|
+
<SourceSelector
|
|
375
|
+
disabled={isEditForm}
|
|
376
|
+
value={value}
|
|
377
|
+
onChange={(_e, { value, options }) => {
|
|
378
|
+
onChange(value);
|
|
379
|
+
setResource({
|
|
380
|
+
id: value,
|
|
381
|
+
name: _.path("text")(_.find({ key: value })(options)),
|
|
382
|
+
});
|
|
383
|
+
}}
|
|
416
384
|
/>
|
|
417
385
|
)}
|
|
418
386
|
/>
|
|
387
|
+
)}
|
|
388
|
+
<Controller
|
|
389
|
+
control={control}
|
|
390
|
+
name="periodicity"
|
|
391
|
+
rules={{ required: true }}
|
|
392
|
+
render={({
|
|
393
|
+
field: { onBlur, onChange, value },
|
|
394
|
+
fieldState: { error },
|
|
395
|
+
}) => (
|
|
396
|
+
<Form.Dropdown
|
|
397
|
+
error={!!error}
|
|
398
|
+
selection
|
|
399
|
+
clearable
|
|
400
|
+
label={formatMessage({ id: "subscriptions.periodicity" })}
|
|
401
|
+
onBlur={onBlur}
|
|
402
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
403
|
+
placeholder={formatMessage({ id: "subscriptions.periodicity" })}
|
|
404
|
+
value={value}
|
|
405
|
+
required
|
|
406
|
+
options={PERIODICITIES.map((periodicity, key) => ({
|
|
407
|
+
key,
|
|
408
|
+
value: periodicity,
|
|
409
|
+
text: formatMessage({
|
|
410
|
+
id: `subscriptions.periodicity.${periodicity}`,
|
|
411
|
+
defaultMessage: periodicity,
|
|
412
|
+
}),
|
|
413
|
+
}))}
|
|
414
|
+
/>
|
|
415
|
+
)}
|
|
416
|
+
/>
|
|
417
|
+
<Controller
|
|
418
|
+
control={control}
|
|
419
|
+
name="scope.events"
|
|
420
|
+
rules={{
|
|
421
|
+
required: true,
|
|
422
|
+
validate: { notEmpty },
|
|
423
|
+
}}
|
|
424
|
+
render={({
|
|
425
|
+
field: { onBlur, onChange, value },
|
|
426
|
+
fieldState: { error },
|
|
427
|
+
}) => (
|
|
428
|
+
<Form.Dropdown
|
|
429
|
+
error={!!error}
|
|
430
|
+
selection
|
|
431
|
+
clearable
|
|
432
|
+
multiple
|
|
433
|
+
disabled={_.isEmpty(eventsForType)}
|
|
434
|
+
label={formatMessage({ id: "subscriptions.events" })}
|
|
435
|
+
onBlur={onBlur}
|
|
436
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
437
|
+
placeholder={formatMessage({ id: "subscriptions.events" })}
|
|
438
|
+
value={value}
|
|
439
|
+
required
|
|
440
|
+
options={eventsForType.map((event, key) => ({
|
|
441
|
+
key,
|
|
442
|
+
value: event,
|
|
443
|
+
text: formatMessage({
|
|
444
|
+
id: `subscriptions.events.${event}`,
|
|
445
|
+
defaultMessage: event,
|
|
446
|
+
}),
|
|
447
|
+
}))}
|
|
448
|
+
/>
|
|
449
|
+
)}
|
|
450
|
+
/>
|
|
451
|
+
<ContentFilters
|
|
452
|
+
control={control}
|
|
453
|
+
setValue={setValue}
|
|
454
|
+
conceptType={selectedConceptType}
|
|
455
|
+
/>
|
|
456
|
+
{_.isEmpty(statuses) ? null : (
|
|
419
457
|
<Controller
|
|
420
458
|
control={control}
|
|
421
|
-
name="scope.
|
|
459
|
+
name="scope.status"
|
|
422
460
|
rules={{
|
|
423
461
|
required: true,
|
|
424
462
|
validate: { notEmpty },
|
|
@@ -428,97 +466,54 @@ export const SubscriptionForm = ({
|
|
|
428
466
|
fieldState: { error },
|
|
429
467
|
}) => (
|
|
430
468
|
<Form.Dropdown
|
|
469
|
+
onBlur={onBlur}
|
|
431
470
|
error={!!error}
|
|
471
|
+
label={formatMessage({ id: "subscriptions.status" })}
|
|
432
472
|
selection
|
|
433
|
-
clearable
|
|
434
473
|
multiple
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
onBlur={onBlur}
|
|
474
|
+
clearable
|
|
475
|
+
required
|
|
438
476
|
onChange={(_e, { value }) => onChange(value)}
|
|
439
|
-
placeholder={formatMessage({ id: "subscriptions.events" })}
|
|
440
477
|
value={value}
|
|
441
|
-
|
|
442
|
-
options={
|
|
478
|
+
placeholder={formatMessage({ id: "subscriptions.status" })}
|
|
479
|
+
options={statuses.map(({ name, color }, key) => ({
|
|
443
480
|
key,
|
|
444
|
-
value:
|
|
445
|
-
text:
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
481
|
+
value: name,
|
|
482
|
+
text: (
|
|
483
|
+
<label>
|
|
484
|
+
{color ? (
|
|
485
|
+
<Icon
|
|
486
|
+
name={
|
|
487
|
+
name == "error" || "empty_dataset"
|
|
488
|
+
? "warning circle"
|
|
489
|
+
: "circle"
|
|
490
|
+
}
|
|
491
|
+
inverted={name == "empty_dataset" ? true : false}
|
|
492
|
+
color={color}
|
|
493
|
+
/>
|
|
494
|
+
) : null}
|
|
495
|
+
<FormattedMessage
|
|
496
|
+
id={`subscriptions.status.${name}`}
|
|
497
|
+
defaultMessage={name}
|
|
498
|
+
/>
|
|
499
|
+
</label>
|
|
500
|
+
),
|
|
449
501
|
}))}
|
|
450
502
|
/>
|
|
451
503
|
)}
|
|
452
504
|
/>
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
505
|
+
)}
|
|
506
|
+
<div className="actions">
|
|
507
|
+
<HistoryBackButton content={formatMessage({ id: "actions.cancel" })} />
|
|
508
|
+
<Button
|
|
509
|
+
primary
|
|
510
|
+
type="submit"
|
|
511
|
+
loading={isLoading}
|
|
512
|
+
disabled={disabled}
|
|
513
|
+
content={formatMessage({ id: "actions.save" })}
|
|
457
514
|
/>
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
control={control}
|
|
461
|
-
name="scope.status"
|
|
462
|
-
rules={{
|
|
463
|
-
required: true,
|
|
464
|
-
validate: { notEmpty },
|
|
465
|
-
}}
|
|
466
|
-
render={({
|
|
467
|
-
field: { onBlur, onChange, value },
|
|
468
|
-
fieldState: { error },
|
|
469
|
-
}) => (
|
|
470
|
-
<Form.Dropdown
|
|
471
|
-
onBlur={onBlur}
|
|
472
|
-
error={!!error}
|
|
473
|
-
label={formatMessage({ id: "subscriptions.status" })}
|
|
474
|
-
selection
|
|
475
|
-
multiple
|
|
476
|
-
clearable
|
|
477
|
-
required
|
|
478
|
-
onChange={(_e, { value }) => onChange(value)}
|
|
479
|
-
value={value}
|
|
480
|
-
placeholder={formatMessage({ id: "subscriptions.status" })}
|
|
481
|
-
options={statuses.map(({ name, color }, key) => ({
|
|
482
|
-
key,
|
|
483
|
-
value: name,
|
|
484
|
-
text: (
|
|
485
|
-
<label>
|
|
486
|
-
{color ? (
|
|
487
|
-
<Icon
|
|
488
|
-
name={
|
|
489
|
-
name == "error" || "empty_dataset"
|
|
490
|
-
? "warning circle"
|
|
491
|
-
: "circle"
|
|
492
|
-
}
|
|
493
|
-
inverted={name == "empty_dataset" ? true : false}
|
|
494
|
-
color={color}
|
|
495
|
-
/>
|
|
496
|
-
) : null}
|
|
497
|
-
<FormattedMessage
|
|
498
|
-
id={`subscriptions.status.${name}`}
|
|
499
|
-
defaultMessage={name}
|
|
500
|
-
/>
|
|
501
|
-
</label>
|
|
502
|
-
),
|
|
503
|
-
}))}
|
|
504
|
-
/>
|
|
505
|
-
)}
|
|
506
|
-
/>
|
|
507
|
-
)}
|
|
508
|
-
<div className="actions">
|
|
509
|
-
<HistoryBackButton
|
|
510
|
-
content={formatMessage({ id: "actions.cancel" })}
|
|
511
|
-
/>
|
|
512
|
-
<Button
|
|
513
|
-
primary
|
|
514
|
-
type="submit"
|
|
515
|
-
loading={isLoading}
|
|
516
|
-
disabled={disabled}
|
|
517
|
-
content={formatMessage({ id: "actions.save" })}
|
|
518
|
-
/>
|
|
519
|
-
</div>
|
|
520
|
-
</Form>
|
|
521
|
-
</Suspense>
|
|
515
|
+
</div>
|
|
516
|
+
</Form>
|
|
522
517
|
);
|
|
523
518
|
};
|
|
524
519
|
|