From 361add3385472a575e6acd6f2619093d2706274c Mon Sep 17 00:00:00 2001 From: lohit Date: Tue, 13 May 2025 19:41:39 +0530 Subject: [PATCH] handle folder run action while a collection run is in progress (#4658) Co-authored-by: lohit --- .../CollectionItem/RunCollectionItem/index.js | 49 ++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RunCollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RunCollectionItem/index.js index 8aaaa749c..f56d408b0 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RunCollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RunCollectionItem/index.js @@ -13,6 +13,7 @@ const RunCollectionItem = ({ collectionUid, item, onClose }) => { const dispatch = useDispatch(); const collection = useSelector(state => state.collections.collections?.find(c => c.uid === collectionUid)); + const isCollectionRunInProgress = collection?.runnerResult?.info?.status && (collection?.runnerResult?.info?.status !== 'ended'); const onSubmit = (recursive) => { dispatch( @@ -22,10 +23,24 @@ const RunCollectionItem = ({ collectionUid, item, onClose }) => { type: 'collection-runner' }) ); - dispatch(runCollectionFolder(collection.uid, item ? item.uid : null, recursive)); + if (!isCollectionRunInProgress) { + dispatch(runCollectionFolder(collection.uid, item ? item.uid : null, recursive)); + } onClose(); }; + const handleViewRunner = (e) => { + e.preventDefault(); + dispatch( + addTab({ + uid: uuid(), + collectionUid: collection.uid, + type: 'collection-runner' + }) + ); + onClose(); + } + const getRequestsCount = (items) => { const requestTypes = ['http-request', 'graphql-request'] return items.filter(req => requestTypes.includes(req.type)).length; @@ -55,22 +70,34 @@ const RunCollectionItem = ({ collectionUid, item, onClose }) => {
This will run all the requests in this folder and all its subfolders.
{isFolderLoading ?
Requests in this folder are still loading.
: null} + {isCollectionRunInProgress ?
A Collection Run is already in progress.
: null}
- - - - - - + { + isCollectionRunInProgress ? + + + + : + <> + + + + + + + + }
)}