import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import useConfig from './use-config' import ApiInput from './components/api-input' import KeyValue from './components/key-value' import EditBody from './components/edit-body' import AuthorizationModal from './components/authorization' import type { HttpNodeType } from './types' import Timeout from './components/timeout' import cn from '@/utils/classnames' import Field from '@/app/components/workflow/nodes/_base/components/field' import Split from '@/app/components/workflow/nodes/_base/components/split' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import { Settings01 } from '@/app/components/base/icons/src/vender/line/general' import type { NodePanelProps } from '@/app/components/workflow/types' import BeforeRunForm from '@/app/components/workflow/nodes/_base/components/before-run-form' import ResultPanel from '@/app/components/workflow/run/result-panel' const i18nPrefix = 'workflow.nodes.http' const Panel: FC> = ({ id, data, }) => { const { t } = useTranslation() const { readOnly, isDataReady, inputs, handleMethodChange, handleUrlChange, headers, setHeaders, addHeader, params, setParams, addParam, setBody, isShowAuthorization, showAuthorization, hideAuthorization, setAuthorization, setTimeout, // single run isShowSingleRun, hideSingleRun, runningStatus, handleRun, handleStop, varInputs, inputVarValues, setInputVarValues, runResult, } = useConfig(id, data) // To prevent prompt editor in body not update data. if (!isDataReady) return null return (
{!readOnly && }
{t(`${i18nPrefix}.authorization.authorization`)} {t(`${i18nPrefix}.authorization.${inputs.authorization.type}`)}
} >
{(isShowAuthorization && !readOnly) && ( )}
<>
{isShowSingleRun && ( } /> )} ) } export default React.memo(Panel)