mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-09 06:55:03 +00:00
feat: change default collection location to default location (#7291)
* feat: change default collection location to default location * refactor: migrate defaultCollectionLocation to defaultLocation in preference.json * refactor: resolveDefaultLocation function * fix: rename variables in default-location
This commit is contained in:
@@ -12,20 +12,24 @@ import { browseDirectory } from 'providers/ReduxStore/slices/collections/actions
|
||||
import { multiLineMsg } from 'utils/common/index';
|
||||
import { formatIpcError } from 'utils/common/error';
|
||||
import { sanitizeName, validateName, validateNameError } from 'utils/common/regex';
|
||||
import get from 'lodash/get';
|
||||
|
||||
const CreateWorkspace = ({ onClose }) => {
|
||||
const inputRef = useRef();
|
||||
const dispatch = useDispatch();
|
||||
const workspaces = useSelector((state) => state.workspaces.workspaces);
|
||||
const preferences = useSelector((state) => state.app.preferences);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
|
||||
const defaultLocation = get(preferences, 'general.defaultLocation', '');
|
||||
|
||||
const formik = useFormik({
|
||||
enableReinitialize: true,
|
||||
initialValues: {
|
||||
workspaceName: '',
|
||||
workspaceFolderName: '',
|
||||
workspaceLocation: ''
|
||||
workspaceLocation: defaultLocation
|
||||
},
|
||||
validationSchema: Yup.object({
|
||||
workspaceName: Yup.string()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useFormik } from 'formik';
|
||||
import * as Yup from 'yup';
|
||||
import toast from 'react-hot-toast';
|
||||
import get from 'lodash/get';
|
||||
import { IconFileZip } from '@tabler/icons';
|
||||
import Modal from 'components/Modal';
|
||||
import { browseDirectory } from 'providers/ReduxStore/slices/collections/actions';
|
||||
@@ -13,16 +14,19 @@ import Help from 'components/Help';
|
||||
|
||||
const ImportWorkspace = ({ onClose }) => {
|
||||
const dispatch = useDispatch();
|
||||
const preferences = useSelector((state) => state.app.preferences);
|
||||
const [dragActive, setDragActive] = useState(false);
|
||||
const [selectedFile, setSelectedFile] = useState(null);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const fileInputRef = useRef(null);
|
||||
const locationInputRef = useRef(null);
|
||||
|
||||
const defaultLocation = get(preferences, 'general.defaultLocation', '');
|
||||
|
||||
const formik = useFormik({
|
||||
enableReinitialize: true,
|
||||
initialValues: {
|
||||
workspaceLocation: ''
|
||||
workspaceLocation: defaultLocation
|
||||
},
|
||||
validationSchema: Yup.object({
|
||||
workspaceLocation: Yup.string().min(1, 'location is required').required('location is required')
|
||||
|
||||
Reference in New Issue
Block a user