import { Button } from '@/components/ui/button'; import { Modal, ModalType } from '@/components/ui/modal/modal'; import { t } from 'i18next'; import { IDataSourceBase, IDataSourceInfoMap } from '../interface'; export type IDelSourceModalProps = Partial & { data?: T; type?: 'delete' | 'unlink'; onOk?: (data?: T) => void; dataSourceInfo: IDataSourceInfoMap; }; export const delSourceModal = ( props: IDelSourceModalProps, ) => { const { data, onOk, type = 'delete', dataSourceInfo, ...otherProps } = props; const config = { title: type === 'delete' ? t('setting.deleteSourceModalTitle') : t('dataflowParser.unlinkSourceModalTitle'), content: (
{type === 'delete' ? (
) : (
)}
{data?.source ? dataSourceInfo[data?.source].icon : ''}
{/*
{data?.source ? DataSourceInfo[data?.source].name : ''}
*/} {data?.name}
), confirmText: type === 'delete' ? t('setting.deleteSourceModalConfirmText') : t('dataflowParser.unlinkSourceModalConfirmText'), }; Modal.show({ visible: true, className: '!w-[560px]', ...otherProps, title: config.title, children: config.content, titleClassName: 'border-b border-border-button', onVisibleChange: () => { Modal.destroy(); }, footer: (
), }); };