mirror of
https://github.com/usebruno/bruno.git
synced 2025-01-03 04:29:09 +01:00
alternate collection
This commit is contained in:
parent
dce96e0f13
commit
6fc1f4e94e
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { uuid } from 'utils/common';
|
import { uuid } from 'utils/common';
|
||||||
import { IconFiles, IconRun, IconEye, IconSettings } from '@tabler/icons';
|
import { IconRun, IconEye, IconSettings, IconAB2 } from '@tabler/icons';
|
||||||
import EnvironmentSelector from 'components/Environments/EnvironmentSelector';
|
import EnvironmentSelector from 'components/Environments/EnvironmentSelector';
|
||||||
import GlobalEnvironmentSelector from 'components/GlobalEnvironments/EnvironmentSelector';
|
import GlobalEnvironmentSelector from 'components/GlobalEnvironments/EnvironmentSelector';
|
||||||
import { addTab } from 'providers/ReduxStore/slices/tabs';
|
import { addTab } from 'providers/ReduxStore/slices/tabs';
|
||||||
@ -9,7 +9,7 @@ import ToolHint from 'components/ToolHint';
|
|||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import JsSandboxMode from 'components/SecuritySettings/JsSandboxMode';
|
import JsSandboxMode from 'components/SecuritySettings/JsSandboxMode';
|
||||||
|
|
||||||
const CollectionToolBar = ({ collection }) => {
|
const CollectionToolBar = ({ collection, onClick }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const handleRun = () => {
|
const handleRun = () => {
|
||||||
@ -45,9 +45,9 @@ const CollectionToolBar = ({ collection }) => {
|
|||||||
return (
|
return (
|
||||||
<StyledWrapper>
|
<StyledWrapper>
|
||||||
<div className="flex items-center p-2">
|
<div className="flex items-center p-2">
|
||||||
<div className="flex flex-1 items-center cursor-pointer hover:underline" onClick={viewCollectionSettings}>
|
<div className="flex flex-1 items-center cursor-pointer hover:underline" onClick={onClick} >
|
||||||
<IconFiles size={18} strokeWidth={1.5} />
|
<span className="ml-2 mr-2 font-semibold" >{collection?.name}</span>
|
||||||
<span className="ml-2 mr-4 font-semibold">{collection?.name}</span>
|
<IconAB2 size={18} strokeWidth={1.5} />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-3 items-center justify-end">
|
<div className="flex flex-3 items-center justify-end">
|
||||||
<span className="mr-2">
|
<span className="mr-2">
|
||||||
|
@ -20,6 +20,25 @@ const RequestTabs = () => {
|
|||||||
const leftSidebarWidth = useSelector((state) => state.app.leftSidebarWidth);
|
const leftSidebarWidth = useSelector((state) => state.app.leftSidebarWidth);
|
||||||
const screenWidth = useSelector((state) => state.app.screenWidth);
|
const screenWidth = useSelector((state) => state.app.screenWidth);
|
||||||
|
|
||||||
|
|
||||||
|
const otherCollection = () => {
|
||||||
|
|
||||||
|
let currentCollectionUid = activeTab.collectionUid
|
||||||
|
let index = collections.findIndex((collection) => collection.uid === currentCollectionUid);
|
||||||
|
let otherTab = null
|
||||||
|
|
||||||
|
while (otherTab == null) {
|
||||||
|
index = (index + 1) % collections.length
|
||||||
|
currentCollectionUid = collections[index].uid
|
||||||
|
otherTab = find(tabs, (t) => t.collectionUid === collections[index].uid);
|
||||||
|
}
|
||||||
|
dispatch(
|
||||||
|
focusTab({
|
||||||
|
uid: otherTab.uid
|
||||||
|
})
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
const getTabClassname = (tab, index) => {
|
const getTabClassname = (tab, index) => {
|
||||||
return classnames('request-tab select-none', {
|
return classnames('request-tab select-none', {
|
||||||
active: tab.uid === activeTabUid,
|
active: tab.uid === activeTabUid,
|
||||||
@ -83,7 +102,7 @@ const RequestTabs = () => {
|
|||||||
)}
|
)}
|
||||||
{collectionRequestTabs && collectionRequestTabs.length ? (
|
{collectionRequestTabs && collectionRequestTabs.length ? (
|
||||||
<>
|
<>
|
||||||
<CollectionToolBar collection={activeCollection} />
|
<CollectionToolBar collection={activeCollection} onClick={otherCollection} />
|
||||||
<div className="flex items-center pl-4">
|
<div className="flex items-center pl-4">
|
||||||
<ul role="tablist">
|
<ul role="tablist">
|
||||||
{showChevrons ? (
|
{showChevrons ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user