balibabu
commited on
Commit
·
edf3ea6
1
Parent(s):
6e795a0
feat: Delete Answer and Relevant from RestrictedUpstreamMap of Switch #1739 (#2039)
Browse files### What problem does this PR solve?
feat: Delete Answer and Relevant from RestrictedUpstreamMap of Switch
#1739
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
web/src/locales/zh-traditional.ts
CHANGED
@@ -563,7 +563,7 @@ export default {
|
|
563 |
yes: '是',
|
564 |
no: '否',
|
565 |
key: 'key',
|
566 |
-
componentId: '組件
|
567 |
add: '新增',
|
568 |
operation: '操作',
|
569 |
run: '運行',
|
|
|
563 |
yes: '是',
|
564 |
no: '否',
|
565 |
key: 'key',
|
566 |
+
componentId: '組件ID',
|
567 |
add: '新增',
|
568 |
operation: '操作',
|
569 |
run: '運行',
|
web/src/locales/zh.ts
CHANGED
@@ -582,7 +582,7 @@ export default {
|
|
582 |
yes: '是',
|
583 |
no: '否',
|
584 |
key: 'key',
|
585 |
-
componentId: '组件
|
586 |
add: '新增',
|
587 |
operation: '操作',
|
588 |
run: '运行',
|
|
|
582 |
yes: '是',
|
583 |
no: '否',
|
584 |
key: 'key',
|
585 |
+
componentId: '组件ID',
|
586 |
add: '新增',
|
587 |
operation: '操作',
|
588 |
run: '运行',
|
web/src/pages/flow/constant.tsx
CHANGED
@@ -471,7 +471,7 @@ export const RestrictedUpstreamMap = {
|
|
471 |
[Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval],
|
472 |
[Operator.QWeather]: [Operator.Begin, Operator.Retrieval],
|
473 |
[Operator.ExeSQL]: [Operator.Begin],
|
474 |
-
[Operator.Switch]: [Operator.Begin
|
475 |
};
|
476 |
|
477 |
export const NodeMap = {
|
|
|
471 |
[Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval],
|
472 |
[Operator.QWeather]: [Operator.Begin, Operator.Retrieval],
|
473 |
[Operator.ExeSQL]: [Operator.Begin],
|
474 |
+
[Operator.Switch]: [Operator.Begin],
|
475 |
};
|
476 |
|
477 |
export const NodeMap = {
|
web/src/pages/flow/switch-form/index.tsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import { CloseOutlined } from '@ant-design/icons';
|
2 |
-
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
3 |
import { useMemo } from 'react';
|
4 |
import { useTranslation } from 'react-i18next';
|
5 |
import {
|
@@ -14,11 +14,11 @@ import { IOperatorForm, ISwitchForm } from '../interface';
|
|
14 |
import { getOtherFieldValues } from '../utils';
|
15 |
|
16 |
const subLabelCol = {
|
17 |
-
span:
|
18 |
};
|
19 |
|
20 |
const subWrapperCol = {
|
21 |
-
span:
|
22 |
};
|
23 |
|
24 |
const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
@@ -53,27 +53,21 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|
53 |
|
54 |
return (
|
55 |
<Form
|
56 |
-
labelCol={{ span:
|
57 |
-
wrapperCol={{ span:
|
58 |
form={form}
|
59 |
name="dynamic_form_complex"
|
60 |
autoComplete="off"
|
61 |
initialValues={{ conditions: [{}] }}
|
62 |
onValuesChange={onValuesChange}
|
63 |
>
|
64 |
-
<Form.Item label={t('flow.to')} name={[SwitchElseTo]}>
|
65 |
-
<Select
|
66 |
-
allowClear
|
67 |
-
options={buildCategorizeToOptions(getSelectedConditionTos())}
|
68 |
-
/>
|
69 |
-
</Form.Item>
|
70 |
<Form.List name="conditions">
|
71 |
{(fields, { add, remove }) => (
|
72 |
<div style={{ display: 'flex', rowGap: 16, flexDirection: 'column' }}>
|
73 |
{fields.map((field) => (
|
74 |
<Card
|
75 |
size="small"
|
76 |
-
title={`
|
77 |
key={field.key}
|
78 |
extra={
|
79 |
<CloseOutlined
|
@@ -105,7 +99,7 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|
105 |
])}
|
106 |
/>
|
107 |
</Form.Item>
|
108 |
-
<Form.Item label="
|
109 |
<Form.List name={[field.name, 'items']}>
|
110 |
{(subFields, subOpt) => (
|
111 |
<div
|
@@ -165,7 +159,7 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|
165 |
onClick={() => subOpt.add()}
|
166 |
block
|
167 |
>
|
168 |
-
+
|
169 |
</Button>
|
170 |
</div>
|
171 |
)}
|
@@ -175,11 +169,18 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|
175 |
))}
|
176 |
|
177 |
<Button type="dashed" onClick={() => add()} block>
|
178 |
-
+
|
179 |
</Button>
|
180 |
</div>
|
181 |
)}
|
182 |
</Form.List>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
<Form.Item noStyle shouldUpdate>
|
185 |
{() => (
|
|
|
1 |
import { CloseOutlined } from '@ant-design/icons';
|
2 |
+
import { Button, Card, Divider, Form, Input, Select, Typography } from 'antd';
|
3 |
import { useMemo } from 'react';
|
4 |
import { useTranslation } from 'react-i18next';
|
5 |
import {
|
|
|
14 |
import { getOtherFieldValues } from '../utils';
|
15 |
|
16 |
const subLabelCol = {
|
17 |
+
span: 11,
|
18 |
};
|
19 |
|
20 |
const subWrapperCol = {
|
21 |
+
span: 13,
|
22 |
};
|
23 |
|
24 |
const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|
|
53 |
|
54 |
return (
|
55 |
<Form
|
56 |
+
labelCol={{ span: 8 }}
|
57 |
+
wrapperCol={{ span: 16 }}
|
58 |
form={form}
|
59 |
name="dynamic_form_complex"
|
60 |
autoComplete="off"
|
61 |
initialValues={{ conditions: [{}] }}
|
62 |
onValuesChange={onValuesChange}
|
63 |
>
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
<Form.List name="conditions">
|
65 |
{(fields, { add, remove }) => (
|
66 |
<div style={{ display: 'flex', rowGap: 16, flexDirection: 'column' }}>
|
67 |
{fields.map((field) => (
|
68 |
<Card
|
69 |
size="small"
|
70 |
+
title={`Case ${field.name + 1}`}
|
71 |
key={field.key}
|
72 |
extra={
|
73 |
<CloseOutlined
|
|
|
99 |
])}
|
100 |
/>
|
101 |
</Form.Item>
|
102 |
+
<Form.Item label="Condition">
|
103 |
<Form.List name={[field.name, 'items']}>
|
104 |
{(subFields, subOpt) => (
|
105 |
<div
|
|
|
159 |
onClick={() => subOpt.add()}
|
160 |
block
|
161 |
>
|
162 |
+
+ Add Condition
|
163 |
</Button>
|
164 |
</div>
|
165 |
)}
|
|
|
169 |
))}
|
170 |
|
171 |
<Button type="dashed" onClick={() => add()} block>
|
172 |
+
+ Add Case
|
173 |
</Button>
|
174 |
</div>
|
175 |
)}
|
176 |
</Form.List>
|
177 |
+
<Divider />
|
178 |
+
<Form.Item label={'ELSE'} name={[SwitchElseTo]}>
|
179 |
+
<Select
|
180 |
+
allowClear
|
181 |
+
options={buildCategorizeToOptions(getSelectedConditionTos())}
|
182 |
+
/>
|
183 |
+
</Form.Item>
|
184 |
|
185 |
<Form.Item noStyle shouldUpdate>
|
186 |
{() => (
|
web/src/pages/flow/utils.ts
CHANGED
@@ -232,5 +232,5 @@ export const getOtherFieldValues = (
|
|
232 |
);
|
233 |
|
234 |
export const generateSwitchHandleText = (idx: number) => {
|
235 |
-
return `
|
236 |
};
|
|
|
232 |
);
|
233 |
|
234 |
export const generateSwitchHandleText = (idx: number) => {
|
235 |
+
return `Case ${idx + 1}`;
|
236 |
};
|