Skip to content
Snippets Groups Projects
Commit bfb9e6c2 authored by Johanna Szepanski's avatar Johanna Szepanski
Browse files

after creation of IOC navigate to management and display success snackbar

parent 408b2df5
No related branches found
No related tags found
2 merge requests!497CE-2790: Prepare for 4.0.0,!470CE-2831: Allow creation of IOC with automatic repo initialization
Pipeline #191529 waiting for manual action
import React, { useMemo, useEffect, useState, useContext } from "react";
import { useNavigate } from "react-router-dom";
import { useTypingTimer } from "../../common/SearchBoxFilter/TypingTimer";
import { useCustomSnackbar } from "../../common/snackbar";
import { RepositoryOptions, WITHOUT_REPO } from "./RepositoryOptions";
import { RepositoryName } from "./RepositoryName";
import { RootPaper } from "@ess-ics/ce-ui-common/dist/components/common/container/RootPaper";
......@@ -26,6 +27,7 @@ const createRequestParams = (query) => {
export function CreateIOC() {
const navigate = useNavigate();
const showSnackBar = useCustomSnackbar();
const [namingEntity, setNamingEntity] = useState({});
const [gitProject, setGitProject] = useState({});
const [nameQuery, onNameKeyUp] = useTypingTimer({ interval: 500 });
......@@ -106,9 +108,15 @@ export function CreateIOC() {
// navigate home once ioc created
useEffect(() => {
if (ioc) {
navigate(`/iocs/${ioc.id}`);
showSnackBar(
selectedRepoOption === WITHOUT_REPO
? "IOC created"
: "IOC created with a repository",
"success"
);
navigate(`/iocs/${ioc.id}?&tab=Management`);
}
}, [ioc, navigate]);
}, [ioc, showSnackBar, selectedRepoOption, navigate]);
return (
<RootPaper
......@@ -209,7 +217,7 @@ export function CreateIOC() {
)}
{error ? (
<Alert severity="error">{renderErrorMessage(error)}</Alert>
<Alert severity="error">{getErrorMessage(error)}</Alert>
) : null}
{loading ? (
<LinearProgress
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment