Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e51429a0bb | ||
|
|
10347e8e18 | ||
|
|
83a1cd2205 | ||
|
|
5f4a3c55cc | ||
|
|
9be06cd305 | ||
|
|
2ebeb14f0e | ||
|
|
0dbf4b0b07 |
No files matched your search
@@ -1,3 +1,22 @@
|
|||||||
|
## 0.13.4
|
||||||
|
- Установлен monaco-editor для избежания загрузки сторонних файлов при открытии редактора
|
||||||
|
- Удалена в редакторе кода всплывашка Невалидный JSON
|
||||||
|
- В редакторе конфига исправлено добавление новых key, новых элементов масивов
|
||||||
|
## 0.13.3
|
||||||
|
- Добавлено отображение id приложения на экранах страниц 'Приложения' и 'Доступы приложений'
|
||||||
|
- Добавлено фиксирование в localStorage открытое или закрытое меню
|
||||||
|
- Исправлена очистка localStorage после протухания или удаления токена
|
||||||
|
- Исправлены стили для субменю, которые влияли на отображение разрешенных и неразрешенных пунктов меню
|
||||||
|
## 0.13.2
|
||||||
|
- Обновление пермишенов
|
||||||
|
## 0.13.1
|
||||||
|
- В LoginPage исправлен background для темной темы
|
||||||
|
## 0.13.0
|
||||||
|
- Добавлена темная тема
|
||||||
|
## 0.12.6
|
||||||
|
- Добавлены кропки "удалить/добавть" в JsonView
|
||||||
|
- Добавлен скролл к JsonView
|
||||||
|
- Добавлена обработка ошибок к изменению конфига
|
||||||
## 0.12.5
|
## 0.12.5
|
||||||
- Исправлено неверное поведение показа меню
|
- Исправлено неверное поведение показа меню
|
||||||
- Добавлена страница NotFoundPage
|
- Добавлена страница NotFoundPage
|
||||||
|
|||||||
+2
-1
@@ -6,7 +6,8 @@ RUN npm install
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM nginx:1.25-alpine-slim
|
FROM nginx:1.25-alpine-slim
|
||||||
EXPOSE 80
|
EXPOSE 8001
|
||||||
|
RUN rm -f /etc/nginx/conf.d/default.conf
|
||||||
COPY cfg/80_isp-admin-ui.conf /etc/nginx/conf.d/80_isp-admin-ui.conf
|
COPY cfg/80_isp-admin-ui.conf /etc/nginx/conf.d/80_isp-admin-ui.conf
|
||||||
COPY --from=build-deps /usr/src/app/build /opt/msp/isp-admin-ui
|
COPY --from=build-deps /usr/src/app/build /opt/msp/isp-admin-ui
|
||||||
|
|
||||||
Generated
+8
-30
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "isp-admin-ui",
|
"name": "isp-admin-ui",
|
||||||
"version": "0.12.5",
|
"version": "0.13.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "isp-admin-ui",
|
"name": "isp-admin-ui",
|
||||||
"version": "0.12.5",
|
"version": "0.13.3",
|
||||||
"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.7.5",
|
||||||
"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#040326c756de20d7a4bfad3411c9fa9feb7c4818",
|
||||||
"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.12.5",
|
"version": "0.13.4",
|
||||||
"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",
|
||||||
|
|||||||
@@ -10,11 +10,13 @@
|
|||||||
&__table {
|
&__table {
|
||||||
&__name-field {
|
&__name-field {
|
||||||
input {
|
input {
|
||||||
|
color: #606060;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
|
color: var(--ant-color-text);
|
||||||
padding: $basic-padding;
|
padding: $basic-padding;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
outline: 1px solid $blue-color;
|
outline: 1px solid $blue-color;
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
|
|
||||||
.active-config {
|
.active-config {
|
||||||
tr {
|
tr {
|
||||||
background: $blue-light;
|
background: var(--ant-color-info-bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-3
@@ -1,8 +1,8 @@
|
|||||||
import { ConfigProvider } from 'antd'
|
import { ConfigProvider } from 'antd'
|
||||||
import ruRu from 'antd/locale/ru_RU'
|
import ruRu from 'antd/locale/ru_RU'
|
||||||
import { useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { lightTheme } from '@constants/theme.ts'
|
import { darkTheme, lightTheme } from '@constants/theme.ts'
|
||||||
|
|
||||||
import { Context } from '@stores/index.tsx'
|
import { Context } from '@stores/index.tsx'
|
||||||
|
|
||||||
@@ -12,10 +12,19 @@ import './app.scss'
|
|||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const [themes, setTheme] = useState(lightTheme)
|
const [themes, setTheme] = useState(lightTheme)
|
||||||
|
const [changeTheme, setChangeTheme] = useState(
|
||||||
|
localStorage.getItem('theme')
|
||||||
|
? JSON.parse(localStorage.getItem('theme') || '')
|
||||||
|
: true
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTheme(() => (changeTheme ? darkTheme : lightTheme))
|
||||||
|
}, [changeTheme])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="app">
|
<div className="app">
|
||||||
<Context.Provider value={{ setTheme }}>
|
<Context.Provider value={{ setTheme, setChangeTheme, changeTheme }}>
|
||||||
<ConfigProvider theme={themes} locale={ruRu}>
|
<ConfigProvider theme={themes} locale={ruRu}>
|
||||||
<Routers />
|
<Routers />
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
|||||||
return (
|
return (
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<Tooltip mouseEnterDelay={1.3} title={item.name}>
|
<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
|
<div
|
||||||
className="link-btn"
|
className="link-btn"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
|
|||||||
@@ -31,11 +31,6 @@
|
|||||||
|
|
||||||
&__row {
|
&__row {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&.ant-table-row {
|
|
||||||
&:hover td {
|
|
||||||
background-color: white !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { EditorState, EditorView } from '@uiw/react-codemirror'
|
import { EditorState, EditorView } from '@uiw/react-codemirror'
|
||||||
import { Button, Spin, Table } from 'antd'
|
import { Button, Spin, Table } from 'antd'
|
||||||
import { ColumnsType } from 'antd/es/table'
|
import { ColumnsType } from 'antd/es/table'
|
||||||
import { FC, memo, useState } from 'react'
|
import { FC, memo, useContext, useState } from 'react'
|
||||||
import CodeMirrorMerge from 'react-codemirror-merge'
|
import CodeMirrorMerge from 'react-codemirror-merge'
|
||||||
|
|
||||||
import Modal from '@widgets/Modal'
|
import Modal from '@widgets/Modal'
|
||||||
@@ -20,6 +20,7 @@ import { VersionType } from '@type/version.type'
|
|||||||
import './compare-version-modal.scss'
|
import './compare-version-modal.scss'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { dateFormats } from '@constants/date.ts'
|
import { dateFormats } from '@constants/date.ts'
|
||||||
|
import { Context } from '@stores/index.tsx'
|
||||||
|
|
||||||
|
|
||||||
const Original = CodeMirrorMerge.Original
|
const Original = CodeMirrorMerge.Original
|
||||||
@@ -37,6 +38,7 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
|
|||||||
const { data: allUsers = [], isLoading: isUsersLoading } =
|
const { data: allUsers = [], isLoading: isUsersLoading } =
|
||||||
userServiceApi.useGetAllUsersQuery()
|
userServiceApi.useGetAllUsersQuery()
|
||||||
const { profile } = useAppSelector((state) => state.profileReducer)
|
const { profile } = useAppSelector((state) => state.profileReducer)
|
||||||
|
const { changeTheme } = useContext(Context)
|
||||||
const isLoading = isVersionLoading || isUsersLoading
|
const isLoading = isVersionLoading || isUsersLoading
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return <Spin />
|
return <Spin />
|
||||||
@@ -79,7 +81,10 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
|
|||||||
<span> Версия: {selectedItem.configVersion}</span>
|
<span> Версия: {selectedItem.configVersion}</span>
|
||||||
<span>{config?.version ? `Текущая версия : ${config?.version}` : `Версия: ${config?.configVersion}`}</span>
|
<span>{config?.version ? `Текущая версия : ${config?.version}` : `Версия: ${config?.configVersion}`}</span>
|
||||||
</div>
|
</div>
|
||||||
<CodeMirrorMerge orientation="a-b">
|
<CodeMirrorMerge
|
||||||
|
orientation="a-b"
|
||||||
|
theme={changeTheme ? 'dark' : 'light'}
|
||||||
|
>
|
||||||
<Original
|
<Original
|
||||||
value={JSON.stringify(sortObject(selectedItem.data), null, 2)}
|
value={JSON.stringify(sortObject(selectedItem.data), null, 2)}
|
||||||
/>
|
/>
|
||||||
@@ -95,7 +100,6 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
|
|||||||
) : (
|
) : (
|
||||||
<div className="compare-version-modal__content__table">
|
<div className="compare-version-modal__content__table">
|
||||||
<Table
|
<Table
|
||||||
rowClassName="compare-version-modal__content__table__row"
|
|
||||||
size="small"
|
size="small"
|
||||||
columns={columns}
|
columns={columns}
|
||||||
pagination={{ pageSize: 30 }}
|
pagination={{ pageSize: 30 }}
|
||||||
|
|||||||
@@ -1,23 +1,40 @@
|
|||||||
import { FC } 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 * 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 debounce = (func: (...args: any[]) => void, wait: number) => {
|
const { changeTheme } = useContext(Context)
|
||||||
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) => {
|
||||||
|
|
||||||
@@ -30,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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,7 +60,7 @@ const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBt
|
|||||||
width="auto"
|
width="auto"
|
||||||
height="100vh"
|
height="100vh"
|
||||||
language="json"
|
language="json"
|
||||||
theme="vs-white"
|
theme={changeTheme ? 'vs-dark' : 'vs-white'}
|
||||||
value={editorValue}
|
value={editorValue}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
options={{
|
options={{
|
||||||
|
|||||||
@@ -1,29 +1,35 @@
|
|||||||
import { FC } from 'react'
|
import { FC, useContext } from 'react'
|
||||||
import {ConfigurationEditorPropsType} from '@pages/ConfigurationEditorPage'
|
import {ConfigurationEditorPropsType} from '@pages/ConfigurationEditorPage'
|
||||||
import { ReactJsonView } from 'isp-ui-kit'
|
import { ReactJsonView } from 'isp-ui-kit'
|
||||||
import {Spin} from 'antd'
|
import {Spin} from 'antd'
|
||||||
import { cleanEmptyParamsObject } from '@utils/objectUtils.ts'
|
import { cleanEmptyParamsObject } from '@utils/objectUtils.ts'
|
||||||
|
import { Context } from '@stores/index.tsx'
|
||||||
|
|
||||||
const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig = {}, setBufConfig, isCurrentConfigLoading, JsonSchema}) => {
|
const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig = {}, setBufConfig, isCurrentConfigLoading}) => {
|
||||||
|
const { changeTheme } = useContext(Context)
|
||||||
if (isCurrentConfigLoading) {
|
if (isCurrentConfigLoading) {
|
||||||
return <Spin className="spin" />
|
return <Spin className="spin" />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleEdit = (updated_src: any) => {
|
||||||
|
const newData = {
|
||||||
|
...bufConfig,
|
||||||
|
data: { ...updated_src }
|
||||||
|
}
|
||||||
|
setBufConfig(cleanEmptyParamsObject(newData))
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReactJsonView
|
<ReactJsonView
|
||||||
|
theme={ changeTheme ? 'twilight' : ''}
|
||||||
|
onAdd={({updated_src}: any) => handleEdit(updated_src)}
|
||||||
|
onDelete={({updated_src}: any) => handleEdit(updated_src)}
|
||||||
displayDataTypes={false}
|
displayDataTypes={false}
|
||||||
displayObjectSize={false}
|
displayObjectSize={false}
|
||||||
name={null}
|
name={null}
|
||||||
enableClipboard={true}
|
enableClipboard={true}
|
||||||
iconStyle="square"
|
iconStyle="square"
|
||||||
onEdit={({updated_src}: any) => {
|
onEdit={({updated_src}: any) => handleEdit(updated_src)}
|
||||||
const newData = {
|
|
||||||
...bufConfig,
|
|
||||||
data: { ...updated_src }
|
|
||||||
}
|
|
||||||
setBufConfig(cleanEmptyParamsObject(newData))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
src={bufConfig.data}
|
src={bufConfig.data}
|
||||||
sortKeys={true}
|
sortKeys={true}
|
||||||
collapsed={1}
|
collapsed={1}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { ReactJsonView } from 'isp-ui-kit'
|
import { ReactJsonView } from 'isp-ui-kit'
|
||||||
import { FC, memo } from 'react'
|
import { FC, memo, useContext } from 'react'
|
||||||
|
|
||||||
import Modal from '@widgets/Modal'
|
import Modal from '@widgets/Modal'
|
||||||
|
|
||||||
import { ConfigurationPreviewModalPropsType } from '@components/ConfigurationPreviewModal/configuration-preview-modal.type.ts'
|
import { ConfigurationPreviewModalPropsType } from '@components/ConfigurationPreviewModal/configuration-preview-modal.type.ts'
|
||||||
|
|
||||||
import './configuration-preview-modal.scss'
|
import './configuration-preview-modal.scss'
|
||||||
|
import { Context } from '@stores/index.tsx'
|
||||||
|
|
||||||
|
|
||||||
const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
|
const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
|
||||||
@@ -14,6 +15,7 @@ const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
|
|||||||
open,
|
open,
|
||||||
onClose
|
onClose
|
||||||
}) => {
|
}) => {
|
||||||
|
const { changeTheme } = useContext(Context)
|
||||||
const data = JSON.parse(JSON.stringify(config.data || {}))
|
const data = JSON.parse(JSON.stringify(config.data || {}))
|
||||||
const configName = versionCompare
|
const configName = versionCompare
|
||||||
? `Версия: ${config.configVersion}`
|
? `Версия: ${config.configVersion}`
|
||||||
@@ -22,6 +24,7 @@ const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
|
|||||||
<div className="configuration-preview-modal">
|
<div className="configuration-preview-modal">
|
||||||
<Modal title={configName || ''} open={open} onClose={onClose}>
|
<Modal title={configName || ''} open={open} onClose={onClose}>
|
||||||
<ReactJsonView
|
<ReactJsonView
|
||||||
|
theme={ changeTheme ? 'twilight' : ''}
|
||||||
src={data}
|
src={data}
|
||||||
name={false}
|
name={false}
|
||||||
sortKeys={true}
|
sortKeys={true}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import './layout.scss';
|
|||||||
const { Content, Sider } = Layout
|
const { Content, Sider } = Layout
|
||||||
|
|
||||||
const LayoutComponent = () => {
|
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 [selectedMenuKeys, setSelectedMenuKeys] = useState<MenuItemKeysType[]>(
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
@@ -95,28 +95,32 @@ const LayoutComponent = () => {
|
|||||||
{
|
{
|
||||||
label: 'Пользователи и роли',
|
label: 'Пользователи и роли',
|
||||||
key: 'sessionManagement',
|
key: 'sessionManagement',
|
||||||
className: hideItem([PermissionKeysType.read]),
|
className: hideItem([
|
||||||
|
PermissionKeysType.user_view,
|
||||||
|
PermissionKeysType.session_view,
|
||||||
|
PermissionKeysType.role_view,
|
||||||
|
]),
|
||||||
icon: <ProfileOutlined />,
|
icon: <ProfileOutlined />,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
label: 'Пользователи',
|
label: 'Пользователи',
|
||||||
key: 'users',
|
key: 'users',
|
||||||
className: hideItem(PermissionKeysType.read)
|
className: hideItem(PermissionKeysType.user_view),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Пользовательские сессии',
|
label: 'Пользовательские сессии',
|
||||||
key: 'sessions',
|
key: 'sessions',
|
||||||
className: hideItem(PermissionKeysType.read)
|
className: hideItem(PermissionKeysType.session_view),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Просмотр журналов ИБ',
|
label: 'Просмотр журналов ИБ',
|
||||||
key: 'securityLog',
|
key: 'securityLog',
|
||||||
className: hideItem(PermissionKeysType.read)
|
className: hideItem(PermissionKeysType.security_log_view),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Роли',
|
label: 'Роли',
|
||||||
key: 'roles',
|
key: 'roles',
|
||||||
className: hideItem(PermissionKeysType.read)
|
className: hideItem(PermissionKeysType.role_view),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -200,7 +204,10 @@ const LayoutComponent = () => {
|
|||||||
theme="light"
|
theme="light"
|
||||||
collapsible
|
collapsible
|
||||||
collapsed={collapsed}
|
collapsed={collapsed}
|
||||||
onCollapse={(value) => setCollapsed(value)}
|
onCollapse={(value) => {
|
||||||
|
LocalStorage.set('menu', value)
|
||||||
|
setCollapsed(value)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Header collapsed={collapsed} />
|
<Header collapsed={collapsed} />
|
||||||
<Menu
|
<Menu
|
||||||
|
|||||||
@@ -19,24 +19,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ant-menu-title-content {
|
.ant-menu-title-content {
|
||||||
color: #1B1B1B;
|
|
||||||
padding-left: 10px
|
padding-left: 10px
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-item {
|
.user-item {
|
||||||
|
padding-left: 21px !important;
|
||||||
& .ant-menu-submenu-arrow {
|
& .ant-menu-submenu-arrow {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
border-bottom: 1px solid lightgray;
|
border-bottom: 1px solid var(--ant-color-border);
|
||||||
border-radius: 0 !important;
|
border-radius: 0 !important;
|
||||||
|
|
||||||
& .ant-menu-submenu-title {
|
|
||||||
padding-left: 21px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
& .ant-menu-title-content {
|
& .ant-menu-title-content {
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
padding-left: 17px !important;
|
padding-left: 17px !important;
|
||||||
@@ -45,9 +40,13 @@
|
|||||||
|
|
||||||
.ant-menu-inline-collapsed {
|
.ant-menu-inline-collapsed {
|
||||||
& .user-item {
|
& .user-item {
|
||||||
& .ant-menu-submenu-title {
|
padding-left: 24px !important;
|
||||||
padding-left: 24px !important;
|
padding-top: 5px !important;
|
||||||
padding-top: 5px !important;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-menu-submenu {
|
||||||
|
.hide-item {
|
||||||
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,14 +58,12 @@ const RolesContent = ({
|
|||||||
const { id: selectedItemId } = useParams()
|
const { id: selectedItemId } = useParams()
|
||||||
|
|
||||||
const [openModal, setOpenModal] = useState<boolean>(false)
|
const [openModal, setOpenModal] = useState<boolean>(false)
|
||||||
const isUpdateRole = hasPermission(PermissionKeysType.write)
|
const isUpdateRole = hasPermission(PermissionKeysType.role_update)
|
||||||
const isCreateRole = hasPermission(PermissionKeysType.write)
|
const isCreateRole = hasPermission(PermissionKeysType.role_add)
|
||||||
|
|
||||||
const isSaveBtnAvailable =
|
const isSaveBtnAvailable =
|
||||||
selectedItemId === 'new' ? isCreateRole : isUpdateRole
|
selectedItemId === 'new' ? isCreateRole : isUpdateRole
|
||||||
|
|
||||||
const isExternalGroup = hasPermission(PermissionKeysType.write)
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!role) {
|
if (!role) {
|
||||||
reset(newRole)
|
reset(newRole)
|
||||||
@@ -152,7 +150,6 @@ const RolesContent = ({
|
|||||||
/>
|
/>
|
||||||
<FormInput
|
<FormInput
|
||||||
data-cy="roles-content__input__external-group"
|
data-cy="roles-content__input__external-group"
|
||||||
disabled={!isExternalGroup}
|
|
||||||
label="Группы ЕСК"
|
label="Группы ЕСК"
|
||||||
name="externalGroup"
|
name="externalGroup"
|
||||||
control={control}
|
control={control}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ $text-size: 1rem;
|
|||||||
$text-size-header1: 1.7rem;
|
$text-size-header1: 1.7rem;
|
||||||
$text-size-header2: 1.25rem;
|
$text-size-header2: 1.25rem;
|
||||||
|
|
||||||
$text-color-gray: var(--ant-primary-color);
|
$text-color-gray: var(--ant-layout-header-color);
|
||||||
$background-color: #F0F2F5;
|
$background-color: var(--ant-layout-light-sider-bg);
|
||||||
$grey: #606060;
|
$grey: #606060;
|
||||||
$border-color: #d9d9d9;
|
$border-color: var(--ant-color-border);
|
||||||
$error-red: #cf1322;
|
$error-red: #cf1322;
|
||||||
|
|
||||||
$blue-color: #40A9FF;
|
$blue-color: #40A9FF;
|
||||||
|
|||||||
+14
-2
@@ -1,5 +1,17 @@
|
|||||||
import { theme } from 'antd'
|
import { theme } from 'antd'
|
||||||
|
|
||||||
export const darkTheme = { algorithm: theme.darkAlgorithm }
|
export const darkTheme = {
|
||||||
|
algorithm: theme.darkAlgorithm,
|
||||||
|
cssVar: true,
|
||||||
|
token: {
|
||||||
|
colorBgLayout: '#000000'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const lightTheme = { algorithm: theme.defaultAlgorithm }
|
export const lightTheme = {
|
||||||
|
algorithm: theme.defaultAlgorithm,
|
||||||
|
cssVar: true,
|
||||||
|
token: {
|
||||||
|
colorBgLayout: '#FFFFFF'
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
.app-access-page {
|
.app-access-page {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
.ant-tree {
|
.ant-tree {
|
||||||
background: none;
|
background: none;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
.applications-page {
|
.applications-page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
&__list {
|
&__list {
|
||||||
.ant-list-item {
|
.ant-list-item {
|
||||||
@@ -21,14 +20,7 @@
|
|||||||
max-height: 100vh;
|
max-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.three-columns {
|
|
||||||
display: flex;
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: inset -1px 0px 0px $border-color;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal__wrap{
|
.modal__wrap{
|
||||||
min-width: 350px;
|
min-width: 380px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { List, message, Spin, Tooltip } from 'antd'
|
import { message, Spin } from 'antd'
|
||||||
import { Layout } from 'isp-ui-kit'
|
import { Layout } from 'isp-ui-kit'
|
||||||
import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
||||||
import { useEffect, useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
@@ -23,6 +23,7 @@ import applicationsGroupApi from '@services/applicationsGroupService.ts'
|
|||||||
import { routePaths } from '@routes/routePaths.ts'
|
import { routePaths } from '@routes/routePaths.ts'
|
||||||
|
|
||||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||||
|
import ListItem from '@widgets/ListItem'
|
||||||
|
|
||||||
import './applications-page.scss'
|
import './applications-page.scss'
|
||||||
|
|
||||||
@@ -79,19 +80,6 @@ const ApplicationsPage = () => {
|
|||||||
return <Spin className="spin" />
|
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 = () => {
|
const addApplicationModal = () => {
|
||||||
setShowApplicationsModal({
|
setShowApplicationsModal({
|
||||||
...showApplicationsModal,
|
...showApplicationsModal,
|
||||||
@@ -172,7 +160,7 @@ const ApplicationsPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="applications-page three-columns">
|
<main className="applications-page">
|
||||||
<Column
|
<Column
|
||||||
title="Группы приложений"
|
title="Группы приложений"
|
||||||
onUpdateItem={updateApplicationModal}
|
onUpdateItem={updateApplicationModal}
|
||||||
@@ -183,7 +171,7 @@ const ApplicationsPage = () => {
|
|||||||
applicationsGroup as unknown as ColumnItem<ApplicationsGroupType>[],
|
applicationsGroup as unknown as ColumnItem<ApplicationsGroupType>[],
|
||||||
searchValue
|
searchValue
|
||||||
)}
|
)}
|
||||||
renderItems={renderColumnItems}
|
renderItems={(item) => <ListItem item={item} />}
|
||||||
searchValue={searchValue}
|
searchValue={searchValue}
|
||||||
selectedItemId={selectedItemId}
|
selectedItemId={selectedItemId}
|
||||||
setSelectedItemId={(itemId) => {
|
setSelectedItemId={(itemId) => {
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
.configuration-editor-page {
|
.configuration-editor-page {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: white;
|
|
||||||
height: 100%;
|
|
||||||
-ms-overflow-style: none; /* IE и Edge */
|
-ms-overflow-style: none; /* IE и Edge */
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
border-left: 1px solid $border-color;
|
border-left: 1px solid $border-color;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: scroll;
|
||||||
|
padding-bottom: 80px;
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
&__header {
|
&__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
padding: $basic-padding *2 $basic-padding;
|
padding: $basic-padding *2 $basic-padding;
|
||||||
border-bottom: 1px solid $border-color;
|
border-bottom: 1px solid $border-color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ const ConfigurationEditorPage: FC = () => {
|
|||||||
createUpdateConfig(cleanEmptyParamsObject(newData))
|
createUpdateConfig(cleanEmptyParamsObject(newData))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.then(({ id }) => {
|
.then(({ id }) => {
|
||||||
message.success('Конфигурация успешно сохранена')
|
|
||||||
isNew && navigate(`/${moduleId}/configEditor/${id}`)
|
isNew && navigate(`/${moduleId}/configEditor/${id}`)
|
||||||
|
message.success('Конфигурация успешно сохранена')
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
if (e.data.errorCode === 2004) {
|
if (e.data.errorCode === 2004) {
|
||||||
@@ -102,9 +102,7 @@ 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('Ошибка обновления элемента')
|
||||||
message.error('Невалидный JSON объект')
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +150,7 @@ const ConfigurationEditorPage: FC = () => {
|
|||||||
<RollbackOutlined />
|
<RollbackOutlined />
|
||||||
Назад
|
Назад
|
||||||
</Button>
|
</Button>
|
||||||
|
<h1>{bufConfig?.name}</h1>
|
||||||
<div className="configuration-editor-page__controll">
|
<div className="configuration-editor-page__controll">
|
||||||
<Button
|
<Button
|
||||||
disabled={!JsonSchema}
|
disabled={!JsonSchema}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
&__inner-marker {
|
&__inner-marker {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
border: 1px solid #15D1E6;
|
border: 1px solid var(--ant-color-border);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
margin: 4px
|
margin: 4px
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { LockOutlined, UserOutlined } from '@ant-design/icons'
|
import { LockOutlined, UserOutlined } from '@ant-design/icons'
|
||||||
import { Button, Divider } from 'antd'
|
import { Button, Divider, Layout } from 'antd'
|
||||||
import { AxiosError } from 'axios'
|
import { AxiosError } from 'axios'
|
||||||
import { FormComponents, useAuth } from 'isp-ui-kit'
|
import { FormComponents, useAuth } from 'isp-ui-kit'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
@@ -105,6 +105,7 @@ const LoginPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<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">
|
||||||
@@ -114,6 +115,7 @@ const LoginPage = () => {
|
|||||||
{renderInternalAuthForm()}
|
{renderInternalAuthForm()}
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
</Layout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ const ModulesPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="modules-page three-columns">
|
<section className="modules-page">
|
||||||
<Column
|
<Column
|
||||||
items={filterFirstColumnItems(ModulesList, searchValue)}
|
items={filterFirstColumnItems(ModulesList, searchValue)}
|
||||||
showAddBtn={false}
|
showAddBtn={false}
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
.modules-page {
|
.modules-page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
&__tabs {
|
&__tabs {
|
||||||
padding: 0 $basic-padding*2;
|
padding: 0 $basic-padding*2;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
overflow-x: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tag {
|
.ant-tag {
|
||||||
@@ -43,10 +45,3 @@
|
|||||||
width: fit-content !important;
|
width: fit-content !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.three-columns {
|
|
||||||
display: flex;
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: inset -1px 0px 0px $border-color;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Button, Descriptions, Popconfirm } from 'antd'
|
import { Button, Descriptions, Popconfirm } from 'antd'
|
||||||
import { useState } from 'react'
|
import { useContext, useEffect, useState } from 'react'
|
||||||
|
|
||||||
import PermissionList from '@widgets/PermissionList'
|
import PermissionList from '@widgets/PermissionList'
|
||||||
|
|
||||||
@@ -9,13 +9,23 @@ import RoleList from '@components/RoleList'
|
|||||||
import { useAppSelector } from '@hooks/redux.ts'
|
import { useAppSelector } from '@hooks/redux.ts'
|
||||||
import useLogout from '@hooks/useLogout.tsx'
|
import useLogout from '@hooks/useLogout.tsx'
|
||||||
|
|
||||||
import './profile-page.scss'
|
import { Context } from '@stores/index.tsx'
|
||||||
|
|
||||||
|
import './profile-page.scss'
|
||||||
|
|
||||||
const ProfilePage = () => {
|
const ProfilePage = () => {
|
||||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false)
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false)
|
||||||
const { profile } = useAppSelector((state) => state.profileReducer)
|
const { profile } = useAppSelector((state) => state.profileReducer)
|
||||||
const { logoutUser, isLoading } = useLogout()
|
const { logoutUser, isLoading } = useLogout()
|
||||||
|
const { changeTheme, setChangeTheme } = useContext(Context)
|
||||||
|
|
||||||
|
const onChangeTheme = () => {
|
||||||
|
setChangeTheme((prev: any) => !prev)
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
localStorage.setItem('theme', JSON.stringify(changeTheme))
|
||||||
|
}, [changeTheme])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="profile-page">
|
<section className="profile-page">
|
||||||
@@ -23,7 +33,10 @@ const ProfilePage = () => {
|
|||||||
onClose={() => setIsModalOpen(false)}
|
onClose={() => setIsModalOpen(false)}
|
||||||
open={isModalOpen}
|
open={isModalOpen}
|
||||||
/>
|
/>
|
||||||
<h1 className="profile-page__title">{`${profile.lastName} ${profile.firstName}`}</h1>
|
<header className="profile-page__header">
|
||||||
|
<h1 className="profile-page__title">{`${profile.lastName} ${profile.firstName}`}</h1>
|
||||||
|
<Button onClick={onChangeTheme}>Сменить тему</Button>
|
||||||
|
</header>
|
||||||
<div className="profile-page__user-info">
|
<div className="profile-page__user-info">
|
||||||
<div className="profile-page__user-info__email-wrapper">
|
<div className="profile-page__user-info__email-wrapper">
|
||||||
<Descriptions>
|
<Descriptions>
|
||||||
|
|||||||
@@ -3,13 +3,18 @@
|
|||||||
.profile-page {
|
.profile-page {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
border: 1px solid #F0F0F0;
|
border: 1px solid var(--ant-color-border);
|
||||||
padding: $basic-padding * 2;
|
padding: $basic-padding * 2;
|
||||||
background: #fff;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
&__title {
|
&__title {
|
||||||
font-size: $text-size-header1;
|
font-size: $text-size-header1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import { NewRoleType, PermissionKeysType, RoleType } from '@type/roles.type.ts'
|
|||||||
|
|
||||||
import './roles-page.scss'
|
import './roles-page.scss'
|
||||||
|
|
||||||
|
|
||||||
const { Column, EmptyData, NoData } = Layout
|
const { Column, EmptyData, NoData } = Layout
|
||||||
|
|
||||||
const RolesPage = () => {
|
const RolesPage = () => {
|
||||||
@@ -43,9 +42,9 @@ const RolesPage = () => {
|
|||||||
const [updateRole] = roleApi.useUpdateRoleMutation()
|
const [updateRole] = roleApi.useUpdateRoleMutation()
|
||||||
const [removeRole] = roleApi.useRemoveRoleMutation()
|
const [removeRole] = roleApi.useRemoveRoleMutation()
|
||||||
|
|
||||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
const isPageAvailable = hasPermission(PermissionKeysType.role_view)
|
||||||
const isAddRolePermissions = hasPermission(PermissionKeysType.write)
|
const isAddRolePermissions = hasPermission(PermissionKeysType.role_add)
|
||||||
const isRemoveRolePermissions = hasPermission(PermissionKeysType.write)
|
const isRemoveRolePermissions = hasPermission(PermissionKeysType.role_delete)
|
||||||
const isLoading = isPermissionLoading || isRolesLoading
|
const isLoading = isPermissionLoading || isRolesLoading
|
||||||
|
|
||||||
const isNew = selectedItemId === 'new'
|
const isNew = selectedItemId === 'new'
|
||||||
@@ -191,7 +190,7 @@ const RolesPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="roles-page three-columns">
|
<section className="roles-page">
|
||||||
<Column
|
<Column
|
||||||
showUpdateBtn={false}
|
showUpdateBtn={false}
|
||||||
items={filterFirstColumnItems(data, searchValue)}
|
items={filterFirstColumnItems(data, searchValue)}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
.roles-page {
|
.roles-page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
.role-item {
|
.role-item {
|
||||||
&__id {
|
&__id {
|
||||||
@@ -14,10 +15,3 @@
|
|||||||
width: 100%
|
width: 100%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.three-columns {
|
|
||||||
display: flex;
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: inset -1px 0px 0px $border-color;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
@@ -33,7 +33,7 @@ const SecurityLogPage = () => {
|
|||||||
const [currentPage, setCurrentPage] = useState(1)
|
const [currentPage, setCurrentPage] = useState(1)
|
||||||
|
|
||||||
const isLoading = isUsersLoading || isLoadingLogs
|
const isLoading = isUsersLoading || isLoadingLogs
|
||||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
const isPageAvailable = hasPermission(PermissionKeysType.security_log_view)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getAllLogs({ limit, offset: 0 })
|
getAllLogs({ limit, offset: 0 })
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
.security-log-page {
|
.security-log-page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #fff;
|
|
||||||
border: 1px solid $border-color;
|
border: 1px solid $border-color;
|
||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import { useNavigate } from 'react-router-dom'
|
|||||||
|
|
||||||
import { SessionStatusKeysType, sessionStatuses } from '@constants/statuses'
|
import { SessionStatusKeysType, sessionStatuses } from '@constants/statuses'
|
||||||
|
|
||||||
import CanEdit from '@components/CanEdit'
|
|
||||||
|
|
||||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil'
|
import { getUserFullName } from '@utils/userUtils/getFullNameUtil'
|
||||||
|
|
||||||
import useRole from '@hooks/useRole'
|
import useRole from '@hooks/useRole'
|
||||||
@@ -47,7 +45,8 @@ const SessionsPage = () => {
|
|||||||
|
|
||||||
const isLoading = isUsersLoading || isLoadingSession
|
const isLoading = isUsersLoading || isLoadingSession
|
||||||
|
|
||||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
const isPageAvailable = hasPermission(PermissionKeysType.session_view)
|
||||||
|
const hasRevokePermission = hasPermission(PermissionKeysType.session_revoke)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isPageAvailable) {
|
if (!isPageAvailable) {
|
||||||
@@ -124,7 +123,7 @@ const SessionsPage = () => {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CanEdit>
|
{hasRevokePermission && (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="Закончить эту сессию?"
|
title="Закончить эту сессию?"
|
||||||
onConfirm={() => handleRevokeSessions(record.id)}
|
onConfirm={() => handleRevokeSessions(record.id)}
|
||||||
@@ -136,7 +135,7 @@ const SessionsPage = () => {
|
|||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
</CanEdit>
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
.sessions-page {
|
.sessions-page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #fff;
|
|
||||||
border: 1px solid $border-color;
|
border: 1px solid $border-color;
|
||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
@import "../../constants/style/styleConst";
|
@import "../../constants/style/styleConst";
|
||||||
|
|
||||||
.user-editor {
|
.user-editor {
|
||||||
background: #fff;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: 1px solid $border-color;
|
border: 1px solid $border-color;
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import { useNavigate } from 'react-router-dom'
|
|||||||
|
|
||||||
import { dateFormats } from '@constants/date.ts'
|
import { dateFormats } from '@constants/date.ts'
|
||||||
|
|
||||||
import CanEdit from '@components/CanEdit'
|
|
||||||
|
|
||||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil.ts'
|
import { getUserFullName } from '@utils/userUtils/getFullNameUtil.ts'
|
||||||
|
|
||||||
import useRole from '@hooks/useRole.tsx'
|
import useRole from '@hooks/useRole.tsx'
|
||||||
@@ -42,8 +40,11 @@ const UsersPage = () => {
|
|||||||
|
|
||||||
const isLoading = isRolesLoading || isUsersLoading
|
const isLoading = isRolesLoading || isUsersLoading
|
||||||
|
|
||||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
const isPageAvailable = hasPermission(PermissionKeysType.user_view)
|
||||||
const hasCreateUserPermission = hasPermission(PermissionKeysType.write)
|
const hasBlockUserPermission = hasPermission(PermissionKeysType.user_block)
|
||||||
|
const hasDeleteUserPermission = hasPermission(PermissionKeysType.user_delete)
|
||||||
|
const hasUpdateUserPermission = hasPermission(PermissionKeysType.user_update)
|
||||||
|
const hasCreateUserPermission = hasPermission(PermissionKeysType.user_create)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isPageAvailable) {
|
if (!isPageAvailable) {
|
||||||
@@ -169,9 +170,9 @@ const UsersPage = () => {
|
|||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return (
|
return (
|
||||||
<div className="users-page__content__table__actions">
|
<div className="users-page__content__table__actions">
|
||||||
<CanEdit>
|
|
||||||
<Button.Group className="button_group">
|
<Button.Group className="button_group">
|
||||||
{renderBlockButton(record)}
|
{hasBlockUserPermission && renderBlockButton(record)}
|
||||||
|
{hasUpdateUserPermission && (
|
||||||
<Tooltip key="EditOutlined" title="Редактировать пользователя">
|
<Tooltip key="EditOutlined" title="Редактировать пользователя">
|
||||||
<Button
|
<Button
|
||||||
data-cy={`users-page__content__table__actions__edit-btn ${record.id}`}
|
data-cy={`users-page__content__table__actions__edit-btn ${record.id}`}
|
||||||
@@ -184,7 +185,8 @@ const UsersPage = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
{hasDeleteUserPermission && (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="Вы действительно хотите удалить этого пользователя?"
|
title="Вы действительно хотите удалить этого пользователя?"
|
||||||
onConfirm={() => handleDeleteUser(record.id)}
|
onConfirm={() => handleDeleteUser(record.id)}
|
||||||
@@ -197,8 +199,8 @@ const UsersPage = () => {
|
|||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
|
)}
|
||||||
</Button.Group>
|
</Button.Group>
|
||||||
</CanEdit>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
.users-page {
|
.users-page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #fff;
|
|
||||||
border: 1px solid $border-color;
|
border: 1px solid $border-color;
|
||||||
.ant-btn-group >.ant-btn:first-child {
|
.ant-btn-group >.ant-btn:first-child {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|||||||
@@ -30,12 +30,17 @@ apiService.interceptors.request.use(
|
|||||||
(error: AxiosError<MSPError>) => Promise.reject(error)
|
(error: AxiosError<MSPError>) => Promise.reject(error)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const localClear = () => {
|
||||||
|
LocalStorage.remove(localStorageKeys.USER_TOKEN)
|
||||||
|
LocalStorage.remove(localStorageKeys.HEADER_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
apiService.interceptors.response.use(
|
apiService.interceptors.response.use(
|
||||||
async (response: any) => response,
|
async (response: any) => response,
|
||||||
(error: AxiosError<MSPError>) => {
|
(error: AxiosError<MSPError>) => {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
if (error.response && error.response.status === 401) {
|
if (error.response && error.response.status === 401) {
|
||||||
LocalStorage.clear()
|
localClear()
|
||||||
message.error('Ваша сессия истекла"').then()
|
message.error('Ваша сессия истекла"').then()
|
||||||
LocalStorage.set('redirectUrl', location.pathname)
|
LocalStorage.set('redirectUrl', location.pathname)
|
||||||
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 } }),
|
||||||
|
|||||||
@@ -21,11 +21,19 @@ import UIReducer from './redusers/UISlice.ts'
|
|||||||
|
|
||||||
export interface ContextProps {
|
export interface ContextProps {
|
||||||
setTheme: Dispatch<
|
setTheme: Dispatch<
|
||||||
SetStateAction<{ algorithm: (token: SeedToken) => MapToken }>
|
SetStateAction<{
|
||||||
|
algorithm: (token: SeedToken) => MapToken
|
||||||
|
cssVar: boolean
|
||||||
|
token: { colorBgLayout: string }
|
||||||
|
}>
|
||||||
>
|
>
|
||||||
|
changeTheme: boolean
|
||||||
|
setChangeTheme: Dispatch<SetStateAction<boolean>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Context = createContext<ContextProps>({
|
export const Context = createContext<ContextProps>({
|
||||||
|
changeTheme: false,
|
||||||
|
setChangeTheme: () => false,
|
||||||
setTheme: () => theme.defaultAlgorithm
|
setTheme: () => theme.defaultAlgorithm
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -1,6 +1,18 @@
|
|||||||
export enum PermissionKeysType {
|
export enum PermissionKeysType {
|
||||||
read = 'read', // Просмотр страниц
|
read = 'read', // Просмотр страниц
|
||||||
write = 'write' // Редактирование страниц
|
write = 'write', // Редактирование страниц
|
||||||
|
user_view = 'user_view', // Просмотр списка пользователей
|
||||||
|
user_block = 'user_block', // Блокировка пользователя
|
||||||
|
user_create = 'user_create', // Создать пользователя
|
||||||
|
user_update = 'user_update', // Обновить пользователя
|
||||||
|
user_delete = 'user_delete', // Удаление пользователя
|
||||||
|
session_view = 'session_view', // Просмотр списка пользовательских сессий
|
||||||
|
session_revoke = 'session_revoke', // Отзыв сессии
|
||||||
|
role_view = 'role_view', // Просмотр экрана ролей
|
||||||
|
role_add = 'role_add', // Создание роли
|
||||||
|
role_update = 'role_update', // Обновление роли
|
||||||
|
role_delete = 'role_delete', // Удаление роли
|
||||||
|
security_log_view = 'security_log_view', // Просмотр журналов ИБ
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RoleType {
|
export interface RoleType {
|
||||||
|
|||||||
@@ -5,4 +5,10 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 8px;
|
top: 8px;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
path {
|
||||||
|
fill: var(--ant-color-text) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import RefParser from '@apidevtools/json-schema-ref-parser'
|
import RefParser from '@apidevtools/json-schema-ref-parser'
|
||||||
import JSONSchemaView from 'json-schema-view-js'
|
import JSONSchemaView from 'json-schema-view-js'
|
||||||
import cloneDeep from 'lodash.clonedeep'
|
import cloneDeep from 'lodash.clonedeep'
|
||||||
import React, { useEffect, useRef } from 'react'
|
import { FC, useContext, useEffect, useRef } from 'react'
|
||||||
|
|
||||||
|
import { Context } from '@stores/index.tsx'
|
||||||
|
|
||||||
import 'json-schema-view-js/dist/style.min.css'
|
import 'json-schema-view-js/dist/style.min.css'
|
||||||
|
|
||||||
@@ -9,7 +11,8 @@ interface JsonSchemaViewerProps {
|
|||||||
schema: object
|
schema: object
|
||||||
}
|
}
|
||||||
|
|
||||||
const JsonSchemaViewer: React.FC<JsonSchemaViewerProps> = ({ schema }) => {
|
const JsonSchemaViewer: FC<JsonSchemaViewerProps> = ({ schema }) => {
|
||||||
|
const { changeTheme } = useContext(Context)
|
||||||
const myRef = useRef<HTMLDivElement>(null)
|
const myRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -28,7 +31,9 @@ const JsonSchemaViewer: React.FC<JsonSchemaViewerProps> = ({ schema }) => {
|
|||||||
if (err) {
|
if (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
} else {
|
} else {
|
||||||
const view = new JSONSchemaView(dereferencedSchema, 3)
|
const view = new JSONSchemaView(dereferencedSchema, 3, {
|
||||||
|
theme: changeTheme ? 'dark' : ''
|
||||||
|
})
|
||||||
if (myRef.current) {
|
if (myRef.current) {
|
||||||
myRef.current.appendChild(view.render())
|
myRef.current.appendChild(view.render())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const ListItem: FC<ListItemProps> = ({ item }) => {
|
|||||||
return (
|
return (
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
<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>
|
</Tooltip>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
background-color: rgba(211, 211, 211, 0.8);
|
background-color: var(--ant-color-bg-mask);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
min-height: 170px;
|
min-height: 170px;
|
||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
background: white;
|
background: var(--ant-layout-light-sider-bg);
|
||||||
color: white;
|
color: white;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
background: white;
|
background: var(--ant-layout-light-sider-bg);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-top-left-radius: 16px;
|
border-top-left-radius: 16px;
|
||||||
border-top-right-radius: 16px;
|
border-top-right-radius: 16px;
|
||||||
|
|||||||
Reference in new issue
Block a user