diff --git a/src/components/Connections/connections.scss b/src/pages/ConnectionsPage/connections.scss similarity index 94% rename from src/components/Connections/connections.scss rename to src/pages/ConnectionsPage/connections.scss index 67f6a98..6d3cb94 100644 --- a/src/components/Connections/connections.scss +++ b/src/pages/ConnectionsPage/connections.scss @@ -1,4 +1,4 @@ -@import "src/constants/style/styleConst"; +@import "../../constants/style/styleConst"; .connection-page { &__content { diff --git a/src/components/Connections/index.tsx b/src/pages/ConnectionsPage/index.tsx similarity index 82% rename from src/components/Connections/index.tsx rename to src/pages/ConnectionsPage/index.tsx index 90420b6..00263be 100644 --- a/src/components/Connections/index.tsx +++ b/src/pages/ConnectionsPage/index.tsx @@ -1,16 +1,9 @@ -import { Spin, Table, Tooltip } from 'antd' +import { Spin, Table, Tag, 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 { AddressType, EndpointType, ModuleStatusType, ModuleType } from '@pages/ModulesPage/module.type.ts' import useRole from '@hooks/useRole.tsx' @@ -21,6 +14,8 @@ 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' const Connections = () => { const { data: ConnectionsList = [], isLoading: isModulesLoading } = @@ -56,12 +51,12 @@ const Connections = () => { } const formatFullDate = (obj: string) => - moment(obj).format('YYYY-MM-DD, HH:mm:ss') + dayjs(obj).format('YYYY-MM-DD, HH:mm:ss') 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) { @@ -71,9 +66,9 @@ const Connections = () => {
  • {path} {inner && ( - + Внутренний - + )}
  • ))} @@ -117,9 +112,13 @@ const Connections = () => { title: 'Соединение установлено', dataIndex: 'establishedAt', key: 'establishedAt', - render: (val: string) => ( - {moment(val).fromNow()} - ) + render: (val: string) => { + dayjs.extend(relativeTime) + + return ( + {dayjs(val).fromNow()} + ) + } }, { title: 'Реализованные методы',