2024-04-27 16:21:14: merge [main:aa6853211bb46e321bc26b3b8132b18c03592910];
This commit is contained in:
1 parent
a31c44eb7b
commit
a6f4c85231
38 files changed
+1966
-60
No files matched your search
@@ -0,0 +1,19 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.applications-content {
|
||||
padding: $basic-padding *2 $basic-padding;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
&__add-btn {
|
||||
max-width: 240px;
|
||||
margin-left: auto;
|
||||
margin-bottom: $basic-margin * 2;
|
||||
}
|
||||
&__update-btn {
|
||||
margin-right: $basic-margin;
|
||||
}
|
||||
&__addToken-btn {
|
||||
display: flex;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,360 @@
|
||||
import {
|
||||
EditOutlined,
|
||||
DeleteOutlined,
|
||||
PlusSquareOutlined
|
||||
} from '@ant-design/icons'
|
||||
import {Button, message, Spin, Table} from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import { FormComponents, Layout } from 'isp-ui-kit'
|
||||
import { FC, useState } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
|
||||
import { ValidationRules } from '@constants/form/validationRules.ts'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
import {
|
||||
ApplicationAppType,
|
||||
ApplicationsServiceType,
|
||||
ApplicationTokenType,
|
||||
NewApplicationAppType,
|
||||
NewApplicationTokenType,
|
||||
UpdateApplicationAppType
|
||||
} from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
import applicationsApi from '@services/applicationsService.ts'
|
||||
import tokensApi from '@services/tokensService.ts'
|
||||
|
||||
import './applications-content.scss'
|
||||
|
||||
const { FormInput, FormSelect } = FormComponents
|
||||
const { EmptyData } = Layout
|
||||
|
||||
interface ApplicationsContentPropTypes {
|
||||
id: number
|
||||
}
|
||||
|
||||
const ApplicationsContent: FC<ApplicationsContentPropTypes> = (id) => {
|
||||
const { data: applications, isLoading: isLoadingApplicationsContent = [] } =
|
||||
applicationsApi.useGetApplicationsByServiceIdQuery(id)
|
||||
|
||||
const [createApplicationService] =
|
||||
applicationsApi.useCreateApplicationServiceMutation()
|
||||
const [updateApplication] =
|
||||
applicationsApi.useUpdateApplicationsServiceMutation()
|
||||
const [removeApplicationsService] =
|
||||
applicationsApi.useRemoveApplicationsServiceMutation()
|
||||
const [createToken] = tokensApi.useCreateTokenMutation()
|
||||
const [showApplicationsModal, setShowApplicationsModal] = useState({
|
||||
addModal: false,
|
||||
updateModal: false,
|
||||
addToken: false
|
||||
})
|
||||
const [currentApplicationsApp, setCurrentApplicationsApp] =
|
||||
useState<ApplicationAppType>()
|
||||
|
||||
const {
|
||||
handleSubmit,
|
||||
control: controlApplicationApp,
|
||||
reset
|
||||
} = useForm<ApplicationAppType>({
|
||||
mode: 'onChange'
|
||||
})
|
||||
|
||||
const { handleSubmit: handleSubmitTokens, control: controlTokens } =
|
||||
useForm<ApplicationTokenType>({
|
||||
mode: 'onChange'
|
||||
})
|
||||
|
||||
const handleShowUpdateModalApplicationApp = (data: ApplicationAppType) => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: true
|
||||
})
|
||||
setCurrentApplicationsApp(data)
|
||||
}
|
||||
const handleShowCreateModalApplicationApp = () => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: true
|
||||
})
|
||||
}
|
||||
const handleShowAddModalToken = (data: ApplicationAppType) => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addToken: true
|
||||
})
|
||||
setCurrentApplicationsApp(data)
|
||||
}
|
||||
|
||||
const handleUpdateApplicationApp = (data: UpdateApplicationAppType) => {
|
||||
if (currentApplicationsApp) {
|
||||
const updateApplications: UpdateApplicationAppType = {
|
||||
id: currentApplicationsApp.id,
|
||||
name: data.name,
|
||||
description: data.description
|
||||
? data.description
|
||||
: currentApplicationsApp.description,
|
||||
serviceId: id.id,
|
||||
type: 'SYSTEM'
|
||||
}
|
||||
updateApplication({ ...currentApplicationsApp, ...updateApplications })
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
reset()
|
||||
message.info('Элемент сохранен')
|
||||
})
|
||||
.catch(() => message.error('Ошибка обновления элемента'))
|
||||
}
|
||||
}
|
||||
|
||||
const handleCreateApplicationApp = (data: NewApplicationAppType) => {
|
||||
const newApplicationApp: NewApplicationAppType = {
|
||||
name: data.name,
|
||||
description: data.description,
|
||||
serviceId: id.id,
|
||||
type: 'SYSTEM'
|
||||
}
|
||||
|
||||
createApplicationService(newApplicationApp)
|
||||
.unwrap()
|
||||
.then(message.info('Элемент сохранен'))
|
||||
.catch((e) => message.error(e))
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
})
|
||||
reset()
|
||||
}
|
||||
const handleRemoveApplicationApp = (id: number) =>
|
||||
removeApplicationsService([id])
|
||||
.then(() => {
|
||||
message.info('Элемент удален')
|
||||
})
|
||||
.catch(message.error('Ошибка добавления элемента'))
|
||||
|
||||
const handleCreateToken = (data: NewApplicationTokenType) => {
|
||||
if (currentApplicationsApp) {
|
||||
const newToken: NewApplicationTokenType = {
|
||||
expireTimeMs: data.expireTimeMs,
|
||||
appId: currentApplicationsApp.id
|
||||
}
|
||||
|
||||
createToken(newToken)
|
||||
.then(() => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addToken: false
|
||||
})
|
||||
reset()
|
||||
message.info('Элемент добавлен')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Ошибка добавления элемента')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const columns: ColumnsType<ApplicationsServiceType> = [
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: ['app', 'id'],
|
||||
key: 'id'
|
||||
},
|
||||
{
|
||||
title: 'Наименование',
|
||||
dataIndex: ['app', 'name'],
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: 'Описание',
|
||||
dataIndex: ['app', 'description'],
|
||||
key: 'description'
|
||||
},
|
||||
{
|
||||
title: 'Type',
|
||||
dataIndex: ['app', 'type'],
|
||||
key: 'Type'
|
||||
},
|
||||
{
|
||||
title: 'Количество токенов',
|
||||
dataIndex: 'tokens',
|
||||
key: 'tokensAmount',
|
||||
render: (value) => {
|
||||
return value.length
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Действия',
|
||||
dataIndex: 'app',
|
||||
key: 'actions',
|
||||
render: (record) => {
|
||||
return (
|
||||
<CanEdit>
|
||||
<Button
|
||||
danger
|
||||
className="applications-content__update-btn"
|
||||
onClick={() => {
|
||||
handleShowUpdateModalApplicationApp(record)
|
||||
}}
|
||||
icon={<EditOutlined />}
|
||||
/>
|
||||
<Button
|
||||
onClick={() => handleRemoveApplicationApp(record.id)}
|
||||
icon={<DeleteOutlined />}
|
||||
/>
|
||||
</CanEdit>
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
const tokensOptions = [
|
||||
{
|
||||
value: -1,
|
||||
label: 'Бессрочно'
|
||||
},
|
||||
{
|
||||
value: 3600000,
|
||||
label: 'Один час'
|
||||
},
|
||||
{
|
||||
value: 86400000,
|
||||
label: 'Один день'
|
||||
},
|
||||
{
|
||||
value: 2592000000,
|
||||
label: '30 дней'
|
||||
},
|
||||
{
|
||||
value: 31536000000,
|
||||
label: 'Один год'
|
||||
}
|
||||
]
|
||||
|
||||
if (!id) {
|
||||
return <EmptyData />
|
||||
}
|
||||
|
||||
if (isLoadingApplicationsContent) {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="applications-content">
|
||||
<CanEdit>
|
||||
<Button
|
||||
className="applications-content__add-btn"
|
||||
type="primary"
|
||||
onClick={handleShowCreateModalApplicationApp}
|
||||
>
|
||||
Добавить
|
||||
</Button>
|
||||
</CanEdit>
|
||||
<Table
|
||||
expandable={{
|
||||
expandedRowRender: (record) => (
|
||||
<CanEdit>
|
||||
<Button
|
||||
className="applications-content__addToken-btn"
|
||||
onClick={() => handleShowAddModalToken(record.app)}
|
||||
>
|
||||
<PlusSquareOutlined /> Добавить токен
|
||||
</Button>
|
||||
</CanEdit>
|
||||
)
|
||||
}}
|
||||
className="appliactions-content__table"
|
||||
rowKey={(record) => record.app.id}
|
||||
pagination={false}
|
||||
dataSource={applications}
|
||||
columns={columns}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmit(handleUpdateApplicationApp)}
|
||||
title="Редактировать"
|
||||
open={showApplicationsModal.updateModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
name="name"
|
||||
label="Наименование"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
label="Описание"
|
||||
name="description"
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmit(handleCreateApplicationApp)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal.addModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
name="name"
|
||||
label="Наименование"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
label="Описание"
|
||||
name="description"
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmitTokens(handleCreateToken)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal.addToken}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addToken: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormSelect
|
||||
options={tokensOptions}
|
||||
name="expireTimeMs"
|
||||
control={controlTokens}
|
||||
label="Время действия"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default ApplicationsContent
|
||||
@@ -4,13 +4,13 @@ import { useRole } from '@hooks/useRole.tsx'
|
||||
|
||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
const AdminPermission = ({ children }: PropsWithChildren) => {
|
||||
const CanEdit = ({ children }: PropsWithChildren) => {
|
||||
const { hasPermission } = useRole()
|
||||
|
||||
if (hasPermission(PermissionKeysType.read)) {
|
||||
if (hasPermission(PermissionKeysType.write)) {
|
||||
return <>{children}</>
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export default AdminPermission
|
||||
export default CanEdit
|
||||
@@ -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 - 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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -1,7 +1,8 @@
|
||||
import {
|
||||
LockOutlined,
|
||||
LogoutOutlined,
|
||||
ProfileOutlined
|
||||
ProfileOutlined,
|
||||
AppstoreAddOutlined
|
||||
} from '@ant-design/icons'
|
||||
import { ConfigProvider, Layout, Menu, Spin } from 'antd'
|
||||
import { useContext, useEffect, useState } from 'react'
|
||||
@@ -12,6 +13,7 @@ import { localStorageKeys } from '@constants/localStorageKeys.ts'
|
||||
import DefaultUser from '@components/Icons/DefaultUser.tsx'
|
||||
import {
|
||||
MenuItemKeysType,
|
||||
MenuItemLabelsType,
|
||||
MenuItemType,
|
||||
menuKeys
|
||||
} from '@components/Layout/layout.type.ts'
|
||||
@@ -22,13 +24,15 @@ import { useAppDispatch, useAppSelector } from '@hooks/redux.ts'
|
||||
import useLogout from '@hooks/useLogout.tsx'
|
||||
import useRole from '@hooks/useRole.tsx'
|
||||
|
||||
import { fetchProfile } from '@stores/redusers/ActionCreators.ts'
|
||||
import { fetchProfile, fetchUI } from '@stores/redusers/ActionCreators.ts'
|
||||
import { StateProfileStatus } from '@stores/redusers/ProfileSlice.ts'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import Header from 'src/widgets/Header'
|
||||
|
||||
import './layout.scss'
|
||||
|
||||
const { Content, Sider } = Layout
|
||||
@@ -38,6 +42,7 @@ const LayoutComponent = () => {
|
||||
const [selectedMenuKeys, setSelectedMenuKeys] = useState<MenuItemKeysType[]>(
|
||||
[]
|
||||
)
|
||||
const [title, setTitle] = useState('')
|
||||
const [openKeys, setOpenKeys] = useState<string[]>([])
|
||||
const dispatch = useAppDispatch()
|
||||
const {
|
||||
@@ -81,6 +86,12 @@ const LayoutComponent = () => {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Группа приложений',
|
||||
key: 'applications',
|
||||
className: hideItem([PermissionKeysType.read]),
|
||||
icon: <AppstoreAddOutlined />
|
||||
},
|
||||
{
|
||||
label: 'Доступы приложений',
|
||||
key: 'appAccess',
|
||||
@@ -114,6 +125,12 @@ const LayoutComponent = () => {
|
||||
className: hideItem(PermissionKeysType.read)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Модули',
|
||||
key: 'modules',
|
||||
className: hideItem(PermissionKeysType.read),
|
||||
icon: <ProfileOutlined />
|
||||
}
|
||||
]
|
||||
|
||||
@@ -130,6 +147,7 @@ const LayoutComponent = () => {
|
||||
useEffect(() => {
|
||||
if (userToken) {
|
||||
dispatch(fetchProfile())
|
||||
dispatch(fetchUI())
|
||||
}
|
||||
}, [])
|
||||
|
||||
@@ -139,6 +157,7 @@ const LayoutComponent = () => {
|
||||
const menuItem = menuKeys[menuKey]
|
||||
|
||||
if (menuItem) {
|
||||
setTitle(MenuItemLabelsType[menuItem.key])
|
||||
setSelectedMenuKeys([menuItem.key])
|
||||
setOpenKeys(menuItem.parent)
|
||||
}
|
||||
@@ -169,6 +188,12 @@ const LayoutComponent = () => {
|
||||
case MenuItemKeysType.roles:
|
||||
navigate(routePaths.roles)
|
||||
break
|
||||
case MenuItemKeysType.modules:
|
||||
navigate(routePaths.modules)
|
||||
break
|
||||
case MenuItemKeysType.applications:
|
||||
navigate(routePaths.applications)
|
||||
break
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -178,37 +203,40 @@ const LayoutComponent = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout className="layout" data-cy="homePage">
|
||||
{status === StateProfileStatus.pending ? (
|
||||
<Spin size="large" />
|
||||
) : (
|
||||
<>
|
||||
<Sider
|
||||
width="250px"
|
||||
data-cy="aside"
|
||||
theme="light"
|
||||
collapsible
|
||||
collapsed={collapsed}
|
||||
onCollapse={(value) => setCollapsed(value)}
|
||||
>
|
||||
<Menu
|
||||
onOpenChange={(keys) => setOpenKeys(keys)}
|
||||
openKeys={openKeys}
|
||||
selectedKeys={selectedMenuKeys}
|
||||
onClick={handlerOnClickMenu}
|
||||
<section>
|
||||
<Header title={title} />
|
||||
<Layout className="layout" data-cy="homePage">
|
||||
{status === StateProfileStatus.pending ? (
|
||||
<Spin size="large" />
|
||||
) : (
|
||||
<>
|
||||
<Sider
|
||||
width="250px"
|
||||
data-cy="aside"
|
||||
theme="light"
|
||||
mode="inline"
|
||||
items={menuItems}
|
||||
/>
|
||||
</Sider>
|
||||
<Layout className="site-layout">
|
||||
<Content className="site-layout__content">
|
||||
<Outlet />
|
||||
</Content>
|
||||
</Layout>
|
||||
</>
|
||||
)}
|
||||
</Layout>
|
||||
collapsible
|
||||
collapsed={collapsed}
|
||||
onCollapse={(value) => setCollapsed(value)}
|
||||
>
|
||||
<Menu
|
||||
onOpenChange={(keys) => setOpenKeys(keys)}
|
||||
openKeys={openKeys}
|
||||
selectedKeys={selectedMenuKeys}
|
||||
onClick={handlerOnClickMenu}
|
||||
theme="light"
|
||||
mode="inline"
|
||||
items={menuItems}
|
||||
/>
|
||||
</Sider>
|
||||
<Layout className="site-layout">
|
||||
<Content className="site-layout__content">
|
||||
<Outlet />
|
||||
</Content>
|
||||
</Layout>
|
||||
</>
|
||||
)}
|
||||
</Layout>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@import 'src/constants/style/styleConst';
|
||||
|
||||
.layout {
|
||||
min-height: 100vh !important;
|
||||
min-height: calc(100vh - 65px) !important;
|
||||
position: relative;
|
||||
|
||||
.hide-item {
|
||||
|
||||
@@ -7,7 +7,20 @@ export enum MenuItemKeysType {
|
||||
appAccess = 'appAccess',
|
||||
roles = 'roles',
|
||||
logout = 'logout',
|
||||
profile = 'profile'
|
||||
profile = 'profile',
|
||||
modules = 'modules',
|
||||
applications = 'applications'
|
||||
}
|
||||
export enum MenuItemLabelsType {
|
||||
users = 'Пользователи',
|
||||
sessions = 'Пользовательские сессии',
|
||||
securityLog = 'Просмотр журналов ИБ',
|
||||
appAccess = 'Доступы приложений',
|
||||
roles = 'Роли',
|
||||
profile = 'Профиль',
|
||||
modules = 'Модули',
|
||||
applications = 'Группа приложений',
|
||||
logout = 'Выход',
|
||||
}
|
||||
|
||||
interface MenuItem {
|
||||
@@ -42,6 +55,14 @@ export const menuKeys: Record<MenuItemKeysType, MenuItem> = {
|
||||
[MenuItemKeysType.profile]: {
|
||||
key: MenuItemKeysType.profile,
|
||||
parent: ['']
|
||||
},
|
||||
[MenuItemKeysType.modules]: {
|
||||
key: MenuItemKeysType.modules,
|
||||
parent: []
|
||||
},
|
||||
[MenuItemKeysType.applications]: {
|
||||
key: MenuItemKeysType.applications,
|
||||
parent: ['']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
.app{
|
||||
overflow: hidden;
|
||||
height: 100vh;
|
||||
padding: 0 $basic-padding;
|
||||
min-height: 0;
|
||||
min-width: 500px;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user