mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-20 19:58:10 +02:00
Added ability to run a single item
This commit is contained in:
parent
3f80a4dfa2
commit
738c6af797
@ -8,6 +8,7 @@ import { useSelector, useDispatch } from 'react-redux';
|
|||||||
import { addTab, focusTab } from 'providers/ReduxStore/slices/tabs';
|
import { addTab, focusTab } from 'providers/ReduxStore/slices/tabs';
|
||||||
import { collectionFolderClicked } from 'providers/ReduxStore/slices/collections';
|
import { collectionFolderClicked } from 'providers/ReduxStore/slices/collections';
|
||||||
import { moveItem } from 'providers/ReduxStore/slices/collections/actions';
|
import { moveItem } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
import { sendRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
import Dropdown from 'components/Dropdown';
|
import Dropdown from 'components/Dropdown';
|
||||||
import NewRequest from 'components/Sidebar/NewRequest';
|
import NewRequest from 'components/Sidebar/NewRequest';
|
||||||
import NewFolder from 'components/Sidebar/NewFolder';
|
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) => <NetworkError onClose={() => toast.dismiss(t.id)} />, {
|
||||||
|
duration: 5000
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const handleClick = (event) => {
|
const handleClick = (event) => {
|
||||||
//scroll to the active tab
|
//scroll to the active tab
|
||||||
setTimeout(scrollToTheActiveTab, 50);
|
setTimeout(scrollToTheActiveTab, 50);
|
||||||
@ -297,6 +306,7 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
|||||||
Rename
|
Rename
|
||||||
</div>
|
</div>
|
||||||
{!isFolder && (
|
{!isFolder && (
|
||||||
|
<>
|
||||||
<div
|
<div
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@ -306,6 +316,17 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
|||||||
>
|
>
|
||||||
Clone
|
Clone
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={(e) => {
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
handleClick(null);
|
||||||
|
handleRun();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Run
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
{!isFolder && item.type === 'http-request' && (
|
{!isFolder && item.type === 'http-request' && (
|
||||||
<div
|
<div
|
||||||
|
Loading…
x
Reference in New Issue
Block a user