import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import toast from 'react-hot-toast'; import { migrateCollectionToYml } from 'providers/ReduxStore/slices/collections/actions'; import Modal from 'components/Modal'; import Portal from 'components/Portal'; import Button from 'ui/Button'; import StyledWrapper from './StyledWrapper'; const MigrateToYmlModal = ({ collection, onClose }) => { const dispatch = useDispatch(); const [isMigrating, setIsMigrating] = useState(false); const [isExporting, setIsExporting] = useState(false); const handleMigrate = () => { setIsMigrating(true); dispatch(migrateCollectionToYml(collection.uid)) .catch(() => {}) .finally(() => { setIsMigrating(false); onClose(); }); }; const handleExportBackup = async () => { if (isExporting) return; setIsExporting(true); try { const { ipcRenderer } = window; const result = await ipcRenderer.invoke('renderer:export-collection-zip', collection.pathname, collection.name); if (result?.success) { toast.success('Collection backup exported'); } } catch (error) { toast.error('Failed to export backup: ' + error.message); } finally { setIsExporting(false); } }; return (

This will convert all files in {collection.name} from .bru format to .yml format.

What will happen:

  • All .bru request files will be converted to .yml
  • Environment files will be converted to YML format
  • bruno.json will be replaced with opencollection.yml
  • The collection will be reloaded after migration
Backup

Export this collection as a ZIP archive before migrating, in case you want to restore it later.

); }; export default MigrateToYmlModal;