diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/CreateEnvironment/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/CreateEnvironment/index.js
index 6aca6c4c1..3427955a2 100644
--- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/CreateEnvironment/index.js
+++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/CreateEnvironment/index.js
@@ -4,9 +4,10 @@ import { useFormik } from 'formik';
import { addEnvironment } from 'providers/ReduxStore/slices/collections/actions';
import * as Yup from 'yup';
import { useDispatch } from 'react-redux';
-import { SharedButton } from 'components/Environments/EnvironmentSettings';
+import Portal from 'components/Portal';
+import Modal from 'components/Modal';
-const CreateEnvironment = ({ collection }) => {
+const CreateEnvironment = ({ collection, onClose }) => {
const dispatch = useDispatch();
const inputRef = useRef();
const formik = useFormik({
@@ -24,8 +25,9 @@ const CreateEnvironment = ({ collection }) => {
dispatch(addEnvironment(values.name, collection.uid))
.then(() => {
toast.success('Environment created in collection');
+ onClose();
})
- .catch(() => toast.error('An error occurred while created the environment'));
+ .catch(() => toast.error('An error occurred while creating the environment'));
}
});
@@ -40,32 +42,41 @@ const CreateEnvironment = ({ collection }) => {
};
return (
-
+
+
+
+
+
);
};
diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/ImportEnvironment/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/ImportEnvironment/index.js
index 8060ea01e..d229ea3a2 100644
--- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/ImportEnvironment/index.js
+++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/ImportEnvironment/index.js
@@ -1,4 +1,6 @@
import React from 'react';
+import Portal from 'components/Portal';
+import Modal from 'components/Modal';
import toast from 'react-hot-toast';
import { useDispatch } from 'react-redux';
import importPostmanEnvironment from 'utils/importers/postman-environment';
@@ -6,7 +8,7 @@ import { importEnvironment } from 'providers/ReduxStore/slices/collections/actio
import { toastError } from 'utils/common/error';
import { IconDatabaseImport } from '@tabler/icons';
-const ImportEnvironment = ({ collection }) => {
+const ImportEnvironment = ({ collection, onClose }) => {
const dispatch = useDispatch();
const handleImportPostmanEnvironment = () => {
@@ -29,18 +31,25 @@ const ImportEnvironment = ({ collection }) => {
.catch(() => toast.error('An error occurred while importing the environment'));
});
})
+ .then(() => {
+ onClose();
+ })
.catch((err) => toastError(err, 'Postman Import environment failed'));
};
return (
-
+
+
+
+
+
);
};
diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js
index 464c032b6..3a17e2ecd 100644
--- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js
+++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js
@@ -45,28 +45,20 @@ const DefaultTab = ({ setTab }) => {
const EnvironmentSettings = ({ collection, onClose }) => {
const [isModified, setIsModified] = useState(false);
const { environments } = collection;
- const [openCreateModal, setOpenCreateModal] = useState(false);
- const [openImportModal, setOpenImportModal] = useState(false);
const [selectedEnvironment, setSelectedEnvironment] = useState(null);
const [tab, setTab] = useState('default');
if (!environments || !environments.length) {
return (
- setTab('default')}
- handleCancel={onClose}
- hideCancel={true}
- >
+
{tab === 'create' ? (
-
+ setTab('default')} />
) : tab === 'import' ? (
-
+ setTab('default')} />
) : (
-
+ <>>
)}
+
);
diff --git a/packages/bruno-app/src/components/FolderSettings/index.js b/packages/bruno-app/src/components/FolderSettings/index.js
index 6dcd9cfd2..eab7baf8d 100644
--- a/packages/bruno-app/src/components/FolderSettings/index.js
+++ b/packages/bruno-app/src/components/FolderSettings/index.js
@@ -12,8 +12,8 @@ const FolderSettings = ({ collection, folder }) => {
const dispatch = useDispatch();
let tab = 'headers';
const { folderLevelSettingsSelectedTab } = collection;
- if (folderLevelSettingsSelectedTab?.[folder.uid]) {
- tab = folderLevelSettingsSelectedTab[folder.uid];
+ if (folderLevelSettingsSelectedTab?.[folder?.uid]) {
+ tab = folderLevelSettingsSelectedTab[folder?.uid];
}
const setTab = (tab) => {
diff --git a/packages/bruno-app/src/utils/collections/index.js b/packages/bruno-app/src/utils/collections/index.js
index 6d992c8e6..4f0afceda 100644
--- a/packages/bruno-app/src/utils/collections/index.js
+++ b/packages/bruno-app/src/utils/collections/index.js
@@ -417,7 +417,25 @@ export const transformCollectionToSaveToExportAsFile = (collection, options = {}
collectionToSave.items = [];
collectionToSave.activeEnvironmentUid = collection.activeEnvironmentUid;
collectionToSave.environments = collection.environments || [];
- collectionToSave.root = collection.root || {};
+ collectionToSave.root = {
+ request: {
+ auth: collection?.root?.request?.auth,
+ headers: collection?.root?.request?.headers,
+ script: collection?.root?.request?.script,
+ vars: collection?.root?.request?.vars,
+ tests: collection?.root?.request?.tests
+ },
+ docs: collection?.root?.request?.docs,
+ meta: {
+ name: collection?.root?.meta?.name || collection?.name
+ }
+ };
+
+ if (!collection?.root?.request?.auth?.mode) {
+ collectionToSave.root.request.auth = {
+ mode: 'none'
+ };
+ }
collectionToSave.brunoConfig = cloneDeep(collection?.brunoConfig);