Merge branch 'MSP-3204_connections' into 'main'
MSP-3204 "Connections" See merge request isp/isp-admin-ui!21
This commit is contained in:
commit
024a70808f
15 files changed
+765
-4
No files matched your search
@@ -1,3 +1,5 @@
|
||||
## 0.10.0
|
||||
- - Добавлена страница 'Модули'
|
||||
## 0.9.0
|
||||
-Добавлена страница приложений
|
||||
## 0.8.1
|
||||
|
||||
Generated
+15
@@ -12,6 +12,8 @@
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"axios": "^1.6.8",
|
||||
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
||||
"moment": "^2.30.1",
|
||||
"compare-versions": "^6.1.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.51.2",
|
||||
@@ -4969,6 +4971,11 @@
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/compare-versions": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.0.tgz",
|
||||
"integrity": "sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg=="
|
||||
},
|
||||
"node_modules/compute-scroll-into-view": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-3.1.0.tgz",
|
||||
@@ -7371,6 +7378,14 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.30.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
||||
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
|
||||
+3
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"private": true,
|
||||
"version": "0.9.0",
|
||||
"version": "0.10.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
@@ -17,6 +17,8 @@
|
||||
"@reduxjs/toolkit": "^2.2.3",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"axios": "^1.6.8",
|
||||
"compare-versions": "^6.1.0",
|
||||
"moment": "^2.30.1",
|
||||
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
@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 - 30px);
|
||||
}
|
||||
}
|
||||
|
||||
&__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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
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
|
||||
@@ -121,6 +121,12 @@ const LayoutComponent = () => {
|
||||
className: hideItem(PermissionKeysType.read)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Модули',
|
||||
key: 'modules',
|
||||
className: hideItem(PermissionKeysType.read),
|
||||
icon: <ProfileOutlined />
|
||||
}
|
||||
]
|
||||
|
||||
@@ -176,6 +182,9 @@ const LayoutComponent = () => {
|
||||
case MenuItemKeysType.roles:
|
||||
navigate(routePaths.roles)
|
||||
break
|
||||
case MenuItemKeysType.modules:
|
||||
navigate(routePaths.modules)
|
||||
break
|
||||
case MenuItemKeysType.applications:
|
||||
navigate(routePaths.applications)
|
||||
break
|
||||
|
||||
@@ -8,6 +8,7 @@ export enum MenuItemKeysType {
|
||||
roles = 'roles',
|
||||
logout = 'logout',
|
||||
profile = 'profile',
|
||||
modules = 'modules',
|
||||
applications = 'applications',
|
||||
}
|
||||
|
||||
@@ -44,6 +45,10 @@ export const menuKeys: Record<MenuItemKeysType, MenuItem> = {
|
||||
key: MenuItemKeysType.profile,
|
||||
parent: ['']
|
||||
},
|
||||
[MenuItemKeysType.modules]: {
|
||||
key: MenuItemKeysType.modules,
|
||||
parent: []
|
||||
},
|
||||
[MenuItemKeysType.applications]: {
|
||||
key: MenuItemKeysType.applications,
|
||||
parent: ['']
|
||||
|
||||
@@ -28,6 +28,8 @@ type PathKeys =
|
||||
| 'setList'
|
||||
| 'setOne'
|
||||
| 'getAllRoutes'
|
||||
| 'getModules'
|
||||
| 'deleteModule'
|
||||
| 'createUpdateService'
|
||||
| 'deleteService'
|
||||
| 'getAllService'
|
||||
@@ -86,6 +88,9 @@ export const apiPaths: Record<PathKeys, string> = {
|
||||
setList: '/access_list/set_list',
|
||||
setOne: '/access_list/set_one',
|
||||
getAllRoutes: '/routing/get_routes',
|
||||
// ======= MODULES ======
|
||||
getModules: '/module/get_modules_info',
|
||||
deleteModule: '/module/delete_module',
|
||||
// ======= SERVICE ======
|
||||
getServiceById: '/service/get_service_by_id',
|
||||
getAllService: '/service/get_service',
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons'
|
||||
import { List, message, Spin, Tabs, Tag, Tooltip } from 'antd'
|
||||
import { compareVersions } from 'compare-versions'
|
||||
import { Layout } from 'isp-ui-kit'
|
||||
import { useEffect, useState } from 'react'
|
||||
import {
|
||||
createSearchParams,
|
||||
Outlet,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
useParams,
|
||||
useSearchParams
|
||||
} from 'react-router-dom'
|
||||
|
||||
import { ModuleType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import { filterFirstColumnItems } from '@utils/firstColumnUtils.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 './modules-page.scss'
|
||||
|
||||
const { Column, EmptyData, NoData } = Layout
|
||||
|
||||
const ModulesPage = () => {
|
||||
const [activeTab, setActiveTab] = useState('configurations')
|
||||
const { id: selectedItemId = '' } = useParams()
|
||||
const navigate = useNavigate()
|
||||
const { role, hasPermission } = useRole()
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
const { data: ModulesList = [], isLoading: isModulesLoading } =
|
||||
modulesServiceApi.useGetModulesQuery('modules', {
|
||||
pollingInterval: 1000,
|
||||
skipPollingIfUnfocused: true
|
||||
})
|
||||
const [removeModule] = modulesServiceApi.useRemoveModuleMutation()
|
||||
const location = useLocation()
|
||||
|
||||
const searchValue = searchParams.get('search') || ''
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
const isRemoveModule = hasPermission(PermissionKeysType.write)
|
||||
const isLoading = isModulesLoading
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPageAvailable) {
|
||||
navigate(routePaths.home)
|
||||
}
|
||||
}, [isPageAvailable])
|
||||
|
||||
useEffect(() => {
|
||||
if (!role) {
|
||||
navigate(routePaths.error)
|
||||
}
|
||||
}, [role])
|
||||
|
||||
useEffect(() => {
|
||||
const url = location.pathname.substring(
|
||||
location.pathname.lastIndexOf('/') + 1
|
||||
)
|
||||
switch (url) {
|
||||
case 'configurations':
|
||||
return setActiveTab('configurations')
|
||||
case 'connections':
|
||||
return setActiveTab('connections')
|
||||
}
|
||||
}, [location])
|
||||
|
||||
const setSelectedItemId = (id: string): void => {
|
||||
if (id) {
|
||||
navigate(
|
||||
{
|
||||
pathname: `${routePaths.modules}/${id}/${activeTab}`,
|
||||
search: createSearchParams(searchParams).toString()
|
||||
},
|
||||
{ replace: true }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const handleOnChangeSearchValue = (value: string): void => {
|
||||
setSearchParams((prev) => {
|
||||
if (!value) {
|
||||
prev.delete('search')
|
||||
} else {
|
||||
prev.set('search', value)
|
||||
}
|
||||
return prev
|
||||
})
|
||||
}
|
||||
|
||||
const handleRemoveModule = (id: string) => {
|
||||
removeModule(id)
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
navigate(routePaths.modules)
|
||||
message.success('Модуль успешно удален').then()
|
||||
setSelectedItemId('')
|
||||
})
|
||||
.catch(() => message.error('Не удалось удалить модуль'))
|
||||
}
|
||||
|
||||
const versionCompare = (versions: string[]) => {
|
||||
const sorted = versions?.sort(compareVersions)
|
||||
const firstVersion = sorted[0]
|
||||
for (let i = 1; i < sorted.length; i++) {
|
||||
if (compareVersions(firstVersion, sorted[i]) !== 0) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
const getLastVersion = (versions: string[]) => {
|
||||
const sorted = versions?.sort(compareVersions)
|
||||
return sorted[sorted.length - 1]
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return <Spin />
|
||||
}
|
||||
|
||||
const currentRole = ModulesList
|
||||
? ModulesList.find(
|
||||
(item: ModuleType) => item.id.toString() === selectedItemId
|
||||
)
|
||||
: null
|
||||
|
||||
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 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>
|
||||
<div className="module-item">
|
||||
<div className="module-item__name">
|
||||
<span>{item.name}</span>
|
||||
<Tooltip overlayInnerStyle={{ width: '300px' }} title={textTooltip}>
|
||||
{renderVersion()}
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className="module-item__content">
|
||||
<span className="module-item__content__description">
|
||||
активные экземпляры:
|
||||
</span>
|
||||
<strong
|
||||
className={`module-item__content__status ${
|
||||
!item.status || !item.status.length
|
||||
? 'module-item__content__status_zero'
|
||||
: ''
|
||||
}`}
|
||||
>
|
||||
{(item.status && item.status.length) || '0'}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
</List.Item>
|
||||
)
|
||||
}
|
||||
|
||||
const renderMainContent = () => {
|
||||
if (!selectedItemId) {
|
||||
return <EmptyData />
|
||||
}
|
||||
|
||||
if (!currentRole) {
|
||||
return <NoData />
|
||||
}
|
||||
|
||||
return <Outlet />
|
||||
}
|
||||
const secondColumnItems = [
|
||||
{
|
||||
key: 'configurations',
|
||||
name: 'Конфигурации'
|
||||
},
|
||||
{ key: 'connections', name: 'Подключения' }
|
||||
]
|
||||
|
||||
return (
|
||||
<section className="modules-page three-columns">
|
||||
<Column
|
||||
items={filterFirstColumnItems(ModulesList, searchValue)}
|
||||
showAddBtn={false}
|
||||
showRemoveBtn={isRemoveModule}
|
||||
onRemoveItem={handleRemoveModule}
|
||||
onChangeSearchValue={handleOnChangeSearchValue}
|
||||
renderItems={renderItems}
|
||||
searchValue={searchValue}
|
||||
selectedItemId={selectedItemId}
|
||||
setSelectedItemId={setSelectedItemId}
|
||||
/>
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={(activeKey) => {
|
||||
setActiveTab(activeKey)
|
||||
const path = `${selectedItemId}/${activeKey}`
|
||||
navigate(path)
|
||||
}}
|
||||
className="modules-page__tabs"
|
||||
tabPosition={'left'}
|
||||
items={secondColumnItems.map((item) => {
|
||||
return {
|
||||
disabled: selectedItemId === '',
|
||||
label: item.name,
|
||||
key: item.key,
|
||||
children: (
|
||||
<div className="modules-page__content">{renderMainContent()}</div>
|
||||
)
|
||||
}
|
||||
})}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default ModulesPage
|
||||
@@ -0,0 +1,89 @@
|
||||
export interface RequiredModuleType {
|
||||
id: string
|
||||
name: string
|
||||
required: boolean
|
||||
}
|
||||
|
||||
export interface AddressType {
|
||||
ip: string
|
||||
port: string
|
||||
}
|
||||
|
||||
export interface EndpointType {
|
||||
extra: Record<string, unknown>
|
||||
inner: boolean
|
||||
path: string
|
||||
userAuthRequired: boolean
|
||||
}
|
||||
|
||||
export interface ModuleStatusType {
|
||||
establishedAt: string
|
||||
libVersion: string
|
||||
version: string
|
||||
address: AddressType
|
||||
endpoints: EndpointType[]
|
||||
}
|
||||
|
||||
export interface ConfigType {
|
||||
active: boolean
|
||||
commonConfigs: string[]
|
||||
createdAt: string
|
||||
data: Record<string, unknown>
|
||||
description: string
|
||||
id: string
|
||||
moduleId: string
|
||||
name: string
|
||||
updatedAt: string
|
||||
valid: boolean
|
||||
version: number
|
||||
}
|
||||
|
||||
export interface JSONSchema {
|
||||
$ref?: string
|
||||
$schema?: string
|
||||
additionalItems?: boolean | JSONSchema
|
||||
additionalProperties?: boolean | JSONSchema
|
||||
allOf?: JSONSchema[]
|
||||
anyOf?: JSONSchema[]
|
||||
default?: any
|
||||
definitions?: Record<string, JSONSchema>
|
||||
dependencies?: Record<string, string | string[] | JSONSchema>
|
||||
description?: string
|
||||
enum?: any[]
|
||||
exclusiveMaximum?: boolean
|
||||
exclusiveMinimum?: boolean
|
||||
format?: string
|
||||
items?: JSONSchema | JSONSchema[]
|
||||
maxItems?: number
|
||||
maxLength?: number
|
||||
maxProperties?: number
|
||||
maximum?: number
|
||||
media?: JSONSchema
|
||||
minItems?: number
|
||||
minLength?: number
|
||||
minProperties?: number
|
||||
minimum?: number
|
||||
multipleOf?: number
|
||||
not?: JSONSchema
|
||||
oneOf?: JSONSchema[]
|
||||
pattern?: string
|
||||
patternProperties?: Record<string, JSONSchema>
|
||||
properties?: Record<string, JSONSchema>
|
||||
required?: string[]
|
||||
title?: string
|
||||
type?: string | string[]
|
||||
uniqueItems?: boolean
|
||||
}
|
||||
|
||||
export interface ModuleType {
|
||||
active: boolean
|
||||
configs: ConfigType[]
|
||||
createdAt: string
|
||||
id: string
|
||||
lastConnectedAt: string
|
||||
lastDisconnectedAt: string
|
||||
name: string
|
||||
requiredModules: RequiredModuleType[]
|
||||
status: ModuleStatusType[]
|
||||
configSchema: JSONSchema
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
@import "../../constants/style/styleConst";
|
||||
|
||||
.modules-page {
|
||||
height: 100%;
|
||||
|
||||
&__tabs {
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
.ant-list-item {
|
||||
padding-bottom: 20px;
|
||||
|
||||
}
|
||||
|
||||
.ant-tag {
|
||||
height: 22px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.module-item {
|
||||
width: 100%;
|
||||
|
||||
&__name {
|
||||
display: flex;
|
||||
padding-bottom: 5px;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&__content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
&__description {
|
||||
color: $grey;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
&__status {
|
||||
border: 1px solid #15d1e6;
|
||||
border-radius: 12px;
|
||||
padding: 0 4px;
|
||||
font-family: sans-serif;
|
||||
opacity: .7;
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&__status_zero {
|
||||
border: 1px solid red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&__content {
|
||||
overflow-x: scroll;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.three-columns {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
box-shadow: inset -1px 0px 0px $border-color;
|
||||
|
||||
height: 100%;
|
||||
|
||||
.column__header {
|
||||
padding: $basic-padding * 2 $basic-padding;
|
||||
|
||||
svg {
|
||||
fill: $blue-color;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-input-affix-wrapper {
|
||||
.ant-input-prefix {
|
||||
margin-left: auto;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-input-affix-wrapper-focused {
|
||||
.ant-input-prefix {
|
||||
.anticon-search {
|
||||
svg {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ant-list-items {
|
||||
.column__items__item {
|
||||
.ant-list-item-meta-title {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
font-weight: 400;
|
||||
color: $text-color-gray;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: $blue-light !important;
|
||||
|
||||
.ant-list-item-meta-title {
|
||||
color: $text-color-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ant-tabs-nav-list {
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
.ant-tabs-tab {
|
||||
justify-content: flex-end;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.column .column__items__item span {
|
||||
width: fit-content;
|
||||
}
|
||||
@@ -18,6 +18,8 @@ const UserEditor = lazy(() => import('src/pages/UserEditor'))
|
||||
const SessionsPage = lazy(() => import('@pages/SessionsPage'))
|
||||
const SecurityLogPage = lazy(() => import('@pages/SecurityLogPage'))
|
||||
const AppAccessPage = lazy(() => import('@pages/AppAccessPage'))
|
||||
const ModulesPage = lazy(() => import('@pages/ModulesPage'))
|
||||
const Connections = lazy(() => import('@components/Connections'))
|
||||
const ApplicationsPage = lazy(() => import('@pages/ApplicationsPage'))
|
||||
|
||||
const Routers = () => {
|
||||
@@ -124,6 +126,33 @@ const Routers = () => {
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
<Route
|
||||
path={routePaths.modules}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ModulesPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route path=":id">
|
||||
<Route
|
||||
path="configurations"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<div>Configurations</div>
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="connections"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<Connections />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
<Route
|
||||
|
||||
@@ -9,6 +9,7 @@ type RoutePaths =
|
||||
| 'securityLog'
|
||||
| 'roles'
|
||||
| 'appAccess'
|
||||
| 'modules'
|
||||
| 'applications'
|
||||
|
||||
export const routePaths: Record<RoutePaths, string> = {
|
||||
@@ -22,5 +23,6 @@ export const routePaths: Record<RoutePaths, string> = {
|
||||
securityLog: '/securityLog',
|
||||
roles: '/roles',
|
||||
appAccess: '/appAccess',
|
||||
modules: '/modules',
|
||||
applications: '/applications'
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { createApi } from '@reduxjs/toolkit/query/react'
|
||||
|
||||
import { apiPaths } from '@constants/api/apiPaths.ts'
|
||||
|
||||
import { ModuleType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import { axiosBaseQuery } from '@utils/apiUtils.ts'
|
||||
|
||||
const modulesServiceApi = createApi({
|
||||
reducerPath: 'modulesServiceApi',
|
||||
refetchOnFocus: true,
|
||||
tagTypes: ['modules'],
|
||||
baseQuery: axiosBaseQuery({ baseUrl: apiPaths.baseConfigUrl }),
|
||||
endpoints: (builder) => ({
|
||||
getModules: builder.query<ModuleType[], string>({
|
||||
query: () => ({ url: apiPaths.getModules, data: { limit: 1000 } }),
|
||||
providesTags: () => ['modules']
|
||||
}),
|
||||
removeModule: builder.mutation<void, string>({
|
||||
query: (id) => ({
|
||||
url: apiPaths.deleteModule,
|
||||
data: [id]
|
||||
}),
|
||||
invalidatesTags: ['modules']
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
export default modulesServiceApi
|
||||
@@ -3,13 +3,14 @@ import { theme } from 'antd'
|
||||
import { MapToken, SeedToken } from 'antd/es/theme/interface'
|
||||
import { createContext, Dispatch, SetStateAction } from 'react'
|
||||
|
||||
import sessionServiceApi from '@services/sessionService.ts'
|
||||
import accessListApi from '@services/accessListService.ts'
|
||||
import appApi from '@services/appService.ts'
|
||||
import modulesServiceApi from '@services/modulesService.ts'
|
||||
import roleApi from '@services/roleService.ts'
|
||||
import securityLogServiceApi from '@services/securityLogService.ts'
|
||||
import userServiceApi from '@services/userService.ts'
|
||||
import routeApi from '@services/routeService.ts'
|
||||
import securityLogServiceApi from '@services/securityLogService.ts'
|
||||
import sessionServiceApi from '@services/sessionService.ts'
|
||||
import userServiceApi from '@services/userService.ts'
|
||||
|
||||
import profileReducer from './redusers/ProfileSlice.ts'
|
||||
import applicationsGroupApi from '@services/applicationsGroupService.ts'
|
||||
@@ -34,6 +35,7 @@ const rootReducer = combineReducers({
|
||||
[appApi.reducerPath]: appApi.reducer,
|
||||
[accessListApi.reducerPath]: accessListApi.reducer,
|
||||
[routeApi.reducerPath]: routeApi.reducer,
|
||||
[modulesServiceApi.reducerPath]: modulesServiceApi.reducer,
|
||||
[applicationsGroupApi.reducerPath]: applicationsGroupApi.reducer,
|
||||
[applicationsApi.reducerPath]: applicationsApi.reducer,
|
||||
})
|
||||
@@ -51,6 +53,7 @@ export const setupStore = () =>
|
||||
routeApi.middleware,
|
||||
userServiceApi.middleware,
|
||||
sessionServiceApi.middleware,
|
||||
modulesServiceApi.middleware,
|
||||
applicationsGroupApi.middleware,
|
||||
applicationsApi.middleware
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user