diff --git a/.gitignore b/.gitignore index 07bdab410..0da494ea2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies +bun.lockb node_modules yarn.lock pnpm-lock.yaml diff --git a/packages/bruno-app/package.json b/packages/bruno-app/package.json index 79b93f908..179719995 100644 --- a/packages/bruno-app/package.json +++ b/packages/bruno-app/package.json @@ -17,6 +17,7 @@ "@fortawesome/react-fontawesome": "^0.1.16", "@reduxjs/toolkit": "^1.8.0", "@tabler/icons": "^1.46.0", + "@tailwindcss/forms": "^0.5.7", "@tippyjs/react": "^4.2.6", "@usebruno/common": "0.1.0", "@usebruno/graphql-docs": "0.1.0", diff --git a/packages/bruno-app/src/components/Sidebar/ImportCollection/index.js b/packages/bruno-app/src/components/Sidebar/ImportCollection/index.js index ecfc4183d..f95518e43 100644 --- a/packages/bruno-app/src/components/Sidebar/ImportCollection/index.js +++ b/packages/bruno-app/src/components/Sidebar/ImportCollection/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import importBrunoCollection from 'utils/importers/bruno-collection'; import importPostmanCollection from 'utils/importers/postman-collection'; import importInsomniaCollection from 'utils/importers/insomnia-collection'; @@ -7,6 +7,13 @@ import { toastError } from 'utils/common/error'; import Modal from 'components/Modal'; const ImportCollection = ({ onClose, handleSubmit }) => { + const [options, setOptions] = useState({ + enablePostmanTranslations: { + enabled: true, + label: 'Auto translate postman scripts', + subLabel: "When enabled, Bruno will try as best to translate the scripts from the imported collection to Bruno's format." + } + }) const handleImportBrunoCollection = () => { importBrunoCollection() .then((collection) => { @@ -16,7 +23,7 @@ const ImportCollection = ({ onClose, handleSubmit }) => { }; const handleImportPostmanCollection = () => { - importPostmanCollection() + importPostmanCollection(options) .then((collection) => { handleSubmit(collection); }) @@ -38,21 +45,66 @@ const ImportCollection = ({ onClose, handleSubmit }) => { }) .catch((err) => toastError(err, 'OpenAPI v3 Import collection failed')); }; - + const toggleOptions = (event, optionKey) => { + setOptions({ ...options, [optionKey]: { + ...options[optionKey], + enabled: !options[optionKey].enabled + } }); + }; + const CollectionButton = ({ children, className, onClick }) => { + return ( + + ) + } return ( -
-
- Bruno Collection +
+

Select the type of your existing collection :

+
+ + Bruno Collection + + + Postman Collection + + + Insomnia Collection + + + OpenAPI V3 Spec +
-
- Postman Collection -
-
- Insomnia Collection -
-
- OpenAPI V3 Spec +
+ {Object.entries(options || {}).map(([key, option]) => ( +
+
+ toggleOptions(e,key)} + className="h-3.5 w-3.5 rounded border-zinc-300 dark:ring-offset-zinc-800 bg-transparent text-indigo-600 dark:text-indigo-500 focus:ring-indigo-600 dark:focus:ring-indigo-500" + /> +
+
+ +

+ {option.subLabel} +

+
+
+ ))}
diff --git a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js index 62a02bdd5..d8cd3dfd2 100644 --- a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js +++ b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js @@ -45,7 +45,11 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName }) => const onSubmit = () => formik.handleSubmit(); return ( - +