2024-05-20 13:33:14: merge [main:cbc2424bba8b53605d0eef5e6716b20406f9b312];
This commit is contained in:
1 parent
98ad434b36
commit
a922f7e914
53 files changed
+1811
-3261
No files matched your search
@@ -28,6 +28,7 @@ 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 = () => {
|
||||
@@ -157,7 +158,7 @@ const AllVersionsPage = () => {
|
||||
title: 'Создано',
|
||||
dataIndex: 'createdAt',
|
||||
render: (value: string) => {
|
||||
return dayjs(value).format('HH:mm:ss DD.MM.YYYY')
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -25,63 +25,10 @@
|
||||
display: flex;
|
||||
background: #fff;
|
||||
box-shadow: inset -1px 0px 0px $border-color;
|
||||
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
svg {
|
||||
path {
|
||||
fill: $text-color-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.modal__wrap{
|
||||
min-width: 350px;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,15 @@
|
||||
import { List, message, Spin } from 'antd'
|
||||
import { Layout, FormComponents } from 'isp-ui-kit'
|
||||
import { List, message, Spin, Tooltip } from 'antd'
|
||||
import { Layout } from 'isp-ui-kit'
|
||||
import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom'
|
||||
|
||||
import { ValidationRules } from '@constants/form/validationRules.ts'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import ApplicationsContent from '@components/ApplicationsContent'
|
||||
import AppGroupModal from 'src/components/AppGroupModal'
|
||||
|
||||
import {
|
||||
NewApplicationsGroupType,
|
||||
ApplicationsGroupType,
|
||||
NewApplicationsGroupType,
|
||||
UpdateApplicationsGroupType
|
||||
} from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
@@ -30,8 +26,8 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './applications-page.scss'
|
||||
|
||||
|
||||
const { Column, EmptyData } = Layout
|
||||
const { FormInput } = FormComponents
|
||||
|
||||
const ApplicationsPage = () => {
|
||||
const navigate = useNavigate()
|
||||
@@ -68,9 +64,12 @@ const ApplicationsPage = () => {
|
||||
updateModal: false
|
||||
})
|
||||
const searchValue = searchParams.get('search') || ''
|
||||
const { handleSubmit, control, reset } = useForm<ApplicationsGroupType>({
|
||||
mode: 'onChange'
|
||||
})
|
||||
|
||||
const currentAppGroup = useMemo(
|
||||
() =>
|
||||
applicationsGroup.find((group) => group.id.toString() === selectedItemId),
|
||||
[applicationsGroup, selectedItemId]
|
||||
)
|
||||
|
||||
if (isErrorApplicationsGroup) {
|
||||
return <EmptyData />
|
||||
@@ -82,14 +81,14 @@ const ApplicationsPage = () => {
|
||||
|
||||
const renderColumnItems = (item: ColumnItem<any>) => {
|
||||
return (
|
||||
<div className="applications-page__list">
|
||||
<List.Item>
|
||||
<span>{item.name}</span>
|
||||
<span className="applications-page__list__desc">
|
||||
{item.description}
|
||||
</span>
|
||||
</List.Item>
|
||||
</div>
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta
|
||||
title={item.name}
|
||||
description={<span>{item.description}</span>}
|
||||
/>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -107,22 +106,31 @@ const ApplicationsPage = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleAddApplicationGroup = (data: any) => {
|
||||
const handleAddApplicationGroup = (data: ApplicationsGroupType) => {
|
||||
const newService: NewApplicationsGroupType = {
|
||||
name: data.name,
|
||||
description: data.description,
|
||||
domainId: 2
|
||||
}
|
||||
createApplicationsGroup(newService)
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
})
|
||||
reset()
|
||||
message.info('Сервис успешно создан')
|
||||
.unwrap()
|
||||
.then((res) => {
|
||||
setSelectedItemId(
|
||||
`${routePaths.applicationsGroup}`,
|
||||
res.id.toString(),
|
||||
searchValue,
|
||||
navigate
|
||||
)
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
})
|
||||
message.success('Группа приложений успешно создана')
|
||||
})
|
||||
.catch(() => message.error('Не удалось создать группу приложений'))
|
||||
}
|
||||
|
||||
const handleUpdateApplicationsGroup = (data: NewApplicationsGroupType) => {
|
||||
const handleUpdateApplicationsGroup = (data: ApplicationsGroupType) => {
|
||||
const updateService: UpdateApplicationsGroupType = {
|
||||
name: data.name,
|
||||
description: data.description,
|
||||
@@ -130,21 +138,20 @@ const ApplicationsPage = () => {
|
||||
id: Number(selectedItemId)
|
||||
}
|
||||
|
||||
updateApplicationsGroup(updateService)
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
|
||||
reset()
|
||||
message.info('Сервис успешно отредактирован')
|
||||
updateApplicationsGroup(updateService).unwrap().then(()=>{
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
message.success('Группа приложений успешно отредактирована')
|
||||
}).catch(()=> message.error('Не удалось отредактировать группу приложений'))
|
||||
}
|
||||
|
||||
const handleRemoveApplicationsGtoup = () => {
|
||||
deleteApplicationsGroup([Number(selectedItemId)])
|
||||
.unwrap()
|
||||
.then(() => message.success('Элемент удален'))
|
||||
.catch(() => message.info('Ошибка удаления элемента'))
|
||||
.catch(() => message.error('Ошибка удаления элемента'))
|
||||
}
|
||||
|
||||
const renderMainContent = () => {
|
||||
@@ -163,79 +170,54 @@ const ApplicationsPage = () => {
|
||||
|
||||
return (
|
||||
<main className="applications-page three-columns">
|
||||
<Column
|
||||
title="Группа приложений"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
showUpdateBtn={!!selectedItemId}
|
||||
onAddItem={addApplicationModal}
|
||||
onRemoveItem={handleRemoveApplicationsGtoup}
|
||||
items={filterFirstColumnItems(
|
||||
applicationsGroup as unknown as ColumnItem<ApplicationsGroupType>[],
|
||||
searchValue
|
||||
)}
|
||||
renderItems={renderColumnItems}
|
||||
searchValue={searchValue}
|
||||
selectedItemId={selectedItemId}
|
||||
setSelectedItemId={(itemId) => {
|
||||
setCurrentApplicationsApp(0)
|
||||
setSelectedItemId(
|
||||
`${routePaths.applicationsGroup}`,
|
||||
itemId,
|
||||
searchValue,
|
||||
navigate
|
||||
)
|
||||
}}
|
||||
onChangeSearchValue={(value) =>
|
||||
setSearchValue(value, setSearchParams)
|
||||
}
|
||||
/>
|
||||
{renderMainContent()}
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmit(handleAddApplicationGroup)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal.addModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormInput
|
||||
control={control}
|
||||
name="name"
|
||||
label="Наименование"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
<FormInput control={control} label="Описание" name="description" />
|
||||
</form>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmit(handleUpdateApplicationsGroup)}
|
||||
title="Редактировать"
|
||||
open={showApplicationsModal.updateModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormInput
|
||||
control={control}
|
||||
name="name"
|
||||
label="Наименование"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
<FormInput control={control} label="Описание" name="description" />
|
||||
</form>
|
||||
</Modal>
|
||||
<Column
|
||||
title="Группы приложений"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
showUpdateBtn={true}
|
||||
onAddItem={addApplicationModal}
|
||||
onRemoveItem={handleRemoveApplicationsGtoup}
|
||||
items={filterFirstColumnItems(
|
||||
applicationsGroup as unknown as ColumnItem<ApplicationsGroupType>[],
|
||||
searchValue
|
||||
)}
|
||||
renderItems={renderColumnItems}
|
||||
searchValue={searchValue}
|
||||
selectedItemId={selectedItemId}
|
||||
setSelectedItemId={(itemId) => {
|
||||
setCurrentApplicationsApp(0)
|
||||
setSelectedItemId(
|
||||
`${routePaths.applicationsGroup}`,
|
||||
itemId,
|
||||
searchValue,
|
||||
navigate
|
||||
)
|
||||
}}
|
||||
onChangeSearchValue={(value) => setSearchValue(value, setSearchParams)}
|
||||
/>
|
||||
{renderMainContent()}
|
||||
<AppGroupModal
|
||||
onOk={handleAddApplicationGroup}
|
||||
title="Добавить группу приложений"
|
||||
open={showApplicationsModal.addModal}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
})
|
||||
}
|
||||
/>
|
||||
<AppGroupModal
|
||||
appGroup={currentAppGroup}
|
||||
title="Редактировать группу приложений"
|
||||
onOk={handleUpdateApplicationsGroup}
|
||||
open={showApplicationsModal.updateModal}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
}
|
||||
/>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@import "../../constants/style/styleConst";
|
||||
|
||||
.configurations {
|
||||
height: calc(100vh - 150px);
|
||||
height: calc(100vh - 80px);
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
min-width: 700px;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { injectStyles } from '@stoplight/mosaic'
|
||||
import { Button, Spin } from 'antd'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { Outlet, useNavigate, useParams } from 'react-router-dom'
|
||||
@@ -72,7 +71,7 @@ const Configurations = () => {
|
||||
if (configId) {
|
||||
return <Outlet />
|
||||
}
|
||||
injectStyles()
|
||||
|
||||
return (
|
||||
<section className="configurations">
|
||||
<ConfigurationPreviewModal
|
||||
@@ -95,6 +94,7 @@ const Configurations = () => {
|
||||
)}
|
||||
<div className="configurations__buttons">
|
||||
<Button
|
||||
disabled={!currentModule?.configSchema}
|
||||
className="configurations____buttons__show-schema-btn"
|
||||
onClick={() => setIsModalOpen(true)}
|
||||
>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
&__wrap-table {
|
||||
overflow-x: scroll;
|
||||
height: calc(100vh - 150px);
|
||||
height: calc(100vh - 70px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ 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 } =
|
||||
@@ -51,7 +52,7 @@ const Connections = () => {
|
||||
}
|
||||
|
||||
const formatFullDate = (obj: string) =>
|
||||
dayjs(obj).format('YYYY-MM-DD, HH:mm:ss')
|
||||
dayjs(obj).format(dateFormats.fullFormat)
|
||||
|
||||
const keySelector = ({
|
||||
address: { ip, port },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons'
|
||||
import { List, message, Spin, Tabs, Tag, Tooltip } from 'antd'
|
||||
import { Badge, List, message, Spin, Tabs, Tag, Tooltip } from 'antd'
|
||||
import { compareVersions } from 'compare-versions'
|
||||
import { Layout } from 'isp-ui-kit'
|
||||
import { useEffect, useState } from 'react'
|
||||
@@ -49,7 +49,7 @@ const ModulesPage = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPageAvailable) {
|
||||
navigate(routePaths.home)
|
||||
navigate(routePaths.error)
|
||||
}
|
||||
}, [isPageAvailable])
|
||||
|
||||
@@ -154,28 +154,34 @@ const ModulesPage = () => {
|
||||
|
||||
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>
|
||||
<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 ? '' : 'blue'}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
}
|
||||
@@ -204,6 +210,7 @@ const ModulesPage = () => {
|
||||
<Column
|
||||
items={filterFirstColumnItems(ModulesList, searchValue)}
|
||||
showAddBtn={false}
|
||||
showUpdateBtn={false}
|
||||
showRemoveBtn={isRemoveModule}
|
||||
onRemoveItem={handleRemoveModule}
|
||||
onChangeSearchValue={handleOnChangeSearchValue}
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
.ant-list-item {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.ant-tag {
|
||||
height: 22px;
|
||||
margin: 0;
|
||||
@@ -31,28 +27,12 @@
|
||||
&__content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
&__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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +42,7 @@
|
||||
}
|
||||
|
||||
.column .column__items__item span {
|
||||
width: fit-content;
|
||||
width: fit-content !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,57 +50,5 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button, Descriptions } from 'antd'
|
||||
import { Button, Descriptions, Popconfirm } from 'antd'
|
||||
import { useState } from 'react'
|
||||
|
||||
import PermissionList from '@widgets/PermissionList'
|
||||
@@ -18,7 +18,7 @@ const ProfilePage = () => {
|
||||
const { logoutUser, isLoading } = useLogout()
|
||||
|
||||
return (
|
||||
<section className="profile-page wrap">
|
||||
<section className="profile-page">
|
||||
<ChangePasswordModal
|
||||
onClose={() => setIsModalOpen(false)}
|
||||
open={isModalOpen}
|
||||
@@ -34,18 +34,22 @@ const ProfilePage = () => {
|
||||
<RoleList userRoles={profile.roles} />
|
||||
<PermissionList permissions={profile.permissions} />
|
||||
<div className="profile-page__actions">
|
||||
<Button
|
||||
loading={isLoading}
|
||||
disabled={isLoading}
|
||||
className="profile-page__actions__exit-btn"
|
||||
type="primary"
|
||||
onClick={logoutUser}
|
||||
<Popconfirm
|
||||
okText="Выйти"
|
||||
cancelText="Отмена"
|
||||
title="Вы действительно хотите выйти из профиля?"
|
||||
onConfirm={logoutUser}
|
||||
>
|
||||
Выход
|
||||
</Button>
|
||||
<Button
|
||||
loading={isLoading}
|
||||
disabled={isLoading}
|
||||
className="profile-page__actions__exit-btn"
|
||||
>
|
||||
Выход
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Button
|
||||
className="profile-page__actions__change-pass-btn"
|
||||
type="primary"
|
||||
onClick={() => setIsModalOpen(true)}
|
||||
>
|
||||
Сменить пароль
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
@import '../../constants/style/styleConst';
|
||||
|
||||
.profile-page {
|
||||
height: 100%;
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
border: 1px solid #F0F0F0;
|
||||
padding: $basic-padding * 2;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { List, Spin, message } from 'antd'
|
||||
import { List, Spin, message, Tooltip } from 'antd'
|
||||
import { Layout } from 'isp-ui-kit'
|
||||
import { useEffect } from 'react'
|
||||
import {
|
||||
@@ -131,10 +131,12 @@ const RolesPage = () => {
|
||||
: null
|
||||
const renderItems = (item: RoleType) => (
|
||||
<List.Item data-cy="role-item">
|
||||
<div className="role-item">
|
||||
<span className="role-item__name">{item.name}</span>
|
||||
<span className="role-item__id">id: {item.id}</span>
|
||||
</div>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta
|
||||
title={item.name}
|
||||
description={<span>id: {item.id}</span>}
|
||||
/>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
|
||||
|
||||
@@ -19,63 +19,5 @@
|
||||
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;
|
||||
}
|
||||
|
||||
svg {
|
||||
path {
|
||||
fill: $text-color-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ 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
|
||||
|
||||
@@ -75,8 +77,7 @@ const SecurityLogPage = () => {
|
||||
dataIndex: 'createdAt',
|
||||
key: 'createdAt',
|
||||
render: (value) => {
|
||||
const date = new Date(value)
|
||||
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
&__wrap-table {
|
||||
overflow-x: scroll;
|
||||
height: calc(100vh - 250px);
|
||||
height: calc(100vh - 160px);
|
||||
}
|
||||
|
||||
&__pagination {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { LogoutOutlined } from '@ant-design/icons'
|
||||
import { Button, Popconfirm, Spin, Table, message, Pagination } from 'antd'
|
||||
import {
|
||||
Button,
|
||||
Popconfirm,
|
||||
Spin,
|
||||
Table,
|
||||
message,
|
||||
Pagination,
|
||||
Tooltip
|
||||
} from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
@@ -21,6 +29,8 @@ 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
|
||||
|
||||
@@ -61,7 +71,7 @@ const SessionsPage = () => {
|
||||
revokeSession(id)
|
||||
.unwrap()
|
||||
.then(() => message.success('Сессия успешно завершена'))
|
||||
.catch(() => message.info('Не удалось завершить сессию'))
|
||||
.catch(() => message.error('Не удалось завершить сессию'))
|
||||
}
|
||||
|
||||
if (isLoading || !data) {
|
||||
@@ -88,8 +98,7 @@ const SessionsPage = () => {
|
||||
dataIndex: 'createdAt',
|
||||
key: 'createdAt',
|
||||
render: (value) => {
|
||||
const date = new Date(value)
|
||||
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -97,8 +106,7 @@ const SessionsPage = () => {
|
||||
dataIndex: 'expiredAt',
|
||||
key: 'expiredAt',
|
||||
render: (value) => {
|
||||
const date = new Date(value)
|
||||
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`
|
||||
return dayjs(value).format(dateFormats.fullFormat)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -121,12 +129,12 @@ const SessionsPage = () => {
|
||||
title="Закончить эту сессию?"
|
||||
onConfirm={() => handleRevokeSessions(record.id)}
|
||||
>
|
||||
<Button
|
||||
data-cy="sessions-page__content__table__logout-btn"
|
||||
type="primary"
|
||||
className="sessions-page__content__table__logout-btn"
|
||||
icon={<LogoutOutlined />}
|
||||
/>
|
||||
<Tooltip key="LogoutOutlined" title="Закончить сессию">
|
||||
<Button
|
||||
data-cy="sessions-page__content__table__logout-btn"
|
||||
icon={<LogoutOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
</CanEdit>
|
||||
</>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
&__wrap-table {
|
||||
overflow-x: scroll;
|
||||
height: calc(100vh - 250px);
|
||||
height: calc(100vh - 160px);
|
||||
}
|
||||
|
||||
&__table {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { ArrowLeftOutlined, SaveOutlined } from '@ant-design/icons'
|
||||
import { Button, message, Spin } from 'antd'
|
||||
import dayjs from 'dayjs'
|
||||
import { FormComponents } from 'isp-ui-kit'
|
||||
import { useEffect } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
import { ValidationRules } from '@constants/form/validationRules.ts'
|
||||
|
||||
import { findExclusiveRole } from '@utils/roleUtils.ts'
|
||||
@@ -23,6 +25,7 @@ import { LabelItem } from 'isp-ui-kit/dist/FormComponents/formTypes'
|
||||
|
||||
import './user-editor.scss'
|
||||
|
||||
|
||||
const UserEditor = () => {
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
@@ -75,7 +78,7 @@ const UserEditor = () => {
|
||||
const exclusiveRole = findExclusiveRole(roles, value.roles as number[])
|
||||
if (exclusiveRole) {
|
||||
if (value.roles && value.roles.length > 1) {
|
||||
message.info(
|
||||
message.error(
|
||||
<>
|
||||
Роль: <strong>{exclusiveRole.name}</strong> несовместима с
|
||||
другими ролями
|
||||
@@ -166,9 +169,7 @@ const UserEditor = () => {
|
||||
{state.lastSessionCreatedAt && (
|
||||
<>
|
||||
Последняя сессия
|
||||
{new Date(state.lastSessionCreatedAt).toLocaleDateString()}
|
||||
|
||||
{new Date(state.lastSessionCreatedAt).toLocaleTimeString()}
|
||||
{dayjs(state.lastSessionCreatedAt).format(dateFormats.fullFormat)}
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
@@ -179,12 +180,20 @@ const UserEditor = () => {
|
||||
<div className="user-editor__content__wrap">
|
||||
<div className="user-editor__content__name">
|
||||
<FormComponents.FormInput
|
||||
label="Пользователь"
|
||||
label="Имя"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
control={control}
|
||||
name="firstName"
|
||||
/>
|
||||
</div>
|
||||
<div className="user-editor__content__name">
|
||||
<FormComponents.FormInput
|
||||
label="Фамилия"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
control={control}
|
||||
name="lastName"
|
||||
/>
|
||||
</div>
|
||||
<div className="user-editor__content__description">
|
||||
<FormComponents.FormInput
|
||||
label="Описание"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {
|
||||
DeleteOutlined,
|
||||
EditTwoTone,
|
||||
EditOutlined,
|
||||
LockOutlined,
|
||||
UnlockOutlined,
|
||||
PlusSquareOutlined
|
||||
} from '@ant-design/icons'
|
||||
import { Button, Popconfirm, Spin, Table, message } from 'antd'
|
||||
import { Button, Popconfirm, Spin, Table, message, Tooltip } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import { useEffect } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
@@ -25,6 +25,8 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
import { UserType } from '@type/user.type.ts'
|
||||
|
||||
import './users-page.scss'
|
||||
import dayjs from 'dayjs'
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
const UsersPage = () => {
|
||||
const { data: allUsers = [], isLoading: isUsersLoading } =
|
||||
@@ -124,7 +126,7 @@ const UsersPage = () => {
|
||||
dataIndex: 'lastSessionCreatedAt',
|
||||
key: 'lastSessionCreatedAt',
|
||||
render: (value: string) =>
|
||||
value ? new Date(value).toLocaleDateString() : ''
|
||||
value ? dayjs(value).format(dateFormats.fullFormat) : ''
|
||||
},
|
||||
{
|
||||
dataIndex: 'actions',
|
||||
@@ -136,40 +138,51 @@ const UsersPage = () => {
|
||||
return (
|
||||
<div className="users-page__content__table__actions">
|
||||
<CanEdit>
|
||||
<Popconfirm
|
||||
title={blockTitle}
|
||||
onConfirm={() => handleBlockUser(record.id)}
|
||||
>
|
||||
<Button
|
||||
data-cy={`users-page__content__table__actions__lock-btn ${record.id}`}
|
||||
className="users-page__content__table__actions__lock-btn"
|
||||
type="primary"
|
||||
danger={record.blocked}
|
||||
icon={record.blocked ? <LockOutlined /> : <UnlockOutlined />}
|
||||
/>
|
||||
</Popconfirm>
|
||||
<div
|
||||
data-cy={`users-page__content__table__actions__edit-btn ${record.id}`}
|
||||
className="users-page__content__table__actions__edit-btn"
|
||||
onClick={() => {
|
||||
navigate(`${routePaths.users}/${record.id}`, {
|
||||
state: { ...record }
|
||||
})
|
||||
}}
|
||||
>
|
||||
<EditTwoTone />
|
||||
</div>
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить этого пользователя?"
|
||||
onConfirm={() => handleDeleteUser(record.id)}
|
||||
>
|
||||
<Button
|
||||
data-cy={`users-page__content__table__actions__delete-btn ${record.id}`}
|
||||
className="users-page__content__table__actions__delete-btn"
|
||||
type="primary"
|
||||
icon={<DeleteOutlined />}
|
||||
/>
|
||||
</Popconfirm>
|
||||
<Button.Group className="button_group">
|
||||
<Popconfirm
|
||||
title={blockTitle}
|
||||
onConfirm={() => handleBlockUser(record.id)}
|
||||
>
|
||||
<Tooltip
|
||||
key="LockOutlined"
|
||||
title="Заблокировать пользователя"
|
||||
>
|
||||
<Button
|
||||
data-cy={`users-page__content__table__actions__lock-btn ${record.id}`}
|
||||
className="users-page__content__table__actions__lock-btn"
|
||||
danger={record.blocked}
|
||||
icon={
|
||||
record.blocked ? <LockOutlined /> : <UnlockOutlined />
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
<Tooltip key="EditOutlined" title="Редактировать пользователя">
|
||||
<Button
|
||||
data-cy={`users-page__content__table__actions__edit-btn ${record.id}`}
|
||||
className="users-page__content__table__actions__edit-btn"
|
||||
icon={<EditOutlined />}
|
||||
onClick={() => {
|
||||
navigate(`${routePaths.users}/${record.id}`, {
|
||||
state: { ...record }
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить этого пользователя?"
|
||||
onConfirm={() => handleDeleteUser(record.id)}
|
||||
>
|
||||
<Tooltip key="DeleteOutlined" title="Удалить пользователя">
|
||||
<Button
|
||||
data-cy={`users-page__content__table__actions__delete-btn ${record.id}`}
|
||||
className="users-page__content__table__actions__delete-btn"
|
||||
icon={<DeleteOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
</Button.Group>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
border: 1px solid $border-color;
|
||||
|
||||
|
||||
.ant-btn-group >.ant-btn:first-child {
|
||||
z-index: 2;
|
||||
}
|
||||
&__header {
|
||||
border-bottom: 1px solid $border-color;
|
||||
padding: 0 3 * $basic-padding;
|
||||
@@ -28,7 +29,7 @@
|
||||
|
||||
&__wrap-table {
|
||||
overflow-x: scroll;
|
||||
height: calc(100vh - 200px);
|
||||
height: calc(100vh - 110px);
|
||||
}
|
||||
|
||||
&__table {
|
||||
@@ -36,30 +37,6 @@
|
||||
justify-content: flex-end;
|
||||
display: flex;
|
||||
gap: $basic-margin;
|
||||
|
||||
&__delete-btn {
|
||||
color: $blue-color;
|
||||
background: $blue-light;
|
||||
}
|
||||
|
||||
&__edit-btn {
|
||||
cursor: pointer;
|
||||
background: $blue-light;
|
||||
padding: 4px 10px;
|
||||
border-radius: 8px;
|
||||
|
||||
&:hover {
|
||||
path:first-child {
|
||||
fill: $blue-color;
|
||||
}
|
||||
|
||||
path:last-child {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
background: $blue-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user