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 8c3da90a7..4a81f59af 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 @@ -23,43 +23,53 @@ const RunCollectionItem = ({ collection, item, onClose }) => { onClose(); }; - const runLength = item ? get(item, 'items.length', 0) : get(collection, 'items.length', 0); - const items = flattenItems(item ? item.items : collection.items); - const requestItems = items.filter((item) => item.type !== 'folder'); - const recursiveRunLength = requestItems.length; + const getRequestsCount = (items) => { + const requestTypes = ['http-request', 'graphql-request'] + return items.filter(req => requestTypes.includes(req.type)).length; + } + + const runLength = item ? getRequestsCount(item.items) : get(collection, 'items.length', 0); + const flattenedItems = flattenItems(item ? item.items : collection.items); + const recursiveRunLength = getRequestsCount(flattenedItems); return ( -
- Run - ({runLength} requests) -
-
This will only run the requests in this folder.
+ {!runLength && !recursiveRunLength ? ( +
No request found in this folder.
+ ) : ( +
+
+ Run + ({runLength} requests) +
+
This will only run the requests in this folder.
-
- Recursive Run - ({recursiveRunLength} requests) -
-
This will run all the requests in this folder and all its subfolders.
+
+ Recursive Run + ({recursiveRunLength} requests) +
+
This will run all the requests in this folder and all its subfolders.
-
- - - - - - - - - -
+
+ + + + + + + + + +
+
+ )}
);