Skip to content

Commit bad5d50

Browse files
committed
Fix issue #14
1 parent 370f829 commit bad5d50

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

datanode-ui/src/libs/enums/Status.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export enum Status {
2020
IN_PROGRESS = "IN_PROGRESS",
2121
IN_PROGRESS_RELOAD = "IN_PROGRESS_RELOAD",
2222
SUCCESS = "SUCCESS",
23+
DELETE_SUCCESS = "DELETE_SUCCESS",
2324
ERROR = "ERROR",
2425
DISABLED = "DISABLED",
2526
}

datanode-ui/src/libs/hooks/useEntity/useEntity.reducer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const reducer = <T extends object>(
5555
draft.status = Status.IN_PROGRESS;
5656
break;
5757
case EntityActions.DELETE_ENTITY_SUCCESS:
58-
draft.status = Status.SUCCESS;
58+
draft.status = Status.DELETE_SUCCESS;
5959
break;
6060
// case EntityActions.DELETE_ENTITY_ERROR:
6161
// draft.status = Status.ERROR;

datanode-ui/src/modules/Admin/DatabaseEntity/DatabaseEntity.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*/
1717

18-
import { Route, Routes, useParams } from "react-router";
18+
import { Route, Routes, useNavigate, useParams } from "react-router";
1919
import { tabs } from "./DatabaseEntity.config";
2020
import React, { useContext, useEffect } from "react";
2121

@@ -50,6 +50,7 @@ export const DatabaseEntity: React.FC = () => {
5050
},
5151
id
5252
);
53+
const navigate = useNavigate();
5354

5455
const handleSave = (newValue: any, keyFile?: any, isAdmin?: boolean) => {
5556
const fd = new FormData();
@@ -84,6 +85,11 @@ export const DatabaseEntity: React.FC = () => {
8485
);
8586
}, [entity, dispatch]);
8687

88+
useEffect(() => {
89+
if(status === Status.DELETE_SUCCESS)
90+
navigate("/administration/databases");
91+
}, [status]);
92+
8793
const handleDelete = () => {
8894
showDialog<any>(ConfirmationDialog, {
8995
onSubmit: deleteEntity,

0 commit comments

Comments
 (0)