balibabu commited on
Commit
8fb1944
·
1 Parent(s): b2b0160

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

Browse files

### 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)

web/src/components/operate-dropdown/index.tsx CHANGED
@@ -11,6 +11,7 @@ interface IProps {
11
  iconFontSize?: number;
12
  items?: MenuProps['items'];
13
  height?: number;
 
14
  }
15
 
16
  const OperateDropdown = ({
@@ -19,12 +20,17 @@ const OperateDropdown = ({
19
  iconFontSize = 30,
20
  items: otherItems = [],
21
  height = 24,
 
22
  }: React.PropsWithChildren<IProps>) => {
23
  const { t } = useTranslation();
24
  const showDeleteConfirm = useShowDeleteConfirm();
25
 
26
  const handleDelete = () => {
27
- showDeleteConfirm({ onOk: deleteItem });
 
 
 
 
28
  };
29
 
30
  const handleDropdownMenuClick: MenuProps['onClick'] = ({ domEvent, key }) => {
 
11
  iconFontSize?: number;
12
  items?: MenuProps['items'];
13
  height?: number;
14
+ needsDeletionValidation?: boolean;
15
  }
16
 
17
  const OperateDropdown = ({
 
20
  iconFontSize = 30,
21
  items: otherItems = [],
22
  height = 24,
23
+ needsDeletionValidation = true,
24
  }: React.PropsWithChildren<IProps>) => {
25
  const { t } = useTranslation();
26
  const showDeleteConfirm = useShowDeleteConfirm();
27
 
28
  const handleDelete = () => {
29
+ if (needsDeletionValidation) {
30
+ showDeleteConfirm({ onOk: deleteItem });
31
+ } else {
32
+ deleteItem();
33
+ }
34
  };
35
 
36
  const handleDropdownMenuClick: MenuProps['onClick'] = ({ domEvent, key }) => {
web/src/pages/flow/canvas/node/dropdown.tsx CHANGED
@@ -41,6 +41,7 @@ const NodeDropdown = ({ id }: IProps) => {
41
  height={14}
42
  deleteItem={deleteNode}
43
  items={items}
 
44
  ></OperateDropdown>
45
  );
46
  };
 
41
  height={14}
42
  deleteItem={deleteNode}
43
  items={items}
44
+ needsDeletionValidation={false}
45
  ></OperateDropdown>
46
  );
47
  };