import React from 'react'; import classnames from 'classnames'; import get from 'lodash/get'; import { updateSettingsSelectedTab } from 'providers/ReduxStore/slices/collections'; import { useDispatch } from 'react-redux'; import ProxySettings from './ProxySettings'; import ClientCertSettings from './ClientCertSettings'; import Headers from './Headers'; import Auth from './Auth'; import Script from './Script'; import Test from './Tests'; import Protobuf from './Protobuf'; import StyledWrapper from './StyledWrapper'; import Vars from './Vars/index'; import StatusDot from 'components/StatusDot'; import Overview from './Overview/index'; const CollectionSettings = ({ collection }) => { const dispatch = useDispatch(); const tab = collection.settingsSelectedTab; const setTab = (tab) => { dispatch( updateSettingsSelectedTab({ collectionUid: collection.uid, tab }) ); }; const root = collection?.draft?.root || collection?.root; const hasScripts = root?.request?.script?.res || root?.request?.script?.req; const hasTests = root?.request?.tests; const hasDocs = root?.docs; const headers = collection.draft?.root ? get(collection, 'draft.root.request.headers', []) : get(collection, 'root.request.headers', []); const activeHeadersCount = headers.filter((header) => header.enabled).length; const requestVars = collection.draft?.root ? get(collection, 'draft.root.request.vars.req', []) : get(collection, 'root.request.vars.req', []); const activeVarsCount = requestVars.filter((v) => v.enabled).length; const authMode = (collection.draft?.root ? get(collection, 'draft.root.request.auth', {}) : get(collection, 'root.request.auth', {})).mode || 'none'; const proxyConfig = collection.draft?.brunoConfig ? get(collection, 'draft.brunoConfig.proxy', {}) : get(collection, 'brunoConfig.proxy', {}); const proxyEnabled = proxyConfig.hostname ? true : false; const clientCertConfig = collection.draft?.brunoConfig ? get(collection, 'draft.brunoConfig.clientCertificates.certs', []) : get(collection, 'brunoConfig.clientCertificates.certs', []); const protobufConfig = collection.draft?.brunoConfig ? get(collection, 'draft.brunoConfig.protobuf', {}) : get(collection, 'brunoConfig.protobuf', {}); const getTabPanel = (tab) => { switch (tab) { case 'overview': { return ; } case 'headers': { return ; } case 'vars': { return ; } case 'auth': { return ; } case 'script': { return