2024-06-27 12:19:23: merge [main:624a447019819d18be1c4512e64b177d6326951d];
This commit is contained in:
1 parent
10b4a7223c
commit
a7906026d5
6 files changed
+59
-22
No files matched your search
@@ -32,7 +32,10 @@ import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './layout.scss'
|
||||
|
||||
|
||||
import './layout.scss';
|
||||
|
||||
|
||||
const { Content, Sider } = Layout
|
||||
|
||||
@@ -138,17 +141,16 @@ const LayoutComponent = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const menuKey = location.pathname.split('/')[1] as MenuItemKeysType
|
||||
|
||||
const selectedKey = selectedMenuKeys[0] || ''
|
||||
const menuItem = menuKeys[menuKey]
|
||||
|
||||
if (menuItem) {
|
||||
if (menuItem && menuKey !== selectedKey) {
|
||||
setSelectedMenuKeys([menuItem.key])
|
||||
setOpenKeys(menuItem.parent)
|
||||
} else {
|
||||
setSelectedMenuKeys([])
|
||||
setOpenKeys([])
|
||||
if (selectedKey) {
|
||||
setOpenKeys(menuItem.parent)
|
||||
}
|
||||
}
|
||||
}, [location])
|
||||
}, [location.pathname])
|
||||
|
||||
const handlerOnClickMenu: MenuProps['onClick'] = ({ key }): void => {
|
||||
switch (key) {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Button } from 'antd'
|
||||
import { Layout } from 'isp-ui-kit'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
|
||||
const { NotFoundPage } = Layout
|
||||
|
||||
const NotFound = () => {
|
||||
const navigate = useNavigate()
|
||||
return (
|
||||
<NotFoundPage>
|
||||
<Button type="primary" onClick={() => navigate(routePaths.modules)}>
|
||||
На главную
|
||||
</Button>
|
||||
</NotFoundPage>
|
||||
)
|
||||
}
|
||||
|
||||
export default NotFound
|
||||
@@ -4,6 +4,7 @@ import { lazy, Suspense } from 'react'
|
||||
import { Navigate, Route, Routes } from 'react-router-dom'
|
||||
|
||||
import LayoutComponent from '@components/Layout'
|
||||
|
||||
// Составная часть основной страницы, поэтому без lazy
|
||||
import Configurations from '@pages/ConfigurationsPage'
|
||||
import Connections from '@pages/ConnectionsPage'
|
||||
@@ -26,7 +27,9 @@ const ModulesPage = lazy(() => import('@pages/ModulesPage'))
|
||||
const ApplicationsPage = lazy(() => import('@pages/ApplicationsPage'))
|
||||
const AllVersionsPage = lazy(() => import('@pages/AllVersionsPage'))
|
||||
const ConfigurationEditorPage = lazy(
|
||||
() => import('@pages/ConfigurationEditorPage'))
|
||||
() => import('@pages/ConfigurationEditorPage')
|
||||
)
|
||||
const NotFound = lazy(() => import('@pages/NotFound'))
|
||||
|
||||
const Routers = () => {
|
||||
return (
|
||||
@@ -151,14 +154,14 @@ const Routers = () => {
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={`:moduleId/${routePaths.configEditor}/:id`}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ConfigurationEditorPage />
|
||||
</Suspense>
|
||||
}>
|
||||
|
||||
</Route>
|
||||
<Route
|
||||
path={`:moduleId/${routePaths.configEditor}/:id`}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ConfigurationEditorPage />
|
||||
</Suspense>
|
||||
}
|
||||
></Route>
|
||||
<Route
|
||||
path={routePaths.modules}
|
||||
element={
|
||||
@@ -213,6 +216,14 @@ const Routers = () => {
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={routePaths.notFound}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<NotFound />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user