MSP-3423 fix prettier
This commit is contained in:
1 parent
7307827078
commit
eff4590fbc
56 files changed
+803
-733
No files matched your search
@@ -2,7 +2,6 @@ import { TreeProps } from 'antd'
|
||||
|
||||
import { AccessListMethodType, EndpointType } from '@type/accessList.type.ts'
|
||||
|
||||
|
||||
export interface AccessListTreePropsType {
|
||||
searchValue: string
|
||||
defaultAllRoutes: Record<string, EndpointType[]>
|
||||
|
||||
@@ -11,7 +11,6 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './access-list-tree.scss'
|
||||
|
||||
|
||||
const unknownMethodKey = 'неизвестные методы'
|
||||
|
||||
const AccessListTree: FC<AccessListTreePropsType> = ({
|
||||
@@ -53,7 +52,11 @@ const AccessListTree: FC<AccessListTreePropsType> = ({
|
||||
<span className={`${unknown ? 'unknown-label' : ''}`}>
|
||||
{obj.path}
|
||||
{obj.inner ? (
|
||||
<Tag className="access-list-tree__inner-tag" color="processing" bordered={false}>
|
||||
<Tag
|
||||
className="access-list-tree__inner-tag"
|
||||
color="processing"
|
||||
bordered={false}
|
||||
>
|
||||
Внутренний
|
||||
</Tag>
|
||||
) : null}
|
||||
|
||||
@@ -12,134 +12,146 @@ import { Button, Dropdown, message, Popconfirm, Tooltip } from 'antd'
|
||||
import { FC } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import configServiceApi from '@services/configService.ts'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import { ActiveTableActionButtonsPropsType } from './active-table-action-buttons.type.ts'
|
||||
|
||||
import './active-table-action-buttons.scss'
|
||||
import CanEdit from '@components/CanEdit'
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
import configServiceApi from '@services/configService.ts'
|
||||
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
const ActiveTableActionButtons: FC<ActiveTableActionButtonsPropsType> =
|
||||
({
|
||||
isActive,
|
||||
record,
|
||||
handleShowCompareModal,
|
||||
handleShowConfig,
|
||||
handleDeleteConfig,
|
||||
handleMarkConfigActive
|
||||
}) => {
|
||||
const navigate = useNavigate()
|
||||
const [createUpdateConfig] = configServiceApi.useCreateUpdateConfigMutation()
|
||||
const ActiveTableActionButtons: FC<ActiveTableActionButtonsPropsType> = ({
|
||||
isActive,
|
||||
record,
|
||||
handleShowCompareModal,
|
||||
handleShowConfig,
|
||||
handleDeleteConfig,
|
||||
handleMarkConfigActive
|
||||
}) => {
|
||||
const navigate = useNavigate()
|
||||
const [createUpdateConfig] = configServiceApi.useCreateUpdateConfigMutation()
|
||||
|
||||
const navigateToAllVersion = () => navigate(`${record.id}/all_versions`)
|
||||
const navigateToAllVersion = () => navigate(`${record.id}/all_versions`)
|
||||
|
||||
const copyConfig = () => {
|
||||
const newConfig = {
|
||||
name: `${record.name} (copy)`,
|
||||
moduleId: record.moduleId,
|
||||
id: '',
|
||||
version: 0,
|
||||
data: record.data
|
||||
} as ConfigType
|
||||
createUpdateConfig(newConfig)
|
||||
.unwrap()
|
||||
.then(() => message.success('Конфиг успешно скопирован'))
|
||||
.catch(() => message.error('Не удалось скопировать конфиг'))
|
||||
}
|
||||
const copyConfig = () => {
|
||||
const newConfig = {
|
||||
name: `${record.name} (copy)`,
|
||||
moduleId: record.moduleId,
|
||||
id: '',
|
||||
version: 0,
|
||||
data: record.data
|
||||
} as ConfigType
|
||||
createUpdateConfig(newConfig)
|
||||
.unwrap()
|
||||
.then(() => message.success('Конфиг успешно скопирован'))
|
||||
.catch(() => message.error('Не удалось скопировать конфиг'))
|
||||
}
|
||||
|
||||
const renderDropDownNoActive = (record: any) => {
|
||||
return (
|
||||
<div className="dropdown">
|
||||
<Tooltip key="1" title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => handleShowCompareModal(record)}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip key="2" title="Просмотр истории">
|
||||
<Button onClick={navigateToAllVersion} icon={<HistoryOutlined />} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip key="4" title="Копировать конфиг">
|
||||
<Button icon={<CopyOutlined />} onClick={copyConfig} />
|
||||
</Tooltip>
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить выбранный конфиг?"
|
||||
onConfirm={() => handleDeleteConfig(record)}
|
||||
>
|
||||
<Tooltip key="3" title="Удалить конфиг">
|
||||
<Button danger icon={<DeleteOutlined />} />
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderDropDownActive = (record: any) => {
|
||||
return (
|
||||
<div className="dropdown">
|
||||
<Tooltip key="1" title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => handleShowCompareModal(record)}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip key="2" title="Просмотр истории">
|
||||
<Button onClick={navigateToAllVersion} icon={<HistoryOutlined />} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip key="4" title="Копировать конфиг">
|
||||
<Button icon={<CopyOutlined />} onClick={copyConfig} />
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderAdditionalButtons = () => {
|
||||
if (isActive) {
|
||||
return (
|
||||
<Dropdown dropdownRender={() => renderDropDownActive(record)}>
|
||||
<Button icon={<EllipsisOutlined />} />
|
||||
</Dropdown>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<CanEdit>
|
||||
<Tooltip key="3" title="Сделать активной">
|
||||
<Button onClick={() => handleMarkConfigActive(record)} icon={<AlertOutlined />} />
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
<Dropdown dropdownRender={() => renderDropDownNoActive(record)}>
|
||||
<Button icon={<EllipsisOutlined />} />
|
||||
</Dropdown>
|
||||
</>
|
||||
)
|
||||
}
|
||||
const renderDropDownNoActive = (record: any) => {
|
||||
return (
|
||||
<div className="active-configurations-table-actions-field">
|
||||
<Button.Group className="button_group">
|
||||
<Tooltip title="Просмотр">
|
||||
<Button
|
||||
onClick={() => handleShowConfig(record)}
|
||||
icon={<EyeOutlined />}
|
||||
/>
|
||||
<div className="dropdown">
|
||||
<Tooltip key="1" title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => handleShowCompareModal(record)}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip key="2" title="Просмотр истории">
|
||||
<Button onClick={navigateToAllVersion} icon={<HistoryOutlined />} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip key="4" title="Копировать конфиг">
|
||||
<Button icon={<CopyOutlined />} onClick={copyConfig} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip title="Редактировать">
|
||||
<Button onClick={() => {
|
||||
navigate(`/${record.moduleId}/${routePaths.configEditor}/${record.id}`, { state: record })
|
||||
}} icon={<FormOutlined />} />
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить выбранный конфиг?"
|
||||
onConfirm={() => handleDeleteConfig(record)}
|
||||
>
|
||||
<Tooltip key="3" title="Удалить конфиг">
|
||||
<Button danger icon={<DeleteOutlined />} />
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
{renderAdditionalButtons()}
|
||||
</Button.Group>
|
||||
</Popconfirm>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderDropDownActive = (record: any) => {
|
||||
return (
|
||||
<div className="dropdown">
|
||||
<Tooltip key="1" title="Сравнение версий">
|
||||
<Button
|
||||
onClick={() => handleShowCompareModal(record)}
|
||||
icon={<SwapOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip key="2" title="Просмотр истории">
|
||||
<Button onClick={navigateToAllVersion} icon={<HistoryOutlined />} />
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip key="4" title="Копировать конфиг">
|
||||
<Button icon={<CopyOutlined />} onClick={copyConfig} />
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderAdditionalButtons = () => {
|
||||
if (isActive) {
|
||||
return (
|
||||
<Dropdown dropdownRender={() => renderDropDownActive(record)}>
|
||||
<Button icon={<EllipsisOutlined />} />
|
||||
</Dropdown>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<CanEdit>
|
||||
<Tooltip key="3" title="Сделать активной">
|
||||
<Button
|
||||
onClick={() => handleMarkConfigActive(record)}
|
||||
icon={<AlertOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
<Dropdown dropdownRender={() => renderDropDownNoActive(record)}>
|
||||
<Button icon={<EllipsisOutlined />} />
|
||||
</Dropdown>
|
||||
</>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div className="active-configurations-table-actions-field">
|
||||
<Button.Group className="button_group">
|
||||
<Tooltip title="Просмотр">
|
||||
<Button
|
||||
onClick={() => handleShowConfig(record)}
|
||||
icon={<EyeOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
<CanEdit>
|
||||
<Tooltip title="Редактировать">
|
||||
<Button
|
||||
onClick={() => {
|
||||
navigate(
|
||||
`/${record.moduleId}/${routePaths.configEditor}/${record.id}`,
|
||||
{ state: record }
|
||||
)
|
||||
}}
|
||||
icon={<FormOutlined />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</CanEdit>
|
||||
{renderAdditionalButtons()}
|
||||
</Button.Group>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ActiveTableActionButtons
|
||||
@@ -3,12 +3,14 @@ import { FC } from 'react'
|
||||
|
||||
import { ListItemProps } from '@widgets/ListItem/list-item.type.ts'
|
||||
|
||||
|
||||
const ListItem: FC<ListItemProps> = ({ item }) => {
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta title={item.name} description={<span>id: {item.id}</span>} />
|
||||
<List.Item.Meta
|
||||
title={item.name}
|
||||
description={<span>id: {item.id}</span>}
|
||||
/>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
|
||||
@@ -6,7 +6,6 @@ import { ModalPropsType } from '@widgets/Modal/modal.type.ts'
|
||||
|
||||
import './modal.scss'
|
||||
|
||||
|
||||
const Modal = ({
|
||||
open,
|
||||
onOk = () => {},
|
||||
@@ -50,7 +49,7 @@ const Modal = ({
|
||||
<div className="modal__content">{children}</div>
|
||||
{footer && (
|
||||
<div className="modal__footer">
|
||||
<Button type="default" onClick={closeModal} >
|
||||
<Button type="default" onClick={closeModal}>
|
||||
{footer.onCanselText}
|
||||
</Button>
|
||||
<Button type="primary" onClick={onOk} loading={loading}>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Outlet } from 'react-router-dom'
|
||||
|
||||
import { ModuleTabContentPropsType } from '@widgets/ModuleTabContent/module-tab-content.type.ts'
|
||||
|
||||
|
||||
const { EmptyData, NoData } = Layout
|
||||
|
||||
const ModuleTabContent = ({
|
||||
|
||||
@@ -5,13 +5,10 @@ import { PermissionListProps } from './permisiion-list.type.ts'
|
||||
|
||||
import './permission-list.scss'
|
||||
|
||||
|
||||
const PermissionList: FC<PermissionListProps> = ({ permissions }) => {
|
||||
return (
|
||||
<Descriptions layout="vertical" className="permission-list">
|
||||
<Descriptions.Item
|
||||
label="Список разрешений"
|
||||
>
|
||||
<Descriptions.Item label="Список разрешений">
|
||||
<ul>
|
||||
{permissions.map((permission, index) => {
|
||||
return <li key={`${permission}-${index}`}>{permission}</li>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export type PermissionListProps = {
|
||||
permissions:string[];
|
||||
permissions: string[]
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import { AccessListMethodType } from '@type/accessList.type.ts'
|
||||
|
||||
import './selected-access-method.scss'
|
||||
|
||||
|
||||
const SelectedAccessMethod: FC<SelectedAccessMethodPropsType> = ({
|
||||
unknownMethodKey,
|
||||
allRoutes,
|
||||
@@ -20,8 +19,10 @@ const SelectedAccessMethod: FC<SelectedAccessMethodPropsType> = ({
|
||||
const renderMethodList = () => {
|
||||
const knownMethods: AccessListMethodType[] = []
|
||||
const unknownMethods: AccessListMethodType[] = []
|
||||
const sortAlphabetically = (a: AccessListMethodType, b: AccessListMethodType) =>
|
||||
a.method.localeCompare(b.method)
|
||||
const sortAlphabetically = (
|
||||
a: AccessListMethodType,
|
||||
b: AccessListMethodType
|
||||
) => a.method.localeCompare(b.method)
|
||||
methods.forEach((method) => {
|
||||
const isUnknown = checkIsUnknownMethod(method.method)
|
||||
if (isUnknown) {
|
||||
|
||||
Reference in new issue
Block a user