File size: 4,454 Bytes
c9d0005
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
export const settings = [
  {
    title: '开始', // 节点名称
    type: 'Start',
    hidden: true,
    targetHandleHidden: true,
    icon: {
      // 图标描述
      type: 'icon-start', // icon-font
      bgColor: '#17B26A', // 图标背景颜色
    },
    nodePanel: {
      width: 600,
      hideDesc: false,
    },
    settingSchema: {
      // 自定义节点配置
      type: 'object',
      properties: {
        input: {
          title: '变量一',
          type: 'string',
          widget: 'input',
        },
        select: {
          title: '变量二',
          type: 'string',
          widget: 'select',
          props: {
            options: [
              { label: 'a', value: 'a' },
              { label: 'b', value: 'b' },
              { label: 'c', value: 'c' },
            ],
          },
        },
        radio1: {
          title: '点击单选',
          type: 'string',
          widget: 'radio',
          props: {
            options: [
              { label: '早', value: 'a' },
              { label: '中', value: 'b' },
              { label: '晚', value: 'c' },
            ],
          },
        },
        textarea1: {
          title: '长文本',
          type: 'string',
          widget: 'textArea',
        },
        date1: {
          title: '日期选择',
          type: 'string',
          widget: 'datePicker',
        },
        dateRange1: {
          title: '日期范围',
          type: 'range',
          widget: 'dateRange',
        },
        time1: {
          title: '时间选择',
          type: 'string',
          widget: 'timePicker',
        },
        timeRange1: {
          title: '时间范围',
          type: 'range',
          widget: 'timeRange',
        },
      },
    },
  },
  {
    title: '结束',
    type: 'End',
    hidden: true,
    sourceHandleHidden: true,
    icon: {
      type: 'icon-end',
      bgColor: '#F79009',
    },
    settingSchema: {
      type: 'object',
      properties: {
        input: {
          title: '变量一',
          type: 'string',
          widget: 'input',
        },
        select: {
          title: '变量二',
          type: 'string',
          widget: 'select',
          props: {
            options: [
              { label: 'a', value: 'a' },
              { label: 'b', value: 'b' },
              { label: 'c', value: 'c' },
            ],
          },
        },
      },
    },
  },
  {
    title: 'Switch',
    type: 'Switch',
    description: '允许你根据 if/else 条件将 workflow 拆分成两个分支',
    icon: {
      type: 'icon-switch',
      bgColor: '#06AED4',
    },
    onTesting: (node, nodes) => {
      console.log("单点调试",node,nodes)
    },
  },
  {
    title: '工具',
    type: 'tool',
    description: '允许使用工具能力',
    icon: {
      type: 'icon-gongju',
      bgColor: '#2E90FA',
    },
  },
  {
    title: '工具',
    type: '_group', // 节点分组
    items: [
      {
        title: '代码执行',
        type: 'Code',
        description: '执行一段 Groovy 或 Python 或 NodeJS 代码实现自定义逻辑',
      },
      {
        title: '工具',
        type: 'tool',
        description: '允许使用工具能力',
        icon: {
          type: 'icon-gongju',
          bgColor: '#2E90FA',
        },
      },
    ],
  },
];

export const nodes = [
  {
    type: 'Start',
    id: '1',
    position: { x: -35, y: 268 },
  },
  {
    type: 'Switch',
    id: 'b6zsd6w5ah2b209t',
    position: { x: 277.5, y: 268 },
    data: {
      list: [
        {
          _id: 'iawoyh5niyi6zjob',
        },
      ],
    },
  },
  {
    type: 'Code',
    id: '3',
    position: { x: 675, y: 123.75 },
  },
  {
    type: 'tool',
    id: '4',
    position: { x: 686.25, y: 495 },
  },
  {
    type: 'End',
    id: '5',
    position: { x: 1176.2499999999998, y: 281.25 },
  },
];
export const edges = [
  {
    source: '3',
    target: '5',
    id: 'e3-5',
  },
  {
    source: '4',
    target: '5',
    id: 'e4-5',
  },
  {
    id: 'px7fsmha99pju315',
    source: '1',
    target: 'b6zsd6w5ah2b209t',
  },
  {
    type: 'buttonedge',
    source: 'b6zsd6w5ah2b209t',
    sourceHandle: 'iawoyh5niyi6zjob',
    target: '3',
    id: 'xy-edge__b6zsd6w5ah2b209tiawoyh5niyi6zjob-3',
  },
  {
    type: 'buttonedge',
    source: 'b6zsd6w5ah2b209t',
    sourceHandle: 'id_else',
    target: '4',
    id: 'xy-edge__b6zsd6w5ah2b209tid_else-4',
  },
];