import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import { RiArrowRightSLine, } from '@remixicon/react' import VarReferencePicker from '../_base/components/variable/var-reference-picker' import Split from '../_base/components/split' import ResultPanel from '../../run/result-panel' import IterationResultPanel from '../../run/iteration-result-panel' import { MAX_ITERATION_PARALLEL_NUM, MIN_ITERATION_PARALLEL_NUM } from '../../constants' import type { IterationNodeType } from './types' import useConfig from './use-config' import { ErrorHandleMode, InputVarType, type NodePanelProps } from '@/app/components/workflow/types' import Field from '@/app/components/workflow/nodes/_base/components/field' import BeforeRunForm from '@/app/components/workflow/nodes/_base/components/before-run-form' import Switch from '@/app/components/base/switch' import Select from '@/app/components/base/select' import Slider from '@/app/components/base/slider' import Input from '@/app/components/base/input' import Divider from '@/app/components/base/divider' const i18nPrefix = 'workflow.nodes.iteration' const Panel: FC> = ({ id, data, }) => { const { t } = useTranslation() const responseMethod = [ { value: ErrorHandleMode.Terminated, name: t(`${i18nPrefix}.ErrorMethod.operationTerminated`), }, { value: ErrorHandleMode.ContinueOnError, name: t(`${i18nPrefix}.ErrorMethod.continueOnError`), }, { value: ErrorHandleMode.RemoveAbnormalOutput, name: t(`${i18nPrefix}.ErrorMethod.removeAbnormalOutput`), }, ] const { readOnly, inputs, filterInputVar, handleInputChange, childrenNodeVars, iterationChildrenNodes, handleOutputVarChange, isShowSingleRun, hideSingleRun, isShowIterationDetail, backToSingleRun, showIterationDetail, hideIterationDetail, runningStatus, handleRun, handleStop, runResult, inputVarValues, setInputVarValues, usedOutVars, iterator, setIterator, iteratorInputKey, iterationRunResult, changeParallel, changeErrorResponseMode, changeParallelNums, } = useConfig(id, data) return (
Array
)} >
Array
)} >
{t(`${i18nPrefix}.parallelPanelDesc`)}
} inline> { inputs.is_parallel && (
{t(`${i18nPrefix}.MaxParallelismDesc`)}
}>
{ changeParallelNums(Number(e.target.value)) }} />
) }
{isShowSingleRun && ( setIterator((keyValue as any)[iteratorInputKey]), }, ]} runningStatus={runningStatus} onRun={handleRun} onStop={handleStop} result={
{t(`${i18nPrefix}.iteration`, { count: iterationRunResult.length })}
} /> )} {isShowIterationDetail && ( )} ) } export default React.memo(Panel)