Merge pull request #2478 from automatisch/aut-1495
feat(ImportFlowDialog): preserve flow filters
This commit is contained in:
@@ -4,7 +4,7 @@ import Button from '@mui/material/Button';
|
|||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
import useMediaQuery from '@mui/material/useMediaQuery';
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link, useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
import SplitButton from 'components/SplitButton';
|
import SplitButton from 'components/SplitButton';
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ import useFormatMessage from 'hooks/useFormatMessage';
|
|||||||
import useAutomatischConfig from 'hooks/useAutomatischConfig';
|
import useAutomatischConfig from 'hooks/useAutomatischConfig';
|
||||||
|
|
||||||
export default function FlowsButtons() {
|
export default function FlowsButtons() {
|
||||||
|
const location = useLocation();
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const currentUserAbility = useCurrentUserAbility();
|
const currentUserAbility = useCurrentUserAbility();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -69,7 +70,7 @@ export default function FlowsButtons() {
|
|||||||
component={Link}
|
component={Link}
|
||||||
disabled={!canCreateFlow}
|
disabled={!canCreateFlow}
|
||||||
startIcon={<UploadIcon />}
|
startIcon={<UploadIcon />}
|
||||||
to={URLS.IMPORT_FLOW}
|
to={{ pathname: URLS.IMPORT_FLOW, search: location.search }}
|
||||||
data-test="import-flow-button"
|
data-test="import-flow-button"
|
||||||
>
|
>
|
||||||
{formatMessage('flows.importFlow')}
|
{formatMessage('flows.importFlow')}
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
import * as React from 'react';
|
import UploadIcon from '@mui/icons-material/Upload';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { useNavigate, Link } from 'react-router-dom';
|
|
||||||
import Alert from '@mui/material/Alert';
|
import Alert from '@mui/material/Alert';
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import Stack from '@mui/material/Stack';
|
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
import DialogActions from '@mui/material/DialogActions';
|
import DialogActions from '@mui/material/DialogActions';
|
||||||
import DialogContent from '@mui/material/DialogContent';
|
import DialogContent from '@mui/material/DialogContent';
|
||||||
import DialogContentText from '@mui/material/DialogContentText';
|
import DialogContentText from '@mui/material/DialogContentText';
|
||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
import Typography from '@mui/material/Typography';
|
import Stack from '@mui/material/Stack';
|
||||||
import UploadIcon from '@mui/icons-material/Upload';
|
|
||||||
import Tooltip from '@mui/material/Tooltip';
|
import Tooltip from '@mui/material/Tooltip';
|
||||||
import Box from '@mui/material/Box';
|
import Typography from '@mui/material/Typography';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import * as URLS from 'config/urls';
|
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
|
||||||
import FileUploadInput from 'components/FileUploadInput';
|
import FileUploadInput from 'components/FileUploadInput';
|
||||||
import useImportFlow from 'hooks/useImportFlow';
|
import * as URLS from 'config/urls';
|
||||||
import { getUnifiedErrorMessage } from 'helpers/errors';
|
import { getUnifiedErrorMessage } from 'helpers/errors';
|
||||||
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
|
import useImportFlow from 'hooks/useImportFlow';
|
||||||
|
|
||||||
function ImportFlowDialog(props) {
|
function ImportFlowDialog(props) {
|
||||||
const { open = true, 'data-test': dataTest = 'import-flow-dialog' } = props;
|
const { open = true, 'data-test': dataTest = 'import-flow-dialog' } = props;
|
||||||
|
|
||||||
const [hasParsingError, setParsingError] = React.useState(false);
|
const [hasParsingError, setParsingError] = React.useState(false);
|
||||||
const [selectedFile, setSelectedFile] = React.useState(null);
|
const [selectedFile, setSelectedFile] = React.useState(null);
|
||||||
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ function ImportFlowDialog(props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
navigate('..');
|
navigate({ pathname: URLS.FLOWS, search: location.search });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import {
|
|||||||
useSearchParams,
|
useSearchParams,
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
|
|
||||||
import FlowFilters from 'components/FlowFilters';
|
|
||||||
import FlowsButtons from 'components/FlowsButtons';
|
|
||||||
import Container from 'components/Container';
|
import Container from 'components/Container';
|
||||||
|
import FlowFilters from 'components/FlowFilters';
|
||||||
import FlowRow from 'components/FlowRow';
|
import FlowRow from 'components/FlowRow';
|
||||||
|
import FlowsButtons from 'components/FlowsButtons';
|
||||||
import Folders from 'components/Folders';
|
import Folders from 'components/Folders';
|
||||||
import ImportFlowDialog from 'components/ImportFlowDialog';
|
import ImportFlowDialog from 'components/ImportFlowDialog';
|
||||||
import NoResultFound from 'components/NoResultFound';
|
import NoResultFound from 'components/NoResultFound';
|
||||||
@@ -24,10 +24,10 @@ import PageTitle from 'components/PageTitle';
|
|||||||
import SearchInput from 'components/SearchInput';
|
import SearchInput from 'components/SearchInput';
|
||||||
import TemplatesDialog from 'components/TemplatesDialog/index.ee';
|
import TemplatesDialog from 'components/TemplatesDialog/index.ee';
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
|
import objectifyUrlSearchParams from 'helpers/objectifyUrlSearchParams';
|
||||||
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
||||||
import useFlows from 'hooks/useFlows';
|
import useFlows from 'hooks/useFlows';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import objectifyUrlSearchParams from 'helpers/objectifyUrlSearchParams';
|
|
||||||
|
|
||||||
export default function Flows() {
|
export default function Flows() {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
|
|||||||
Reference in New Issue
Block a user