2024-05-13 10:51:12: merge [main:6f6359c4c01bf3e0cef37b14d6b016b7d5a1fa84];
This commit is contained in:
1 parent
2989c66a65
commit
739a9a3a4b
45 files changed
+4018
-309
No files matched your search
@@ -0,0 +1,36 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
|
||||
.active-configurations-table {
|
||||
&__title {
|
||||
margin-bottom: $basic-margin*2;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
&__table {
|
||||
&__name-field {
|
||||
input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: $basic-margin;
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
gap: $basic-margin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.active-config {
|
||||
tr {
|
||||
background: $blue-light;
|
||||
}
|
||||
|
||||
.ant-table-cell-row-hover {
|
||||
background: $blue-color-2 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
export interface ActiveConfigurationsTablePropsType {
|
||||
isActiveTable?: boolean
|
||||
data: ConfigType[]
|
||||
handleShowConfig: (config: ConfigType) => void
|
||||
handleShowCompareModal: (config: ConfigType) => void
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
import { CheckOutlined, CloseOutlined, EditOutlined } from '@ant-design/icons'
|
||||
import { Button, message, Table, Tag, Tooltip } from 'antd'
|
||||
import { FC, useEffect, useRef, useState } from 'react'
|
||||
|
||||
import ActiveTableActionButtons from '@widgets/ActiveTableActionButtons'
|
||||
|
||||
import {
|
||||
ActiveConfigurationsTablePropsType
|
||||
} from '@components/ActiveConfigurationsTable/active-configurations-table.type.ts'
|
||||
|
||||
import configApi from '@services/configService.ts'
|
||||
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
|
||||
import './active-configurations-table.scss'
|
||||
import dayjs from 'dayjs'
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
|
||||
const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
|
||||
({
|
||||
isActiveTable = false,
|
||||
handleShowConfig,
|
||||
handleShowCompareModal,
|
||||
data
|
||||
}) => {
|
||||
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()
|
||||
|
||||
|
||||
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 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 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="#4fc14f">Корректная</Tag>
|
||||
}
|
||||
return <Tag color="red">Некорректная</Tag>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Дата обновления',
|
||||
dataIndex: 'updatedAt',
|
||||
key: 'updatedAt',
|
||||
align: 'center',
|
||||
render: (value: string) => {
|
||||
return dayjs(value).format('HH:mm:ss DD.MM.YYYY')
|
||||
}
|
||||
},
|
||||
{
|
||||
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">
|
||||
<h2 className="active-configurations-table__title">
|
||||
{isActiveTable ? 'Активная конфигурация' : 'Другие конфигурации'}
|
||||
</h2>
|
||||
<Table
|
||||
className={className}
|
||||
rowKey={(record) => record.id}
|
||||
pagination={false}
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ActiveConfigurationsTable
|
||||
@@ -0,0 +1,37 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.compare-version-modal {
|
||||
.modal__wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
justify-content: initial;
|
||||
}
|
||||
|
||||
.modal__content {
|
||||
overflow: initial;
|
||||
}
|
||||
|
||||
&__header {
|
||||
margin-top: $basic-margin;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: $basic-margin;
|
||||
|
||||
}
|
||||
|
||||
&__content {
|
||||
.cm-merge-theme {
|
||||
overflow-y: scroll;
|
||||
height: calc(90vh - 150px);
|
||||
}
|
||||
|
||||
&__table {
|
||||
overflow-y: auto;
|
||||
height: calc(90vh - 50px);
|
||||
|
||||
&__row {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { ModalPropsType } from '@widgets/Modal/modal.type.ts'
|
||||
|
||||
export interface CompareVersionModalPropsType
|
||||
extends Omit<ModalPropsType, 'title' | 'children'> {
|
||||
config: Record<string, any>
|
||||
currentConfigId: string
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import { EditorState, EditorView } from '@uiw/react-codemirror'
|
||||
import { Button, Spin, Table } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import { FC, useState } from 'react'
|
||||
import CodeMirrorMerge from 'react-codemirror-merge'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import { CompareVersionModalPropsType } from '@components/CompareVersionModal/compare-version-modal.type'
|
||||
|
||||
import { sortObject } from '@utils/objectUtils.ts'
|
||||
|
||||
import { useAppSelector } from '@hooks/redux.ts'
|
||||
|
||||
import configServiceApi from '@services/configService.ts'
|
||||
import userServiceApi from '@services/userService.ts'
|
||||
|
||||
import { VersionType } from '@type/version.type'
|
||||
|
||||
import './compare-version-modal.scss'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
|
||||
const Original = CodeMirrorMerge.Original
|
||||
const Modified = CodeMirrorMerge.Modified
|
||||
|
||||
const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
|
||||
open,
|
||||
onClose,
|
||||
config,
|
||||
currentConfigId
|
||||
}) => {
|
||||
const [selectedItem, setSelectedItem] = useState<VersionType>()
|
||||
const { data: versions = [], isLoading: isVersionLoading } =
|
||||
configServiceApi.useGetAllVersionQuery(currentConfigId)
|
||||
const { data: allUsers = [], isLoading: isUsersLoading } =
|
||||
userServiceApi.useGetAllUsersQuery()
|
||||
const { profile } = useAppSelector((state) => state.profileReducer)
|
||||
const isLoading = isVersionLoading || isUsersLoading
|
||||
if (isLoading) {
|
||||
return <Spin />
|
||||
}
|
||||
|
||||
const columns: ColumnsType<VersionType> = [
|
||||
{
|
||||
key: 'configVersion',
|
||||
title: 'Версия конфигурации',
|
||||
dataIndex: 'configVersion'
|
||||
},
|
||||
{
|
||||
key: 'createdAt',
|
||||
title: 'Создано',
|
||||
dataIndex: 'createdAt',
|
||||
render: (value: string) => {
|
||||
return dayjs(value).format('HH:mm:ss DD.MM.YYYY')
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'user',
|
||||
title: 'Автор',
|
||||
dataIndex: 'adminId',
|
||||
render: (value: number) => {
|
||||
const user = allUsers.find((user) => user.id === value)
|
||||
if (user) {
|
||||
return `${user.lastName} ${user.firstName}`
|
||||
}
|
||||
return `${profile.lastName} ${profile.firstName}`
|
||||
}
|
||||
}
|
||||
]
|
||||
return (
|
||||
<div className="compare-version-modal">
|
||||
<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?.configVersion}</span>
|
||||
</div>
|
||||
<CodeMirrorMerge orientation="a-b">
|
||||
<Original
|
||||
value={JSON.stringify(sortObject(selectedItem.data), null, 2)}
|
||||
/>
|
||||
<Modified
|
||||
value={JSON.stringify(sortObject(config?.data), null, 2)}
|
||||
extensions={[
|
||||
EditorView.editable.of(false),
|
||||
EditorState.readOnly.of(true)
|
||||
]}
|
||||
/>
|
||||
</CodeMirrorMerge>
|
||||
</div>
|
||||
) : (
|
||||
<div className="compare-version-modal__content__table">
|
||||
<Table
|
||||
rowClassName="compare-version-modal__content__table__row"
|
||||
size="small"
|
||||
columns={columns}
|
||||
pagination={{ pageSize: 30 }}
|
||||
dataSource={versions}
|
||||
rowKey={(record) => record.id}
|
||||
onRow={(record) => {
|
||||
return {
|
||||
onClick: () => setSelectedItem(record)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default CompareVersionModal
|
||||
@@ -0,0 +1,9 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.config-schema-modal {
|
||||
.modal__wrap {
|
||||
min-width: 880px;
|
||||
}
|
||||
|
||||
.json-schema-view {
|
||||
padding: $basic-padding
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { JsonSchemaViewer } from '@stoplight/json-schema-viewer'
|
||||
import { FC } from 'react'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import { ConfigSchemaModalPropsType } from '@components/ConfigSchemaModal/config-schema-moda.type.ts'
|
||||
|
||||
import './config-schema-modal.scss'
|
||||
|
||||
const ConfigSchemaModal: FC<ConfigSchemaModalPropsType> = ({
|
||||
open,
|
||||
onClose,
|
||||
schema
|
||||
}) => {
|
||||
return (
|
||||
<div className="config-schema-modal">
|
||||
<Modal title="Текущая схема конфигурации" open={open} onClose={onClose}>
|
||||
<JsonSchemaViewer
|
||||
viewMode="view"
|
||||
className="json-schema-view"
|
||||
schema={schema}
|
||||
emptyText="No schema defined"
|
||||
defaultExpandedDepth={99}
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ConfigSchemaModal
|
||||
@@ -0,0 +1,5 @@
|
||||
.configuration-preview-modal {
|
||||
.react-json-view {
|
||||
width: 100vw;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { ModalPropsType } from '@widgets/Modal/modal.type.ts'
|
||||
|
||||
export interface ConfigurationPreviewModalPropsType
|
||||
extends Omit<ModalPropsType, 'title' | 'children'> {
|
||||
config: Record<string, any>
|
||||
versionCompare?: boolean
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { ReactJsonView } from 'isp-ui-kit'
|
||||
import { FC } from 'react'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import { ConfigurationPreviewModalPropsType } from '@components/ConfigurationPreviewModal/configuration-preview-modal.type.ts'
|
||||
|
||||
import './configuration-preview-modal.scss'
|
||||
|
||||
|
||||
const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
|
||||
versionCompare = false,
|
||||
config,
|
||||
open,
|
||||
onClose
|
||||
}) => {
|
||||
const data = JSON.parse(JSON.stringify(config.data || {}))
|
||||
const configName = versionCompare
|
||||
? `Версия: ${config.configVersion}`
|
||||
: config.name
|
||||
return (
|
||||
<div className="configuration-preview-modal">
|
||||
<Modal title={configName || ''} open={open} onClose={onClose}>
|
||||
<ReactJsonView
|
||||
src={data}
|
||||
name={false}
|
||||
sortKeys={true}
|
||||
displayDataTypes={false}
|
||||
editKeys={false}
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ConfigurationPreviewModal
|
||||
@@ -1,46 +0,0 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.connection-page {
|
||||
&__content {
|
||||
padding: 2 * $basic-padding 3 * $basic-padding 2 * $basic-padding 0;
|
||||
width: 100%;
|
||||
|
||||
&__wrap-table {
|
||||
overflow-x: scroll;
|
||||
height: calc(100vh - 100px);
|
||||
}
|
||||
}
|
||||
|
||||
&__endpoint-list {
|
||||
&__item {
|
||||
height: 25px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
&__inner-marker {
|
||||
font-size: 11px;
|
||||
border: 1px solid #15D1E6;
|
||||
border-radius: 12px;
|
||||
padding: 0 4px;
|
||||
margin: 4px
|
||||
}
|
||||
}
|
||||
|
||||
&__no-data {
|
||||
user-select: none;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 1.5em;
|
||||
overflow: hidden;
|
||||
font-family: PT Sans, sans-serif;
|
||||
font-weight: 500;
|
||||
padding: 8px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
import { Spin, Table, Tooltip } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import moment from 'moment'
|
||||
import 'moment/dist/locale/ru'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
import {
|
||||
AddressType,
|
||||
EndpointType,
|
||||
ModuleStatusType,
|
||||
ModuleType
|
||||
} from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import useRole from '@hooks/useRole.tsx'
|
||||
|
||||
import modulesServiceApi from '@services/modulesService.ts'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './connections.scss'
|
||||
|
||||
const Connections = () => {
|
||||
const { data: ConnectionsList = [], isLoading: isModulesLoading } =
|
||||
modulesServiceApi.useGetModulesQuery('modules')
|
||||
const { role, hasPermission } = useRole()
|
||||
const navigate = useNavigate()
|
||||
const { id } = useParams()
|
||||
const [obj, setObj] = useState<ModuleStatusType[] | []>([])
|
||||
|
||||
const isLoading = isModulesLoading
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
|
||||
useEffect(() => {
|
||||
const filterId = ConnectionsList.find((item: ModuleType) => item.id === id)
|
||||
if (filterId && filterId.status) {
|
||||
setObj(filterId.status)
|
||||
}
|
||||
}, [ConnectionsList, id])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPageAvailable) {
|
||||
navigate(routePaths.home)
|
||||
}
|
||||
}, [isPageAvailable])
|
||||
useEffect(() => {
|
||||
if (!role) {
|
||||
navigate(routePaths.error)
|
||||
}
|
||||
}, [role])
|
||||
|
||||
if (isLoading) {
|
||||
return <Spin />
|
||||
}
|
||||
|
||||
const formatFullDate = (obj: string) =>
|
||||
moment(obj).format('YYYY-MM-DD, HH:mm:ss')
|
||||
|
||||
const keySelector = ({
|
||||
address: { ip, port },
|
||||
establishedAt
|
||||
}: ModuleStatusType) => ip + port + establishedAt
|
||||
|
||||
const renderEndpoints = ({ endpoints }: ModuleStatusType) => {
|
||||
if (endpoints && endpoints.length) {
|
||||
return (
|
||||
<ul className="connection-page__endpoint-list">
|
||||
{endpoints.map(({ path, inner }) => (
|
||||
<li className="connection-page__endpoint-list__item" key={path}>
|
||||
{path}
|
||||
{inner && (
|
||||
<span className="connection-page__endpoint-list__inner-marker">
|
||||
Внутренний
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="connection-page__no-data">Нет реализованных методов</div>
|
||||
)
|
||||
}
|
||||
|
||||
const columns: ColumnsType = [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key: 'num',
|
||||
render: (
|
||||
_val: ModuleStatusType,
|
||||
_record: ModuleStatusType,
|
||||
index: number
|
||||
) => index + 1
|
||||
},
|
||||
{
|
||||
title: 'Версия',
|
||||
dataIndex: 'version',
|
||||
key: 'version'
|
||||
},
|
||||
{
|
||||
title: 'Версия библиотеки',
|
||||
dataIndex: 'libVersion',
|
||||
key: 'libVersion'
|
||||
},
|
||||
{
|
||||
title: 'Адрес',
|
||||
dataIndex: 'address',
|
||||
key: 'address',
|
||||
render: (value: AddressType) => `${value.ip}:${value.port}`
|
||||
},
|
||||
{
|
||||
title: 'Соединение установлено',
|
||||
dataIndex: 'establishedAt',
|
||||
key: 'establishedAt',
|
||||
render: (val: string) => (
|
||||
<Tooltip title={formatFullDate(val)}>{moment(val).fromNow()}</Tooltip>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Реализованные методы',
|
||||
dataIndex: 'endpoints',
|
||||
key: 'endpoints',
|
||||
render: (value: EndpointType[]) => (value && value.length) || '0'
|
||||
}
|
||||
]
|
||||
|
||||
return (
|
||||
<section className="connection-page">
|
||||
<div className="connection-page__content">
|
||||
<div className="connection-page__content__wrap-table">
|
||||
<Table
|
||||
rowKey={keySelector}
|
||||
pagination={false}
|
||||
dataSource={obj}
|
||||
columns={columns}
|
||||
expandable={{
|
||||
expandedRowRender: (i) => renderEndpoints(i)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default Connections
|
||||
@@ -1,8 +1,9 @@
|
||||
import {
|
||||
AppstoreAddOutlined,
|
||||
LockOutlined,
|
||||
LogoutOutlined,
|
||||
ProfileOutlined,
|
||||
AppstoreAddOutlined
|
||||
ProductOutlined,
|
||||
ProfileOutlined
|
||||
} from '@ant-design/icons'
|
||||
import { ConfigProvider, Layout, Menu, Spin } from 'antd'
|
||||
import { useContext, useEffect, useState } from 'react'
|
||||
@@ -33,6 +34,8 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import Header from 'src/widgets/Header'
|
||||
|
||||
|
||||
|
||||
import './layout.scss'
|
||||
|
||||
const { Content, Sider } = Layout
|
||||
@@ -130,7 +133,7 @@ const LayoutComponent = () => {
|
||||
label: 'Модули',
|
||||
key: 'modules',
|
||||
className: hideItem(PermissionKeysType.read),
|
||||
icon: <ProfileOutlined />
|
||||
icon: <ProductOutlined />
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Reference in new issue
Block a user