create.config.ts
2.11 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
import { GcpPubsubFieldsEnum, GcpPubsubFieldsNameEnum } from '../../../enum/formField/external';
import { AttributeConfiguration } from '/@/views/rule/designer/src/components/AttributeConfiguration';
import { FileItemType, getFileData } from '../AzureIotHub/CredentialsCard/config';
import { FormSchema, useComponentRegister } from '/@/components/Form';
useComponentRegister('AttributeConfiguration', AttributeConfiguration);
export const formSchemas: FormSchema[] = [
{
field: GcpPubsubFieldsEnum.PROJECT_ID,
label: GcpPubsubFieldsNameEnum.PROJECT_ID,
component: 'Input',
required: true,
componentProps: {
placeholder: `请输入${GcpPubsubFieldsNameEnum.PROJECT_ID}`,
},
},
{
field: GcpPubsubFieldsEnum.TOPIC_NAME,
label: GcpPubsubFieldsNameEnum.TOPIC_NAME,
component: 'Input',
required: true,
componentProps: {
placeholder: `请输入${GcpPubsubFieldsNameEnum.TOPIC_NAME}`,
},
},
{
field: GcpPubsubFieldsEnum.SERVICE_ACCOUNT_KEY_FILE_NAME,
label: GcpPubsubFieldsNameEnum.SERVICE_ACCOUNT_KEY_FILE_NAME,
component: 'Input',
show: false,
componentProps: {
placeholder: `请输入${GcpPubsubFieldsNameEnum.TOPIC_NAME}`,
},
},
{
field: GcpPubsubFieldsEnum.SERVICE_ACCOUNT_KEY,
label: GcpPubsubFieldsNameEnum.SERVICE_ACCOUNT_KEY,
component: 'ApiUpload',
valueField: 'fileList',
changeEvent: 'update:fileList',
required: true,
componentProps: ({ formActionType }) => {
const { setFieldsValue } = formActionType;
return {
overFileLimitHiddenUploadEntry: true,
api: getFileData,
'onUpdate:fileList'(file: FileItemType[]) {
setFieldsValue({ [GcpPubsubFieldsEnum.SERVICE_ACCOUNT_KEY_FILE_NAME]: file?.[0]?.name });
},
};
},
},
{
field: GcpPubsubFieldsEnum.MESSAGE_ATTRIBUTES,
label: GcpPubsubFieldsNameEnum.MESSAGE_ATTRIBUTES,
component: 'AttributeConfiguration',
helpMessage:
'Use ${metadataKey} for value from metadata, $[messageKey] for value from message body in name/value fields',
slot: GcpPubsubFieldsEnum.MESSAGE_ATTRIBUTES,
},
];