Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a1d2b594c | ||
|
|
3e52a14c0a | ||
|
|
63fa6bc2ab | ||
|
|
e51429a0bb | ||
|
|
10347e8e18 |
No files matched your search
+1
-1
@@ -36,7 +36,7 @@
|
||||
"^@type/(.*)$",
|
||||
"^./*.*.ts",
|
||||
"^[./]",
|
||||
"^./*.*.(scss|css)"
|
||||
".(scss|css)$"
|
||||
],
|
||||
"importOrderSeparation": true
|
||||
}
|
||||
@@ -1,3 +1,25 @@
|
||||
## 0.15.0
|
||||
- Добавлены placeholder для поиска в первом столбце
|
||||
- Добавлен заголовок первого столбца на экране Модули
|
||||
- Изменен интервал поллинга для get_modules на 5 секунд
|
||||
- Изменена логика работы редиректа после окончания сессии
|
||||
## 0.14.2
|
||||
- Исправлено появление экрана после логина
|
||||
- На экране ошибки добавлена кнопка "На главную"
|
||||
- Внутренние улучшения кода
|
||||
## 0.14.1
|
||||
- Исправлено отображение времени создания на странице Токенов
|
||||
## 0.14.0
|
||||
- Для первого столбца добавлен поиск по id элемента
|
||||
## 0.13.4
|
||||
- Установлен monaco-editor для избежания загрузки сторонних файлов при открытии редактора
|
||||
- Удалена в редакторе кода всплывашка Невалидный JSON
|
||||
- В редакторе конфига исправлено добавление новых key, новых элементов масивов
|
||||
## 0.13.3
|
||||
- Добавлено отображение id приложения на экранах страниц 'Приложения' и 'Доступы приложений'
|
||||
- Добавлено фиксирование в localStorage открытое или закрытое меню
|
||||
- Исправлена очистка localStorage после протухания или удаления токена
|
||||
- Исправлены стили для субменю, которые влияли на отображение разрешенных и неразрешенных пунктов меню
|
||||
## 0.13.2
|
||||
- Обновление пермишенов
|
||||
## 0.13.1
|
||||
|
||||
Generated
+8
-30
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"version": "0.13.0",
|
||||
"version": "0.15.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "isp-admin-ui",
|
||||
"version": "0.13.0",
|
||||
"version": "0.15.0",
|
||||
"dependencies": {
|
||||
"@apidevtools/json-schema-ref-parser": "^9.0.6",
|
||||
"@codemirror/lang-json": "^6.0.1",
|
||||
@@ -20,6 +20,7 @@
|
||||
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
||||
"json-schema-view-js": "^2.0.1",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"monaco-editor": "^0.52.0",
|
||||
"react": "^18.2.0",
|
||||
"react-codemirror-merge": "^4.21.25",
|
||||
"react-dom": "^18.2.0",
|
||||
@@ -3961,18 +3962,6 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/eslint": {
|
||||
"version": "8.56.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz",
|
||||
"integrity": "sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/estree": "*",
|
||||
"@types/json-schema": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
|
||||
@@ -7981,8 +7970,8 @@
|
||||
}
|
||||
},
|
||||
"node_modules/isp-ui-kit": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#657a9c1b62fb757938e12091faba6f5f53c7d7e9",
|
||||
"version": "0.8.0",
|
||||
"resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#01a9d57ecddddc7b979ffefd499bad21c5bb8ca9",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@codemirror/lang-javascript": "^6.2.1",
|
||||
@@ -8375,21 +8364,10 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.30.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
||||
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/monaco-editor": {
|
||||
"version": "0.49.0",
|
||||
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.49.0.tgz",
|
||||
"integrity": "sha512-2I8/T3X/hLxB2oPHgqcNYUVdA/ZEFShT7IAujifIPMfKkNbLOqY8XCoyHCXrsdjb36dW9MwoTwBCFpXKMwNwaQ==",
|
||||
"peer": true
|
||||
"version": "0.52.0",
|
||||
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.0.tgz",
|
||||
"integrity": "sha512-OeWhNpABLCeTqubfqLMXGsqf6OmPU6pHM85kF3dhy6kq5hnhuVS1p3VrEW/XhWHc71P2tHyS5JFySD8mgs1crw=="
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"private": true,
|
||||
"version": "0.13.2",
|
||||
"version": "0.15.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
@@ -26,6 +26,7 @@
|
||||
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
||||
"json-schema-view-js": "^2.0.1",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"monaco-editor": "^0.52.0",
|
||||
"react": "^18.2.0",
|
||||
"react-codemirror-merge": "^4.21.25",
|
||||
"react-dom": "^18.2.0",
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { ConfigProvider } from 'antd'
|
||||
import ruRu from 'antd/locale/ru_RU'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
|
||||
import { darkTheme, lightTheme } from '@constants/theme.ts'
|
||||
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
import Routers from '@routes/Routers'
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import './app.scss'
|
||||
|
||||
@@ -18,6 +20,19 @@ const App = () => {
|
||||
: 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(() => {
|
||||
setTheme(() => (changeTheme ? darkTheme : lightTheme))
|
||||
}, [changeTheme])
|
||||
|
||||
@@ -142,7 +142,7 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1.3} title={item.name}>
|
||||
<List.Item.Meta title={item.name} description={item.description} />
|
||||
<List.Item.Meta title={item.name} description={<span>id: {item.id}</span>}/>
|
||||
<div
|
||||
className="link-btn"
|
||||
onClick={(e) => {
|
||||
@@ -171,6 +171,7 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
<section className="applications-content">
|
||||
<Column
|
||||
title="Приложения"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
showUpdateBtn={true}
|
||||
onAddItem={addApplicationModal}
|
||||
|
||||
@@ -1,25 +1,40 @@
|
||||
import { FC, useContext } from 'react'
|
||||
import { ConfigurationEditorPropsType } from '@pages/ConfigurationEditorPage'
|
||||
import Editor from '@monaco-editor/react'
|
||||
import Editor, { loader } from '@monaco-editor/react'
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
import { message } from 'antd'
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
import * as monaco from 'monaco-editor'
|
||||
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
||||
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
||||
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
|
||||
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
|
||||
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
||||
|
||||
const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBtn= () => {}, bufConfig, setBufConfig }) => {
|
||||
const { changeTheme } = useContext(Context)
|
||||
const debounce = (func: (...args: any[]) => void, wait: number) => {
|
||||
let timeout: NodeJS.Timeout
|
||||
return (...args: []) => {
|
||||
clearTimeout(timeout)
|
||||
timeout = setTimeout(() => {
|
||||
func.apply(this, [...args])
|
||||
}, wait)
|
||||
}
|
||||
}
|
||||
|
||||
const debouncedHandleError = debounce(() => {
|
||||
message.error('Невалидный JSON объект')
|
||||
}, 500)
|
||||
self.MonacoEnvironment = {
|
||||
getWorker(_, label) {
|
||||
if (label === 'json') {
|
||||
return new jsonWorker();
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return new cssWorker();
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return new htmlWorker();
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return new tsWorker();
|
||||
}
|
||||
return new editorWorker();
|
||||
},
|
||||
};
|
||||
|
||||
loader.config({ monaco });
|
||||
|
||||
loader.init().then();
|
||||
|
||||
const handleChange = (data: string | undefined) => {
|
||||
|
||||
@@ -32,7 +47,6 @@ const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBt
|
||||
setDisableBtn(false)
|
||||
setBufConfig(newData)
|
||||
} catch (error) {
|
||||
debouncedHandleError()
|
||||
setDisableBtn(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig =
|
||||
return (
|
||||
<ReactJsonView
|
||||
theme={ changeTheme ? 'twilight' : ''}
|
||||
onAdd={true}
|
||||
onAdd={({updated_src}: any) => handleEdit(updated_src)}
|
||||
onDelete={({updated_src}: any) => handleEdit(updated_src)}
|
||||
displayDataTypes={false}
|
||||
displayObjectSize={false}
|
||||
|
||||
@@ -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 './layout.scss';
|
||||
|
||||
import './layout.scss'
|
||||
|
||||
const { Content, Sider } = Layout
|
||||
|
||||
const LayoutComponent = () => {
|
||||
const [collapsed, setCollapsed] = useState<boolean>(true)
|
||||
const [collapsed, setCollapsed] = useState<boolean>(
|
||||
LocalStorage.get('menu') === null ? true : LocalStorage.get('menu')
|
||||
)
|
||||
const [selectedMenuKeys, setSelectedMenuKeys] = useState<MenuItemKeysType[]>(
|
||||
[]
|
||||
)
|
||||
const [openKeys, setOpenKeys] = useState<string[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const dispatch = useAppDispatch()
|
||||
const {
|
||||
status,
|
||||
@@ -135,13 +135,21 @@ const LayoutComponent = () => {
|
||||
)
|
||||
})
|
||||
}, [theme])
|
||||
|
||||
useEffect(() => {
|
||||
if (userToken) {
|
||||
if (userToken && status === StateProfileStatus.notInit) {
|
||||
dispatch(fetchProfile())
|
||||
dispatch(fetchUI())
|
||||
}
|
||||
}, [])
|
||||
}, [userToken, status])
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
status === StateProfileStatus.resolved ||
|
||||
status === StateProfileStatus.rejected
|
||||
) {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [status])
|
||||
|
||||
useEffect(() => {
|
||||
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) {
|
||||
return <Navigate to={routePaths.error} replace />
|
||||
}
|
||||
@@ -194,36 +206,33 @@ const LayoutComponent = () => {
|
||||
return (
|
||||
<section>
|
||||
<Layout className="layout" data-cy="homePage">
|
||||
{status === StateProfileStatus.pending ? (
|
||||
<Spin size="large" />
|
||||
) : (
|
||||
<>
|
||||
<Sider
|
||||
width="250px"
|
||||
data-cy="aside"
|
||||
theme="light"
|
||||
collapsible
|
||||
collapsed={collapsed}
|
||||
onCollapse={(value) => setCollapsed(value)}
|
||||
>
|
||||
<Header collapsed={collapsed} />
|
||||
<Menu
|
||||
onOpenChange={(keys) => setOpenKeys(keys)}
|
||||
openKeys={openKeys}
|
||||
selectedKeys={selectedMenuKeys}
|
||||
onClick={handlerOnClickMenu}
|
||||
theme="light"
|
||||
mode="inline"
|
||||
items={menuItems}
|
||||
/>
|
||||
</Sider>
|
||||
<Layout className="site-layout">
|
||||
<Content className="site-layout__content">
|
||||
<Outlet />
|
||||
</Content>
|
||||
</Layout>
|
||||
</>
|
||||
)}
|
||||
<Sider
|
||||
width="250px"
|
||||
data-cy="aside"
|
||||
theme="light"
|
||||
collapsible
|
||||
collapsed={collapsed}
|
||||
onCollapse={(value) => {
|
||||
LocalStorage.set('menu', value)
|
||||
setCollapsed(value)
|
||||
}}
|
||||
>
|
||||
<Header collapsed={collapsed} />
|
||||
<Menu
|
||||
onOpenChange={(keys) => setOpenKeys(keys)}
|
||||
openKeys={openKeys}
|
||||
selectedKeys={selectedMenuKeys}
|
||||
onClick={handlerOnClickMenu}
|
||||
theme="light"
|
||||
mode="inline"
|
||||
items={menuItems}
|
||||
/>
|
||||
</Sider>
|
||||
<Layout className="site-layout">
|
||||
<Content className="site-layout__content">
|
||||
<Outlet />
|
||||
</Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</section>
|
||||
)
|
||||
|
||||
@@ -44,3 +44,9 @@
|
||||
padding-top: 5px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-menu-submenu {
|
||||
.hide-item {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import 'dayjs/locale/ru'
|
||||
import duration from 'dayjs/plugin/duration'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import { FormComponents, Layout } from 'isp-ui-kit'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
@@ -24,10 +24,7 @@ import {
|
||||
|
||||
import tokensApi from '@services/tokensService.ts'
|
||||
|
||||
|
||||
|
||||
import './tokens.scss';
|
||||
|
||||
import './tokens.scss'
|
||||
|
||||
const { FormSelect } = FormComponents
|
||||
const { EmptyData } = Layout
|
||||
@@ -117,16 +114,14 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
||||
title: 'Токен',
|
||||
dataIndex: 'token',
|
||||
key: 'token',
|
||||
render: (record) => <div>{shortenString(record)}</div>
|
||||
render: (value) => <div>{shortenString(value)}</div>
|
||||
},
|
||||
{
|
||||
title: 'Дата/Время выпуска',
|
||||
dataIndex: 'createdAt',
|
||||
key: 'createdAt',
|
||||
render: (record) => {
|
||||
const formatTime = dayjs(record.createdAt).format(
|
||||
dateFormats.fullFormat
|
||||
)
|
||||
render: (value) => {
|
||||
const formatTime = dayjs(value).format(dateFormats.fullFormat)
|
||||
return <div>{formatTime}</div>
|
||||
}
|
||||
},
|
||||
@@ -135,7 +130,6 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
||||
dataIndex: 'expireTime',
|
||||
key: 'expireTime',
|
||||
render: (value, record) => {
|
||||
|
||||
if (value === -1) {
|
||||
return <span>Никогда</span>
|
||||
}
|
||||
@@ -158,7 +152,11 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
||||
return (
|
||||
<Button.Group>
|
||||
<Tooltip title="Скопировать">
|
||||
<Button className="copy-btn" icon={<CopyOutlined />} data-clipboard-text={value} />
|
||||
<Button
|
||||
className="copy-btn"
|
||||
icon={<CopyOutlined />}
|
||||
data-clipboard-text={value}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip title="Удалить">
|
||||
<Popconfirm
|
||||
@@ -174,28 +172,31 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
||||
}
|
||||
]
|
||||
|
||||
const tokensOptions = [
|
||||
{
|
||||
value: -1,
|
||||
label: 'Бессрочно'
|
||||
},
|
||||
{
|
||||
value: 3600000,
|
||||
label: 'Один час'
|
||||
},
|
||||
{
|
||||
value: 86400000,
|
||||
label: 'Один день'
|
||||
},
|
||||
{
|
||||
value: 2592000000,
|
||||
label: '30 дней'
|
||||
},
|
||||
{
|
||||
value: 31536000000,
|
||||
label: 'Один год'
|
||||
}
|
||||
]
|
||||
const tokensOptions = useMemo(
|
||||
() => [
|
||||
{
|
||||
value: -1,
|
||||
label: 'Бессрочно'
|
||||
},
|
||||
{
|
||||
value: 3600000,
|
||||
label: 'Один час'
|
||||
},
|
||||
{
|
||||
value: 86400000,
|
||||
label: 'Один день'
|
||||
},
|
||||
{
|
||||
value: 2592000000,
|
||||
label: '30 дней'
|
||||
},
|
||||
{
|
||||
value: 31536000000,
|
||||
label: 'Один год'
|
||||
}
|
||||
],
|
||||
[]
|
||||
)
|
||||
if (!id) {
|
||||
return <EmptyData />
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ const AppAccessPage = () => {
|
||||
<section className="app-access-page">
|
||||
<Column
|
||||
title="Приложения"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
showUpdateBtn={false}
|
||||
showAddBtn={false}
|
||||
showRemoveBtn={false}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { List, message, Spin, Tooltip } from 'antd'
|
||||
import { message, Spin } from 'antd'
|
||||
import { Layout } from 'isp-ui-kit'
|
||||
import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
@@ -23,6 +23,7 @@ import applicationsGroupApi from '@services/applicationsGroupService.ts'
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
import ListItem from '@widgets/ListItem'
|
||||
|
||||
import './applications-page.scss'
|
||||
|
||||
@@ -79,19 +80,6 @@ const ApplicationsPage = () => {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
|
||||
const renderColumnItems = (item: ColumnItem<any>) => {
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta
|
||||
title={item.name}
|
||||
description={<span>{item.description}</span>}
|
||||
/>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
}
|
||||
|
||||
const addApplicationModal = () => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
@@ -175,6 +163,7 @@ const ApplicationsPage = () => {
|
||||
<main className="applications-page">
|
||||
<Column
|
||||
title="Группы приложений"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
showUpdateBtn={true}
|
||||
onAddItem={addApplicationModal}
|
||||
@@ -183,7 +172,7 @@ const ApplicationsPage = () => {
|
||||
applicationsGroup as unknown as ColumnItem<ApplicationsGroupType>[],
|
||||
searchValue
|
||||
)}
|
||||
renderItems={renderColumnItems}
|
||||
renderItems={(item) => <ListItem item={item} />}
|
||||
searchValue={searchValue}
|
||||
selectedItemId={selectedItemId}
|
||||
setSelectedItemId={(itemId) => {
|
||||
|
||||
@@ -102,9 +102,6 @@ const ConfigurationEditorPage: FC = () => {
|
||||
if (e.data.errorCode === 2003) {
|
||||
setDetailsError({ details: e.data.details, isOpenDetailsErrorModal: true })
|
||||
}
|
||||
if (e.data.errorCode === 400) {
|
||||
message.error('Невалидный JSON объект')
|
||||
}
|
||||
message.error('Ошибка обновления элемента')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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 { response,status } = err
|
||||
const { response, status } = err
|
||||
if (response && status === 401) {
|
||||
setFormError(response.statusText, messages.loginError)
|
||||
} else {
|
||||
@@ -57,9 +57,8 @@ const LoginPage = () => {
|
||||
LocalStorage.set(localStorageKeys.HEADER_NAME, response.headerName)
|
||||
LocalStorage.set(localStorageKeys.USER_TOKEN, response.token)
|
||||
const redirectUrl =
|
||||
localStorage.getItem('redirectUrl') || routePaths.home
|
||||
sessionStorage.getItem('prevRoute') || routePaths.home
|
||||
navigate(redirectUrl, { replace: true })
|
||||
localStorage.removeItem('redirectUrl')
|
||||
})
|
||||
.catch((err: AxiosError<MSPError>) => handleError(err))
|
||||
}
|
||||
@@ -106,15 +105,15 @@ const LoginPage = () => {
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<section className="login-page">
|
||||
<form className="login-page__content">
|
||||
<h1 data-cy="login-title" className="login-page__content__title">
|
||||
Вход в систему
|
||||
</h1>
|
||||
<Divider />
|
||||
{renderInternalAuthForm()}
|
||||
</form>
|
||||
</section>
|
||||
<section className="login-page">
|
||||
<form className="login-page__content">
|
||||
<h1 data-cy="login-title" className="login-page__content__title">
|
||||
Вход в систему
|
||||
</h1>
|
||||
<Divider />
|
||||
{renderInternalAuthForm()}
|
||||
</form>
|
||||
</section>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ const ModulesPage = () => {
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
const { data: ModulesList = [], isLoading: isModulesLoading } =
|
||||
modulesServiceApi.useGetModulesQuery('modules', {
|
||||
pollingInterval: 1000,
|
||||
pollingInterval: 5000,
|
||||
skipPollingIfUnfocused: true
|
||||
})
|
||||
const [removeModule] = modulesServiceApi.useRemoveModuleMutation()
|
||||
@@ -190,6 +190,8 @@ const ModulesPage = () => {
|
||||
return (
|
||||
<section className="modules-page">
|
||||
<Column
|
||||
title="Модули"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
items={filterFirstColumnItems(ModulesList, searchValue)}
|
||||
showAddBtn={false}
|
||||
showUpdateBtn={false}
|
||||
|
||||
@@ -11,7 +11,7 @@ const NotFound = () => {
|
||||
const navigate = useNavigate()
|
||||
return (
|
||||
<NotFoundPage>
|
||||
<Button type="primary" onClick={() => navigate(routePaths.modules)}>
|
||||
<Button type="primary" onClick={() => navigate(routePaths.home)}>
|
||||
На главную
|
||||
</Button>
|
||||
</NotFoundPage>
|
||||
|
||||
@@ -192,6 +192,8 @@ const RolesPage = () => {
|
||||
return (
|
||||
<section className="roles-page">
|
||||
<Column
|
||||
title="Роли пользователей"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
showUpdateBtn={false}
|
||||
items={filterFirstColumnItems(data, searchValue)}
|
||||
showAddBtn={isAddRolePermissions}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Spin } from 'antd'
|
||||
import { Layout } from 'isp-ui-kit'
|
||||
import { lazy, Suspense } from 'react'
|
||||
import { Navigate, Route, Routes } from 'react-router-dom'
|
||||
|
||||
@@ -8,13 +7,11 @@ import LayoutComponent from '@components/Layout'
|
||||
// Составная часть основной страницы, поэтому без lazy
|
||||
import Configurations from '@pages/ConfigurationsPage'
|
||||
import Connections from '@pages/ConnectionsPage'
|
||||
import ErrorWrapperPage from '@pages/ErrorWrapperPage'
|
||||
|
||||
import PrivateRoute from '@routes/PrivateRoute'
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
|
||||
const { ErrorPage } = Layout
|
||||
|
||||
const LoginPage = lazy(() => import('@pages/LoginPage'))
|
||||
const ProfilePage = lazy(() => import('@pages/ProfilePage'))
|
||||
const UsersPage = lazy(() => import('@pages/UsersPage'))
|
||||
@@ -204,7 +201,7 @@ const Routers = () => {
|
||||
path={routePaths.error}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ErrorPage />
|
||||
<ErrorWrapperPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -30,14 +30,20 @@ apiService.interceptors.request.use(
|
||||
(error: AxiosError<MSPError>) => Promise.reject(error)
|
||||
)
|
||||
|
||||
const localClear = () => {
|
||||
LocalStorage.remove(localStorageKeys.USER_TOKEN)
|
||||
LocalStorage.remove(localStorageKeys.HEADER_NAME)
|
||||
}
|
||||
|
||||
apiService.interceptors.response.use(
|
||||
async (response: any) => response,
|
||||
(error: AxiosError<MSPError>) => {
|
||||
console.error(error)
|
||||
if (error.response && error.response.status === 401) {
|
||||
LocalStorage.clear()
|
||||
localClear()
|
||||
const prevRoute = sessionStorage.getItem('prevRoute') || ''
|
||||
message.error('Ваша сессия истекла"').then()
|
||||
LocalStorage.set('redirectUrl', location.pathname)
|
||||
sessionStorage.setItem('prevRoute', prevRoute)
|
||||
window.location.href = routePaths.login
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ const configServiceApi = createApi({
|
||||
}),
|
||||
createUpdateConfig: builder.mutation<ConfigType, ConfigType>({
|
||||
query: (data) => ({ url: apiPaths.createUpdateConfig, data }),
|
||||
invalidatesTags: () => ['configs', 'versions']
|
||||
invalidatesTags: () => ['configs', 'versions', 'config']
|
||||
}),
|
||||
deleteVersion: builder.mutation<void, string>({
|
||||
query: (id) => ({ url: apiPaths.deleteVersion, data: { id } }),
|
||||
|
||||
@@ -3,9 +3,16 @@ import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
||||
export const filterFirstColumnItems = <T extends NonNullable<unknown>>(
|
||||
listItems: ColumnItem<T>[],
|
||||
searchValue: string
|
||||
): ColumnItem<T>[] =>
|
||||
listItems
|
||||
? listItems.filter((el) =>
|
||||
el.name.toLowerCase().trim().includes(searchValue.toLowerCase().trim())
|
||||
)
|
||||
): ColumnItem<T>[] => {
|
||||
const normalizedSearchValue = searchValue.toLowerCase().trim()
|
||||
return listItems
|
||||
? listItems.filter((el) => {
|
||||
const normalizedName = el.name.toLowerCase().trim()
|
||||
const normalizedId = el.id.toString().toLowerCase().trim()
|
||||
return (
|
||||
normalizedName.includes(normalizedSearchValue) ||
|
||||
normalizedId.includes(normalizedSearchValue)
|
||||
)
|
||||
})
|
||||
: []
|
||||
}
|
||||
@@ -8,7 +8,7 @@ const ListItem: FC<ListItemProps> = ({ item }) => {
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta title={item.name} />
|
||||
<List.Item.Meta title={item.name} description={<span>id: {item.id}</span>} />
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ export default defineConfig(({ mode }) => {
|
||||
},
|
||||
host: true,
|
||||
strictPort: true,
|
||||
port: 8001,
|
||||
port: 8000,
|
||||
proxy: {
|
||||
'/api': env.PROXY_URL
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user