2024-10-18 07:21:12: merge [main:5410dbee742841318d58b4865020b1b33dd6c586];
This commit is contained in:
1 parent
ae26c073e1
commit
3ddbdbda6d
60 files changed
+1595
-747
No files matched your search
@@ -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 = () => {
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
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>
|
||||
}
|
||||
|
||||
export interface DescriptionPropsType {
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface Schema {
|
||||
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
|
||||
}
|
||||
|
||||
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 }
|
||||
}
|
||||
|
||||
export interface ObjectFieldTemplatePropertyType {
|
||||
name: string
|
||||
content: ReactNode
|
||||
}
|
||||
|
||||
export interface SchemaPropertiesType {
|
||||
[key: string]: {
|
||||
type?: string
|
||||
title?: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface ObjectFieldTemplatePropsType {
|
||||
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 SortPropType {
|
||||
name: string
|
||||
}
|
||||
@@ -9,12 +9,15 @@
|
||||
height: 100vh;
|
||||
overflow: scroll;
|
||||
padding-bottom: 80px;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.react-json-view {
|
||||
margin: $basic-margin *3 0 $basic-margin *2 0;
|
||||
}
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -22,7 +25,8 @@
|
||||
padding: $basic-padding *2 $basic-padding;
|
||||
border-bottom: 1px solid $border-color;
|
||||
}
|
||||
&__controll{
|
||||
|
||||
&__controll {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -30,8 +34,9 @@
|
||||
width: auto;
|
||||
margin-left: $basic-margin;
|
||||
}
|
||||
|
||||
&__content {
|
||||
padding: $basic-padding * 3 $basic-padding;
|
||||
padding: $basic-padding * 3 $basic-padding;
|
||||
}
|
||||
|
||||
.rjsf {
|
||||
@@ -40,37 +45,104 @@
|
||||
.form-group {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ant-form-item-label {
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
.ant-tabs-right {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ant-col-8 .ant-form-item-label {
|
||||
margin-right: $basic-margin *2;
|
||||
}
|
||||
|
||||
.ant-form-item-row {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.collapseArray_item_content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ant-collapse-item {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.ant-collapse-header {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.collapseArray_item {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
||||
.anticon-delete {
|
||||
margin-left: auto;
|
||||
padding-left: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-col-sm-16 {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.ant-col .ant-form-item-control {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.ant-form-item-control-input-content {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
flex: auto;
|
||||
}
|
||||
|
||||
.flex-space-between {
|
||||
display: flex;
|
||||
flex-direction: row !important;
|
||||
justify-content: space-between;
|
||||
|
||||
&__plus {
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
.collapseArray_item {
|
||||
align-items: center;
|
||||
.ant-btn-link {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.ant-btn-group {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.ant-row .ant-row-end {
|
||||
width: 60px;
|
||||
margin: 0 0 $basic-margin auto !important;
|
||||
}
|
||||
|
||||
&__form {
|
||||
padding: $basic-padding;
|
||||
}
|
||||
|
||||
.modal__wrap {
|
||||
min-height: 110px;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 190px;
|
||||
}
|
||||
|
||||
.confirm-btn, .danger {
|
||||
margin-right: $basic-margin;
|
||||
}
|
||||
|
||||
.error-data {
|
||||
color: red;
|
||||
font-size: 16px;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RollbackOutlined } from '@ant-design/icons'
|
||||
import { Button, Dropdown, MenuProps, message, Radio, RadioChangeEvent, Spin } from 'antd'
|
||||
import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'
|
||||
import { FC, useEffect, useRef, useState} from 'react'
|
||||
import { useLocation, useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
import ConfigurationEditorCode from '@components/ConfigurationEditorCode'
|
||||
@@ -12,24 +12,19 @@ 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, ResponseSchemaType } from '@pages/ModulesPage/module.type.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'
|
||||
|
||||
|
||||
export interface ConfigurationEditorPropsType {
|
||||
JsonSchema?: ResponseSchemaType
|
||||
bufConfig?: ConfigType
|
||||
setBufConfig: Dispatch<SetStateAction<ConfigType | undefined>>
|
||||
isCurrentConfigLoading: boolean
|
||||
setDisableBtn?: Dispatch<SetStateAction<boolean>>
|
||||
}
|
||||
|
||||
const ConfigurationEditorPage: FC = () => {
|
||||
const navigate = useNavigate()
|
||||
const { moduleId = '' } = useParams()
|
||||
const { id = '' } = useParams()
|
||||
const isNew = id === 'new'
|
||||
const { data: JsonSchema, isLoading: isLoadingJsonSchema } =
|
||||
const { data: jsonSchema, isLoading: isLoadingJsonSchema } =
|
||||
modulesServiceApi.useGetByModuleIdQuery(moduleId)
|
||||
const {
|
||||
data: currentConfig,
|
||||
@@ -43,9 +38,14 @@ const ConfigurationEditorPage: FC = () => {
|
||||
const [bufConfig, setBufConfig] = useState<ConfigType>()
|
||||
const [detailsErrors, setDetailsError] = useState({ details: {}, isOpenDetailsErrorModal: false })
|
||||
const [disableBtn, setDisableBtn] = useState(false)
|
||||
const submitRef = useRef<any>(null)
|
||||
|
||||
const formRadio = 'form'
|
||||
const codeRadio = 'code'
|
||||
const jsonRadio = 'json'
|
||||
|
||||
useEffect(() => {
|
||||
setBufConfig(isNew ? {} : sortObject(currentConfig))
|
||||
setBufConfig(isNew ? {} : sortObject(currentConfig))
|
||||
}, [isCurrentConfigLoading])
|
||||
|
||||
const itemsSaveBtn = [
|
||||
@@ -62,14 +62,23 @@ const ConfigurationEditorPage: FC = () => {
|
||||
const onSaveBtn: MenuProps['onClick'] = (e, upVersion = undefined) => {
|
||||
const isUnsafe = e.key === 'unsafe'
|
||||
handleSaveClick(upVersion, isUnsafe)
|
||||
|
||||
}
|
||||
|
||||
const onRadioChange = (e: RadioChangeEvent) => {
|
||||
if (!bufConfig) return
|
||||
if (submitRef.current && radioValue === formRadio) {
|
||||
setBufConfig({ ...bufConfig, data: { ...submitRef.current } })
|
||||
}
|
||||
setRadioValue(e.target.value)
|
||||
}
|
||||
|
||||
const handleSaveClick = (upVersion?: number, unsafe?: boolean) => {
|
||||
let newData = {}
|
||||
const sentData =
|
||||
radioValue === formRadio
|
||||
? { ...bufConfig, data: { ...submitRef.current } }
|
||||
: { ...bufConfig }
|
||||
if (bufConfig) {
|
||||
if (isNew) {
|
||||
newData = {
|
||||
@@ -77,13 +86,13 @@ const ConfigurationEditorPage: FC = () => {
|
||||
moduleId: moduleId,
|
||||
id: '',
|
||||
version: 0,
|
||||
data: bufConfig.data,
|
||||
data: sentData.data,
|
||||
unsafe: unsafe
|
||||
} as ConfigType
|
||||
}
|
||||
if (currentConfig) {
|
||||
newData = {
|
||||
...bufConfig,
|
||||
...sentData,
|
||||
version: upVersion ? upVersion : currentConfig.version,
|
||||
unsafe: unsafe
|
||||
} as ConfigType
|
||||
@@ -102,10 +111,12 @@ const ConfigurationEditorPage: FC = () => {
|
||||
if (e.data.errorCode === 2003) {
|
||||
setDetailsError({ details: e.data.details, isOpenDetailsErrorModal: true })
|
||||
}
|
||||
if (e.data.errorCode === 400) {
|
||||
message.error('Невалидный JSON объект')
|
||||
}
|
||||
message.error('Ошибка обновления элемента')
|
||||
})
|
||||
}
|
||||
|
||||
if (isLoadingJsonSchema || isCurrentConfigLoading) {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
@@ -114,15 +125,18 @@ const ConfigurationEditorPage: FC = () => {
|
||||
const renderContent = () => {
|
||||
|
||||
switch (radioValue) {
|
||||
// case 'form':
|
||||
// return (
|
||||
// <ConfigurationEditorForm
|
||||
// bufConfig={bufConfig}
|
||||
// setBufConfig={setBufConfig}
|
||||
// isCurrentConfigLoading={isCurrentConfigLoading}
|
||||
// />
|
||||
// )
|
||||
case 'json':
|
||||
case formRadio:
|
||||
return (
|
||||
<ConfigurationEditorForm
|
||||
submitRef={submitRef}
|
||||
bufConfig={bufConfig}
|
||||
setBufConfig={setBufConfig}
|
||||
jsonSchema={jsonSchema}
|
||||
isCurrentConfigLoading={isCurrentConfigLoading}
|
||||
setDisableBtn={setDisableBtn}
|
||||
/>
|
||||
)
|
||||
case jsonRadio:
|
||||
return (
|
||||
<ConfigurationEditorJson
|
||||
bufConfig={bufConfig}
|
||||
@@ -130,7 +144,7 @@ const ConfigurationEditorPage: FC = () => {
|
||||
isCurrentConfigLoading={isCurrentConfigLoading}
|
||||
/>
|
||||
)
|
||||
case 'code':
|
||||
case codeRadio:
|
||||
return (
|
||||
<ConfigurationEditorCode
|
||||
setDisableBtn={setDisableBtn}
|
||||
@@ -153,17 +167,14 @@ const ConfigurationEditorPage: FC = () => {
|
||||
<h1>{bufConfig?.name}</h1>
|
||||
<div className="configuration-editor-page__controll">
|
||||
<Button
|
||||
disabled={!JsonSchema}
|
||||
disabled={!jsonSchema}
|
||||
className="configurations____buttons__show-schema-btn"
|
||||
onClick={() => setShowSchemeModal(true)}
|
||||
>
|
||||
Текущая схема конфигурации
|
||||
</Button>
|
||||
<Dropdown.Button
|
||||
onClick={() => {
|
||||
handleSaveClick()
|
||||
navigate(`/modules/${moduleId}/configurations`)
|
||||
}}
|
||||
onClick={() => handleSaveClick()}
|
||||
disabled={disableBtn}
|
||||
type="primary"
|
||||
className="configuration-editor-page__save-btn"
|
||||
@@ -175,10 +186,12 @@ const ConfigurationEditorPage: FC = () => {
|
||||
|
||||
</section>
|
||||
<div className="configuration-editor-page__content">
|
||||
<Radio.Group defaultValue="json" size="large" onChange={onRadioChange}>
|
||||
<Radio.Button disabled value="form">Форма</Radio.Button>
|
||||
<Radio.Button disabled={disableBtn} value="json">JSON</Radio.Button>
|
||||
<Radio.Button value="code">Редактор кода</Radio.Button>
|
||||
<Radio.Group defaultValue={jsonRadio} disabled={disableBtn} size="large" onChange={onRadioChange}>
|
||||
<Radio.Button value={formRadio}>Форма</Radio.Button>
|
||||
<Radio.Button disabled={disableBtn} value={jsonRadio}>
|
||||
JSON
|
||||
</Radio.Button>
|
||||
<Radio.Button value={codeRadio}>Редактор кода</Radio.Button>
|
||||
</Radio.Group>
|
||||
|
||||
{renderContent()}
|
||||
@@ -186,7 +199,7 @@ const ConfigurationEditorPage: FC = () => {
|
||||
|
||||
|
||||
<ConfigSchemaModal
|
||||
schema={JsonSchema?.schema}
|
||||
schema={jsonSchema?.schema}
|
||||
open={showSchemeModal}
|
||||
onClose={() => setShowSchemeModal(false)}
|
||||
/>
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user