Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/base/src/__snapshots__/App.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ exports[`App render App when "checkPageAction" is false 1`] = `
<div
class="ant-space-item"
>
SQLE操作记录
操作记录
</div>
</div>
</button>
Expand Down Expand Up @@ -2231,7 +2231,7 @@ exports[`App render App when token is existed 1`] = `
<div
class="ant-space-item"
>
SQLE操作记录
操作记录
</div>
</div>
</button>
Expand Down
2 changes: 1 addition & 1 deletion packages/base/src/locale/zh-CN/dmsHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
action_1_0: '授权审计',
action_1_1: '权限模板审计',
action_1_2: '数据源操作审计',
action_1_3: 'SQLE操作记录'
action_1_3: '操作记录'
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/base/src/locale/zh-CN/dmsMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
authAudit: '授权审计',
templateAudit: '权限模板审计',
instanceAudit: '数据源操作审计',
SQLEOperateRecord: 'SQLE操作记录',
SQLEOperateRecord: '操作记录',
inspectionAndDiagnosis: '巡检与诊断',
SQLWorkbench: 'SQL工作台',
ruleTemplate: '审核规则模板',
Expand Down Expand Up @@ -68,6 +68,7 @@ export default {
viewRule: '查看规则',
ruleManage: '规则管理',
system: '系统设置',
globalOperationRecord: '全局操作记录',
changeTheme: '模式切换',
instanceManager: '数据源管理',
knowledge: '知识库'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ exports[`test base/home/CEDefaultScene should match snapshot when role is admin
<div
class="ant-space-item"
>
SQLE操作记录
操作记录
</div>
</div>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ exports[`test base/home/DefaultScene should match snapshot when role is admin 1`
<div
class="ant-space-item"
>
SQLE操作记录
操作记录
</div>
</div>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ exports[`test base/Home/StepItems should match snapshot 1`] = `
<div
class="ant-space-item"
>
SQLE操作记录
操作记录
</div>
</div>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('test base/Home/StepItems', () => {
`/sqle/project/${projectID}/exec-workflow/create`
);

fireEvent.click(screen.getByText('SQLE操作记录'));
fireEvent.click(screen.getByText('操作记录'));
expect(navigateSpy).toHaveBeenCalledTimes(13);
expect(navigateSpy).toHaveBeenNthCalledWith(
13,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ exports[`test base/page/Home should match snapshot 1`] = `
<div
class="ant-space-item"
>
SQLE操作记录
操作记录
</div>
</div>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ exports[`test base/page/Home should match snapshot 1`] = `
<div
class="ant-space-item"
>
SQLE操作记录
操作记录
</div>
</div>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ exports[`test genMenuItemsWithMenuStructTree should match snapshot 4`] = `
"label": <ForwardRef(TypedLink)
to="/sqle/project/600300/operation-record"
>
SQLE操作记录
操作记录
</ForwardRef(TypedLink)>,
"permission": "page:operation_record",
"structKey": "sqle-log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
UserShieldFilled,
CenterCircleHexagonFilled,
DatabaseFilled,
ProfileEditFilled
ProfileEditFilled,
OperateAuditFilled
} from '@actiontech/icons';
import { ContextMenuItem } from './ContextMenu/index.type';
import ContextMenu from './ContextMenu';
Expand All @@ -16,6 +17,7 @@ import {
usePermission
} from '@actiontech/shared/lib/features';
import { useTypedNavigate } from '@actiontech/shared';
import { ROUTE_PATHS } from '@actiontech/dms-kit';

const GlobalSetting: React.FC = () => {
const { t } = useTranslation();
Expand All @@ -37,30 +39,40 @@ const GlobalSetting: React.FC = () => {
key: 'user-center',
icon: <UserShieldFilled />,
text: t('menu.userCenter'),
onClick: () => handleClickItem('/user-center'),
onClick: () => handleClickItem(ROUTE_PATHS.BASE.USER_CENTER),
permission: PERMISSIONS.PAGES.BASE.USER_CENTER
},
{
key: 'data-source-management',
icon: <DatabaseFilled />,
text: t('dmsMenu.globalSettings.instanceManager'),
onClick: () => handleClickItem(`/data-source-management`),
onClick: () =>
handleClickItem(ROUTE_PATHS.BASE.DATA_SOURCE_MANAGEMENT.index.path),
permission: PERMISSIONS.PAGES.BASE.DATA_SOURCE_MANAGEMENT
},
// #if [sqle]
{
key: 'rule-manager',
icon: <ProfileEditFilled />,
text: t('dmsMenu.globalSettings.ruleManage'),
onClick: () => handleClickItem('/sqle/rule-manager'),
onClick: () =>
handleClickItem(ROUTE_PATHS.SQLE.RULE_MANAGEMENT.index.path),
permission: PERMISSIONS.PAGES.SQLE.RULE_MANAGEMENT
},
// #endif
{
key: 'operationRecord',
icon: <OperateAuditFilled />,
text: t('dmsMenu.globalSettings.globalOperationRecord'),
onClick: () =>
handleClickItem(ROUTE_PATHS.SQLE.GLOBAL_OPERATION_LOG.index),
permission: PERMISSIONS.PAGES.SQLE.GLOBAL_OPERATION_RECORD
},
{
key: 'system',
icon: <GearFilled />,
text: t('dmsMenu.globalSettings.system'),
onClick: () => handleClickItem('/system'),
onClick: () => handleClickItem(ROUTE_PATHS.BASE.SYSTEM.index.path),
permission: PERMISSIONS.PAGES.BASE.SYSTEM_SETTING
}
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('base/page/Nav/SideMenu/GlobalSetting', () => {
await act(async () => jest.advanceTimersByTime(500));
expect(baseElement).toMatchSnapshot();

expect(getAllBySelector('.content-item-text').length).toBe(4);
expect(getAllBySelector('.content-item-text').length).toBe(5);

fireEvent.click(screen.getByText('用户中心'));
expect(navigateSpy).toHaveBeenNthCalledWith(1, '/user-center');
Expand All @@ -68,5 +68,8 @@ describe('base/page/Nav/SideMenu/GlobalSetting', () => {

fireEvent.click(screen.getByText('系统设置'));
expect(navigateSpy).toHaveBeenNthCalledWith(4, '/system');

fireEvent.click(screen.getByText('全局操作记录'));
expect(navigateSpy).toHaveBeenNthCalledWith(5, '/operation-record');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,30 @@ exports[`base/page/Nav/SideMenu/GlobalSetting render snap when is "checkPagePerm
规则管理
</div>
</div>
<div
class="content-item"
>
<svg
height="16"
viewBox="0 0 18 18"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M3 1.5h11.25a.75.75 0 0 1 .75.75v6a3.75 3.75 0 0 0-6 3c.007.517.119 1.028.33 1.5A2.25 2.25 0 0 0 7.5 15v1.5H3a.75.75 0 0 1-.75-.75V2.25A.75.75 0 0 1 3 1.5M6 9h2.25V7.5H6zm0-3h5.25V4.5H6z"
fill="#C3C6CD"
/>
<path
d="M11.298 9.529A2.25 2.25 0 0 1 12.75 9a2.25 2.25 0 0 1 .75 4.373v.877h2.25a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-.75.75h-6A.75.75 0 0 1 9 16.5V15a.75.75 0 0 1 .75-.75H12v-.877a2.25 2.25 0 0 1-.702-3.844m.828 1.304a.75.75 0 1 0 1.248.834.75.75 0 0 0-1.248-.834"
fill="#8A8F99"
/>
</svg>
<div
class="content-item-text"
>
全局操作记录
</div>
</div>
<div
class="content-item"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ exports[`base/router-base-ee render base route data snap 1`] = `
"key": "globalDashboard",
"path": "/sqle/global-dashboard",
},
{
"element": <div>
globalOperationRecord
</div>,
"key": "globalOperationRecord",
"path": "/operation-record",
},
{
"children": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ exports[`base/router-base-ce render base route data snap 1`] = `
"key": "globalDashboard",
"path": "/sqle/global-dashboard",
},
{
"element": <div>
globalOperationRecord
</div>,
"key": "globalOperationRecord",
"path": "/operation-record",
},
{
"children": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ exports[`base/router-sqle-ce render sqle project detail router render sqle proje
</body>
`;

exports[`base/router-sqle-ce render sqle project detail router render sqle project detail router when version is ce render operationRecord 2`] = `
<body>
<div>
<div>
globalOperationRecord
</div>
</div>
</body>
`;

exports[`base/router-sqle-ce render sqle project detail router render sqle project detail router when version is ce render route dashboard 1`] = `
<body>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,20 @@ exports[`base/router-sqle-ee render sqle project detail router render sqle proje
</body>
`;

exports[`base/router-sqle-ee render sqle project detail router render sqle project detail router when version is ce render global operationRecord 1`] = `
<body>
<div>
<div
data-test-parent-id="availabilityZoneWrapper"
>
<div>
globalOperationRecord
</div>
</div>
</div>
</body>
`;

exports[`base/router-sqle-ee render sqle project detail router render sqle project detail router when version is ce render operationRecord 1`] = `
<body>
<div>
Expand Down
7 changes: 7 additions & 0 deletions packages/base/src/router/test/router.ce.sqle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,13 @@ describe('base/router-sqle-ce', () => {
expect(screen.getByText('operationRecord')).toBeInTheDocument();
});

it('render operationRecord', () => {
const { baseElement } = customRender([`/operation-record`]);

expect(baseElement).toMatchSnapshot();
expect(screen.getByText('globalOperationRecord')).toBeInTheDocument();
});

describe('render route sqlManagement', () => {
it('render sqlManagement', async () => {
const { baseElement } = customRender([
Expand Down
7 changes: 7 additions & 0 deletions packages/base/src/router/test/router.sqle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,13 @@ describe('base/router-sqle-ee', () => {
expect(screen.getByText('operationRecord')).toBeInTheDocument();
});

it('render global operationRecord', () => {
const { baseElement } = customRender([`/operation-record`]);

expect(baseElement).toMatchSnapshot();
expect(screen.getByText('globalOperationRecord')).toBeInTheDocument();
});

describe('render route sqlManagement', () => {
it('render sqlManagement', async () => {
const { baseElement } = customRender([
Expand Down
6 changes: 5 additions & 1 deletion packages/dms-kit/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ nav:

## 1.0.5

- 修复BasicButton样式
- 修复BasicButton样式

## 1.0.6

- 添加全局操作记录path
2 changes: 1 addition & 1 deletion packages/dms-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@actiontech/dms-kit",
"version": "1.0.5",
"version": "1.0.6",
"description": "DMS Kit - React UI Components Library",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
3 changes: 3 additions & 0 deletions packages/dms-kit/src/data/routePaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ export const ROUTE_PATHS = {
path: ':projectID/operation-record'
}
},
GLOBAL_OPERATION_LOG: {
index: '/operation-record'
},
PLUGIN_AUDIT: {
index: {
prefix: '/sqle/project',
Expand Down
1 change: 1 addition & 0 deletions packages/shared/lib/api/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export { default as MemberGroupService } from './service/MemberGroup';
export { default as NotificationService } from './service/Notification';
export { default as OAuth2Service } from './service/OAuth2';
export { default as OpPermissionService } from './service/OpPermission';
export { default as OperationRecordService } from './service/OperationRecord';
export { default as ProjectService } from './service/Project';
export { default as ResourceOverviewService } from './service/ResourceOverview';
export { default as RoleService } from './service/Role';
Expand Down
44 changes: 44 additions & 0 deletions packages/shared/lib/api/base/service/OperationRecord/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {
IGetOperationRecordListReply,
IAddOperationRecordReq,
IAddOperationRecordReply
} from '../common.d';

export interface IGetOperationRecordListParams {
filter_operate_time_from?: string;

filter_operate_time_to?: string;

filter_operate_project_name?: string;

fuzzy_search_operate_user_name?: string;

filter_operate_type_name?: string;

filter_operate_action?: string;

page_index: number;

page_size: number;
}

export interface IGetOperationRecordListReturn
extends IGetOperationRecordListReply {}

export interface IAddOperationRecordParams extends IAddOperationRecordReq {}

export interface IAddOperationRecordReturn extends IAddOperationRecordReply {}

export interface IExportOperationRecordListParams {
filter_operate_time_from?: string;

filter_operate_time_to?: string;

filter_operate_project_name?: string;

fuzzy_search_operate_user_name?: string;

filter_operate_type_name?: string;

filter_operate_action?: string;
}
Loading