From 738c6af79773de40508c91addf31c35cbafb45ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Dathueyt?= Date: Wed, 22 Nov 2023 08:49:37 +0100 Subject: [PATCH 1/2] Added ability to run a single item --- .../Collection/CollectionItem/index.js | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) 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 b12cfde157..4393fe131b 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' && (
Date: Wed, 22 Nov 2023 09:05:23 +0100 Subject: [PATCH 2/2] Added missing import --- .../Sidebar/Collections/Collection/CollectionItem/index.js | 1 + 1 file changed, 1 insertion(+) 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 4393fe131b..a90e2bd296 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 @@ -24,6 +24,7 @@ import { getDefaultRequestPaneTab } from 'utils/collections'; import { hideHomePage } from 'providers/ReduxStore/slices/app'; import toast from 'react-hot-toast'; import StyledWrapper from './StyledWrapper'; +import NetworkError from 'components/ResponsePane/NetworkError/index'; const CollectionItem = ({ item, collection, searchText }) => { const tabs = useSelector((state) => state.tabs.tabs);