mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 11:05:59 +08:00
### What problem does this PR solve? feat: deleting a node does not require a confirmation box to pop up #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
25a8c076bf
commit
957cd55e4a
@ -11,6 +11,7 @@ interface IProps {
|
|||||||
iconFontSize?: number;
|
iconFontSize?: number;
|
||||||
items?: MenuProps['items'];
|
items?: MenuProps['items'];
|
||||||
height?: number;
|
height?: number;
|
||||||
|
needsDeletionValidation?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const OperateDropdown = ({
|
const OperateDropdown = ({
|
||||||
@ -19,12 +20,17 @@ const OperateDropdown = ({
|
|||||||
iconFontSize = 30,
|
iconFontSize = 30,
|
||||||
items: otherItems = [],
|
items: otherItems = [],
|
||||||
height = 24,
|
height = 24,
|
||||||
|
needsDeletionValidation = true,
|
||||||
}: React.PropsWithChildren<IProps>) => {
|
}: React.PropsWithChildren<IProps>) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const showDeleteConfirm = useShowDeleteConfirm();
|
const showDeleteConfirm = useShowDeleteConfirm();
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
showDeleteConfirm({ onOk: deleteItem });
|
if (needsDeletionValidation) {
|
||||||
|
showDeleteConfirm({ onOk: deleteItem });
|
||||||
|
} else {
|
||||||
|
deleteItem();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDropdownMenuClick: MenuProps['onClick'] = ({ domEvent, key }) => {
|
const handleDropdownMenuClick: MenuProps['onClick'] = ({ domEvent, key }) => {
|
||||||
|
@ -41,6 +41,7 @@ const NodeDropdown = ({ id }: IProps) => {
|
|||||||
height={14}
|
height={14}
|
||||||
deleteItem={deleteNode}
|
deleteItem={deleteNode}
|
||||||
items={items}
|
items={items}
|
||||||
|
needsDeletionValidation={false}
|
||||||
></OperateDropdown>
|
></OperateDropdown>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user