2024-05-13 14:16:16: merge [main:4f88d86ea2ec3d29ae7282a24b25fd132eb9406e];
This commit is contained in:
1 parent
739a9a3a4b
commit
98ad434b36
24 files changed
+141
-98
No files matched your search
@@ -1,3 +1,5 @@
|
||||
## 0.11.1
|
||||
- Проверка на пермишены заменена на компонент CanEdit
|
||||
## 0.11.0
|
||||
- Добавлена страница Конфигураций
|
||||
- Добавлена страница сравнения версий
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"version": "0.11.0",
|
||||
"version": "0.11.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "isp-admin-ui",
|
||||
"version": "0.11.0",
|
||||
"version": "0.11.1",
|
||||
"dependencies": {
|
||||
"@codemirror/lang-json": "^6.0.1",
|
||||
"@reduxjs/toolkit": "^2.2.3",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"private": true,
|
||||
"version": "0.11.0",
|
||||
"version": "0.11.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
width: 100%;
|
||||
min-width: 760px;
|
||||
|
||||
padding: $basic-padding * 2;
|
||||
padding: $basic-padding * 1.8;
|
||||
border: 1px solid $border-color;
|
||||
|
||||
&__header {
|
||||
|
||||
@@ -22,7 +22,6 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './app-access-content.scss'
|
||||
|
||||
|
||||
const unknownMethodKey = 'неизвестные методы'
|
||||
|
||||
const AppAccessContent: FC<AppAccessContentPropsType> = ({
|
||||
@@ -31,7 +30,7 @@ const AppAccessContent: FC<AppAccessContentPropsType> = ({
|
||||
}) => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const { hasPermission } = useRole()
|
||||
|
||||
|
||||
const canWrite = hasPermission(PermissionKeysType.write)
|
||||
|
||||
const {
|
||||
@@ -171,7 +170,8 @@ const AppAccessContent: FC<AppAccessContentPropsType> = ({
|
||||
onChange={onChange}
|
||||
/>
|
||||
<div className="app-access-content__header__action-buttons">
|
||||
<Button disabled={!canWrite}
|
||||
<Button
|
||||
disabled={!canWrite}
|
||||
onClick={() => {
|
||||
setAllMethods(false)
|
||||
}}
|
||||
|
||||
@@ -1,27 +1,39 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.applications-content {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-columns:250px 1fr;
|
||||
width: 100%;
|
||||
|
||||
.column-content {
|
||||
margin-left: $basic-margin;
|
||||
}
|
||||
|
||||
&__add-btn {
|
||||
display: flex;
|
||||
max-width: 240px;
|
||||
margin-left: auto;
|
||||
margin-bottom: $basic-margin * 2;
|
||||
}
|
||||
|
||||
&__update-btn {
|
||||
margin-right: $basic-margin;
|
||||
}
|
||||
|
||||
&__addToken-btn {
|
||||
display: flex;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.link-btn {
|
||||
color: $blue-color;
|
||||
|
||||
&:hover {
|
||||
color: $text-color-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
.column {
|
||||
border-left: 0;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import { routePaths } from '@routes/routePaths.ts'
|
||||
import './applications-content.scss'
|
||||
|
||||
const { FormInput } = FormComponents
|
||||
const { EmptyData, Column, ContentColumn } = Layout
|
||||
const { EmptyData, Column } = Layout
|
||||
|
||||
interface ApplicationsContentPropTypes {
|
||||
selectedItemId: number
|
||||
@@ -39,7 +39,6 @@ interface ApplicationsContentPropTypes {
|
||||
|
||||
const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
selectedItemId,
|
||||
currentApplicationsApp,
|
||||
setCurrentApplicationsApp
|
||||
}) => {
|
||||
const { data: applications, isLoading: isLoadingApplicationsContent = [] } =
|
||||
@@ -60,7 +59,7 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
const [searchParams, setSearchParams] = useSearchParams('')
|
||||
const searchAppValue = searchParams.get('appSearch') || ''
|
||||
const navigate = useNavigate()
|
||||
const { appId } = useParams()
|
||||
const { appId = '' } = useParams()
|
||||
|
||||
const {
|
||||
handleSubmit,
|
||||
@@ -82,13 +81,11 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
})
|
||||
}
|
||||
const renderTokenContent = () => {
|
||||
if (!currentApplicationsApp) {
|
||||
if (!appId) {
|
||||
return <EmptyData />
|
||||
}
|
||||
|
||||
return (
|
||||
<TokenContent key={currentApplicationsApp} id={currentApplicationsApp} />
|
||||
)
|
||||
return <TokenContent key={appId} id={Number(appId)} />
|
||||
}
|
||||
|
||||
const handleUpdateApplicationApp = (data: UpdateApplicationAppType) => {
|
||||
@@ -186,7 +183,7 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
)}
|
||||
renderItems={renderColumnItems}
|
||||
searchValue={searchAppValue}
|
||||
selectedItemId={currentApplicationsApp.toString()}
|
||||
selectedItemId={appId}
|
||||
setSelectedItemId={(itemId: string) => {
|
||||
setCurrentApplicationsApp(Number(itemId))
|
||||
setSelectedItemId(
|
||||
@@ -204,7 +201,7 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<ContentColumn>{renderTokenContent()}</ContentColumn>
|
||||
{renderTokenContent()}
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmit(handleUpdateApplicationApp)}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
ProfileOutlined
|
||||
} from '@ant-design/icons'
|
||||
import { ConfigProvider, Layout, Menu, Spin } from 'antd'
|
||||
import type { MenuProps } from 'antd'
|
||||
import { useContext, useEffect, useState } from 'react'
|
||||
import { Navigate, Outlet, useLocation, useNavigate } from 'react-router-dom'
|
||||
|
||||
@@ -166,7 +167,7 @@ const LayoutComponent = () => {
|
||||
}
|
||||
}, [location])
|
||||
|
||||
const handlerOnClickMenu = ({ key }: any): void => {
|
||||
const handlerOnClickMenu: MenuProps['onClick'] = ({ key }): void => {
|
||||
switch (key) {
|
||||
case MenuItemKeysType.logout: {
|
||||
logoutUser()
|
||||
|
||||
@@ -93,7 +93,7 @@ const RolesContent = ({
|
||||
dataSource={permissions}
|
||||
pagination={{ pageSize: 10 }}
|
||||
scroll={{
|
||||
y: 'calc(100vh - 450px)',
|
||||
y: 'calc(100vh - 500px)',
|
||||
}}
|
||||
rowSelection={{
|
||||
selectedRowKeys: value,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@import "../../constants/style/styleConst";
|
||||
|
||||
.roles-content {
|
||||
padding: $basic-padding*3;
|
||||
padding: $basic-padding*2 $basic-padding*3;
|
||||
min-width: 400px;
|
||||
|
||||
&__header {
|
||||
|
||||
@@ -219,41 +219,45 @@ const TokenContent = ({ id }: TokenPropTypes) => {
|
||||
|
||||
return (
|
||||
<section className="token-content">
|
||||
<CanEdit>
|
||||
<Button
|
||||
className="applications-content__add-btn"
|
||||
type="primary"
|
||||
onClick={handleShowAddModalToken}
|
||||
>
|
||||
Добавить токен
|
||||
</Button>
|
||||
</CanEdit>
|
||||
|
||||
<Table
|
||||
className="appliactions-tokent__table"
|
||||
rowKey={(record) => record.createdAt}
|
||||
pagination={false}
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmitTokens(handleCreateToken)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() => setShowApplicationsModal(false)}
|
||||
>
|
||||
<form>
|
||||
<FormSelect
|
||||
options={tokensOptions}
|
||||
name="expireTime"
|
||||
control={controlTokens}
|
||||
label="Время действия"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
<div className="token-content__wrap">
|
||||
<header className="token-content__header">
|
||||
<CanEdit>
|
||||
<Button
|
||||
className="applications-content__add-btn"
|
||||
type="primary"
|
||||
onClick={handleShowAddModalToken}
|
||||
>
|
||||
Добавить токен
|
||||
</Button>
|
||||
</CanEdit>
|
||||
</header>
|
||||
<div className="token-content__table">
|
||||
<Table
|
||||
className="appliactions-tokent__table"
|
||||
rowKey={(record) => record.createdAt}
|
||||
pagination={false}
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
</div>
|
||||
<Modal
|
||||
onOk={handleSubmitTokens(handleCreateToken)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() => setShowApplicationsModal(false)}
|
||||
>
|
||||
<form>
|
||||
<FormSelect
|
||||
options={tokensOptions}
|
||||
name="expireTime"
|
||||
control={controlTokens}
|
||||
label="Время действия"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.token-content {
|
||||
padding: $basic-padding *2 $basic-padding;
|
||||
overflow-x: scroll;
|
||||
width: 100%;
|
||||
|
||||
&__wrap {
|
||||
padding: $basic-padding*2 $basic-padding*3;
|
||||
min-width: 700px;
|
||||
}
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@ $grey: #606060;
|
||||
$border-color: #d9d9d9;
|
||||
$error-red: #cf1322;
|
||||
|
||||
$border-color: #F0F0F0;
|
||||
|
||||
$blue-color: #40A9FF;
|
||||
$blue-light: #E6F7FF;
|
||||
$text-color-blue: #1890FF;
|
||||
|
||||
@@ -1,16 +1,31 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.applications-page {
|
||||
height: 100vh;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
background: #fff;
|
||||
|
||||
&__list {
|
||||
.ant-list-item {
|
||||
flex-direction: column;
|
||||
align-items: self-start;
|
||||
|
||||
.applications-page__list__desc {
|
||||
width: auto !important;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.column-content {
|
||||
max-height: 100vh;
|
||||
}
|
||||
|
||||
.three-columns {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
box-shadow: inset -1px 0px 0px $border-color;
|
||||
|
||||
height: 100%;
|
||||
|
||||
.column__header {
|
||||
padding: $basic-padding * 2 $basic-padding;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { message, Spin } from 'antd'
|
||||
import { List, message, Spin } from 'antd'
|
||||
import { Layout, FormComponents } from 'isp-ui-kit'
|
||||
import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
||||
import { useEffect, useState } from 'react'
|
||||
@@ -7,7 +7,6 @@ import { useNavigate, useParams, useSearchParams } from 'react-router-dom'
|
||||
|
||||
import { ValidationRules } from '@constants/form/validationRules.ts'
|
||||
|
||||
import ListItem from '@widgets/ListItem'
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import ApplicationsContent from '@components/ApplicationsContent'
|
||||
@@ -31,7 +30,7 @@ import { PermissionKeysType } from '@type/roles.type.ts'
|
||||
|
||||
import './applications-page.scss'
|
||||
|
||||
const { Column, ContentColumn, EmptyData } = Layout
|
||||
const { Column, EmptyData } = Layout
|
||||
const { FormInput } = FormComponents
|
||||
|
||||
const ApplicationsPage = () => {
|
||||
@@ -81,7 +80,18 @@ const ApplicationsPage = () => {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
|
||||
const renderColumnItems = (item: ColumnItem<any>) => <ListItem item={item} />
|
||||
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>
|
||||
)
|
||||
}
|
||||
|
||||
const addApplicationModal = () => {
|
||||
setShowApplicationsModal({
|
||||
@@ -152,8 +162,7 @@ const ApplicationsPage = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="applications-page">
|
||||
<div className="applications-page__wrap three-columns">
|
||||
<main className="applications-page three-columns">
|
||||
<Column
|
||||
title="Группа приложений"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
@@ -180,8 +189,7 @@ const ApplicationsPage = () => {
|
||||
setSearchValue(value, setSearchParams)
|
||||
}
|
||||
/>
|
||||
|
||||
<ContentColumn>{renderMainContent()}</ContentColumn>
|
||||
{renderMainContent()}
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmit(handleAddApplicationGroup)}
|
||||
@@ -228,7 +236,6 @@ const ApplicationsPage = () => {
|
||||
<FormInput control={control} label="Описание" name="description" />
|
||||
</form>
|
||||
</Modal>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
height: calc(100vh - 150px);
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
min-width: 700px;
|
||||
|
||||
&__buttons {
|
||||
display: flex;
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
.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);
|
||||
height: calc(100vh - 150px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ const LoginPage = () => {
|
||||
navigate(redirectUrl, { replace: true })
|
||||
localStorage.removeItem('redirectUrl')
|
||||
})
|
||||
.catch((err: any) => handleError(err))
|
||||
.catch((err: AxiosError<MSPError>) => handleError(err))
|
||||
}
|
||||
|
||||
const renderInternalAuthForm = () => {
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
height: 100%;
|
||||
|
||||
&__tabs {
|
||||
padding: $basic-padding*3 $basic-padding*2;
|
||||
padding: 0 $basic-padding*2 $basic-padding*2;
|
||||
width: 100%;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
.ant-list-item {
|
||||
padding-bottom: 20px;
|
||||
|
||||
}
|
||||
|
||||
.ant-tag {
|
||||
@@ -57,11 +56,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&__content {
|
||||
overflow-x: scroll;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.column .column__items__item span {
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
|
||||
.three-columns {
|
||||
@@ -122,7 +124,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.column .column__items__item span {
|
||||
width: fit-content;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ const RolesPage = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleRemoveRole = (id: any) => {
|
||||
const handleRemoveRole = (id: string) => {
|
||||
const idAsNumber = parseInt(id, 10)
|
||||
removeRole(idAsNumber)
|
||||
.unwrap()
|
||||
@@ -170,6 +170,7 @@ const RolesPage = () => {
|
||||
return (
|
||||
<section className="roles-page three-columns">
|
||||
<Column
|
||||
showUpdateBtn={false}
|
||||
items={filterFirstColumnItems(data, searchValue)}
|
||||
showAddBtn={isAddRolePermissions}
|
||||
showRemoveBtn={isRemoveRolePermissions}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
&__wrap-table {
|
||||
overflow-x: scroll;
|
||||
height: calc(100vh - 200px);
|
||||
height: calc(100vh - 250px);
|
||||
}
|
||||
|
||||
&__pagination {
|
||||
|
||||
@@ -6,6 +6,8 @@ import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { SessionStatusKeysType, sessionStatuses } from '@constants/statuses'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil'
|
||||
|
||||
import useRole from '@hooks/useRole'
|
||||
@@ -36,7 +38,6 @@ const SessionsPage = () => {
|
||||
const isLoading = isUsersLoading || isLoadingSession
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
const hasRevokePermission = hasPermission(PermissionKeysType.write)
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPageAvailable) {
|
||||
@@ -115,7 +116,7 @@ const SessionsPage = () => {
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{hasRevokePermission && (
|
||||
<CanEdit>
|
||||
<Popconfirm
|
||||
title="Закончить эту сессию?"
|
||||
onConfirm={() => handleRevokeSessions(record.id)}
|
||||
@@ -127,7 +128,7 @@ const SessionsPage = () => {
|
||||
icon={<LogoutOutlined />}
|
||||
/>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</CanEdit>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
&__wrap-table {
|
||||
overflow-x: scroll;
|
||||
height: calc(100vh - 200px);
|
||||
height: calc(100vh - 250px);
|
||||
}
|
||||
|
||||
&__table {
|
||||
|
||||
@@ -10,6 +10,8 @@ import { ColumnsType } from 'antd/es/table'
|
||||
import { useEffect } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
import { getUserFullName } from '@utils/userUtils/getFullNameUtil.ts'
|
||||
|
||||
import useRole from '@hooks/useRole.tsx'
|
||||
@@ -37,9 +39,6 @@ const UsersPage = () => {
|
||||
const isLoading = isRolesLoading || isUsersLoading
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
const hasBlockUserPermission = hasPermission(PermissionKeysType.write)
|
||||
const hasDeleteUserPermission = hasPermission(PermissionKeysType.write)
|
||||
const hasUpdateUserPermission = hasPermission(PermissionKeysType.write)
|
||||
const hasCreateUserPermission = hasPermission(PermissionKeysType.write)
|
||||
|
||||
useEffect(() => {
|
||||
@@ -106,7 +105,7 @@ const UsersPage = () => {
|
||||
dataIndex: 'roles',
|
||||
key: 'roles',
|
||||
render: (values: number[]) => {
|
||||
const labels: any[] = []
|
||||
const labels: string[] = []
|
||||
values.forEach((value: number) => {
|
||||
const roleLabel = roles?.find((el) => el.id === value)
|
||||
if (roleLabel) {
|
||||
@@ -136,7 +135,7 @@ const UsersPage = () => {
|
||||
: 'Вы действительно хотите заблокировать этого пользователя?'
|
||||
return (
|
||||
<div className="users-page__content__table__actions">
|
||||
{hasBlockUserPermission && (
|
||||
<CanEdit>
|
||||
<Popconfirm
|
||||
title={blockTitle}
|
||||
onConfirm={() => handleBlockUser(record.id)}
|
||||
@@ -149,8 +148,6 @@ const UsersPage = () => {
|
||||
icon={record.blocked ? <LockOutlined /> : <UnlockOutlined />}
|
||||
/>
|
||||
</Popconfirm>
|
||||
)}
|
||||
{hasUpdateUserPermission && (
|
||||
<div
|
||||
data-cy={`users-page__content__table__actions__edit-btn ${record.id}`}
|
||||
className="users-page__content__table__actions__edit-btn"
|
||||
@@ -162,9 +159,6 @@ const UsersPage = () => {
|
||||
>
|
||||
<EditTwoTone />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{hasDeleteUserPermission && (
|
||||
<Popconfirm
|
||||
title="Вы действительно хотите удалить этого пользователя?"
|
||||
onConfirm={() => handleDeleteUser(record.id)}
|
||||
@@ -176,7 +170,7 @@ const UsersPage = () => {
|
||||
icon={<DeleteOutlined />}
|
||||
/>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</CanEdit>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user