create.config.ts
3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { DirectionEnum, EntityTypeEnum } from '../../../enum/form';
import { useRuleChainI18n } from '../../../hook/useRuleChainI18n';
import { FormSchema } from '/@/components/Form';
const { tLabel, tPlaceholder, t } = useRuleChainI18n('action', 'deleteRelation');
export enum DeleteRelationFieldsEnum {
DELETE_FOR_SINGLE_ENTITY = 'deleteForSingleEntity',
DIRECTION = 'direction',
ENTITY_TYPE = 'entityType',
ENTITY_NAME_PATTERN = 'entityNamePattern',
RELATION_TYPE = 'relationType',
ENTITY_CACHE_EXPIRATION = 'entityCacheExpiration',
}
export const formSchemas: FormSchema[] = [
{
field: DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY,
component: 'Checkbox',
label: tLabel(DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY),
renderComponentContent: () => ({
default: () =>
'Deletes relation from the originator of the incoming message to the specified entity or list of entities based on direction and type.',
}),
},
{
field: DeleteRelationFieldsEnum.DIRECTION,
component: 'Select',
label: tLabel(DeleteRelationFieldsEnum.DIRECTION),
show: ({ model }) => model[DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY],
required: true,
componentProps: {
options: Object.keys(DirectionEnum).map((value) => ({
label: t(`enum.direction.${value}`),
value,
})),
getPopupContainer: () => document.body,
placeholder: tPlaceholder(DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY, 'choose'),
},
},
{
field: DeleteRelationFieldsEnum.ENTITY_TYPE,
component: 'Select',
label: tLabel(DeleteRelationFieldsEnum.ENTITY_TYPE),
colProps: { span: 12 },
required: true,
componentProps: {
options: Object.keys(EntityTypeEnum).map((value) => ({
label: t(`enum.entityType.${value}`),
value,
})),
getPopupContainer: () => document.body,
placeholder: tPlaceholder(DeleteRelationFieldsEnum.ENTITY_TYPE, 'choose'),
},
},
{
field: DeleteRelationFieldsEnum.ENTITY_NAME_PATTERN,
component: 'Input',
label: tLabel(DeleteRelationFieldsEnum.ENTITY_NAME_PATTERN),
colProps: { span: 12 },
show: ({ model }) => model[DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY],
helpMessage: [
'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
],
required: true,
componentProps: {
placeholder: tPlaceholder(DeleteRelationFieldsEnum.ENTITY_NAME_PATTERN),
},
},
{
field: DeleteRelationFieldsEnum.RELATION_TYPE,
component: 'Input',
label: tLabel(DeleteRelationFieldsEnum.RELATION_TYPE),
helpMessage: [
'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
],
required: true,
componentProps: {
placeholder: tPlaceholder(DeleteRelationFieldsEnum.RELATION_TYPE),
},
},
{
field: DeleteRelationFieldsEnum.ENTITY_CACHE_EXPIRATION,
component: 'InputNumber',
label: tLabel(DeleteRelationFieldsEnum.ENTITY_CACHE_EXPIRATION),
helpMessage: [
'Specifies maximum time interval allowed to store found entity records. 0 value means that records will never expire.',
],
required: true,
componentProps: {
min: 0,
placeholder: tPlaceholder(DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY),
},
},
];