Skip to content

Commit 4171a9f

Browse files
authored
Cluster edit - cancelling edit should take the user back to the cluster detail page (#307)
1 parent 84ddfa2 commit 4171a9f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

apps/cluster-orch/src/components/pages/ClusterEdit/ClusterEdit.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
ToastVisibility,
2222
} from "@spark-design/tokens";
2323
import { useEffect, useState } from "react";
24-
import { useParams } from "react-router-dom";
24+
import { useNavigate, useParams } from "react-router-dom";
2525
import { useAppDispatch, useAppSelector } from "../../../store/hooks";
2626
import {
2727
clearCluster,
@@ -47,7 +47,8 @@ export interface ClusterEditProps {
4747
const ClusterEdit = ({ HostsTableRemote }: ClusterEditProps) => {
4848
const cy = { "data-cy": dataCy };
4949
const { clusterName } = useParams<urlParams>() as urlParams;
50-
const navigate = useInfraNavigate();
50+
const navigate = useNavigate();
51+
const infraNavigate = useInfraNavigate();
5152
const dispatch = useAppDispatch();
5253

5354
//initial nodes
@@ -341,7 +342,7 @@ const ClusterEdit = ({ HostsTableRemote }: ClusterEditProps) => {
341342
variant={ButtonVariant.Secondary}
342343
onPress={() => {
343344
dispatch(clearCluster());
344-
navigate(clusterManagementRoute);
345+
navigate(-1);
345346
}}
346347
>
347348
Cancel
@@ -387,7 +388,7 @@ const ClusterEdit = ({ HostsTableRemote }: ClusterEditProps) => {
387388
onHide={() => {
388389
if (onReqSuccess()) {
389390
setSuccessVisibility(ToastVisibility.Hide);
390-
navigate(clusterManagementRoute);
391+
infraNavigate(clusterManagementRoute);
391392
}
392393
if (onReqError()) {
393394
setErrorVisibility(ToastVisibility.Hide);

0 commit comments

Comments
 (0)