MSP-3423 fix prettier
This commit is contained in:
1 parent
7307827078
commit
eff4590fbc
56 files changed
+803
-733
No files matched your search
@@ -1,223 +1,227 @@
|
||||
import { CheckOutlined, CloseOutlined, EditOutlined } from '@ant-design/icons'
|
||||
import { Button, message, Table, Tag, Tooltip } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import dayjs from 'dayjs'
|
||||
import { FC, useEffect, useRef, useState } from 'react'
|
||||
import { useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
import ActiveTableActionButtons from '@widgets/ActiveTableActionButtons'
|
||||
|
||||
import {
|
||||
ActiveConfigurationsTablePropsType
|
||||
} from '@components/ActiveConfigurationsTable/active-configurations-table.type.ts'
|
||||
import { ActiveConfigurationsTablePropsType } from '@components/ActiveConfigurationsTable/active-configurations-table.type.ts'
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import configApi from '@services/configService.ts'
|
||||
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import './active-configurations-table.scss'
|
||||
import dayjs from 'dayjs'
|
||||
import CanEdit from '@components/CanEdit'
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
import { useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> = ({
|
||||
isActiveTable = false,
|
||||
handleShowConfig,
|
||||
handleShowCompareModal,
|
||||
data,
|
||||
currentModule = {}
|
||||
}) => {
|
||||
const [editKeyConfig, setEditKeyConfig] = useState<string>('')
|
||||
const [tempEditValues, setTempEditValues] = useState<any>()
|
||||
const inputRefs = useRef<Record<string, HTMLInputElement | null>>({})
|
||||
const [createUpdateConfig] = configApi.useCreateUpdateConfigMutation()
|
||||
const [markConfigAsActive] = configApi.useMarkConfigAsActiveMutation()
|
||||
const [deleteConfig] = configApi.useDeleteConfigMutation()
|
||||
const navigate = useNavigate()
|
||||
const { id: moduleId } = useParams()
|
||||
|
||||
const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
|
||||
({
|
||||
isActiveTable = false,
|
||||
handleShowConfig,
|
||||
handleShowCompareModal,
|
||||
data,
|
||||
currentModule = {}
|
||||
}) => {
|
||||
const [editKeyConfig, setEditKeyConfig] = useState<string>('')
|
||||
const [tempEditValues, setTempEditValues] = useState<any>()
|
||||
const inputRefs = useRef<Record<string, HTMLInputElement | null>>({})
|
||||
const [createUpdateConfig] = configApi.useCreateUpdateConfigMutation()
|
||||
const [markConfigAsActive] = configApi.useMarkConfigAsActiveMutation()
|
||||
const [deleteConfig] = configApi.useDeleteConfigMutation()
|
||||
const navigate = useNavigate()
|
||||
const {id: moduleId} = useParams()
|
||||
|
||||
useEffect(() => {
|
||||
if (inputRefs.current[editKeyConfig]) {
|
||||
inputRefs.current[editKeyConfig]?.focus()
|
||||
}
|
||||
}, [editKeyConfig])
|
||||
const handleEditStart = (record: ConfigType) => {
|
||||
setEditKeyConfig(record.id)
|
||||
setTempEditValues({
|
||||
...tempEditValues,
|
||||
[record.id]: record.name
|
||||
} as ConfigType)
|
||||
useEffect(() => {
|
||||
if (inputRefs.current[editKeyConfig]) {
|
||||
inputRefs.current[editKeyConfig]?.focus()
|
||||
}
|
||||
}, [editKeyConfig])
|
||||
const handleEditStart = (record: ConfigType) => {
|
||||
setEditKeyConfig(record.id)
|
||||
setTempEditValues({
|
||||
...tempEditValues,
|
||||
[record.id]: record.name
|
||||
} as ConfigType)
|
||||
}
|
||||
|
||||
const handleCancelEdit = (record: ConfigType) => {
|
||||
setEditKeyConfig('')
|
||||
setTempEditValues({
|
||||
...tempEditValues,
|
||||
[record.id]: record.name
|
||||
} as ConfigType)
|
||||
}
|
||||
const handleCancelEdit = (record: ConfigType) => {
|
||||
setEditKeyConfig('')
|
||||
setTempEditValues({
|
||||
...tempEditValues,
|
||||
[record.id]: record.name
|
||||
} as ConfigType)
|
||||
}
|
||||
|
||||
const handleSaveEdit = (record: ConfigType) => {
|
||||
const sendData = { ...record, name: tempEditValues[record.id] }
|
||||
createUpdateConfig(sendData)
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
message.success('Элемент успешно сохранен')
|
||||
setEditKeyConfig('')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Не удалось сохранить элемент')
|
||||
})
|
||||
}
|
||||
const handleDeleteConfig = (record: ConfigType) => {
|
||||
deleteConfig(record.id)
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
message.success('Элемент успешно удален')
|
||||
setEditKeyConfig('')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Не удалось удалить элемент')
|
||||
})
|
||||
}
|
||||
const handleSaveEdit = (record: ConfigType) => {
|
||||
const sendData = { ...record, name: tempEditValues[record.id] }
|
||||
createUpdateConfig(sendData)
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
message.success('Элемент успешно сохранен')
|
||||
setEditKeyConfig('')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Не удалось сохранить элемент')
|
||||
})
|
||||
}
|
||||
const handleDeleteConfig = (record: ConfigType) => {
|
||||
deleteConfig(record.id)
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
message.success('Элемент успешно удален')
|
||||
setEditKeyConfig('')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Не удалось удалить элемент')
|
||||
})
|
||||
}
|
||||
|
||||
const handleMarkConfigActive = (record: ConfigType) => {
|
||||
markConfigAsActive(record.id)
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
message.success('Элемент успешно обновлен')
|
||||
setEditKeyConfig('')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Не удалось обновить элемент')
|
||||
})
|
||||
}
|
||||
const handleMarkConfigActive = (record: ConfigType) => {
|
||||
markConfigAsActive(record.id)
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
message.success('Элемент успешно обновлен')
|
||||
setEditKeyConfig('')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Не удалось обновить элемент')
|
||||
})
|
||||
}
|
||||
|
||||
const renderNameField = (value: string, record: ConfigType) => {
|
||||
const canEdit = editKeyConfig === record.id
|
||||
const inputValue = canEdit ? tempEditValues[record.id] : value
|
||||
const renderNameField = (value: string, record: ConfigType) => {
|
||||
const canEdit = editKeyConfig === record.id
|
||||
const inputValue = canEdit ? tempEditValues[record.id] : value
|
||||
|
||||
return (
|
||||
<div className="active-configurations-table__table__name-field">
|
||||
<input
|
||||
ref={(inputRef) => (inputRefs.current[record.id] = inputRef)}
|
||||
onChange={(event) => {
|
||||
const { value } = event.target
|
||||
setTempEditValues({ ...tempEditValues, [record.id]: value })
|
||||
}}
|
||||
disabled={!canEdit}
|
||||
value={inputValue}
|
||||
/>
|
||||
{canEdit ? (
|
||||
<div className="active-configurations-table__table__name-field__actions">
|
||||
<Tooltip title="Сохранить">
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => handleSaveEdit(record)}
|
||||
icon={<CheckOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip title="Отменить">
|
||||
<Button
|
||||
onClick={() => handleCancelEdit(record)}
|
||||
icon={<CloseOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
) : (
|
||||
<CanEdit>
|
||||
<Tooltip title="Редактировать название">
|
||||
<Button
|
||||
onClick={() => handleEditStart(record)}
|
||||
icon={<EditOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const columns: ColumnsType<ConfigType> = [
|
||||
{
|
||||
title: 'Наименование',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
render: renderNameField,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: 'Версия',
|
||||
dataIndex: 'version',
|
||||
key: 'version',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: 'Статус',
|
||||
dataIndex: 'valid',
|
||||
key: 'version',
|
||||
align: 'center',
|
||||
render: (value: boolean) => {
|
||||
if (value) {
|
||||
return <Tag color="success">Корректная</Tag>
|
||||
}
|
||||
return <Tag color="error">Некорректная</Tag>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Дата обновления',
|
||||
dataIndex: 'updatedAt',
|
||||
key: 'updatedAt',
|
||||
align: 'center',
|
||||
render: (value: string) => {
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Действия',
|
||||
dataIndex: 'actions',
|
||||
key: 'actions',
|
||||
align: 'center',
|
||||
render: (_: unknown, record: ConfigType) => (
|
||||
<ActiveTableActionButtons
|
||||
isActive={isActiveTable}
|
||||
handleShowConfig={handleShowConfig}
|
||||
handleShowCompareModal={handleShowCompareModal}
|
||||
handleDeleteConfig={handleDeleteConfig}
|
||||
handleMarkConfigActive={handleMarkConfigActive}
|
||||
record={record}
|
||||
/>
|
||||
)
|
||||
}
|
||||
]
|
||||
const className = `active-configurations-table__table ${isActiveTable ? 'active-config' : ''}`
|
||||
return (
|
||||
<div className="active-configurations-table">
|
||||
<div className="active-configurations-table__buttons">
|
||||
<h2 className="active-configurations-table__title">
|
||||
{isActiveTable ? 'Активная' : 'Остальные'}
|
||||
</h2>
|
||||
{!isActiveTable && <CanEdit>
|
||||
<Button
|
||||
className="configurations__buttons__new-config-brn"
|
||||
onClick={() => navigate(`/${moduleId}/${routePaths.configEditor}/new`, {state: currentModule})}
|
||||
>
|
||||
Создать
|
||||
</Button>
|
||||
</CanEdit>}
|
||||
</div>
|
||||
<Table
|
||||
rowHoverable={false}
|
||||
className={className}
|
||||
rowKey={(record) => record.id}
|
||||
pagination={false}
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
<div className="active-configurations-table__table__name-field">
|
||||
<input
|
||||
ref={(inputRef) => (inputRefs.current[record.id] = inputRef)}
|
||||
onChange={(event) => {
|
||||
const { value } = event.target
|
||||
setTempEditValues({ ...tempEditValues, [record.id]: value })
|
||||
}}
|
||||
disabled={!canEdit}
|
||||
value={inputValue}
|
||||
/>
|
||||
{canEdit ? (
|
||||
<div className="active-configurations-table__table__name-field__actions">
|
||||
<Tooltip title="Сохранить">
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => handleSaveEdit(record)}
|
||||
icon={<CheckOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip title="Отменить">
|
||||
<Button
|
||||
onClick={() => handleCancelEdit(record)}
|
||||
icon={<CloseOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
) : (
|
||||
<CanEdit>
|
||||
<Tooltip title="Редактировать название">
|
||||
<Button
|
||||
onClick={() => handleEditStart(record)}
|
||||
icon={<EditOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const columns: ColumnsType<ConfigType> = [
|
||||
{
|
||||
title: 'Наименование',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
render: renderNameField,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: 'Версия',
|
||||
dataIndex: 'version',
|
||||
key: 'version',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: 'Статус',
|
||||
dataIndex: 'valid',
|
||||
key: 'version',
|
||||
align: 'center',
|
||||
render: (value: boolean) => {
|
||||
if (value) {
|
||||
return <Tag color="success">Корректная</Tag>
|
||||
}
|
||||
return <Tag color="error">Некорректная</Tag>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Дата обновления',
|
||||
dataIndex: 'updatedAt',
|
||||
key: 'updatedAt',
|
||||
align: 'center',
|
||||
render: (value: string) => {
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Действия',
|
||||
dataIndex: 'actions',
|
||||
key: 'actions',
|
||||
align: 'center',
|
||||
render: (_: unknown, record: ConfigType) => (
|
||||
<ActiveTableActionButtons
|
||||
isActive={isActiveTable}
|
||||
handleShowConfig={handleShowConfig}
|
||||
handleShowCompareModal={handleShowCompareModal}
|
||||
handleDeleteConfig={handleDeleteConfig}
|
||||
handleMarkConfigActive={handleMarkConfigActive}
|
||||
record={record}
|
||||
/>
|
||||
)
|
||||
}
|
||||
]
|
||||
const className = `active-configurations-table__table ${isActiveTable ? 'active-config' : ''}`
|
||||
return (
|
||||
<div className="active-configurations-table">
|
||||
<div className="active-configurations-table__buttons">
|
||||
<h2 className="active-configurations-table__title">
|
||||
{isActiveTable ? 'Активная' : 'Остальные'}
|
||||
</h2>
|
||||
{!isActiveTable && (
|
||||
<CanEdit>
|
||||
<Button
|
||||
className="configurations__buttons__new-config-brn"
|
||||
onClick={() =>
|
||||
navigate(`/${moduleId}/${routePaths.configEditor}/new`, {
|
||||
state: currentModule
|
||||
})
|
||||
}
|
||||
>
|
||||
Создать
|
||||
</Button>
|
||||
</CanEdit>
|
||||
)}
|
||||
</div>
|
||||
<Table
|
||||
rowHoverable={false}
|
||||
className={className}
|
||||
rowKey={(record) => record.id}
|
||||
pagination={false}
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ActiveConfigurationsTable
|
||||
@@ -2,10 +2,7 @@ import { ModalPropsType } from '@widgets/Modal/modal.type.ts'
|
||||
|
||||
import { ApplicationsGroupType } from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
export type AppGroupModalType = Omit<
|
||||
ModalPropsType,
|
||||
'onOk' | 'children'
|
||||
> & {
|
||||
export type AppGroupModalType = Omit<ModalPropsType, 'onOk' | 'children'> & {
|
||||
appGroup?: ApplicationsGroupType
|
||||
onOk: (data: ApplicationsGroupType) => void
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import { AppGroupModalType } from '@components/AppGroupModal/app-group-modal.typ
|
||||
|
||||
import { ApplicationsGroupType } from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
|
||||
const { FormInput, FormTextArea } = FormComponents
|
||||
|
||||
const AppGroupModal: FC<AppGroupModalType> = ({
|
||||
@@ -18,8 +17,7 @@ const AppGroupModal: FC<AppGroupModalType> = ({
|
||||
onClose,
|
||||
onOk,
|
||||
open,
|
||||
appGroup,
|
||||
|
||||
appGroup
|
||||
}) => {
|
||||
const { handleSubmit, control, reset } = useForm<ApplicationsGroupType>({
|
||||
mode: 'onChange',
|
||||
|
||||
@@ -10,10 +10,9 @@ import { AppModalType } from '@components/AppModal/app-group-modal.type.ts'
|
||||
|
||||
import { ApplicationAppType } from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
|
||||
const { FormInput, FormTextArea } = FormComponents
|
||||
|
||||
const AppModal: FC<AppModalType> = ({ title,onOk, onClose, open, app }) => {
|
||||
const AppModal: FC<AppModalType> = ({ title, onOk, onClose, open, app }) => {
|
||||
const { handleSubmit, control, reset } = useForm<ApplicationAppType>({
|
||||
mode: 'onChange',
|
||||
defaultValues: app
|
||||
|
||||
@@ -24,7 +24,6 @@ import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import './applications-content.scss'
|
||||
|
||||
|
||||
const { EmptyData, Column } = Layout
|
||||
|
||||
interface ApplicationsContentPropTypes {
|
||||
@@ -134,7 +133,9 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
message.success('Элемент удален')
|
||||
navigate(`${routePaths.applicationsGroup}/${selectedItemId}/${routePaths.application}`)
|
||||
navigate(
|
||||
`${routePaths.applicationsGroup}/${selectedItemId}/${routePaths.application}`
|
||||
)
|
||||
})
|
||||
.catch(() => message.error('Ошибка удаления элемента'))
|
||||
|
||||
@@ -142,7 +143,10 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1.3} title={item.name}>
|
||||
<List.Item.Meta title={item.name} description={<span>id: {item.id}</span>}/>
|
||||
<List.Item.Meta
|
||||
title={item.name}
|
||||
description={<span>id: {item.id}</span>}
|
||||
/>
|
||||
<div
|
||||
className="link-btn"
|
||||
onClick={(e) => {
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
import { message } from 'antd'
|
||||
import { FormComponents } from 'isp-ui-kit'
|
||||
import { FC, useEffect, useState } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
|
||||
import { apiPaths } from '@constants/api/apiPaths.ts'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import {
|
||||
ChangePasswordModalProps,
|
||||
ChangePasswordModalType
|
||||
} from '@components/ChangePasswordModal/change-password-modal.type.ts'
|
||||
import { apiService } from '@services/apiService.ts'
|
||||
|
||||
import { ChangeProfilePassword } from '@pages/ProfilePage/profile-page.type.ts'
|
||||
import { apiPaths } from '@constants/api/apiPaths.ts'
|
||||
import { message } from 'antd'
|
||||
|
||||
import useLogout from '@hooks/useLogout.tsx'
|
||||
|
||||
import { apiService } from '@services/apiService.ts'
|
||||
|
||||
const { FormInputPassword } = FormComponents
|
||||
const ChangePasswordModal: FC<ChangePasswordModalProps> = ({
|
||||
open,
|
||||
onClose
|
||||
}) => {
|
||||
open,
|
||||
onClose
|
||||
}) => {
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
@@ -36,10 +40,10 @@ const ChangePasswordModal: FC<ChangePasswordModalProps> = ({
|
||||
const onSubmit = async (formValue: ChangePasswordModalType) => {
|
||||
setLoading(true)
|
||||
try {
|
||||
await apiService.post<ChangeProfilePassword>(
|
||||
apiPaths.changePassword,
|
||||
{ oldPassword: formValue.oldPassword, newPassword: formValue.newPassword }
|
||||
)
|
||||
await apiService.post<ChangeProfilePassword>(apiPaths.changePassword, {
|
||||
oldPassword: formValue.oldPassword,
|
||||
newPassword: formValue.newPassword
|
||||
})
|
||||
await logoutUser()
|
||||
message.success('Пароль успешно изменен')
|
||||
clearErrors('oldPassword')
|
||||
@@ -115,4 +119,3 @@ const ChangePasswordModal: FC<ChangePasswordModalProps> = ({
|
||||
)
|
||||
}
|
||||
export default ChangePasswordModal
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { EditorState, EditorView } from '@uiw/react-codemirror'
|
||||
import { Button, Spin, Table } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import dayjs from 'dayjs'
|
||||
import { FC, memo, useContext, useState } from 'react'
|
||||
import CodeMirrorMerge from 'react-codemirror-merge'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import { CompareVersionModalPropsType } from '@components/CompareVersionModal/compare-version-modal.type'
|
||||
@@ -15,23 +18,21 @@ import { useAppSelector } from '@hooks/redux.ts'
|
||||
import configServiceApi from '@services/configService.ts'
|
||||
import userServiceApi from '@services/userService.ts'
|
||||
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
import { VersionType } from '@type/version.type'
|
||||
|
||||
import './compare-version-modal.scss'
|
||||
import dayjs from 'dayjs'
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
|
||||
const Original = CodeMirrorMerge.Original
|
||||
const Modified = CodeMirrorMerge.Modified
|
||||
|
||||
const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
|
||||
open,
|
||||
onClose,
|
||||
config,
|
||||
currentConfigId
|
||||
}) => {
|
||||
open,
|
||||
onClose,
|
||||
config,
|
||||
currentConfigId
|
||||
}) => {
|
||||
const [selectedItem, setSelectedItem] = useState<VersionType>()
|
||||
const { data: versions = [], isLoading: isVersionLoading } =
|
||||
configServiceApi.useGetAllVersionQuery(currentConfigId)
|
||||
@@ -73,13 +74,21 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
|
||||
]
|
||||
return (
|
||||
<div className="compare-version-modal">
|
||||
<Modal title="Выберите версию для сравнения" open={open} onClose={onClose}>
|
||||
<Modal
|
||||
title="Выберите версию для сравнения"
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
>
|
||||
{selectedItem ? (
|
||||
<div className="compare-version-modal__content">
|
||||
<Button onClick={() => setSelectedItem(undefined)}>Назад</Button>
|
||||
<div className="compare-version-modal__header">
|
||||
<span> Версия: {selectedItem.configVersion}</span>
|
||||
<span>{config?.version ? `Текущая версия : ${config?.version}` : `Версия: ${config?.configVersion}`}</span>
|
||||
<span>
|
||||
{config?.version
|
||||
? `Текущая версия : ${config?.version}`
|
||||
: `Версия: ${config?.configVersion}`}
|
||||
</span>
|
||||
</div>
|
||||
<CodeMirrorMerge
|
||||
orientation="a-b"
|
||||
|
||||
@@ -2,7 +2,6 @@ import { ModalPropsType } from '@widgets/Modal/modal.type.ts'
|
||||
|
||||
import { JSONSchema } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
|
||||
export interface ConfigSchemaModalPropsType
|
||||
extends Omit<ModalPropsType, 'title' | 'children'> {
|
||||
schema?: JSONSchema
|
||||
|
||||
@@ -12,7 +12,6 @@ const ConfigSchemaModal: FC<ConfigSchemaModalPropsType> = ({
|
||||
onClose,
|
||||
schema = {}
|
||||
}) => {
|
||||
|
||||
return (
|
||||
<div className="config-schema-modal">
|
||||
<Modal title="Текущая схема" open={open} onClose={onClose}>
|
||||
|
||||
@@ -1,48 +1,53 @@
|
||||
import { FC, useContext } from 'react'
|
||||
import Editor, { loader } from '@monaco-editor/react'
|
||||
import * as monaco from 'monaco-editor'
|
||||
import editorWorker from 'monaco-editor/esm/vs/editor/editor.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 jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
|
||||
import { FC, useContext } from 'react'
|
||||
|
||||
import { ConfigurationEditorPropsType } from '@pages/ConfigurationEditorPage/ConfigurationEditor.type.ts'
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
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';
|
||||
import { ConfigurationEditorPropsType } from '@pages/ConfigurationEditorPage/ConfigurationEditor.type.ts'
|
||||
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)
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorker(_, label) {
|
||||
if (label === 'json') {
|
||||
return new jsonWorker();
|
||||
return new jsonWorker()
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return new cssWorker();
|
||||
return new cssWorker()
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return new htmlWorker();
|
||||
return new htmlWorker()
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return new tsWorker();
|
||||
return new tsWorker()
|
||||
}
|
||||
return new editorWorker();
|
||||
},
|
||||
};
|
||||
return new editorWorker()
|
||||
}
|
||||
}
|
||||
|
||||
loader.config({ monaco });
|
||||
loader.config({ monaco })
|
||||
|
||||
loader.init().then();
|
||||
loader.init().then()
|
||||
|
||||
const handleChange = (data: string | undefined) => {
|
||||
|
||||
if (data) {
|
||||
try {
|
||||
const newData = {
|
||||
...bufConfig,
|
||||
data: {...JSON.parse(data) }
|
||||
data: { ...JSON.parse(data) }
|
||||
} as ConfigType
|
||||
setDisableBtn(false)
|
||||
setBufConfig(newData)
|
||||
@@ -52,7 +57,7 @@ const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBt
|
||||
}
|
||||
}
|
||||
|
||||
const editorValue = JSON.stringify(bufConfig?.data, null, '\t')
|
||||
const editorValue = JSON.stringify(bufConfig?.data, null, '\t')
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -67,12 +72,11 @@ const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBt
|
||||
minimap: {
|
||||
enabled: false
|
||||
},
|
||||
fontSize: 16,
|
||||
fontSize: 16
|
||||
}}
|
||||
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ConfigurationEditorCode
|
||||
export default ConfigurationEditorCode
|
||||
@@ -17,8 +17,6 @@ import equal from 'deep-equal'
|
||||
import { createRef, FC, memo, useEffect, useState } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
|
||||
|
||||
import {
|
||||
ArrayFieldTemplatePropsType,
|
||||
ConfigurationEditorPropsType,
|
||||
@@ -30,14 +28,16 @@ import {
|
||||
SortPropType
|
||||
} from '@pages/ConfigurationEditorPage/ConfigurationEditor.type.ts'
|
||||
import { ResponseSchemaType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import { cleanEmptyParamsObject } from '@utils/objectUtils.ts'
|
||||
|
||||
const { Text: AntdText } = Typography
|
||||
|
||||
const ConfigurationEditorForm: FC<ConfigurationEditorPropsType> = ({
|
||||
bufConfig = {},
|
||||
jsonSchema = {},
|
||||
submitRef,
|
||||
}) => {
|
||||
bufConfig = {},
|
||||
jsonSchema = {},
|
||||
submitRef
|
||||
}) => {
|
||||
const Form = withTheme(AntDTheme)
|
||||
const sortProps = (a: SortPropType, b: SortPropType) =>
|
||||
a.name.localeCompare(b.name)
|
||||
@@ -59,13 +59,14 @@ const ConfigurationEditorForm: FC<ConfigurationEditorPropsType> = ({
|
||||
}
|
||||
|
||||
const onSubmit = (data: any) => {
|
||||
if(!submitRef) return
|
||||
if(!formRef.current.validateFormWithFormData(formRef.current.state.formData)) {
|
||||
submitRef.current = data
|
||||
} else {
|
||||
submitRef.current = data.formData
|
||||
}
|
||||
|
||||
if (!submitRef) return
|
||||
if (
|
||||
!formRef.current.validateFormWithFormData(formRef.current.state.formData)
|
||||
) {
|
||||
submitRef.current = data
|
||||
} else {
|
||||
submitRef.current = data.formData
|
||||
}
|
||||
}
|
||||
|
||||
const forceSubmit = () => {
|
||||
@@ -78,15 +79,15 @@ const ConfigurationEditorForm: FC<ConfigurationEditorPropsType> = ({
|
||||
|
||||
const onFormChange = () => {
|
||||
if (!formRef.current) return
|
||||
if(formRef.current.validateFormWithFormData(formRef.current.state.formData)) {
|
||||
formRef?.current?.submit()
|
||||
} else {
|
||||
forceSubmit()
|
||||
}
|
||||
if (
|
||||
formRef.current.validateFormWithFormData(formRef.current.state.formData)
|
||||
) {
|
||||
formRef?.current?.submit()
|
||||
} else {
|
||||
forceSubmit()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const Description: FC<DescriptionPropsType> = ({ description }) =>
|
||||
description ? (
|
||||
<span>
|
||||
@@ -188,13 +189,13 @@ const ConfigurationEditorForm: FC<ConfigurationEditorPropsType> = ({
|
||||
}
|
||||
|
||||
const ArrayFieldTemplate: FC<ArrayFieldTemplatePropsType> = ({
|
||||
items,
|
||||
onAddClick,
|
||||
canAdd,
|
||||
title,
|
||||
idSchema,
|
||||
schema: { description }
|
||||
}) => {
|
||||
items,
|
||||
onAddClick,
|
||||
canAdd,
|
||||
title,
|
||||
idSchema,
|
||||
schema: { description }
|
||||
}) => {
|
||||
return (
|
||||
<Collapse defaultActiveKey={idSchema.$id}>
|
||||
<Collapse.Panel
|
||||
@@ -272,12 +273,12 @@ const ConfigurationEditorForm: FC<ConfigurationEditorPropsType> = ({
|
||||
items={[
|
||||
...(propsSimple.length
|
||||
? [
|
||||
{
|
||||
label: 'Остальные',
|
||||
key: 'General',
|
||||
children: propsSimple.map((element) => element.content)
|
||||
}
|
||||
]
|
||||
{
|
||||
label: 'Остальные',
|
||||
key: 'General',
|
||||
children: propsSimple.map((element) => element.content)
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...propsComplex.map((element) => ({
|
||||
label: schemaProperties[element.name]?.title || element.name,
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
import { FC, useContext } from 'react'
|
||||
import { Spin } from 'antd'
|
||||
import { ReactJsonView } from 'isp-ui-kit'
|
||||
import {Spin} from 'antd'
|
||||
import { cleanEmptyParamsObject } from '@utils/objectUtils.ts'
|
||||
import { Context } from '@stores/index.tsx'
|
||||
import { FC, useContext } from 'react'
|
||||
|
||||
import { ConfigurationEditorPropsType } from '@pages/ConfigurationEditorPage/ConfigurationEditor.type.ts'
|
||||
|
||||
const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig = {}, setBufConfig, isCurrentConfigLoading}) => {
|
||||
import { cleanEmptyParamsObject } from '@utils/objectUtils.ts'
|
||||
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({
|
||||
bufConfig = {},
|
||||
setBufConfig,
|
||||
isCurrentConfigLoading
|
||||
}) => {
|
||||
const { changeTheme } = useContext(Context)
|
||||
if (isCurrentConfigLoading) {
|
||||
return <Spin className="spin" />
|
||||
@@ -21,15 +28,15 @@ const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig =
|
||||
|
||||
return (
|
||||
<ReactJsonView
|
||||
theme={ changeTheme ? 'twilight' : ''}
|
||||
onAdd={({updated_src}: any) => handleEdit(updated_src)}
|
||||
onDelete={({updated_src}: any) => handleEdit(updated_src)}
|
||||
theme={changeTheme ? 'twilight' : ''}
|
||||
onAdd={({ updated_src }: any) => handleEdit(updated_src)}
|
||||
onDelete={({ updated_src }: any) => handleEdit(updated_src)}
|
||||
displayDataTypes={false}
|
||||
displayObjectSize={false}
|
||||
name={null}
|
||||
enableClipboard={true}
|
||||
iconStyle="square"
|
||||
onEdit={({updated_src}: any) => handleEdit(updated_src)}
|
||||
onEdit={({ updated_src }: any) => handleEdit(updated_src)}
|
||||
src={bufConfig.data}
|
||||
sortKeys={true}
|
||||
collapsed={1}
|
||||
|
||||
@@ -5,9 +5,9 @@ import Modal from '@widgets/Modal'
|
||||
|
||||
import { ConfigurationPreviewModalPropsType } from '@components/ConfigurationPreviewModal/configuration-preview-modal.type.ts'
|
||||
|
||||
import './configuration-preview-modal.scss'
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
import './configuration-preview-modal.scss'
|
||||
|
||||
const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
|
||||
versionCompare = false,
|
||||
@@ -24,7 +24,7 @@ const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
|
||||
<div className="configuration-preview-modal">
|
||||
<Modal title={configName || ''} open={open} onClose={onClose}>
|
||||
<ReactJsonView
|
||||
theme={ changeTheme ? 'twilight' : ''}
|
||||
theme={changeTheme ? 'twilight' : ''}
|
||||
src={data}
|
||||
name={false}
|
||||
sortKeys={true}
|
||||
|
||||
@@ -1,33 +1,31 @@
|
||||
import { Button } from 'antd'
|
||||
import { Dispatch, FC, SetStateAction } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
import { ModalPropsType } from '@widgets/Modal/modal.type.ts'
|
||||
import { Dispatch, FC, SetStateAction } from 'react'
|
||||
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
import configServiceApi from '@services/configService.ts'
|
||||
|
||||
|
||||
interface ConfirmModalProps
|
||||
extends Omit<ModalPropsType, 'title' | 'children'> {
|
||||
interface ConfirmModalProps extends Omit<ModalPropsType, 'title' | 'children'> {
|
||||
handleSaveClick: (upVersion?: number, unsafe?: boolean) => void
|
||||
setBufConfig: Dispatch<SetStateAction<ConfigType | undefined>>
|
||||
currentConfig: ConfigType | undefined
|
||||
}
|
||||
|
||||
const ConfirmConfigModal: FC<ConfirmModalProps> = ({
|
||||
currentConfig,
|
||||
setBufConfig,
|
||||
handleSaveClick,
|
||||
onClose = () => null,
|
||||
open
|
||||
}) => {
|
||||
currentConfig,
|
||||
setBufConfig,
|
||||
handleSaveClick,
|
||||
onClose = () => null,
|
||||
open
|
||||
}) => {
|
||||
const { id = '' } = useParams()
|
||||
const isNew = id === 'new' ? '' : id
|
||||
|
||||
const {
|
||||
data
|
||||
} = configServiceApi.useGetConfigByIdQuery(isNew)
|
||||
|
||||
const { data } = configServiceApi.useGetConfigByIdQuery(isNew)
|
||||
|
||||
const onConfirmHandler = () => {
|
||||
setBufConfig(currentConfig)
|
||||
@@ -35,14 +33,26 @@ const ConfirmConfigModal: FC<ConfirmModalProps> = ({
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal title="Версия конфигурации была кем-то изменена" open={open}
|
||||
onClose={onClose}>
|
||||
<Button className="confirm-btn danger" type="primary" danger onClick={() => {
|
||||
handleSaveClick(data && data.version)
|
||||
onClose()
|
||||
}}>Сохранить принудительно</Button>
|
||||
<Button className="confirm-btn" type="primary" onClick={onConfirmHandler}>Принять изменения</Button>
|
||||
<Modal
|
||||
title="Версия конфигурации была кем-то изменена"
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
>
|
||||
<Button
|
||||
className="confirm-btn danger"
|
||||
type="primary"
|
||||
danger
|
||||
onClick={() => {
|
||||
handleSaveClick(data && data.version)
|
||||
onClose()
|
||||
}}
|
||||
>
|
||||
Сохранить принудительно
|
||||
</Button>
|
||||
<Button className="confirm-btn" type="primary" onClick={onConfirmHandler}>
|
||||
Принять изменения
|
||||
</Button>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
export default ConfirmConfigModal
|
||||
export default ConfirmConfigModal
|
||||
@@ -1,15 +1,19 @@
|
||||
import { Table } from 'antd'
|
||||
import { FC } from 'react'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
import { ModalPropsType } from '@widgets/Modal/modal.type.ts'
|
||||
import { FC } from 'react'
|
||||
import { Table } from 'antd'
|
||||
|
||||
interface ErrorConfigModalProps
|
||||
extends Omit<ModalPropsType, 'title' | 'children'> {
|
||||
details?: { [key: string]: string }
|
||||
}
|
||||
|
||||
const ErrorConfigModal: FC<ErrorConfigModalProps> = ({ details = {}, onClose, open }) => {
|
||||
|
||||
const ErrorConfigModal: FC<ErrorConfigModalProps> = ({
|
||||
details = {},
|
||||
onClose,
|
||||
open
|
||||
}) => {
|
||||
const columns = [
|
||||
{
|
||||
dataIndex: 'key',
|
||||
@@ -28,13 +32,21 @@ const ErrorConfigModal: FC<ErrorConfigModalProps> = ({ details = {}, onClose, op
|
||||
}))
|
||||
|
||||
return (
|
||||
<Modal title="Несоотвествия схемы конфигурации" open={open}
|
||||
onClose={onClose}>
|
||||
<Modal
|
||||
title="Несоотвествия схемы конфигурации"
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
>
|
||||
<div>
|
||||
<Table columns={columns} dataSource={data} showHeader={false} pagination={false} />
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
showHeader={false}
|
||||
pagination={false}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
||||
export default ErrorConfigModal
|
||||
export default ErrorConfigModal
|
||||
@@ -98,29 +98,29 @@ const LayoutComponent = () => {
|
||||
className: hideItem([
|
||||
PermissionKeysType.user_view,
|
||||
PermissionKeysType.session_view,
|
||||
PermissionKeysType.role_view,
|
||||
PermissionKeysType.role_view
|
||||
]),
|
||||
icon: <ProfileOutlined />,
|
||||
children: [
|
||||
{
|
||||
label: 'Пользователи',
|
||||
key: 'users',
|
||||
className: hideItem(PermissionKeysType.user_view),
|
||||
className: hideItem(PermissionKeysType.user_view)
|
||||
},
|
||||
{
|
||||
label: 'Пользовательские сессии',
|
||||
key: 'sessions',
|
||||
className: hideItem(PermissionKeysType.session_view),
|
||||
className: hideItem(PermissionKeysType.session_view)
|
||||
},
|
||||
{
|
||||
label: 'Просмотр журналов ИБ',
|
||||
key: 'securityLog',
|
||||
className: hideItem(PermissionKeysType.security_log_view),
|
||||
className: hideItem(PermissionKeysType.security_log_view)
|
||||
},
|
||||
{
|
||||
label: 'Роли',
|
||||
key: 'roles',
|
||||
className: hideItem(PermissionKeysType.role_view),
|
||||
className: hideItem(PermissionKeysType.role_view)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import ModuleTabContent from '@widgets/ModuleTabContent'
|
||||
|
||||
import { ModuleTabsPropsType } from '@components/ModuleTabs/module-tabs.type.ts'
|
||||
|
||||
|
||||
const secondColumnItems = [
|
||||
{
|
||||
key: 'configurations',
|
||||
|
||||
@@ -6,7 +6,6 @@ import roleApi from '@services/roleService.ts'
|
||||
|
||||
import './role-list.scss'
|
||||
|
||||
|
||||
const RoleList = ({ userRoles }: RoleListProps) => {
|
||||
const { data: roles = [], isLoading, isError } = roleApi.useGetAllRolesQuery()
|
||||
const roleIds = new Set(userRoles)
|
||||
|
||||
@@ -19,7 +19,6 @@ import { PermissionKeysType, RoleType } from '@type/roles.type.ts'
|
||||
|
||||
import './roles-content.scss'
|
||||
|
||||
|
||||
const newRole: Partial<RoleType> = {
|
||||
externalGroup: '',
|
||||
name: '',
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
type FormattersKey = 'fullFormat'
|
||||
|
||||
|
||||
export const dateFormats:Record<FormattersKey,string> = {
|
||||
export const dateFormats: Record<FormattersKey, string> = {
|
||||
fullFormat: 'DD.MM.YYYY HH:mm:ss'
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import { LocalStorage } from '@utils/localStorageUtils.ts'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
|
||||
const useLogout = () => {
|
||||
const { logout, isLoading } = useAuth()
|
||||
const navigate = useNavigate()
|
||||
|
||||
+2
-2
@@ -1,4 +1,6 @@
|
||||
import { setupListeners } from '@reduxjs/toolkit/query'
|
||||
import dayjs from 'dayjs'
|
||||
import 'dayjs/locale/ru'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { Provider } from 'react-redux'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
@@ -6,11 +8,9 @@ import { BrowserRouter } from 'react-router-dom'
|
||||
import App from './components/App.tsx'
|
||||
|
||||
import { setupStore } from './stores'
|
||||
import 'dayjs/locale/ru'
|
||||
|
||||
import 'react-resizable/css/styles.css'
|
||||
import 'simplebar-react/dist/simplebar.min.css'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
dayjs.locale('ru')
|
||||
const store = setupStore()
|
||||
|
||||
@@ -10,6 +10,8 @@ import dayjs from 'dayjs'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Navigate, useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
import CompareVersionModal from '@components/CompareVersionModal'
|
||||
import ConfigurationPreviewModal from '@components/ConfigurationPreviewModal'
|
||||
@@ -28,8 +30,6 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
import { VersionType } from '@type/version.type.ts'
|
||||
|
||||
import './all-versions-page.scss'
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
|
||||
const AllVersionsPage = () => {
|
||||
const [showCompareModal, setShowCompareModal] = useState<boolean>(false)
|
||||
@@ -109,42 +109,42 @@ const AllVersionsPage = () => {
|
||||
return (
|
||||
<div className="all-version-page__actions-field">
|
||||
<Button.Group className="button_group">
|
||||
<CanEdit>
|
||||
<Tooltip title="Установить выбранную версию">
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите установить выбранную версию ?"
|
||||
onConfirm={() => handleRevertVersion(record.data)}
|
||||
>
|
||||
<Button icon={<ReloadOutlined />} />
|
||||
</Popconfirm>
|
||||
<CanEdit>
|
||||
<Tooltip title="Установить выбранную версию">
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите установить выбранную версию ?"
|
||||
onConfirm={() => handleRevertVersion(record.data)}
|
||||
>
|
||||
<Button icon={<ReloadOutlined />} />
|
||||
</Popconfirm>
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
<Tooltip title="Просмотр версии">
|
||||
<Button
|
||||
onClick={() => {
|
||||
setCurrentClickVersion(record)
|
||||
setShowPreviewModal(true)
|
||||
}}
|
||||
icon={<EyeOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
<Tooltip title="Просмотр версии">
|
||||
<Button
|
||||
onClick={() => {
|
||||
setCurrentClickVersion(record)
|
||||
setShowPreviewModal(true)
|
||||
}}
|
||||
icon={<EyeOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => {
|
||||
setCurrentClickVersion(record)
|
||||
setShowCompareModal(true)
|
||||
}}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить выбранную версию ?"
|
||||
onConfirm={() => handeRemoveVersion(record.id)}
|
||||
>
|
||||
<Button danger icon={<DeleteOutlined />} />
|
||||
</Popconfirm>
|
||||
</CanEdit>
|
||||
<Tooltip title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => {
|
||||
setCurrentClickVersion(record)
|
||||
setShowCompareModal(true)
|
||||
}}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить выбранную версию ?"
|
||||
onConfirm={() => handeRemoveVersion(record.id)}
|
||||
>
|
||||
<Button danger icon={<DeleteOutlined />} />
|
||||
</Popconfirm>
|
||||
</CanEdit>
|
||||
</Button.Group>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -28,7 +28,6 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './app-access-page.scss'
|
||||
|
||||
|
||||
const { Column, EmptyData } = Layout
|
||||
|
||||
const firstColumnSearchParam = 'search'
|
||||
|
||||
@@ -4,8 +4,9 @@ import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom'
|
||||
|
||||
import ListItem from '@widgets/ListItem'
|
||||
|
||||
import ApplicationsContent from '@components/ApplicationsContent'
|
||||
import AppGroupModal from 'src/components/AppGroupModal'
|
||||
|
||||
import {
|
||||
ApplicationsGroupType,
|
||||
@@ -23,11 +24,11 @@ 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 AppGroupModal from 'src/components/AppGroupModal'
|
||||
|
||||
import './applications-page.scss'
|
||||
|
||||
|
||||
const { Column, EmptyData } = Layout
|
||||
|
||||
const ApplicationsPage = () => {
|
||||
@@ -126,13 +127,18 @@ const ApplicationsPage = () => {
|
||||
id: Number(selectedItemId)
|
||||
}
|
||||
|
||||
updateApplicationsGroup(updateService).unwrap().then(()=>{
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
updateApplicationsGroup(updateService)
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
message.success('Группа приложений успешно отредактирована')
|
||||
})
|
||||
message.success('Группа приложений успешно отредактирована')
|
||||
}).catch(()=> message.error('Не удалось отредактировать группу приложений'))
|
||||
.catch(() =>
|
||||
message.error('Не удалось отредактировать группу приложений')
|
||||
)
|
||||
}
|
||||
|
||||
const handleRemoveApplicationsGtoup = () => {
|
||||
|
||||
@@ -1,89 +1,96 @@
|
||||
import {ConfigType, ResponseSchemaType} from '@pages/ModulesPage/module.type.ts'
|
||||
import {ComponentType, Dispatch, MutableRefObject, ReactNode, SetStateAction} from 'react'
|
||||
import {
|
||||
ComponentType,
|
||||
Dispatch,
|
||||
MutableRefObject,
|
||||
ReactNode,
|
||||
SetStateAction
|
||||
} from 'react'
|
||||
|
||||
import {
|
||||
ConfigType,
|
||||
ResponseSchemaType
|
||||
} from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
export interface ConfigurationEditorPropsType {
|
||||
jsonSchema?: ResponseSchemaType
|
||||
bufConfig?: ConfigType
|
||||
setBufConfig: Dispatch<SetStateAction<ConfigType | undefined>>
|
||||
isCurrentConfigLoading: boolean
|
||||
setDisableBtn?: Dispatch<SetStateAction<boolean>>
|
||||
submitRef?: MutableRefObject<null>
|
||||
jsonSchema?: ResponseSchemaType
|
||||
bufConfig?: ConfigType
|
||||
setBufConfig: Dispatch<SetStateAction<ConfigType | undefined>>
|
||||
isCurrentConfigLoading: boolean
|
||||
setDisableBtn?: Dispatch<SetStateAction<boolean>>
|
||||
submitRef?: MutableRefObject<null>
|
||||
}
|
||||
|
||||
export interface DescriptionPropsType {
|
||||
description?: string;
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface Schema {
|
||||
type: string;
|
||||
dynamic?: boolean;
|
||||
type: string
|
||||
dynamic?: boolean
|
||||
}
|
||||
|
||||
export interface FieldTemplatePropsType {
|
||||
id: string;
|
||||
classNames?: string;
|
||||
label?: string;
|
||||
rawHelp?: string;
|
||||
required?: boolean;
|
||||
rawDescription?: string;
|
||||
rawErrors?: string[];
|
||||
children: ReactNode;
|
||||
displayLabel?: boolean;
|
||||
schema: Schema;
|
||||
id: string
|
||||
classNames?: string
|
||||
label?: string
|
||||
rawHelp?: string
|
||||
required?: boolean
|
||||
rawDescription?: string
|
||||
rawErrors?: string[]
|
||||
children: ReactNode
|
||||
displayLabel?: boolean
|
||||
schema: Schema
|
||||
}
|
||||
|
||||
|
||||
export interface ArrayFieldTemplatePropsType {
|
||||
items: {
|
||||
index: number;
|
||||
children: ReactNode;
|
||||
onDropIndexClick: (index: number) => () => void;
|
||||
}[];
|
||||
onAddClick: (event: MouseEvent) => void
|
||||
canAdd: boolean;
|
||||
title: string;
|
||||
titleField?: ComponentType<any>;
|
||||
idSchema: { $id: string };
|
||||
schema: { description?: string };
|
||||
items: {
|
||||
index: number
|
||||
children: ReactNode
|
||||
onDropIndexClick: (index: number) => () => void
|
||||
}[]
|
||||
onAddClick: (event: MouseEvent) => void
|
||||
canAdd: boolean
|
||||
title: string
|
||||
titleField?: ComponentType<any>
|
||||
idSchema: { $id: string }
|
||||
schema: { description?: string }
|
||||
}
|
||||
|
||||
|
||||
export interface ObjectFieldTemplatePropertyType {
|
||||
name: string;
|
||||
content: ReactNode;
|
||||
name: string
|
||||
content: ReactNode
|
||||
}
|
||||
|
||||
export interface SchemaPropertiesType {
|
||||
[key: string]: {
|
||||
type?: string;
|
||||
title?: string;
|
||||
};
|
||||
[key: string]: {
|
||||
type?: string
|
||||
title?: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface ObjectFieldTemplatePropsType {
|
||||
properties: ObjectFieldTemplatePropertyType[];
|
||||
idSchema: {
|
||||
$id: string;
|
||||
};
|
||||
schema: {
|
||||
properties: SchemaPropertiesType;
|
||||
};
|
||||
activeTabKey: string;
|
||||
handleTabsChange: (key: string) => void;
|
||||
properties: ObjectFieldTemplatePropertyType[]
|
||||
idSchema: {
|
||||
$id: string
|
||||
}
|
||||
schema: {
|
||||
properties: SchemaPropertiesType
|
||||
}
|
||||
activeTabKey: string
|
||||
handleTabsChange: (key: string) => void
|
||||
}
|
||||
|
||||
export interface ErrorsObjType {
|
||||
message: string;
|
||||
name: string;
|
||||
params: {
|
||||
missingProperty?: string;
|
||||
};
|
||||
property: string;
|
||||
schemaPath: string;
|
||||
stack: string;
|
||||
export interface ErrorsObjType {
|
||||
message: string
|
||||
name: string
|
||||
params: {
|
||||
missingProperty?: string
|
||||
}
|
||||
property: string
|
||||
schemaPath: string
|
||||
stack: string
|
||||
}
|
||||
|
||||
export interface SortPropType {
|
||||
name: string;
|
||||
}
|
||||
name: string
|
||||
}
|
||||
@@ -1,31 +1,23 @@
|
||||
import { RollbackOutlined } from '@ant-design/icons'
|
||||
import {
|
||||
Button,
|
||||
Dropdown,
|
||||
MenuProps,
|
||||
message,
|
||||
Radio,
|
||||
RadioChangeEvent,
|
||||
Spin
|
||||
} from 'antd'
|
||||
import { FC, useEffect, useRef, useState } from 'react'
|
||||
import { Button, Dropdown, MenuProps, message, Radio, RadioChangeEvent, Spin } from 'antd'
|
||||
import { FC, useEffect, useRef, useState} from 'react'
|
||||
import { useLocation, useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
import ConfigSchemaModal from '@components/ConfigSchemaModal'
|
||||
import ConfigurationEditorCode from '@components/ConfigurationEditorCode'
|
||||
import ConfigurationEditorForm from '@components/ConfigurationEditorForm'
|
||||
import ConfigurationEditorJson from '@components/ConfigurationEditorJson'
|
||||
import ConfirmConfigModal from '@components/ConfirmConfigModal/ConfirmConfigModal.tsx'
|
||||
import ErrorConfigModal from '@components/ErrorConfigModal/ErrorConfigModal.tsx'
|
||||
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import { cleanEmptyParamsObject, sortObject } from '@utils/objectUtils.ts'
|
||||
|
||||
import configServiceApi from '@services/configService.ts'
|
||||
import modulesServiceApi from '@services/modulesService.ts'
|
||||
|
||||
import './configuration-editor-page.scss'
|
||||
import ConfigSchemaModal from '@components/ConfigSchemaModal'
|
||||
import { cleanEmptyParamsObject, sortObject } from '@utils/objectUtils.ts'
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
import ConfirmConfigModal from '@components/ConfirmConfigModal/ConfirmConfigModal.tsx'
|
||||
import ErrorConfigModal from '@components/ErrorConfigModal/ErrorConfigModal.tsx'
|
||||
import ConfigurationEditorForm from '@components/ConfigurationEditorForm'
|
||||
|
||||
|
||||
|
||||
const ConfigurationEditorPage: FC = () => {
|
||||
const navigate = useNavigate()
|
||||
@@ -34,18 +26,17 @@ const ConfigurationEditorPage: FC = () => {
|
||||
const isNew = id === 'new'
|
||||
const { data: jsonSchema, isLoading: isLoadingJsonSchema } =
|
||||
modulesServiceApi.useGetByModuleIdQuery(moduleId)
|
||||
const { data: currentConfig, isLoading: isCurrentConfigLoading } =
|
||||
configServiceApi.useGetConfigByIdQuery(id)
|
||||
const {
|
||||
data: currentConfig,
|
||||
isLoading: isCurrentConfigLoading,
|
||||
} = configServiceApi.useGetConfigByIdQuery(id)
|
||||
const [createUpdateConfig] = configServiceApi.useCreateUpdateConfigMutation()
|
||||
const { state } = useLocation()
|
||||
const [showConfirmModal, setShowConfirmModal] = useState(false)
|
||||
const [showSchemeModal, setShowSchemeModal] = useState(false)
|
||||
const [radioValue, setRadioValue] = useState('json')
|
||||
const [bufConfig, setBufConfig] = useState<ConfigType>()
|
||||
const [detailsErrors, setDetailsError] = useState({
|
||||
details: {},
|
||||
isOpenDetailsErrorModal: false
|
||||
})
|
||||
const [detailsErrors, setDetailsError] = useState({ details: {}, isOpenDetailsErrorModal: false })
|
||||
const [disableBtn, setDisableBtn] = useState(false)
|
||||
const submitRef = useRef<any>(null)
|
||||
|
||||
@@ -71,6 +62,7 @@ const ConfigurationEditorPage: FC = () => {
|
||||
const onSaveBtn: MenuProps['onClick'] = (e, upVersion = undefined) => {
|
||||
const isUnsafe = e.key === 'unsafe'
|
||||
handleSaveClick(upVersion, isUnsafe)
|
||||
|
||||
}
|
||||
|
||||
const onRadioChange = (e: RadioChangeEvent) => {
|
||||
@@ -117,10 +109,7 @@ const ConfigurationEditorPage: FC = () => {
|
||||
setShowConfirmModal(true)
|
||||
}
|
||||
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 объект')
|
||||
@@ -132,7 +121,9 @@ const ConfigurationEditorPage: FC = () => {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
|
||||
|
||||
const renderContent = () => {
|
||||
|
||||
switch (radioValue) {
|
||||
case formRadio:
|
||||
return (
|
||||
@@ -165,6 +156,7 @@ const ConfigurationEditorPage: FC = () => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<main className="configuration-editor-page">
|
||||
<section className="configuration-editor-page__header">
|
||||
@@ -191,6 +183,7 @@ const ConfigurationEditorPage: FC = () => {
|
||||
Сохранить и выйти
|
||||
</Dropdown.Button>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
<div className="configuration-editor-page__content">
|
||||
<Radio.Group defaultValue={jsonRadio} disabled={disableBtn} size="large" onChange={onRadioChange}>
|
||||
@@ -204,6 +197,7 @@ const ConfigurationEditorPage: FC = () => {
|
||||
{renderContent()}
|
||||
</div>
|
||||
|
||||
|
||||
<ConfigSchemaModal
|
||||
schema={jsonSchema?.schema}
|
||||
open={showSchemeModal}
|
||||
@@ -215,16 +209,11 @@ const ConfigurationEditorPage: FC = () => {
|
||||
setBufConfig={setBufConfig}
|
||||
open={showConfirmModal}
|
||||
handleSaveClick={handleSaveClick}
|
||||
onClose={() => setShowConfirmModal(false)}
|
||||
/>
|
||||
onClose={() => setShowConfirmModal(false)} />
|
||||
|
||||
<ErrorConfigModal details={detailsErrors.details} open={detailsErrors.isOpenDetailsErrorModal}
|
||||
onClose={() => setDetailsError({details: {}, isOpenDetailsErrorModal: false })} />
|
||||
|
||||
<ErrorConfigModal
|
||||
details={detailsErrors.details}
|
||||
open={detailsErrors.isOpenDetailsErrorModal}
|
||||
onClose={() =>
|
||||
setDetailsError({ details: {}, isOpenDetailsErrorModal: false })
|
||||
}
|
||||
/>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './configurations.scss'
|
||||
|
||||
|
||||
const Configurations = () => {
|
||||
const {
|
||||
data: modulesList = [],
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
import { Spin, Table, Tag, Tooltip } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import dayjs from 'dayjs'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import { memo, useEffect, useState } from 'react'
|
||||
import { useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
import { AddressType, EndpointType, ModuleStatusType, ModuleType } from '@pages/ModulesPage/module.type.ts'
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
import {
|
||||
AddressType,
|
||||
EndpointType,
|
||||
ModuleStatusType,
|
||||
ModuleType
|
||||
} from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import useRole from '@hooks/useRole.tsx'
|
||||
|
||||
@@ -14,9 +23,6 @@ import { routePaths } from '@routes/routePaths.ts'
|
||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './connections.scss'
|
||||
import dayjs from 'dayjs'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
const Connections = () => {
|
||||
const { data: ConnectionsList = [], isLoading: isModulesLoading } =
|
||||
@@ -55,9 +61,9 @@ const Connections = () => {
|
||||
dayjs(obj).format(dateFormats.fullFormat)
|
||||
|
||||
const keySelector = ({
|
||||
address: { ip, port },
|
||||
establishedAt
|
||||
}: ModuleStatusType) => ip + port + establishedAt
|
||||
address: { ip, port },
|
||||
establishedAt
|
||||
}: ModuleStatusType) => ip + port + establishedAt
|
||||
|
||||
const renderEndpoints = ({ endpoints }: ModuleStatusType) => {
|
||||
if (endpoints && endpoints.length) {
|
||||
@@ -67,7 +73,11 @@ const Connections = () => {
|
||||
<li className="connection-page__endpoint-list__item" key={path}>
|
||||
{path}
|
||||
{inner && (
|
||||
<Tag className="connection-page__inner-tag" color="processing" bordered={false}>
|
||||
<Tag
|
||||
className="connection-page__inner-tag"
|
||||
color="processing"
|
||||
bordered={false}
|
||||
>
|
||||
Внутренний
|
||||
</Tag>
|
||||
)}
|
||||
|
||||
@@ -27,7 +27,6 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './modules-page.scss'
|
||||
|
||||
|
||||
const { Column } = Layout
|
||||
|
||||
const ModulesPage = () => {
|
||||
@@ -133,58 +132,58 @@ const ModulesPage = () => {
|
||||
)
|
||||
|
||||
const renderItems = (item: ModuleType) => {
|
||||
const isSame = versionCompare(item?.status?.map((i) => i.version))
|
||||
const textTooltip = isSame
|
||||
? 'Активны экземпляры одинаковых версий'
|
||||
: 'Активны экземпляры разных версий'
|
||||
const lastVersion = getLastVersion(item.status?.map((i) => i.version))
|
||||
const isSame = versionCompare(item?.status?.map((i) => i.version))
|
||||
const textTooltip = isSame
|
||||
? 'Активны экземпляры одинаковых версий'
|
||||
: 'Активны экземпляры разных версий'
|
||||
const lastVersion = getLastVersion(item.status?.map((i) => i.version))
|
||||
|
||||
const renderVersion = () => {
|
||||
if (!isSame && lastVersion) {
|
||||
return (
|
||||
<Tag icon={<ExclamationCircleOutlined />} color="warning">
|
||||
{lastVersion}
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
if (isSame && lastVersion) {
|
||||
return <Tag color="default">{lastVersion}</Tag>
|
||||
}
|
||||
return ''
|
||||
const renderVersion = () => {
|
||||
if (!isSame && lastVersion) {
|
||||
return (
|
||||
<Tag icon={<ExclamationCircleOutlined />} color="warning">
|
||||
{lastVersion}
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
if (isSame && lastVersion) {
|
||||
return <Tag color="default">{lastVersion}</Tag>
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta
|
||||
title={
|
||||
<div className="module-item__name">
|
||||
<span>{item.name}</span>
|
||||
<Tooltip
|
||||
overlayInnerStyle={{ width: '300px' }}
|
||||
title={textTooltip}
|
||||
>
|
||||
{renderVersion()}
|
||||
</Tooltip>
|
||||
</div>
|
||||
}
|
||||
description={
|
||||
<div className="module-item__content">
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta
|
||||
title={
|
||||
<div className="module-item__name">
|
||||
<span>{item.name}</span>
|
||||
<Tooltip
|
||||
overlayInnerStyle={{ width: '300px' }}
|
||||
title={textTooltip}
|
||||
>
|
||||
{renderVersion()}
|
||||
</Tooltip>
|
||||
</div>
|
||||
}
|
||||
description={
|
||||
<div className="module-item__content">
|
||||
<span className="module-item__content__description">
|
||||
активные экземпляры:
|
||||
</span>
|
||||
<Badge
|
||||
size="small"
|
||||
showZero
|
||||
count={(item.status && item.status.length) || 0}
|
||||
color={!item.status || !item.status.length ? '' : 'cyan'}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
<Badge
|
||||
size="small"
|
||||
showZero
|
||||
count={(item.status && item.status.length) || 0}
|
||||
color={!item.status || !item.status.length ? '' : 'cyan'}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -90,15 +90,15 @@ export interface ModuleType {
|
||||
}
|
||||
|
||||
export interface ResponseSchemaType {
|
||||
createdAt: string,
|
||||
id: string,
|
||||
moduleId: string,
|
||||
schema: JSONSchema,
|
||||
updatedAt: string,
|
||||
createdAt: string
|
||||
id: string
|
||||
moduleId: string
|
||||
schema: JSONSchema
|
||||
updatedAt: string
|
||||
version: string
|
||||
}
|
||||
export interface ConfigResponse {
|
||||
originalResponse: ConfigType[]
|
||||
activeConfigs: ConfigType[]
|
||||
inactiveConfigs:ConfigType[]
|
||||
inactiveConfigs: ConfigType[]
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
|
||||
const { NotFoundPage } = Layout
|
||||
|
||||
const NotFound = () => {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { Pagination, Spin, Table } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import dayjs from 'dayjs'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil'
|
||||
|
||||
import useRole from '@hooks/useRole'
|
||||
@@ -16,8 +19,6 @@ import { LogType } from '@type/log.type'
|
||||
import { PermissionKeysType } from '@type/roles.type'
|
||||
|
||||
import './security-log-page.scss'
|
||||
import dayjs from 'dayjs'
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
const limit = 10
|
||||
|
||||
@@ -77,7 +78,7 @@ const SecurityLogPage = () => {
|
||||
dataIndex: 'createdAt',
|
||||
key: 'createdAt',
|
||||
render: (value) => {
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -9,9 +9,11 @@ import {
|
||||
Tooltip
|
||||
} from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import dayjs from 'dayjs'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
import { SessionStatusKeysType, sessionStatuses } from '@constants/statuses'
|
||||
|
||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil'
|
||||
@@ -27,8 +29,6 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
import { SessionType } from '@type/session.type'
|
||||
|
||||
import './sessions-page.scss'
|
||||
import dayjs from 'dayjs'
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
const limit = 10
|
||||
|
||||
@@ -97,7 +97,7 @@ const SessionsPage = () => {
|
||||
dataIndex: 'createdAt',
|
||||
key: 'createdAt',
|
||||
render: (value) => {
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -105,7 +105,7 @@ const SessionsPage = () => {
|
||||
dataIndex: 'expiredAt',
|
||||
key: 'expiredAt',
|
||||
render: (value) => {
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -135,7 +135,7 @@ const SessionsPage = () => {
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
)}
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import { LabelItem } from 'isp-ui-kit/dist/FormComponents/formTypes'
|
||||
|
||||
import './user-editor.scss'
|
||||
|
||||
|
||||
const UserEditor = () => {
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
@@ -27,7 +27,6 @@ import { UserType } from '@type/user.type.ts'
|
||||
|
||||
import './users-page.scss'
|
||||
|
||||
|
||||
const UsersPage = () => {
|
||||
const { data: allUsers = [], isLoading: isUsersLoading } =
|
||||
userServiceApi.useGetAllUsersQuery()
|
||||
@@ -131,8 +130,12 @@ const UsersPage = () => {
|
||||
dataIndex: 'email',
|
||||
key: 'email',
|
||||
render: (value, record) => {
|
||||
if(record.blocked){
|
||||
return <div>{value} <Tag color="red">Заблокирован</Tag></div>
|
||||
if (record.blocked) {
|
||||
return (
|
||||
<div>
|
||||
{value} <Tag color="red">Заблокирован</Tag>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return value
|
||||
@@ -170,9 +173,9 @@ const UsersPage = () => {
|
||||
render: (_, record) => {
|
||||
return (
|
||||
<div className="users-page__content__table__actions">
|
||||
<Button.Group className="button_group">
|
||||
{hasBlockUserPermission && renderBlockButton(record)}
|
||||
{hasUpdateUserPermission && (
|
||||
<Button.Group className="button_group">
|
||||
{hasBlockUserPermission && renderBlockButton(record)}
|
||||
{hasUpdateUserPermission && (
|
||||
<Tooltip key="EditOutlined" title="Редактировать пользователя">
|
||||
<Button
|
||||
data-cy={`users-page__content__table__actions__edit-btn ${record.id}`}
|
||||
@@ -185,8 +188,8 @@ const UsersPage = () => {
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
{hasDeleteUserPermission && (
|
||||
)}
|
||||
{hasDeleteUserPermission && (
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить этого пользователя?"
|
||||
onConfirm={() => handleDeleteUser(record.id)}
|
||||
@@ -199,8 +202,8 @@ const UsersPage = () => {
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Button.Group>
|
||||
)}
|
||||
</Button.Group>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import { LocalStorage } from '@utils/localStorageUtils.ts'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
|
||||
const PrivateRoute = () => {
|
||||
const location = useLocation()
|
||||
const userToken = LocalStorage.get(localStorageKeys.USER_TOKEN)
|
||||
|
||||
@@ -36,5 +36,5 @@ export const routePaths: Record<RoutePaths, string> = {
|
||||
connections: 'connections',
|
||||
configurations: 'configurations',
|
||||
allVersions: ':configId/all_versions',
|
||||
configEditor: 'configEditor',
|
||||
configEditor: 'configEditor'
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
AccessListSetListSetOneRequestType
|
||||
} from '@type/accessList.type.ts'
|
||||
|
||||
|
||||
const accessListApi = createApi({
|
||||
reducerPath: 'accessListApi',
|
||||
refetchOnFocus: true,
|
||||
@@ -21,7 +20,10 @@ const accessListApi = createApi({
|
||||
query: ({ id }) => ({ url: apiPaths.getById, data: { id } }),
|
||||
providesTags: () => ['AccessItems']
|
||||
}),
|
||||
setList: builder.mutation<AccessListMethodType[], AccessListSetListRequestType>({
|
||||
setList: builder.mutation<
|
||||
AccessListMethodType[],
|
||||
AccessListSetListRequestType
|
||||
>({
|
||||
query: (data) => ({ url: apiPaths.setList, data }),
|
||||
invalidatesTags: () => ['AccessItems']
|
||||
}),
|
||||
|
||||
@@ -6,11 +6,10 @@ import { axiosBaseQuery } from '@utils/apiUtils.ts'
|
||||
|
||||
import { AppApiResponseType, DomainType } from '@type/app.type.ts'
|
||||
|
||||
|
||||
const appApi = createApi({
|
||||
reducerPath: 'appService',
|
||||
refetchOnFocus: true,
|
||||
tagTypes: ['SystemTreeApps' , 'Application'],
|
||||
tagTypes: ['SystemTreeApps', 'Application'],
|
||||
baseQuery: axiosBaseQuery({ baseUrl: apiPaths.baseSystemUrl }),
|
||||
endpoints: (builder) => ({
|
||||
getSystemTree: builder.query<AppApiResponseType, void>({
|
||||
|
||||
@@ -8,7 +8,6 @@ import { axiosBaseQuery } from '@utils/apiUtils.ts'
|
||||
|
||||
import { VersionType } from '@type/version.type.ts'
|
||||
|
||||
|
||||
const configServiceApi = createApi({
|
||||
reducerPath: 'configApi',
|
||||
tagTypes: ['configs', 'versions', 'config'],
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { createApi } from '@reduxjs/toolkit/query/react'
|
||||
|
||||
import { apiPaths } from '@constants/api/apiPaths.ts'
|
||||
|
||||
import { ModuleType, ResponseSchemaType } from '@pages/ModulesPage/module.type.ts'
|
||||
import {
|
||||
ModuleType,
|
||||
ResponseSchemaType
|
||||
} from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import { axiosBaseQuery } from '@utils/apiUtils.ts'
|
||||
|
||||
|
||||
const modulesServiceApi = createApi({
|
||||
reducerPath: 'modulesServiceApi',
|
||||
refetchOnFocus: false,
|
||||
@@ -28,9 +31,9 @@ const modulesServiceApi = createApi({
|
||||
url: apiPaths.getByModuleId,
|
||||
data: { moduleId }
|
||||
}),
|
||||
providesTags: () => ['schema'],
|
||||
}),
|
||||
providesTags: () => ['schema']
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
export default modulesServiceApi
|
||||
export default modulesServiceApi
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
RouteType
|
||||
} from '@type/accessList.type.ts'
|
||||
|
||||
|
||||
const routeApi = createApi({
|
||||
reducerPath: 'routeApi',
|
||||
refetchOnFocus: true,
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
|
||||
import { fetchProfile } from './ActionCreators.ts'
|
||||
|
||||
|
||||
export enum StateProfileStatus {
|
||||
resolved = 'resolved',
|
||||
pending = 'pending',
|
||||
|
||||
@@ -12,7 +12,7 @@ export enum PermissionKeysType {
|
||||
role_add = 'role_add', // Создание роли
|
||||
role_update = 'role_update', // Обновление роли
|
||||
role_delete = 'role_delete', // Удаление роли
|
||||
security_log_view = 'security_log_view', // Просмотр журналов ИБ
|
||||
security_log_view = 'security_log_view' // Просмотр журналов ИБ
|
||||
}
|
||||
|
||||
export interface RoleType {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
config: { [key: string]: any };
|
||||
config: { [key: string]: any }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-14
@@ -17,10 +17,16 @@ const sortObject = (obj: any): any => {
|
||||
}
|
||||
|
||||
function isEmpty(value: unknown): boolean {
|
||||
return (value === undefined ||
|
||||
return (
|
||||
value === undefined ||
|
||||
value === null ||
|
||||
(typeof value === 'string' && value.trim() === '') || // Пустые строки
|
||||
(Array.isArray(value) && value.length === 0) || (typeof value === 'object' && true && !Array.isArray(value) && Object.keys(value).length === 0))
|
||||
(Array.isArray(value) && value.length === 0) ||
|
||||
(typeof value === 'object' &&
|
||||
true &&
|
||||
!Array.isArray(value) &&
|
||||
Object.keys(value).length === 0)
|
||||
)
|
||||
}
|
||||
|
||||
function cleanEmptyParamsObject(obj: any): any {
|
||||
@@ -29,22 +35,22 @@ function cleanEmptyParamsObject(obj: any): any {
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
return obj
|
||||
.map(cleanEmptyParamsObject)
|
||||
.filter(item => !isEmpty(item)) // Удаление пустых элементов в массиве
|
||||
return obj.map(cleanEmptyParamsObject).filter((item) => !isEmpty(item)) // Удаление пустых элементов в массиве
|
||||
}
|
||||
|
||||
return Object.keys(obj).reduce((acc, key) => {
|
||||
const value = cleanEmptyParamsObject(obj[key]) // Рекурсивная обработка объектов
|
||||
return Object.keys(obj).reduce(
|
||||
(acc, key) => {
|
||||
const value = cleanEmptyParamsObject(obj[key]) // Рекурсивная обработка объектов
|
||||
|
||||
if (!isEmpty(value)) { // Проверяем пустоту значения после рекурсивной обработки
|
||||
acc[key] = value // Сохраняем только непустые значения
|
||||
}
|
||||
if (!isEmpty(value)) {
|
||||
// Проверяем пустоту значения после рекурсивной обработки
|
||||
acc[key] = value // Сохраняем только непустые значения
|
||||
}
|
||||
|
||||
return acc
|
||||
}, {} as Record<string, unknown>)
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, unknown>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export { sortObject, cleanEmptyParamsObject }
|
||||
@@ -2,7 +2,6 @@ import { TreeProps } from 'antd'
|
||||
|
||||
import { AccessListMethodType, EndpointType } from '@type/accessList.type.ts'
|
||||
|
||||
|
||||
export interface AccessListTreePropsType {
|
||||
searchValue: string
|
||||
defaultAllRoutes: Record<string, EndpointType[]>
|
||||
|
||||
@@ -11,7 +11,6 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './access-list-tree.scss'
|
||||
|
||||
|
||||
const unknownMethodKey = 'неизвестные методы'
|
||||
|
||||
const AccessListTree: FC<AccessListTreePropsType> = ({
|
||||
@@ -53,7 +52,11 @@ const AccessListTree: FC<AccessListTreePropsType> = ({
|
||||
<span className={`${unknown ? 'unknown-label' : ''}`}>
|
||||
{obj.path}
|
||||
{obj.inner ? (
|
||||
<Tag className="access-list-tree__inner-tag" color="processing" bordered={false}>
|
||||
<Tag
|
||||
className="access-list-tree__inner-tag"
|
||||
color="processing"
|
||||
bordered={false}
|
||||
>
|
||||
Внутренний
|
||||
</Tag>
|
||||
) : null}
|
||||
|
||||
@@ -12,134 +12,146 @@ import { Button, Dropdown, message, Popconfirm, Tooltip } from 'antd'
|
||||
import { FC } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import configServiceApi from '@services/configService.ts'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import { ActiveTableActionButtonsPropsType } from './active-table-action-buttons.type.ts'
|
||||
|
||||
import './active-table-action-buttons.scss'
|
||||
import CanEdit from '@components/CanEdit'
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
import configServiceApi from '@services/configService.ts'
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
const ActiveTableActionButtons: FC<ActiveTableActionButtonsPropsType> =
|
||||
({
|
||||
isActive,
|
||||
record,
|
||||
handleShowCompareModal,
|
||||
handleShowConfig,
|
||||
handleDeleteConfig,
|
||||
handleMarkConfigActive
|
||||
}) => {
|
||||
const navigate = useNavigate()
|
||||
const [createUpdateConfig] = configServiceApi.useCreateUpdateConfigMutation()
|
||||
const ActiveTableActionButtons: FC<ActiveTableActionButtonsPropsType> = ({
|
||||
isActive,
|
||||
record,
|
||||
handleShowCompareModal,
|
||||
handleShowConfig,
|
||||
handleDeleteConfig,
|
||||
handleMarkConfigActive
|
||||
}) => {
|
||||
const navigate = useNavigate()
|
||||
const [createUpdateConfig] = configServiceApi.useCreateUpdateConfigMutation()
|
||||
|
||||
const navigateToAllVersion = () => navigate(`${record.id}/all_versions`)
|
||||
const navigateToAllVersion = () => navigate(`${record.id}/all_versions`)
|
||||
|
||||
const copyConfig = () => {
|
||||
const newConfig = {
|
||||
name: `${record.name} (copy)`,
|
||||
moduleId: record.moduleId,
|
||||
id: '',
|
||||
version: 0,
|
||||
data: record.data
|
||||
} as ConfigType
|
||||
createUpdateConfig(newConfig)
|
||||
.unwrap()
|
||||
.then(() => message.success('Конфиг успешно скопирован'))
|
||||
.catch(() => message.error('Не удалось скопировать конфиг'))
|
||||
}
|
||||
const copyConfig = () => {
|
||||
const newConfig = {
|
||||
name: `${record.name} (copy)`,
|
||||
moduleId: record.moduleId,
|
||||
id: '',
|
||||
version: 0,
|
||||
data: record.data
|
||||
} as ConfigType
|
||||
createUpdateConfig(newConfig)
|
||||
.unwrap()
|
||||
.then(() => message.success('Конфиг успешно скопирован'))
|
||||
.catch(() => message.error('Не удалось скопировать конфиг'))
|
||||
}
|
||||
|
||||
const renderDropDownNoActive = (record: any) => {
|
||||
return (
|
||||
<div className="dropdown">
|
||||
<Tooltip key="1" title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => handleShowCompareModal(record)}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip key="2" title="Просмотр истории">
|
||||
<Button onClick={navigateToAllVersion} icon={<HistoryOutlined />} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip key="4" title="Копировать конфиг">
|
||||
<Button icon={<CopyOutlined />} onClick={copyConfig} />
|
||||
</Tooltip>
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить выбранный конфиг?"
|
||||
onConfirm={() => handleDeleteConfig(record)}
|
||||
>
|
||||
<Tooltip key="3" title="Удалить конфиг">
|
||||
<Button danger icon={<DeleteOutlined />} />
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderDropDownActive = (record: any) => {
|
||||
return (
|
||||
<div className="dropdown">
|
||||
<Tooltip key="1" title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => handleShowCompareModal(record)}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip key="2" title="Просмотр истории">
|
||||
<Button onClick={navigateToAllVersion} icon={<HistoryOutlined />} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip key="4" title="Копировать конфиг">
|
||||
<Button icon={<CopyOutlined />} onClick={copyConfig} />
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderAdditionalButtons = () => {
|
||||
if (isActive) {
|
||||
return (
|
||||
<Dropdown dropdownRender={() => renderDropDownActive(record)}>
|
||||
<Button icon={<EllipsisOutlined />} />
|
||||
</Dropdown>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<CanEdit>
|
||||
<Tooltip key="3" title="Сделать активной">
|
||||
<Button onClick={() => handleMarkConfigActive(record)} icon={<AlertOutlined />} />
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
<Dropdown dropdownRender={() => renderDropDownNoActive(record)}>
|
||||
<Button icon={<EllipsisOutlined />} />
|
||||
</Dropdown>
|
||||
</>
|
||||
)
|
||||
}
|
||||
const renderDropDownNoActive = (record: any) => {
|
||||
return (
|
||||
<div className="active-configurations-table-actions-field">
|
||||
<Button.Group className="button_group">
|
||||
<Tooltip title="Просмотр">
|
||||
<Button
|
||||
onClick={() => handleShowConfig(record)}
|
||||
icon={<EyeOutlined />}
|
||||
/>
|
||||
<div className="dropdown">
|
||||
<Tooltip key="1" title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => handleShowCompareModal(record)}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip key="2" title="Просмотр истории">
|
||||
<Button onClick={navigateToAllVersion} icon={<HistoryOutlined />} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip key="4" title="Копировать конфиг">
|
||||
<Button icon={<CopyOutlined />} onClick={copyConfig} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip title="Редактировать">
|
||||
<Button onClick={() => {
|
||||
navigate(`/${record.moduleId}/${routePaths.configEditor}/${record.id}`, { state: record })
|
||||
}} icon={<FormOutlined />} />
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить выбранный конфиг?"
|
||||
onConfirm={() => handleDeleteConfig(record)}
|
||||
>
|
||||
<Tooltip key="3" title="Удалить конфиг">
|
||||
<Button danger icon={<DeleteOutlined />} />
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
{renderAdditionalButtons()}
|
||||
</Button.Group>
|
||||
</Popconfirm>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderDropDownActive = (record: any) => {
|
||||
return (
|
||||
<div className="dropdown">
|
||||
<Tooltip key="1" title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => handleShowCompareModal(record)}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip key="2" title="Просмотр истории">
|
||||
<Button onClick={navigateToAllVersion} icon={<HistoryOutlined />} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip key="4" title="Копировать конфиг">
|
||||
<Button icon={<CopyOutlined />} onClick={copyConfig} />
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderAdditionalButtons = () => {
|
||||
if (isActive) {
|
||||
return (
|
||||
<Dropdown dropdownRender={() => renderDropDownActive(record)}>
|
||||
<Button icon={<EllipsisOutlined />} />
|
||||
</Dropdown>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<CanEdit>
|
||||
<Tooltip key="3" title="Сделать активной">
|
||||
<Button
|
||||
onClick={() => handleMarkConfigActive(record)}
|
||||
icon={<AlertOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
<Dropdown dropdownRender={() => renderDropDownNoActive(record)}>
|
||||
<Button icon={<EllipsisOutlined />} />
|
||||
</Dropdown>
|
||||
</>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div className="active-configurations-table-actions-field">
|
||||
<Button.Group className="button_group">
|
||||
<Tooltip title="Просмотр">
|
||||
<Button
|
||||
onClick={() => handleShowConfig(record)}
|
||||
icon={<EyeOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip title="Редактировать">
|
||||
<Button
|
||||
onClick={() => {
|
||||
navigate(
|
||||
`/${record.moduleId}/${routePaths.configEditor}/${record.id}`,
|
||||
{ state: record }
|
||||
)
|
||||
}}
|
||||
icon={<FormOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
{renderAdditionalButtons()}
|
||||
</Button.Group>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ActiveTableActionButtons
|
||||
@@ -3,12 +3,14 @@ import { FC } from 'react'
|
||||
|
||||
import { ListItemProps } from '@widgets/ListItem/list-item.type.ts'
|
||||
|
||||
|
||||
const ListItem: FC<ListItemProps> = ({ item }) => {
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta title={item.name} description={<span>id: {item.id}</span>} />
|
||||
<List.Item.Meta
|
||||
title={item.name}
|
||||
description={<span>id: {item.id}</span>}
|
||||
/>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
|
||||
@@ -6,7 +6,6 @@ import { ModalPropsType } from '@widgets/Modal/modal.type.ts'
|
||||
|
||||
import './modal.scss'
|
||||
|
||||
|
||||
const Modal = ({
|
||||
open,
|
||||
onOk = () => {},
|
||||
@@ -50,7 +49,7 @@ const Modal = ({
|
||||
<div className="modal__content">{children}</div>
|
||||
{footer && (
|
||||
<div className="modal__footer">
|
||||
<Button type="default" onClick={closeModal} >
|
||||
<Button type="default" onClick={closeModal}>
|
||||
{footer.onCanselText}
|
||||
</Button>
|
||||
<Button type="primary" onClick={onOk} loading={loading}>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Outlet } from 'react-router-dom'
|
||||
|
||||
import { ModuleTabContentPropsType } from '@widgets/ModuleTabContent/module-tab-content.type.ts'
|
||||
|
||||
|
||||
const { EmptyData, NoData } = Layout
|
||||
|
||||
const ModuleTabContent = ({
|
||||
|
||||
@@ -5,13 +5,10 @@ import { PermissionListProps } from './permisiion-list.type.ts'
|
||||
|
||||
import './permission-list.scss'
|
||||
|
||||
|
||||
const PermissionList: FC<PermissionListProps> = ({ permissions }) => {
|
||||
return (
|
||||
<Descriptions layout="vertical" className="permission-list">
|
||||
<Descriptions.Item
|
||||
label="Список разрешений"
|
||||
>
|
||||
<Descriptions.Item label="Список разрешений">
|
||||
<ul>
|
||||
{permissions.map((permission, index) => {
|
||||
return <li key={`${permission}-${index}`}>{permission}</li>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export type PermissionListProps = {
|
||||
permissions:string[];
|
||||
permissions: string[]
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import { AccessListMethodType } from '@type/accessList.type.ts'
|
||||
|
||||
import './selected-access-method.scss'
|
||||
|
||||
|
||||
const SelectedAccessMethod: FC<SelectedAccessMethodPropsType> = ({
|
||||
unknownMethodKey,
|
||||
allRoutes,
|
||||
@@ -20,8 +19,10 @@ const SelectedAccessMethod: FC<SelectedAccessMethodPropsType> = ({
|
||||
const renderMethodList = () => {
|
||||
const knownMethods: AccessListMethodType[] = []
|
||||
const unknownMethods: AccessListMethodType[] = []
|
||||
const sortAlphabetically = (a: AccessListMethodType, b: AccessListMethodType) =>
|
||||
a.method.localeCompare(b.method)
|
||||
const sortAlphabetically = (
|
||||
a: AccessListMethodType,
|
||||
b: AccessListMethodType
|
||||
) => a.method.localeCompare(b.method)
|
||||
methods.forEach((method) => {
|
||||
const isUnknown = checkIsUnknownMethod(method.method)
|
||||
if (isUnknown) {
|
||||
|
||||
Reference in new issue
Block a user