diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js index b12cfde1..4393fe13 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js @@ -8,6 +8,7 @@ import { useSelector, useDispatch } from 'react-redux'; import { addTab, focusTab } from 'providers/ReduxStore/slices/tabs'; import { collectionFolderClicked } from 'providers/ReduxStore/slices/collections'; import { moveItem } from 'providers/ReduxStore/slices/collections/actions'; +import { sendRequest } from 'providers/ReduxStore/slices/collections/actions'; import Dropdown from 'components/Dropdown'; import NewRequest from 'components/Sidebar/NewRequest'; import NewFolder from 'components/Sidebar/NewFolder'; @@ -95,6 +96,14 @@ const CollectionItem = ({ item, collection, searchText }) => { } }; + const handleRun = async () => { + dispatch(sendRequest(item, collection.uid)).catch((err) => + toast.custom((t) => toast.dismiss(t.id)} />, { + duration: 5000 + }) + ); + }; + const handleClick = (event) => { //scroll to the active tab setTimeout(scrollToTheActiveTab, 50); @@ -297,15 +306,27 @@ const CollectionItem = ({ item, collection, searchText }) => { Rename {!isFolder && ( -
{ - dropdownTippyRef.current.hide(); - setCloneItemModalOpen(true); - }} - > - Clone -
+ <> +
{ + dropdownTippyRef.current.hide(); + setCloneItemModalOpen(true); + }} + > + Clone +
+
{ + dropdownTippyRef.current.hide(); + handleClick(null); + handleRun(); + }} + > + Run +
+ )} {!isFolder && item.type === 'http-request' && (