create.config.ts
3.69 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import { MessagePropertiesEnum } from '../../../enum/form';
import { useRuleChainI18n } from '../../../hook/useRuleChainI18n';
import { FormSchema } from '/@/components/Form';
export enum RabbitmqFieldsEnum {
  EXCHANGE_NAME_PATTERN = 'exchangeNamePattern',
  ROUTING_KEY_PATTERN = 'routingKeyPattern',
  MESSAGE_PROPERTIES = 'messageProperties',
  HOST = 'host',
  PORT = 'port',
  VIRTUAL_HOST = 'virtualHost',
  USERNAME = 'username',
  PASSWORD = 'password',
  AUTOMATIC_RECOVERY_ENABLED = 'automaticRecoveryEnabled',
  CONNECTION_TIMEOUT = 'connectionTimeout',
  HANDSHAKE_TIMEOUT = 'handshakeTimeout',
  CLIENT_PROPERTIES = 'clientProperties',
}
const { tLabel, tPlaceholder } = useRuleChainI18n('external', 'rabbitmq');
export const formSchemas: FormSchema[] = [
  {
    field: RabbitmqFieldsEnum.EXCHANGE_NAME_PATTERN,
    label: tLabel(RabbitmqFieldsEnum.EXCHANGE_NAME_PATTERN),
    component: 'Input',
    componentProps: {
      placeholder: tPlaceholder(RabbitmqFieldsEnum.EXCHANGE_NAME_PATTERN),
    },
  },
  {
    field: RabbitmqFieldsEnum.ROUTING_KEY_PATTERN,
    label: tLabel(RabbitmqFieldsEnum.ROUTING_KEY_PATTERN),
    component: 'Input',
    componentProps: {
      placeholder: tPlaceholder(RabbitmqFieldsEnum.ROUTING_KEY_PATTERN),
    },
  },
  {
    field: RabbitmqFieldsEnum.MESSAGE_PROPERTIES,
    label: tLabel(RabbitmqFieldsEnum.MESSAGE_PROPERTIES),
    component: 'Select',
    componentProps: {
      allowClear: true,
      options: Object.keys(MessagePropertiesEnum).map((value) => ({ label: value, value })),
      placeholder: tPlaceholder(RabbitmqFieldsEnum.ROUTING_KEY_PATTERN, 'choose'),
      getPopupContainer: () => document.body,
    },
  },
  {
    field: RabbitmqFieldsEnum.HOST,
    label: tLabel(RabbitmqFieldsEnum.HOST),
    component: 'Input',
    required: true,
    colProps: { span: 12 },
    componentProps: {
      placeholder: tPlaceholder(RabbitmqFieldsEnum.HOST),
    },
  },
  {
    field: RabbitmqFieldsEnum.PORT,
    label: tLabel(RabbitmqFieldsEnum.PORT),
    component: 'InputNumber',
    required: true,
    colProps: { span: 12 },
    componentProps: {
      placeholder: tPlaceholder(RabbitmqFieldsEnum.PORT),
    },
  },
  {
    field: RabbitmqFieldsEnum.VIRTUAL_HOST,
    label: tLabel(RabbitmqFieldsEnum.VIRTUAL_HOST),
    component: 'Input',
    componentProps: {
      placeholder: tPlaceholder(RabbitmqFieldsEnum.VIRTUAL_HOST),
    },
  },
  {
    field: RabbitmqFieldsEnum.USERNAME,
    label: tLabel(RabbitmqFieldsEnum.USERNAME),
    component: 'Input',
    componentProps: {
      placeholder: tPlaceholder(RabbitmqFieldsEnum.USERNAME),
    },
  },
  {
    field: RabbitmqFieldsEnum.PASSWORD,
    label: tLabel(RabbitmqFieldsEnum.PASSWORD),
    component: 'Input',
    componentProps: {
      placeholder: tPlaceholder(RabbitmqFieldsEnum.PASSWORD),
    },
  },
  {
    field: RabbitmqFieldsEnum.AUTOMATIC_RECOVERY_ENABLED,
    component: 'Checkbox',
    label: '',
    renderComponentContent: () => ({
      default: () => tLabel(RabbitmqFieldsEnum.AUTOMATIC_RECOVERY_ENABLED),
    }),
  },
  {
    field: RabbitmqFieldsEnum.CONNECTION_TIMEOUT,
    label: tLabel(RabbitmqFieldsEnum.CONNECTION_TIMEOUT),
    component: 'InputNumber',
    componentProps: {
      min: 0,
      placeholder: tPlaceholder(RabbitmqFieldsEnum.CONNECTION_TIMEOUT),
    },
  },
  {
    field: RabbitmqFieldsEnum.HANDSHAKE_TIMEOUT,
    label: tLabel(RabbitmqFieldsEnum.HANDSHAKE_TIMEOUT),
    component: 'InputNumber',
    componentProps: {
      min: 0,
      placeholder: tPlaceholder(RabbitmqFieldsEnum.HANDSHAKE_TIMEOUT),
    },
  },
  {
    field: RabbitmqFieldsEnum.CLIENT_PROPERTIES,
    label: tLabel(RabbitmqFieldsEnum.CLIENT_PROPERTIES),
    component: 'Input',
    slot: RabbitmqFieldsEnum.CLIENT_PROPERTIES,
  },
];