create.config.ts
1.17 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
import { useRuleChainI18n } from '../../../hook/useRuleChainI18n';
import {
JavascriptEditorWithTestModal,
ScriptEditorValueType,
} from '../../../src/components/JavaScriptFilterModal';
import { DefaultNodeConfig } from '../../../types/node';
import { FormSchema, useComponentRegister } from '/@/components/Form';
const { tLabel, t } = useRuleChainI18n('action', 'log');
useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal);
export interface FormFieldsValue {
[LogFieldsEnum.JS_SCRIPT]: ScriptEditorValueType;
}
export interface NodeConfigValue extends DefaultNodeConfig, ScriptEditorValueType {}
export enum LogFieldsEnum {
JS_SCRIPT = 'jsScript',
}
export const formSchemas: FormSchema[] = [
{
field: LogFieldsEnum.JS_SCRIPT,
component: 'JavascriptEditorWithTestModal',
label: tLabel(LogFieldsEnum.JS_SCRIPT),
valueField: 'value',
changeEvent: 'update:value',
componentProps: {
javaScriptEditorProps: {
functionName: 'ToString',
scriptType: 'string',
paramsName: ['msg', 'metadata', 'msgType'],
},
buttonName: t('rule.chain.action.log.fields.jsScriptButtonName'),
},
},
];