Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a1d2b594c | ||
|
|
3e52a14c0a |
No files matched your search
+1
-1
@@ -36,7 +36,7 @@
|
|||||||
"^@type/(.*)$",
|
"^@type/(.*)$",
|
||||||
"^./*.*.ts",
|
"^./*.*.ts",
|
||||||
"^[./]",
|
"^[./]",
|
||||||
"^./*.*.(scss|css)"
|
".(scss|css)$"
|
||||||
],
|
],
|
||||||
"importOrderSeparation": true
|
"importOrderSeparation": true
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,12 @@
|
|||||||
|
## 0.15.0
|
||||||
|
- Добавлены placeholder для поиска в первом столбце
|
||||||
|
- Добавлен заголовок первого столбца на экране Модули
|
||||||
|
- Изменен интервал поллинга для get_modules на 5 секунд
|
||||||
|
- Изменена логика работы редиректа после окончания сессии
|
||||||
|
## 0.14.2
|
||||||
|
- Исправлено появление экрана после логина
|
||||||
|
- На экране ошибки добавлена кнопка "На главную"
|
||||||
|
- Внутренние улучшения кода
|
||||||
## 0.14.1
|
## 0.14.1
|
||||||
- Исправлено отображение времени создания на странице Токенов
|
- Исправлено отображение времени создания на странице Токенов
|
||||||
## 0.14.0
|
## 0.14.0
|
||||||
|
|||||||
Generated
+4
-4
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "isp-admin-ui",
|
"name": "isp-admin-ui",
|
||||||
"version": "0.14.1",
|
"version": "0.15.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "isp-admin-ui",
|
"name": "isp-admin-ui",
|
||||||
"version": "0.14.1",
|
"version": "0.15.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apidevtools/json-schema-ref-parser": "^9.0.6",
|
"@apidevtools/json-schema-ref-parser": "^9.0.6",
|
||||||
"@codemirror/lang-json": "^6.0.1",
|
"@codemirror/lang-json": "^6.0.1",
|
||||||
@@ -7970,8 +7970,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/isp-ui-kit": {
|
"node_modules/isp-ui-kit": {
|
||||||
"version": "0.7.5",
|
"version": "0.8.0",
|
||||||
"resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#040326c756de20d7a4bfad3411c9fa9feb7c4818",
|
"resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#01a9d57ecddddc7b979ffefd499bad21c5bb8ca9",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/lang-javascript": "^6.2.1",
|
"@codemirror/lang-javascript": "^6.2.1",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "isp-admin-ui",
|
"name": "isp-admin-ui",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.14.1",
|
"version": "0.15.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import { ConfigProvider } from 'antd'
|
import { ConfigProvider } from 'antd'
|
||||||
import ruRu from 'antd/locale/ru_RU'
|
import ruRu from 'antd/locale/ru_RU'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
import { useLocation } from 'react-router-dom'
|
||||||
|
|
||||||
import { darkTheme, lightTheme } from '@constants/theme.ts'
|
import { darkTheme, lightTheme } from '@constants/theme.ts'
|
||||||
|
|
||||||
import { Context } from '@stores/index.tsx'
|
import { Context } from '@stores/index.tsx'
|
||||||
|
|
||||||
import Routers from '@routes/Routers'
|
import Routers from '@routes/Routers'
|
||||||
|
import { routePaths } from '@routes/routePaths.ts'
|
||||||
|
|
||||||
import './app.scss'
|
import './app.scss'
|
||||||
|
|
||||||
@@ -18,6 +20,19 @@ const App = () => {
|
|||||||
: true
|
: true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const location = useLocation()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const prevRoute = sessionStorage.getItem('prevRoute')
|
||||||
|
if (
|
||||||
|
location.pathname !== routePaths.error &&
|
||||||
|
location.pathname !== routePaths.login &&
|
||||||
|
location.pathname !== prevRoute
|
||||||
|
) {
|
||||||
|
sessionStorage.setItem('prevRoute', location.pathname)
|
||||||
|
}
|
||||||
|
}, [location])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTheme(() => (changeTheme ? darkTheme : lightTheme))
|
setTheme(() => (changeTheme ? darkTheme : lightTheme))
|
||||||
}, [changeTheme])
|
}, [changeTheme])
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
|||||||
<section className="applications-content">
|
<section className="applications-content">
|
||||||
<Column
|
<Column
|
||||||
title="Приложения"
|
title="Приложения"
|
||||||
|
searchPlaceholder="Введите имя или id"
|
||||||
onUpdateItem={updateApplicationModal}
|
onUpdateItem={updateApplicationModal}
|
||||||
showUpdateBtn={true}
|
showUpdateBtn={true}
|
||||||
onAddItem={addApplicationModal}
|
onAddItem={addApplicationModal}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
.error-page {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
const ErrorPage = () => {
|
|
||||||
return (
|
|
||||||
<section className="error-page">
|
|
||||||
<p>Извините, ошибка</p>
|
|
||||||
</section>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ErrorPage
|
|
||||||
@@ -32,19 +32,19 @@ import { routePaths } from '@routes/routePaths.ts'
|
|||||||
|
|
||||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||||
|
|
||||||
|
import './layout.scss'
|
||||||
|
|
||||||
import './layout.scss';
|
|
||||||
|
|
||||||
|
|
||||||
const { Content, Sider } = Layout
|
const { Content, Sider } = Layout
|
||||||
|
|
||||||
const LayoutComponent = () => {
|
const LayoutComponent = () => {
|
||||||
const [collapsed, setCollapsed] = useState<boolean>(LocalStorage.get('menu') === null ? true : LocalStorage.get('menu'))
|
const [collapsed, setCollapsed] = useState<boolean>(
|
||||||
|
LocalStorage.get('menu') === null ? true : LocalStorage.get('menu')
|
||||||
|
)
|
||||||
const [selectedMenuKeys, setSelectedMenuKeys] = useState<MenuItemKeysType[]>(
|
const [selectedMenuKeys, setSelectedMenuKeys] = useState<MenuItemKeysType[]>(
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
const [openKeys, setOpenKeys] = useState<string[]>([])
|
const [openKeys, setOpenKeys] = useState<string[]>([])
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
const {
|
const {
|
||||||
status,
|
status,
|
||||||
@@ -135,13 +135,21 @@ const LayoutComponent = () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
}, [theme])
|
}, [theme])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (userToken) {
|
if (userToken && status === StateProfileStatus.notInit) {
|
||||||
dispatch(fetchProfile())
|
dispatch(fetchProfile())
|
||||||
dispatch(fetchUI())
|
dispatch(fetchUI())
|
||||||
}
|
}
|
||||||
}, [])
|
}, [userToken, status])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
status === StateProfileStatus.resolved ||
|
||||||
|
status === StateProfileStatus.rejected
|
||||||
|
) {
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
}, [status])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const menuKey = location.pathname.split('/')[1] as MenuItemKeysType
|
const menuKey = location.pathname.split('/')[1] as MenuItemKeysType
|
||||||
@@ -187,6 +195,10 @@ const LayoutComponent = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loading || status === StateProfileStatus.pending) {
|
||||||
|
return <Spin size="large" fullscreen />
|
||||||
|
}
|
||||||
|
|
||||||
if (status === StateProfileStatus.rejected) {
|
if (status === StateProfileStatus.rejected) {
|
||||||
return <Navigate to={routePaths.error} replace />
|
return <Navigate to={routePaths.error} replace />
|
||||||
}
|
}
|
||||||
@@ -194,39 +206,33 @@ const LayoutComponent = () => {
|
|||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
<Layout className="layout" data-cy="homePage">
|
<Layout className="layout" data-cy="homePage">
|
||||||
{status === StateProfileStatus.pending ? (
|
<Sider
|
||||||
<Spin size="large" />
|
width="250px"
|
||||||
) : (
|
data-cy="aside"
|
||||||
<>
|
theme="light"
|
||||||
<Sider
|
collapsible
|
||||||
width="250px"
|
collapsed={collapsed}
|
||||||
data-cy="aside"
|
onCollapse={(value) => {
|
||||||
theme="light"
|
LocalStorage.set('menu', value)
|
||||||
collapsible
|
setCollapsed(value)
|
||||||
collapsed={collapsed}
|
}}
|
||||||
onCollapse={(value) => {
|
>
|
||||||
LocalStorage.set('menu', value)
|
<Header collapsed={collapsed} />
|
||||||
setCollapsed(value)
|
<Menu
|
||||||
}}
|
onOpenChange={(keys) => setOpenKeys(keys)}
|
||||||
>
|
openKeys={openKeys}
|
||||||
<Header collapsed={collapsed} />
|
selectedKeys={selectedMenuKeys}
|
||||||
<Menu
|
onClick={handlerOnClickMenu}
|
||||||
onOpenChange={(keys) => setOpenKeys(keys)}
|
theme="light"
|
||||||
openKeys={openKeys}
|
mode="inline"
|
||||||
selectedKeys={selectedMenuKeys}
|
items={menuItems}
|
||||||
onClick={handlerOnClickMenu}
|
/>
|
||||||
theme="light"
|
</Sider>
|
||||||
mode="inline"
|
<Layout className="site-layout">
|
||||||
items={menuItems}
|
<Content className="site-layout__content">
|
||||||
/>
|
<Outlet />
|
||||||
</Sider>
|
</Content>
|
||||||
<Layout className="site-layout">
|
</Layout>
|
||||||
<Content className="site-layout__content">
|
|
||||||
<Outlet />
|
|
||||||
</Content>
|
|
||||||
</Layout>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Layout>
|
</Layout>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ const AppAccessPage = () => {
|
|||||||
<section className="app-access-page">
|
<section className="app-access-page">
|
||||||
<Column
|
<Column
|
||||||
title="Приложения"
|
title="Приложения"
|
||||||
|
searchPlaceholder="Введите имя или id"
|
||||||
showUpdateBtn={false}
|
showUpdateBtn={false}
|
||||||
showAddBtn={false}
|
showAddBtn={false}
|
||||||
showRemoveBtn={false}
|
showRemoveBtn={false}
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ const ApplicationsPage = () => {
|
|||||||
<main className="applications-page">
|
<main className="applications-page">
|
||||||
<Column
|
<Column
|
||||||
title="Группы приложений"
|
title="Группы приложений"
|
||||||
|
searchPlaceholder="Введите имя или id"
|
||||||
onUpdateItem={updateApplicationModal}
|
onUpdateItem={updateApplicationModal}
|
||||||
showUpdateBtn={true}
|
showUpdateBtn={true}
|
||||||
onAddItem={addApplicationModal}
|
onAddItem={addApplicationModal}
|
||||||
|
|||||||
@@ -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 { ErrorPage } = Layout
|
||||||
|
|
||||||
|
const ErrorWrapperPage = () => {
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ErrorPage>
|
||||||
|
<Button type="primary" onClick={() => navigate(routePaths.modules)}>
|
||||||
|
На главную
|
||||||
|
</Button>
|
||||||
|
</ErrorPage>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ErrorWrapperPage
|
||||||
@@ -38,7 +38,7 @@ const LoginPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleError = (err: AxiosError<MSPError>): void => {
|
const handleError = (err: AxiosError<MSPError>): void => {
|
||||||
const { response,status } = err
|
const { response, status } = err
|
||||||
if (response && status === 401) {
|
if (response && status === 401) {
|
||||||
setFormError(response.statusText, messages.loginError)
|
setFormError(response.statusText, messages.loginError)
|
||||||
} else {
|
} else {
|
||||||
@@ -57,9 +57,8 @@ const LoginPage = () => {
|
|||||||
LocalStorage.set(localStorageKeys.HEADER_NAME, response.headerName)
|
LocalStorage.set(localStorageKeys.HEADER_NAME, response.headerName)
|
||||||
LocalStorage.set(localStorageKeys.USER_TOKEN, response.token)
|
LocalStorage.set(localStorageKeys.USER_TOKEN, response.token)
|
||||||
const redirectUrl =
|
const redirectUrl =
|
||||||
localStorage.getItem('redirectUrl') || routePaths.home
|
sessionStorage.getItem('prevRoute') || routePaths.home
|
||||||
navigate(redirectUrl, { replace: true })
|
navigate(redirectUrl, { replace: true })
|
||||||
localStorage.removeItem('redirectUrl')
|
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError<MSPError>) => handleError(err))
|
.catch((err: AxiosError<MSPError>) => handleError(err))
|
||||||
}
|
}
|
||||||
@@ -106,15 +105,15 @@ const LoginPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<section className="login-page">
|
<section className="login-page">
|
||||||
<form className="login-page__content">
|
<form className="login-page__content">
|
||||||
<h1 data-cy="login-title" className="login-page__content__title">
|
<h1 data-cy="login-title" className="login-page__content__title">
|
||||||
Вход в систему
|
Вход в систему
|
||||||
</h1>
|
</h1>
|
||||||
<Divider />
|
<Divider />
|
||||||
{renderInternalAuthForm()}
|
{renderInternalAuthForm()}
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const ModulesPage = () => {
|
|||||||
const [searchParams, setSearchParams] = useSearchParams()
|
const [searchParams, setSearchParams] = useSearchParams()
|
||||||
const { data: ModulesList = [], isLoading: isModulesLoading } =
|
const { data: ModulesList = [], isLoading: isModulesLoading } =
|
||||||
modulesServiceApi.useGetModulesQuery('modules', {
|
modulesServiceApi.useGetModulesQuery('modules', {
|
||||||
pollingInterval: 1000,
|
pollingInterval: 5000,
|
||||||
skipPollingIfUnfocused: true
|
skipPollingIfUnfocused: true
|
||||||
})
|
})
|
||||||
const [removeModule] = modulesServiceApi.useRemoveModuleMutation()
|
const [removeModule] = modulesServiceApi.useRemoveModuleMutation()
|
||||||
@@ -190,6 +190,8 @@ const ModulesPage = () => {
|
|||||||
return (
|
return (
|
||||||
<section className="modules-page">
|
<section className="modules-page">
|
||||||
<Column
|
<Column
|
||||||
|
title="Модули"
|
||||||
|
searchPlaceholder="Введите имя или id"
|
||||||
items={filterFirstColumnItems(ModulesList, searchValue)}
|
items={filterFirstColumnItems(ModulesList, searchValue)}
|
||||||
showAddBtn={false}
|
showAddBtn={false}
|
||||||
showUpdateBtn={false}
|
showUpdateBtn={false}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const NotFound = () => {
|
|||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
return (
|
return (
|
||||||
<NotFoundPage>
|
<NotFoundPage>
|
||||||
<Button type="primary" onClick={() => navigate(routePaths.modules)}>
|
<Button type="primary" onClick={() => navigate(routePaths.home)}>
|
||||||
На главную
|
На главную
|
||||||
</Button>
|
</Button>
|
||||||
</NotFoundPage>
|
</NotFoundPage>
|
||||||
|
|||||||
@@ -192,6 +192,8 @@ const RolesPage = () => {
|
|||||||
return (
|
return (
|
||||||
<section className="roles-page">
|
<section className="roles-page">
|
||||||
<Column
|
<Column
|
||||||
|
title="Роли пользователей"
|
||||||
|
searchPlaceholder="Введите имя или id"
|
||||||
showUpdateBtn={false}
|
showUpdateBtn={false}
|
||||||
items={filterFirstColumnItems(data, searchValue)}
|
items={filterFirstColumnItems(data, searchValue)}
|
||||||
showAddBtn={isAddRolePermissions}
|
showAddBtn={isAddRolePermissions}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { Spin } from 'antd'
|
import { Spin } from 'antd'
|
||||||
import { Layout } from 'isp-ui-kit'
|
|
||||||
import { lazy, Suspense } from 'react'
|
import { lazy, Suspense } from 'react'
|
||||||
import { Navigate, Route, Routes } from 'react-router-dom'
|
import { Navigate, Route, Routes } from 'react-router-dom'
|
||||||
|
|
||||||
@@ -8,13 +7,11 @@ import LayoutComponent from '@components/Layout'
|
|||||||
// Составная часть основной страницы, поэтому без lazy
|
// Составная часть основной страницы, поэтому без lazy
|
||||||
import Configurations from '@pages/ConfigurationsPage'
|
import Configurations from '@pages/ConfigurationsPage'
|
||||||
import Connections from '@pages/ConnectionsPage'
|
import Connections from '@pages/ConnectionsPage'
|
||||||
|
import ErrorWrapperPage from '@pages/ErrorWrapperPage'
|
||||||
|
|
||||||
import PrivateRoute from '@routes/PrivateRoute'
|
import PrivateRoute from '@routes/PrivateRoute'
|
||||||
import { routePaths } from '@routes/routePaths.ts'
|
import { routePaths } from '@routes/routePaths.ts'
|
||||||
|
|
||||||
|
|
||||||
const { ErrorPage } = Layout
|
|
||||||
|
|
||||||
const LoginPage = lazy(() => import('@pages/LoginPage'))
|
const LoginPage = lazy(() => import('@pages/LoginPage'))
|
||||||
const ProfilePage = lazy(() => import('@pages/ProfilePage'))
|
const ProfilePage = lazy(() => import('@pages/ProfilePage'))
|
||||||
const UsersPage = lazy(() => import('@pages/UsersPage'))
|
const UsersPage = lazy(() => import('@pages/UsersPage'))
|
||||||
@@ -204,7 +201,7 @@ const Routers = () => {
|
|||||||
path={routePaths.error}
|
path={routePaths.error}
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<ErrorPage />
|
<ErrorWrapperPage />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -41,8 +41,9 @@ apiService.interceptors.response.use(
|
|||||||
console.error(error)
|
console.error(error)
|
||||||
if (error.response && error.response.status === 401) {
|
if (error.response && error.response.status === 401) {
|
||||||
localClear()
|
localClear()
|
||||||
|
const prevRoute = sessionStorage.getItem('prevRoute') || ''
|
||||||
message.error('Ваша сессия истекла"').then()
|
message.error('Ваша сессия истекла"').then()
|
||||||
LocalStorage.set('redirectUrl', location.pathname)
|
sessionStorage.setItem('prevRoute', prevRoute)
|
||||||
window.location.href = routePaths.login
|
window.location.href = routePaths.login
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
},
|
},
|
||||||
host: true,
|
host: true,
|
||||||
strictPort: true,
|
strictPort: true,
|
||||||
port: 8001,
|
port: 8000,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': env.PROXY_URL
|
'/api': env.PROXY_URL
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user