mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: restrict classification operators cannot be connected to Answer and other classification #918 (#1294)
### What problem does this PR solve? feat: restrict classification operators cannot be connected to Answer and other classification #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
47
web/src/pages/flow/canvas/node/dropdown.tsx
Normal file
47
web/src/pages/flow/canvas/node/dropdown.tsx
Normal file
@ -0,0 +1,47 @@
|
||||
import OperateDropdown from '@/components/operate-dropdown';
|
||||
import { CopyOutlined } from '@ant-design/icons';
|
||||
import { Flex, MenuProps } from 'antd';
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import useGraphStore from '../../store';
|
||||
|
||||
interface IProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
const NodeDropdown = ({ id }: IProps) => {
|
||||
const { t } = useTranslation();
|
||||
const deleteNodeById = useGraphStore((store) => store.deleteNodeById);
|
||||
const duplicateNodeById = useGraphStore((store) => store.duplicateNode);
|
||||
|
||||
const deleteNode = useCallback(() => {
|
||||
deleteNodeById(id);
|
||||
}, [id, deleteNodeById]);
|
||||
|
||||
const duplicateNode = useCallback(() => {
|
||||
duplicateNodeById(id);
|
||||
}, [id, duplicateNodeById]);
|
||||
|
||||
const items: MenuProps['items'] = [
|
||||
{
|
||||
key: '2',
|
||||
onClick: duplicateNode,
|
||||
label: (
|
||||
<Flex justify={'space-between'}>
|
||||
{t('common.copy')}
|
||||
<CopyOutlined />
|
||||
</Flex>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<OperateDropdown
|
||||
iconFontSize={14}
|
||||
deleteItem={deleteNode}
|
||||
items={items}
|
||||
></OperateDropdown>
|
||||
);
|
||||
};
|
||||
|
||||
export default NodeDropdown;
|
||||
Reference in New Issue
Block a user