mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-20 09:59:12 +08:00
fix: update operate and value
This commit is contained in:
parent
876ea90fe9
commit
7ad409b3d9
@ -68,21 +68,28 @@ const ConditionItem = ({
|
|||||||
|
|
||||||
const [isHovered, setIsHovered] = useState(false)
|
const [isHovered, setIsHovered] = useState(false)
|
||||||
|
|
||||||
|
const doUpdateCondition = useCallback((newCondition: Condition) => {
|
||||||
|
if (isSubVariableKey)
|
||||||
|
onUpdateSubVariableCondition?.(caseId, conditionId, condition.id, newCondition)
|
||||||
|
else
|
||||||
|
onUpdateCondition(caseId, condition.id, newCondition)
|
||||||
|
}, [caseId, condition, conditionId, isSubVariableKey, onUpdateCondition, onUpdateSubVariableCondition])
|
||||||
|
|
||||||
const handleUpdateConditionOperator = useCallback((value: ComparisonOperator) => {
|
const handleUpdateConditionOperator = useCallback((value: ComparisonOperator) => {
|
||||||
const newCondition = {
|
const newCondition = {
|
||||||
...condition,
|
...condition,
|
||||||
comparison_operator: value,
|
comparison_operator: value,
|
||||||
}
|
}
|
||||||
onUpdateCondition(caseId, condition.id, newCondition)
|
doUpdateCondition(newCondition)
|
||||||
}, [caseId, condition, onUpdateCondition])
|
}, [condition, doUpdateCondition])
|
||||||
|
|
||||||
const handleUpdateConditionValue = useCallback((value: string) => {
|
const handleUpdateConditionValue = useCallback((value: string) => {
|
||||||
const newCondition = {
|
const newCondition = {
|
||||||
...condition,
|
...condition,
|
||||||
value,
|
value,
|
||||||
}
|
}
|
||||||
onUpdateCondition(caseId, condition.id, newCondition)
|
doUpdateCondition(newCondition)
|
||||||
}, [caseId, condition, onUpdateCondition])
|
}, [condition, doUpdateCondition])
|
||||||
|
|
||||||
const handleUpdateConditionNumberVarType = useCallback((numberVarType: NumberVarType) => {
|
const handleUpdateConditionNumberVarType = useCallback((numberVarType: NumberVarType) => {
|
||||||
const newCondition = {
|
const newCondition = {
|
||||||
|
|||||||
@ -40,8 +40,8 @@ type Props = {
|
|||||||
|
|
||||||
const ConditionWrap: FC<Props> = ({
|
const ConditionWrap: FC<Props> = ({
|
||||||
isSubVariable,
|
isSubVariable,
|
||||||
caseId: conditionParentCaseId,
|
caseId,
|
||||||
conditionId: parentConditionId,
|
conditionId,
|
||||||
nodeId: id,
|
nodeId: id,
|
||||||
cases = [],
|
cases = [],
|
||||||
readOnly,
|
readOnly,
|
||||||
@ -118,8 +118,8 @@ const ConditionWrap: FC<Props> = ({
|
|||||||
<ConditionList
|
<ConditionList
|
||||||
disabled={readOnly}
|
disabled={readOnly}
|
||||||
caseItem={item}
|
caseItem={item}
|
||||||
caseId={isSubVariable ? conditionParentCaseId! : item.case_id}
|
caseId={isSubVariable ? caseId! : item.case_id}
|
||||||
conditionId={parentConditionId}
|
conditionId={conditionId}
|
||||||
onUpdateCondition={handleUpdateCondition}
|
onUpdateCondition={handleUpdateCondition}
|
||||||
onRemoveCondition={handleRemoveCondition}
|
onRemoveCondition={handleRemoveCondition}
|
||||||
onUpdateConditionLogicalOperator={handleUpdateConditionLogicalOperator}
|
onUpdateConditionLogicalOperator={handleUpdateConditionLogicalOperator}
|
||||||
@ -146,7 +146,7 @@ const ConditionWrap: FC<Props> = ({
|
|||||||
<Button
|
<Button
|
||||||
size='small'
|
size='small'
|
||||||
disabled={readOnly}
|
disabled={readOnly}
|
||||||
onClick={() => handleAddSubVariableCondition?.(conditionParentCaseId!, parentConditionId!)}
|
onClick={() => handleAddSubVariableCondition?.(caseId!, conditionId!)}
|
||||||
>
|
>
|
||||||
<RiAddLine className='mr-1 w-3.5 h-3.5' />
|
<RiAddLine className='mr-1 w-3.5 h-3.5' />
|
||||||
{t('workflow.nodes.ifElse.addSubVariable')}
|
{t('workflow.nodes.ifElse.addSubVariable')}
|
||||||
@ -190,7 +190,7 @@ const ConditionWrap: FC<Props> = ({
|
|||||||
<Button
|
<Button
|
||||||
size='small'
|
size='small'
|
||||||
disabled={readOnly}
|
disabled={readOnly}
|
||||||
onClick={() => handleAddSubVariableCondition?.(conditionParentCaseId!, parentConditionId!)}
|
onClick={() => handleAddSubVariableCondition?.(caseId!, conditionId!)}
|
||||||
>
|
>
|
||||||
<RiAddLine className='mr-1 w-3.5 h-3.5' />
|
<RiAddLine className='mr-1 w-3.5 h-3.5' />
|
||||||
{t('workflow.nodes.ifElse.addSubVariable')}
|
{t('workflow.nodes.ifElse.addSubVariable')}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user