Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae26c073e1 | ||
|
|
1a1d2b594c | ||
|
|
3e52a14c0a | ||
|
|
63fa6bc2ab | ||
|
|
e51429a0bb |
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,23 @@
|
|||||||
|
## 0.15.1
|
||||||
|
- Изменен цвет компонента Tag в ActiveConfigurationsTable
|
||||||
|
- Изменена иконка редакторивания конфига на <FormOutlined />
|
||||||
|
## 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
|
## 0.13.3
|
||||||
- Добавлено отображение id приложения на экранах страниц 'Приложения' и 'Доступы приложений'
|
- Добавлено отображение id приложения на экранах страниц 'Приложения' и 'Доступы приложений'
|
||||||
- Добавлено фиксирование в localStorage открытое или закрытое меню
|
- Добавлено фиксирование в localStorage открытое или закрытое меню
|
||||||
|
|||||||
Generated
+8
-30
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "isp-admin-ui",
|
"name": "isp-admin-ui",
|
||||||
"version": "0.13.0",
|
"version": "0.15.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "isp-admin-ui",
|
"name": "isp-admin-ui",
|
||||||
"version": "0.13.0",
|
"version": "0.15.1",
|
||||||
"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",
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
||||||
"json-schema-view-js": "^2.0.1",
|
"json-schema-view-js": "^2.0.1",
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
|
"monaco-editor": "^0.52.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-codemirror-merge": "^4.21.25",
|
"react-codemirror-merge": "^4.21.25",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
@@ -3961,18 +3962,6 @@
|
|||||||
"node": ">=6.9.0"
|
"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": {
|
"node_modules/@types/estree": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
|
||||||
@@ -7981,8 +7970,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/isp-ui-kit": {
|
"node_modules/isp-ui-kit": {
|
||||||
"version": "0.7.1",
|
"version": "0.8.1",
|
||||||
"resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#657a9c1b62fb757938e12091faba6f5f53c7d7e9",
|
"resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#18178ff6af4ea9ee220a3d5eab318e88af7a6b96",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/lang-javascript": "^6.2.1",
|
"@codemirror/lang-javascript": "^6.2.1",
|
||||||
@@ -8375,21 +8364,10 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"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": {
|
"node_modules/monaco-editor": {
|
||||||
"version": "0.49.0",
|
"version": "0.52.0",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.49.0.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.0.tgz",
|
||||||
"integrity": "sha512-2I8/T3X/hLxB2oPHgqcNYUVdA/ZEFShT7IAujifIPMfKkNbLOqY8XCoyHCXrsdjb36dW9MwoTwBCFpXKMwNwaQ==",
|
"integrity": "sha512-OeWhNpABLCeTqubfqLMXGsqf6OmPU6pHM85kF3dhy6kq5hnhuVS1p3VrEW/XhWHc71P2tHyS5JFySD8mgs1crw=="
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "isp-admin-ui",
|
"name": "isp-admin-ui",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.13.3",
|
"version": "0.15.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
||||||
"json-schema-view-js": "^2.0.1",
|
"json-schema-view-js": "^2.0.1",
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
|
"monaco-editor": "^0.52.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-codemirror-merge": "^4.21.25",
|
"react-codemirror-merge": "^4.21.25",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
render: (value: boolean) => {
|
render: (value: boolean) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
return <Tag color="#4fc14f">Корректная</Tag>
|
return <Tag color="success">Корректная</Tag>
|
||||||
}
|
}
|
||||||
return <Tag color="red">Некорректная</Tag>
|
return <Tag color="error">Некорректная</Tag>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,25 +1,40 @@
|
|||||||
import { FC, useContext } from 'react'
|
import { FC, useContext } from 'react'
|
||||||
import { ConfigurationEditorPropsType } from '@pages/ConfigurationEditorPage'
|
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 { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||||
import { message } from 'antd'
|
|
||||||
import { Context } from '@stores/index.tsx'
|
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 ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBtn= () => {}, bufConfig, setBufConfig }) => {
|
||||||
const { changeTheme } = useContext(Context)
|
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(() => {
|
self.MonacoEnvironment = {
|
||||||
message.error('Невалидный JSON объект')
|
getWorker(_, label) {
|
||||||
}, 500)
|
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) => {
|
const handleChange = (data: string | undefined) => {
|
||||||
|
|
||||||
@@ -32,7 +47,6 @@ const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBt
|
|||||||
setDisableBtn(false)
|
setDisableBtn(false)
|
||||||
setBufConfig(newData)
|
setBufConfig(newData)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debouncedHandleError()
|
|
||||||
setDisableBtn(true)
|
setDisableBtn(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig =
|
|||||||
return (
|
return (
|
||||||
<ReactJsonView
|
<ReactJsonView
|
||||||
theme={ changeTheme ? 'twilight' : ''}
|
theme={ changeTheme ? 'twilight' : ''}
|
||||||
onAdd={true}
|
onAdd={({updated_src}: any) => handleEdit(updated_src)}
|
||||||
onDelete={({updated_src}: any) => handleEdit(updated_src)}
|
onDelete={({updated_src}: any) => handleEdit(updated_src)}
|
||||||
displayDataTypes={false}
|
displayDataTypes={false}
|
||||||
displayObjectSize={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 { 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>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import 'dayjs/locale/ru'
|
|||||||
import duration from 'dayjs/plugin/duration'
|
import duration from 'dayjs/plugin/duration'
|
||||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||||
import { FormComponents, Layout } from 'isp-ui-kit'
|
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 { useForm } from 'react-hook-form'
|
||||||
|
|
||||||
import { dateFormats } from '@constants/date.ts'
|
import { dateFormats } from '@constants/date.ts'
|
||||||
@@ -24,10 +24,7 @@ import {
|
|||||||
|
|
||||||
import tokensApi from '@services/tokensService.ts'
|
import tokensApi from '@services/tokensService.ts'
|
||||||
|
|
||||||
|
import './tokens.scss'
|
||||||
|
|
||||||
import './tokens.scss';
|
|
||||||
|
|
||||||
|
|
||||||
const { FormSelect } = FormComponents
|
const { FormSelect } = FormComponents
|
||||||
const { EmptyData } = Layout
|
const { EmptyData } = Layout
|
||||||
@@ -117,16 +114,14 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
|||||||
title: 'Токен',
|
title: 'Токен',
|
||||||
dataIndex: 'token',
|
dataIndex: 'token',
|
||||||
key: 'token',
|
key: 'token',
|
||||||
render: (record) => <div>{shortenString(record)}</div>
|
render: (value) => <div>{shortenString(value)}</div>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Дата/Время выпуска',
|
title: 'Дата/Время выпуска',
|
||||||
dataIndex: 'createdAt',
|
dataIndex: 'createdAt',
|
||||||
key: 'createdAt',
|
key: 'createdAt',
|
||||||
render: (record) => {
|
render: (value) => {
|
||||||
const formatTime = dayjs(record.createdAt).format(
|
const formatTime = dayjs(value).format(dateFormats.fullFormat)
|
||||||
dateFormats.fullFormat
|
|
||||||
)
|
|
||||||
return <div>{formatTime}</div>
|
return <div>{formatTime}</div>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -135,7 +130,6 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
|||||||
dataIndex: 'expireTime',
|
dataIndex: 'expireTime',
|
||||||
key: 'expireTime',
|
key: 'expireTime',
|
||||||
render: (value, record) => {
|
render: (value, record) => {
|
||||||
|
|
||||||
if (value === -1) {
|
if (value === -1) {
|
||||||
return <span>Никогда</span>
|
return <span>Никогда</span>
|
||||||
}
|
}
|
||||||
@@ -158,7 +152,11 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
|||||||
return (
|
return (
|
||||||
<Button.Group>
|
<Button.Group>
|
||||||
<Tooltip title="Скопировать">
|
<Tooltip title="Скопировать">
|
||||||
<Button className="copy-btn" icon={<CopyOutlined />} data-clipboard-text={value} />
|
<Button
|
||||||
|
className="copy-btn"
|
||||||
|
icon={<CopyOutlined />}
|
||||||
|
data-clipboard-text={value}
|
||||||
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Удалить">
|
<Tooltip title="Удалить">
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
@@ -174,28 +172,31 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const tokensOptions = [
|
const tokensOptions = useMemo(
|
||||||
{
|
() => [
|
||||||
value: -1,
|
{
|
||||||
label: 'Бессрочно'
|
value: -1,
|
||||||
},
|
label: 'Бессрочно'
|
||||||
{
|
},
|
||||||
value: 3600000,
|
{
|
||||||
label: 'Один час'
|
value: 3600000,
|
||||||
},
|
label: 'Один час'
|
||||||
{
|
},
|
||||||
value: 86400000,
|
{
|
||||||
label: 'Один день'
|
value: 86400000,
|
||||||
},
|
label: 'Один день'
|
||||||
{
|
},
|
||||||
value: 2592000000,
|
{
|
||||||
label: '30 дней'
|
value: 2592000000,
|
||||||
},
|
label: '30 дней'
|
||||||
{
|
},
|
||||||
value: 31536000000,
|
{
|
||||||
label: 'Один год'
|
value: 31536000000,
|
||||||
}
|
label: 'Один год'
|
||||||
]
|
}
|
||||||
|
],
|
||||||
|
[]
|
||||||
|
)
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return <EmptyData />
|
return <EmptyData />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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}
|
||||||
|
|||||||
@@ -102,9 +102,6 @@ const ConfigurationEditorPage: FC = () => {
|
|||||||
if (e.data.errorCode === 2003) {
|
if (e.data.errorCode === 2003) {
|
||||||
setDetailsError({ details: e.data.details, isOpenDetailsErrorModal: true })
|
setDetailsError({ details: e.data.details, isOpenDetailsErrorModal: true })
|
||||||
}
|
}
|
||||||
if (e.data.errorCode === 400) {
|
|
||||||
message.error('Невалидный JSON объект')
|
|
||||||
}
|
|
||||||
message.error('Ошибка обновления элемента')
|
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 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ const configServiceApi = createApi({
|
|||||||
}),
|
}),
|
||||||
createUpdateConfig: builder.mutation<ConfigType, ConfigType>({
|
createUpdateConfig: builder.mutation<ConfigType, ConfigType>({
|
||||||
query: (data) => ({ url: apiPaths.createUpdateConfig, data }),
|
query: (data) => ({ url: apiPaths.createUpdateConfig, data }),
|
||||||
invalidatesTags: () => ['configs', 'versions']
|
invalidatesTags: () => ['configs', 'versions', 'config']
|
||||||
}),
|
}),
|
||||||
deleteVersion: builder.mutation<void, string>({
|
deleteVersion: builder.mutation<void, string>({
|
||||||
query: (id) => ({ url: apiPaths.deleteVersion, data: { id } }),
|
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>>(
|
export const filterFirstColumnItems = <T extends NonNullable<unknown>>(
|
||||||
listItems: ColumnItem<T>[],
|
listItems: ColumnItem<T>[],
|
||||||
searchValue: string
|
searchValue: string
|
||||||
): ColumnItem<T>[] =>
|
): ColumnItem<T>[] => {
|
||||||
listItems
|
const normalizedSearchValue = searchValue.toLowerCase().trim()
|
||||||
? listItems.filter((el) =>
|
return listItems
|
||||||
el.name.toLowerCase().trim().includes(searchValue.toLowerCase().trim())
|
? listItems.filter((el) => {
|
||||||
)
|
const normalizedName = el.name.toLowerCase().trim()
|
||||||
|
const normalizedId = el.id.toString().toLowerCase().trim()
|
||||||
|
return (
|
||||||
|
normalizedName.includes(normalizedSearchValue) ||
|
||||||
|
normalizedId.includes(normalizedSearchValue)
|
||||||
|
)
|
||||||
|
})
|
||||||
: []
|
: []
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
AlertOutlined,
|
AlertOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
EditOutlined,
|
FormOutlined,
|
||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
HistoryOutlined,
|
HistoryOutlined,
|
||||||
SwapOutlined,
|
SwapOutlined,
|
||||||
@@ -133,7 +133,7 @@ const ActiveTableActionButtons: FC<ActiveTableActionButtonsPropsType> =
|
|||||||
<Tooltip title="Редактировать">
|
<Tooltip title="Редактировать">
|
||||||
<Button onClick={() => {
|
<Button onClick={() => {
|
||||||
navigate(`/${record.moduleId}/${routePaths.configEditor}/${record.id}`, { state: record })
|
navigate(`/${record.moduleId}/${routePaths.configEditor}/${record.id}`, { state: record })
|
||||||
}} icon={<EditOutlined />} />
|
}} icon={<FormOutlined />} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</CanEdit>
|
</CanEdit>
|
||||||
{renderAdditionalButtons()}
|
{renderAdditionalButtons()}
|
||||||
|
|||||||
+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