import CopyToClipboard from '@/components/copy-to-clipboard'; import { useDebugSingle, useFetchInputElements } from '@/hooks/flow-hooks'; import { IModalProps } from '@/interfaces/common'; import { CloseOutlined } from '@ant-design/icons'; import { Drawer } from 'antd'; import { isEmpty } from 'lodash'; import { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import JsonView from 'react18-json-view'; import 'react18-json-view/src/style.css'; import DebugContent from '../../debug-content'; interface IProps { componentId?: string; } const SingleDebugDrawer = ({ componentId, visible, hideModal, }: IModalProps & IProps) => { const { t } = useTranslation(); const { data: list } = useFetchInputElements(componentId); const { debugSingle, data, loading } = useDebugSingle(); const onOk = useCallback( (nextValues: any[]) => { if (componentId) { debugSingle({ component_id: componentId, params: nextValues }); } }, [componentId, debugSingle], ); const content = JSON.stringify(data, null, 2); return ( {t('flow.testRun')} } width={'100%'} onClose={hideModal} open={visible} getContainer={false} mask={false} placement={'bottom'} height={'95%'} closeIcon={null} >
{!isEmpty(data) ? (
JSON
) : null}
); }; export default SingleDebugDrawer;