From 9d19df9812c368451435f457696d9fd52fa166fd Mon Sep 17 00:00:00 2001 From: jsonBackup Date: Thu, 22 Feb 2024 10:27:13 +0100 Subject: [PATCH] Add prefix to NavPath and remove it from path --- .../src/common/components/Menu/RoutingMenuItem.tsx | 2 +- .../src/databases/container/Databases.tsx | 2 +- .../src/modules/container/Modules.tsx | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Moryx.CommandCenter.Web/src/common/components/Menu/RoutingMenuItem.tsx b/src/Moryx.CommandCenter.Web/src/common/components/Menu/RoutingMenuItem.tsx index 376445cce..c5ad926b4 100644 --- a/src/Moryx.CommandCenter.Web/src/common/components/Menu/RoutingMenuItem.tsx +++ b/src/Moryx.CommandCenter.Web/src/common/components/Menu/RoutingMenuItem.tsx @@ -23,7 +23,7 @@ function RoutingMenuItem(props: MenuItemProps) { const navigate = useNavigate(); const isOpened = (location: any): boolean => { - return location.pathname.endsWith(`/${props.MenuItem.NavPath}`); + return location.pathname.startsWith(props.MenuItem.NavPath); }; const [IsOpened, setIsOpened] = React.useState(isOpened(location)); diff --git a/src/Moryx.CommandCenter.Web/src/databases/container/Databases.tsx b/src/Moryx.CommandCenter.Web/src/databases/container/Databases.tsx index c835164fe..3dcc054f1 100644 --- a/src/Moryx.CommandCenter.Web/src/databases/container/Databases.tsx +++ b/src/Moryx.CommandCenter.Web/src/databases/container/Databases.tsx @@ -71,7 +71,7 @@ class Database extends React.Component{namespace}

), SubMenuItems: [], diff --git a/src/Moryx.CommandCenter.Web/src/modules/container/Modules.tsx b/src/Moryx.CommandCenter.Web/src/modules/container/Modules.tsx index 6bec9356d..e2410ca07 100644 --- a/src/Moryx.CommandCenter.Web/src/modules/container/Modules.tsx +++ b/src/Moryx.CommandCenter.Web/src/modules/container/Modules.tsx @@ -76,20 +76,20 @@ class Modules extends React.Component), SubMenuItems: [ { Name: "Configuration", - NavPath: moduleModel.name + "/configuration", + NavPath: "/modules/" + moduleModel.name + "/configuration", Icon: mdiCogs, SubMenuItems: [], }, { Name: "Console", - NavPath: moduleModel.name + "/console", + NavPath: "/modules/" + moduleModel.name + "/console", Icon: mdiConsoleLine, SubMenuItems: [], }, @@ -104,17 +104,17 @@ class Modules extends React.Component { const module = this.props.Modules.filter(function (element: ServerModuleModel, index: number, array: ServerModuleModel[]): boolean { return element.name === menuItem.Name; })[0]; routes.push( - } />); menuItem.SubMenuItems.forEach((subMenuItem) => { if (subMenuItem.NavPath.endsWith("configuration")) { routes.push( - } />); } else if (subMenuItem.NavPath.endsWith("console")) { routes.push( - } />); }