Ver código fonte

feat: deleting a node does not require a confirmation box to pop up #918 (#1380)

### 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)
tags/v0.8.0
balibabu 1 ano atrás
pai
commit
957cd55e4a
Nenhuma conta vinculada ao e-mail do autor do commit

+ 7
- 1
web/src/components/operate-dropdown/index.tsx Ver arquivo

iconFontSize?: number; iconFontSize?: number;
items?: MenuProps['items']; items?: MenuProps['items'];
height?: number; height?: number;
needsDeletionValidation?: boolean;
} }


const OperateDropdown = ({ 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 }) => {

+ 1
- 0
web/src/pages/flow/canvas/node/dropdown.tsx Ver arquivo

height={14} height={14}
deleteItem={deleteNode} deleteItem={deleteNode}
items={items} items={items}
needsDeletionValidation={false}
></OperateDropdown> ></OperateDropdown>
); );
}; };

Carregando…
Cancelar
Salvar