From 7b94e069e91ae236110fc06e48808959fa00dff4 Mon Sep 17 00:00:00 2001 From: ravindra-bruno Date: Wed, 17 Jun 2026 16:56:33 +0530 Subject: [PATCH] =?UTF-8?q?feat(import):=20hide=20File=20Format=20option?= =?UTF-8?q?=20and=20default=20collections=20to=20Open=E2=80=A6=20(#8247)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImportCollectionLocation/StyledWrapper.js | 9 +- .../Sidebar/ImportCollectionLocation/index.js | 298 ++++++++++-------- .../import-file-format-options.spec.ts | 59 ++++ 3 files changed, 233 insertions(+), 133 deletions(-) create mode 100644 tests/import/postman/import-file-format-options.spec.ts diff --git a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/StyledWrapper.js b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/StyledWrapper.js index 3de12e12b..3179cee52 100644 --- a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/StyledWrapper.js +++ b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/StyledWrapper.js @@ -13,10 +13,13 @@ const Wrapper = styled.div` .current-group:hover { background-color: ${(props) => darken(0.03, props.theme.background.surface1)}; border-color: ${(props) => darken(0.03, props.theme.background.surface2)}; + } - /* Fix dropdown positioning */ - [data-tippy-root] { - left: 0 !important; + .advanced-options { + .caret { + color: ${(props) => props.theme.textLink}; + fill: ${(props) => props.theme.textLink}; + } } `; diff --git a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js index 1739a6961..9fdf186f8 100644 --- a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js +++ b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js @@ -15,6 +15,7 @@ import { wsdlToBruno } from '@usebruno/converters'; import { toastError } from 'utils/common/error'; import { addLog } from 'providers/ReduxStore/slices/logs'; import { useBetaFeature, BETA_FEATURES } from 'utils/beta-features'; +import Portal from 'components/Portal'; import Modal from 'components/Modal'; import Help from 'components/Help'; import Dropdown from 'components/Dropdown'; @@ -109,9 +110,11 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, rawData, format, sour const dispatch = useDispatch(); const [groupingType, setGroupingType] = useState('tags'); const [collectionFormat, setCollectionFormat] = useState(DEFAULT_COLLECTION_FORMAT); + const [showFileFormat, setShowFileFormat] = useState(false); const isOpenAPISyncEnabled = useBetaFeature(BETA_FEATURES.OPENAPI_SYNC); const [enableCheckForSpecUpdates, setEnableCheckForSpecUpdates] = useState(isOpenAPISyncEnabled); const dropdownTippyRef = useRef(); + const optionsDropdownTippyRef = useRef(); const isOpenApi = format === 'openapi'; const isZipImport = format === 'bruno-zip'; const isOpenApiFromUrl = isOpenApi && !!sourceUrl && !filePath; @@ -198,6 +201,21 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, rawData, format, sour dropdownTippyRef.current = ref; }; + const onOptionsDropdownCreate = (ref) => { + optionsDropdownTippyRef.current = ref; + }; + + const ImportOptions = forwardRef((props, ref) => { + return ( +
+ + +
+ ); + }); + const GroupingDropdownIcon = forwardRef((props, ref) => { const selectedOption = groupingOptions.find((option) => option.value === groupingType); return ( @@ -243,140 +261,160 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, rawData, format, sour }; return ( - - -
e.preventDefault()}> -
- -
{collectionName}
- - <> - - { - formik.setFieldValue('collectionLocation', e.target.value); - }} - /> - - {formik.touched.collectionLocation && formik.errors.collectionLocation ? ( -
{formik.errors.collectionLocation}
- ) : null} - -
- - Browse - -
- - {!isZipImport && ( -
- - -
- )} -
- - {isOpenApi && ( -
-
- -

- Select whether to create folders according to the spec's paths or tags. -

-
-
- } placement="bottom-start"> - {groupingOptions.map((option) => ( -
{ - dropdownTippyRef?.current?.hide(); - setGroupingType(option.value); - }} - > - {option.label} -
- ))} + + + + } placement="bottom-start"> +
{ + optionsDropdownTippyRef?.current?.hide(); + setShowFileFormat(!showFileFormat); + }} + > + {showFileFormat ? 'Hide File Format' : 'Show File Format'} +
-
- )} - - {showCheckForSpecUpdatesOption && ( -
-