From 63084e945fac4609cb450c7822c9bfa7771b11fb Mon Sep 17 00:00:00 2001 From: veselovnk Date: Thu, 27 Jun 2024 11:31:00 +0300 Subject: [PATCH 1/3] MSP-3523 fix menu collapse --- src/components/Layout/index.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index 6656cd4..c856efa 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -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) { From 37e9093166e03eeafd3db98497d2bb67947fa5fd Mon Sep 17 00:00:00 2001 From: veselovnk Date: Thu, 27 Jun 2024 11:31:16 +0300 Subject: [PATCH 2/3] MSP-3523 add notFound page --- src/pages/NotFound/index.tsx | 21 +++++++++++++++++++++ src/routes/Routers/index.tsx | 29 ++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 src/pages/NotFound/index.tsx diff --git a/src/pages/NotFound/index.tsx b/src/pages/NotFound/index.tsx new file mode 100644 index 0000000..9d56d09 --- /dev/null +++ b/src/pages/NotFound/index.tsx @@ -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 ( + + + + ) +} + +export default NotFound diff --git a/src/routes/Routers/index.tsx b/src/routes/Routers/index.tsx index ab65472..c102096 100644 --- a/src/routes/Routers/index.tsx +++ b/src/routes/Routers/index.tsx @@ -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 = () => { } /> - }> - - - }> - - + }> + + + } + > { } /> + }> + + + } + /> ) } From d483a7980a3af0c6dca10fe383b4fb7d361c58ac Mon Sep 17 00:00:00 2001 From: veselovnk Date: Thu, 27 Jun 2024 11:42:57 +0300 Subject: [PATCH 3/3] MSP-3523 up version to 0.12.5 --- CHANGELOG.md | 3 +++ package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bef2e1..c328c9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.12.5 +- Исправлено неверное поведение показа меню +- Добавлена страница NotFoundPage ## 0.12.4 - Уменьшен размер бандла ## 0.12.3 diff --git a/package-lock.json b/package-lock.json index a748570..968da3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "isp-admin-ui", - "version": "0.12.3", + "version": "0.12.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "isp-admin-ui", - "version": "0.12.3", + "version": "0.12.5", "dependencies": { "@apidevtools/json-schema-ref-parser": "^9.0.6", "@codemirror/lang-json": "^6.0.1", @@ -7981,8 +7981,8 @@ } }, "node_modules/isp-ui-kit": { - "version": "0.6.0", - "resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#5f48f91bdb9b342bc7b14c3a40ea061c3474ae81", + "version": "0.7.1", + "resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#657a9c1b62fb757938e12091faba6f5f53c7d7e9", "license": "ISC", "dependencies": { "@codemirror/lang-javascript": "^6.2.1", diff --git a/package.json b/package.json index a7d72a9..ea09212 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "isp-admin-ui", "private": true, - "version": "0.12.4", + "version": "0.12.5", "type": "module", "scripts": { "start": "vite",