MSP-3203 move Connections to page folder
This commit is contained in:
1 parent
61a1ec0964
commit
bbb4291788
2 files changed
+18
-19
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
@import "src/constants/style/styleConst";
|
@import "../../constants/style/styleConst";
|
||||||
|
|
||||||
.connection-page {
|
.connection-page {
|
||||||
&__content {
|
&__content {
|
||||||
@@ -1,16 +1,9 @@
|
|||||||
import { Spin, Table, Tooltip } from 'antd'
|
import { Spin, Table, Tag, Tooltip } from 'antd'
|
||||||
import { ColumnsType } from 'antd/es/table'
|
import { ColumnsType } from 'antd/es/table'
|
||||||
import moment from 'moment'
|
|
||||||
import 'moment/dist/locale/ru'
|
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
|
|
||||||
import {
|
import { AddressType, EndpointType, ModuleStatusType, ModuleType } from '@pages/ModulesPage/module.type.ts'
|
||||||
AddressType,
|
|
||||||
EndpointType,
|
|
||||||
ModuleStatusType,
|
|
||||||
ModuleType
|
|
||||||
} from '@pages/ModulesPage/module.type.ts'
|
|
||||||
|
|
||||||
import useRole from '@hooks/useRole.tsx'
|
import useRole from '@hooks/useRole.tsx'
|
||||||
|
|
||||||
@@ -21,6 +14,8 @@ import { routePaths } from '@routes/routePaths.ts'
|
|||||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||||
|
|
||||||
import './connections.scss'
|
import './connections.scss'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||||
|
|
||||||
const Connections = () => {
|
const Connections = () => {
|
||||||
const { data: ConnectionsList = [], isLoading: isModulesLoading } =
|
const { data: ConnectionsList = [], isLoading: isModulesLoading } =
|
||||||
@@ -56,12 +51,12 @@ const Connections = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formatFullDate = (obj: string) =>
|
const formatFullDate = (obj: string) =>
|
||||||
moment(obj).format('YYYY-MM-DD, HH:mm:ss')
|
dayjs(obj).format('YYYY-MM-DD, HH:mm:ss')
|
||||||
|
|
||||||
const keySelector = ({
|
const keySelector = ({
|
||||||
address: { ip, port },
|
address: { ip, port },
|
||||||
establishedAt
|
establishedAt
|
||||||
}: ModuleStatusType) => ip + port + establishedAt
|
}: ModuleStatusType) => ip + port + establishedAt
|
||||||
|
|
||||||
const renderEndpoints = ({ endpoints }: ModuleStatusType) => {
|
const renderEndpoints = ({ endpoints }: ModuleStatusType) => {
|
||||||
if (endpoints && endpoints.length) {
|
if (endpoints && endpoints.length) {
|
||||||
@@ -71,9 +66,9 @@ const Connections = () => {
|
|||||||
<li className="connection-page__endpoint-list__item" key={path}>
|
<li className="connection-page__endpoint-list__item" key={path}>
|
||||||
{path}
|
{path}
|
||||||
{inner && (
|
{inner && (
|
||||||
<span className="connection-page__endpoint-list__inner-marker">
|
<Tag color="processing" bordered={false}>
|
||||||
Внутренний
|
Внутренний
|
||||||
</span>
|
</Tag>
|
||||||
)}
|
)}
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
@@ -117,9 +112,13 @@ const Connections = () => {
|
|||||||
title: 'Соединение установлено',
|
title: 'Соединение установлено',
|
||||||
dataIndex: 'establishedAt',
|
dataIndex: 'establishedAt',
|
||||||
key: 'establishedAt',
|
key: 'establishedAt',
|
||||||
render: (val: string) => (
|
render: (val: string) => {
|
||||||
<Tooltip title={formatFullDate(val)}>{moment(val).fromNow()}</Tooltip>
|
dayjs.extend(relativeTime)
|
||||||
)
|
|
||||||
|
return (
|
||||||
|
<Tooltip title={formatFullDate(val)}>{dayjs(val).fromNow()}</Tooltip>
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Реализованные методы',
|
title: 'Реализованные методы',
|
||||||
Reference in new issue
Block a user