From 725edf26ca8f22c4464794c29368765fdf682beb Mon Sep 17 00:00:00 2001
From: actiontech-zihan
Date: Thu, 11 Jun 2026 07:10:00 +0000
Subject: [PATCH] feat(operation-record): enhance global and project filter UI
Add metadata hooks, filter bar wiring, paramsSerializer, and action labels with type suffix.
Refs actiontech/dms-ee#880
---
.../base/service/OperationRecord/index.d.ts | 42 +-
.../api/base/service/OperationRecord/index.ts | 44 +-
.../shared/lib/api/base/service/common.d.ts | 547 +---
.../sqle/service/OperationRecord/index.d.ts | 64 +-
.../mockApi/sqle/operationRecord/index.ts | 57 +
.../src/hooks/useOperationActions/index.tsx | 115 +
.../src/hooks/useOperationTypeName/index.tsx | 76 +
.../src/hooks/useOperationUserNames/index.tsx | 67 +
.../sqle/src/locale/en-US/operationRecord.ts | 5 +-
.../sqle/src/locale/zh-CN/operationRecord.ts | 4 +-
.../List/__snapshots__/index.test.tsx.snap | 2447 +++++++++++++----
.../src/page/OperationRecord/List/column.tsx | 163 +-
.../page/OperationRecord/List/index.test.tsx | 130 +-
.../src/page/OperationRecord/List/index.tsx | 261 +-
.../__snapshots__/index.test.tsx.snap | 776 +++++-
.../src/page/OperationRecord/index.test.tsx | 4 +-
16 files changed, 3518 insertions(+), 1284 deletions(-)
create mode 100644 packages/sqle/src/hooks/useOperationActions/index.tsx
create mode 100644 packages/sqle/src/hooks/useOperationTypeName/index.tsx
create mode 100644 packages/sqle/src/hooks/useOperationUserNames/index.tsx
diff --git a/packages/shared/lib/api/base/service/OperationRecord/index.d.ts b/packages/shared/lib/api/base/service/OperationRecord/index.d.ts
index 2a9cb1a236..687d206187 100644
--- a/packages/shared/lib/api/base/service/OperationRecord/index.d.ts
+++ b/packages/shared/lib/api/base/service/OperationRecord/index.d.ts
@@ -1,7 +1,10 @@
import {
IGetOperationRecordListReply,
IAddOperationRecordReq,
- IAddOperationRecordReply
+ IAddOperationRecordReply,
+ IGetOperationTypeNameListReply,
+ IGetOperationActionListReply,
+ IGetOperationUserNameListReply
} from '../common.d';
export interface IGetOperationRecordListParams {
@@ -13,9 +16,15 @@ export interface IGetOperationRecordListParams {
fuzzy_search_operate_user_name?: string;
- filter_operate_type_name?: string;
+ fuzzy_search_operate_content?: string;
- filter_operate_action?: string;
+ filter_fuzzy_operate_user_name?: string;
+
+ filter_operate_type_names?: string[];
+
+ filter_operate_actions?: string[];
+
+ filter_operate_status?: string;
page_index: number;
@@ -38,7 +47,30 @@ export interface IExportOperationRecordListParams {
fuzzy_search_operate_user_name?: string;
- filter_operate_type_name?: string;
+ fuzzy_search_operate_content?: string;
+
+ filter_fuzzy_operate_user_name?: string;
+
+ filter_operate_type_names?: string[];
+
+ filter_operate_actions?: string[];
+
+ filter_operate_status?: string;
+}
+
+export interface IGetOperationTypeNameListParams {}
+
+export interface IGetOperationTypeNameListReturn
+ extends IGetOperationTypeNameListReply {}
+
+export interface IGetOperationActionListParams {}
- filter_operate_action?: string;
+export interface IGetOperationActionListReturn
+ extends IGetOperationActionListReply {}
+
+export interface IGetOperationUserNameListParams {
+ filter_operate_project_name?: string;
}
+
+export interface IGetOperationUserNameListReturn
+ extends IGetOperationUserNameListReply {}
diff --git a/packages/shared/lib/api/base/service/OperationRecord/index.ts b/packages/shared/lib/api/base/service/OperationRecord/index.ts
index d73a17c0d4..4a28b89e8e 100644
--- a/packages/shared/lib/api/base/service/OperationRecord/index.ts
+++ b/packages/shared/lib/api/base/service/OperationRecord/index.ts
@@ -11,7 +11,13 @@ import {
IGetOperationRecordListReturn,
IAddOperationRecordParams,
IAddOperationRecordReturn,
- IExportOperationRecordListParams
+ IExportOperationRecordListParams,
+ IGetOperationTypeNameListParams,
+ IGetOperationTypeNameListReturn,
+ IGetOperationActionListParams,
+ IGetOperationActionListReturn,
+ IGetOperationUserNameListParams,
+ IGetOperationUserNameListReturn
} from './index.d';
class OperationRecordService extends ServiceBase {
@@ -50,6 +56,42 @@ class OperationRecordService extends ServiceBase {
options
);
}
+
+ public GetOperationTypeNameList(
+ params?: IGetOperationTypeNameListParams,
+ options?: AxiosRequestConfig
+ ) {
+ const paramsData = this.cloneDeep(params);
+ return this.get(
+ '/v1/dms/operation_records/operation_type_names',
+ paramsData,
+ options
+ );
+ }
+
+ public GetOperationActionList(
+ params?: IGetOperationActionListParams,
+ options?: AxiosRequestConfig
+ ) {
+ const paramsData = this.cloneDeep(params);
+ return this.get(
+ '/v1/dms/operation_records/operation_actions',
+ paramsData,
+ options
+ );
+ }
+
+ public GetOperationUserNameList(
+ params?: IGetOperationUserNameListParams,
+ options?: AxiosRequestConfig
+ ) {
+ const paramsData = this.cloneDeep(params);
+ return this.get(
+ '/v1/dms/operation_records/operation_user_names',
+ paramsData,
+ options
+ );
+ }
}
export default new OperationRecordService();
diff --git a/packages/shared/lib/api/base/service/common.d.ts b/packages/shared/lib/api/base/service/common.d.ts
index 5d9d120e87..9776559206 100644
--- a/packages/shared/lib/api/base/service/common.d.ts
+++ b/packages/shared/lib/api/base/service/common.d.ts
@@ -1,6 +1,4 @@
import {
- AddSensitiveDataDiscoveryTaskExecutionPlanEnum,
- AddSensitiveDataDiscoveryTaskIdentificationMethodEnum,
DBServiceIsConnectableReplyConnectionStatusEnum,
DMSProxyTargetScenarioEnum,
GetDataExportTaskStatusEnum,
@@ -15,15 +13,9 @@ import {
ListGlobalDBServiceV2LastConnectionTestStatusEnum,
ListMemberRoleWithOpRangeOpRangeTypeEnum,
ListOpPermissionRangeTypeEnum,
- ListOpPermissionServiceEnum,
ListProjectV1ProjectPriorityEnum,
ListProjectV2ProjectPriorityEnum,
ListRoleStatEnum,
- ListSensitiveDataDiscoveryTaskHistoriesDataStatusEnum,
- ListSensitiveDataDiscoveryTasksDataExecutionPlanEnum,
- ListSensitiveDataDiscoveryTasksDataIdentificationMethodEnum,
- ListSensitiveDataDiscoveryTasksDataStatusEnum,
- ListSensitiveDataDiscoveryTasksDataTaskTypeEnum,
ListUserAuthenticationTypeEnum,
ListUserStatEnum,
ListUserSystemEnum,
@@ -33,21 +25,14 @@ import {
OpPermissionItemRangeTypeEnum,
OperationOperationTypeEnum,
OperationRecordListItemStatusEnum,
- ProcessApprovalRequestReqActionEnum,
ProjectInfoProjectPriorityEnum,
ProjectV1ProjectPriorityEnum,
ProjectV2ProjectPriorityEnum,
SQLQueryConfigAllowQueryWhenLessThanAuditLevelEnum,
- SensitiveFieldScanResultConfidenceEnum,
- TableColumnMaskingDetailConfidenceEnum,
- TableColumnMaskingDetailStatusEnum,
TestFeishuConfigurationAccountTypeEnum,
UpdateCurrentUserSystemEnum,
UpdateProjectProjectPriorityEnum,
UpdateProjectV2ProjectPriorityEnum,
- UpdateSensitiveDataDiscoveryTaskExecutionPlanEnum,
- UpdateSensitiveDataDiscoveryTaskIdentificationMethodEnum,
- UpdateSensitiveDataDiscoveryTaskReqActionEnum,
UpdateUserSystemEnum,
WorkflowRecordStatusEnum,
WorkflowStepStateEnum
@@ -131,22 +116,6 @@ export interface IAddGatewayReq {
add_gateway?: IGateway;
}
-export interface IAddMaskingTemplate {
- name: string;
-
- rule_ids: number[];
-}
-
-export interface IAddMaskingTemplateReply {
- code?: number;
-
- message?: string;
-}
-
-export interface IAddMaskingTemplateReq {
- masking_template: IAddMaskingTemplate;
-}
-
export interface IAddMemberGroupReply {
code?: number;
@@ -227,36 +196,6 @@ export interface IAddRoleReq {
role?: IRole;
}
-export interface IAddSensitiveDataDiscoveryTask {
- cron_expression?: string;
-
- db_service_uid: string;
-
- execution_plan: AddSensitiveDataDiscoveryTaskExecutionPlanEnum;
-
- identification_method: AddSensitiveDataDiscoveryTaskIdentificationMethodEnum;
-
- is_periodic_scan_enabled?: boolean;
-
- masking_template_id: number;
-}
-
-export interface IAddSensitiveDataDiscoveryTaskData {
- suspected_sensitive_fields_tree?: ISuspectedSensitiveFieldsTree;
-}
-
-export interface IAddSensitiveDataDiscoveryTaskReply {
- code?: number;
-
- data?: IAddSensitiveDataDiscoveryTaskData;
-
- message?: string;
-}
-
-export interface IAddSensitiveDataDiscoveryTaskReq {
- task: IAddSensitiveDataDiscoveryTask;
-}
-
export interface IAddSession {
password: string;
@@ -435,8 +374,6 @@ export interface ICBOperationLog {
session_id?: string;
uid?: string;
-
- workflow_id?: string;
}
export interface ICBOperationLogTips {
@@ -563,16 +500,6 @@ export interface IComponentNameWithVersion {
version?: string;
}
-export interface IConfigureMaskingRulesReply {
- code?: number;
-
- message?: string;
-}
-
-export interface IConfigureMaskingRulesReq {
- masking_rule_configs: IMaskingRuleConfig[];
-}
-
export interface ICreateBusinessTagReq {
business_tag?: IBusinessTag;
}
@@ -581,12 +508,6 @@ export interface ICreateEnvironmentTagReq {
environment_name?: string;
}
-export interface ICurrentProjectAdmin {
- is_admin?: boolean;
-
- member_groups?: string[];
-}
-
export interface IDBService {
additional_params?: IAdditionalParam[];
@@ -602,6 +523,8 @@ export interface IDBService {
host: string;
+ is_enable_masking?: boolean;
+
maintenance_times: IMaintenanceTime[];
name: string;
@@ -676,6 +599,8 @@ export interface IDBServiceV2 {
host: string;
+ is_enable_masking?: boolean;
+
maintenance_times: IMaintenanceTime[];
name: string;
@@ -783,18 +708,6 @@ export interface IDeleteGatewayReply {
message?: string;
}
-export interface IDeleteMaskingTemplateReply {
- code?: number;
-
- message?: string;
-}
-
-export interface IDeleteSensitiveDataDiscoveryTaskReply {
- code?: number;
-
- message?: string;
-}
-
export interface IEnvironmentTag {
name?: string;
@@ -1005,22 +918,6 @@ export interface IGetLoginTipsReply {
message?: string;
}
-export interface IGetMaskingOverviewTreeData {
- dashboard?: IMaskingOverviewDashboard;
-
- databases?: {
- [key: string]: any;
- };
-}
-
-export interface IGetMaskingOverviewTreeReply {
- code?: number;
-
- data?: IGetMaskingOverviewTreeData;
-
- message?: string;
-}
-
export interface IGetMemberGroup {
is_project_admin?: boolean;
@@ -1044,8 +941,6 @@ export interface IGetMemberGroupReply {
export interface IGetOauth2ConfigurationResData {
access_token_tag?: string;
- auto_bind_same_name_user?: boolean;
-
auto_create_user?: boolean;
back_channel_logout_uri?: string;
@@ -1054,8 +949,6 @@ export interface IGetOauth2ConfigurationResData {
client_id?: string;
- enable_manually_bind?: boolean;
-
enable_oauth2?: boolean;
login_perm_expr?: string;
@@ -1113,16 +1006,48 @@ export interface IGetOperationRecordListReply {
total_nums?: number;
}
-export interface IGetPlaintextAccessRequestDetailReply {
+export interface IOperationTypeNameListItem {
+ operation_type_name?: string;
+
+ desc?: string;
+}
+
+export interface IGetOperationTypeNameListReply {
code?: number;
- data?: {
- masking_preview?: IMaskingPreviewData;
+ data?: IOperationTypeNameListItem[];
- query_sql?: string;
+ message?: string;
+}
- reason?: string;
- };
+export interface IOperationActionListItem {
+ operation_type?: string;
+
+ operation_action?: string;
+
+ desc?: string;
+}
+
+export interface IGetOperationActionListReply {
+ code?: number;
+
+ data?: IOperationActionListItem[];
+
+ message?: string;
+}
+
+export interface IOperationUserNameListItem {
+ operation_user_name?: string;
+
+ operation_req_ip?: string;
+
+ desc?: string;
+}
+
+export interface IGetOperationUserNameListReply {
+ code?: number;
+
+ data?: IOperationUserNameListItem[];
message?: string;
}
@@ -1187,21 +1112,11 @@ export interface IGetSystemVariablesReply {
message?: string;
}
-export interface IGetTableColumnMaskingDetailsReply {
- code?: number;
-
- data?: ITableColumnMaskingDetail[];
-
- message?: string;
-}
-
export interface IGetUser {
access_token_info?: IAccessTokenInfo;
authentication_type?: GetUserAuthenticationTypeEnum;
- business_write_permission?: boolean;
-
email?: string;
is_admin?: boolean;
@@ -1247,8 +1162,6 @@ export interface IGetUserOpPermissionReply {
code?: number;
data?: {
- business_write_permission?: boolean;
-
is_admin?: boolean;
op_permission_list?: IOpPermissionItem[];
@@ -1315,7 +1228,9 @@ export interface IGlobalDataExportWorkflow {
workflow_uid?: string;
}
-export interface II18nStr {}
+export interface II18nStr {
+ [key: string]: string;
+}
export interface IImportDBService {
additional_params?: IAdditionalParam[];
@@ -1328,6 +1243,8 @@ export interface IImportDBService {
host?: string;
+ is_enable_masking?: boolean;
+
maintenance_times?: IMaintenanceTime[];
name?: string;
@@ -1356,6 +1273,8 @@ export interface IImportDBServiceV2 {
host?: string;
+ is_enable_masking?: boolean;
+
maintenance_times?: IMaintenanceTime[];
name?: string;
@@ -1521,28 +1440,6 @@ export interface IListCBOperationLogsReply {
total_nums?: number;
}
-export interface IListCreatableDBServicesForMaskingTaskData {
- db_service_host?: string;
-
- db_service_name?: string;
-
- db_service_port?: string;
-
- db_service_uid?: string;
-
- db_type?: string;
-}
-
-export interface IListCreatableDBServicesForMaskingTaskReply {
- code?: number;
-
- data?: IListCreatableDBServicesForMaskingTaskData[];
-
- message?: string;
-
- total_nums?: number;
-}
-
export interface IListDBService {
additional_params?: IAdditionalParam[];
@@ -1883,8 +1780,6 @@ export interface IListGlobalDBServiceV2 {
uid?: string;
unfinished_workflow_num?: number;
-
- workflow_exec_enabled?: boolean;
}
export interface IListGlobalDBServicesReply {
@@ -1920,13 +1815,11 @@ export interface IListMaskingRulesData {
effect?: string;
- effect_example_after?: string;
-
- effect_example_before?: string;
-
id?: number;
masking_type?: string;
+
+ reference_fields?: string[];
}
export interface IListMaskingRulesReply {
@@ -1937,35 +1830,7 @@ export interface IListMaskingRulesReply {
message?: string;
}
-export interface IListMaskingTemplatesData {
- id?: number;
-
- name?: string;
-
- rule_count?: number;
-
- rule_names?: string[];
-}
-
-export interface IListMaskingTemplatesReply {
- code?: number;
-
- data?: IListMaskingTemplatesData[];
-
- message?: string;
-
- total_nums?: number;
-}
-
export interface IListMember {
- current_project_admin?: ICurrentProjectAdmin;
-
- current_project_manage_permissions?: IProjectManagePermission[];
-
- current_project_op_permissions?: IProjectOpPermission[];
-
- is_group_member?: boolean;
-
is_project_admin?: boolean;
platform_roles?: IUidWithName[];
@@ -1980,10 +1845,6 @@ export interface IListMember {
}
export interface IListMemberGroup {
- current_project_manage_permissions?: IUidWithName[];
-
- current_project_op_permissions?: IProjectOpPermission[];
-
is_project_admin?: boolean;
name?: string;
@@ -1995,14 +1856,6 @@ export interface IListMemberGroup {
users?: IUidWithName[];
}
-export interface IListMemberGroupTipsReply {
- code?: number;
-
- data?: IUidWithName[];
-
- message?: string;
-}
-
export interface IListMemberGroupsReply {
code?: number;
@@ -2024,10 +1877,6 @@ export interface IListMemberReply {
}
export interface IListMemberRoleWithOpRange {
- member_group?: IProjectMemberGroup;
-
- op_permissions?: IUidWithName[];
-
op_range_type?: ListMemberRoleWithOpRangeOpRangeTypeEnum;
range_uids?: IUidWithName[];
@@ -2070,13 +1919,9 @@ export interface IListMembersForInternalReply {
export interface IListOpPermission {
description?: string;
- module?: string;
-
op_permission?: IUidWithName;
range_type?: ListOpPermissionRangeTypeEnum;
-
- service?: ListOpPermissionServiceEnum;
}
export interface IListOpPermissionReply {
@@ -2089,16 +1934,6 @@ export interface IListOpPermissionReply {
total_nums?: number;
}
-export interface IListPendingApprovalRequestsReply {
- code?: number;
-
- data?: IPendingApprovalRequestData[];
-
- message?: string;
-
- total_nums?: number;
-}
-
export interface IListProjectReply {
code?: number;
@@ -2162,21 +1997,13 @@ export interface IListRole {
name?: string;
- op_permissions?: IListRoleOpPermission[];
+ op_permissions?: IUidWithName[];
stat?: ListRoleStatEnum;
uid?: string;
}
-export interface IListRoleOpPermission {
- module?: string;
-
- name?: string;
-
- uid?: string;
-}
-
export interface IListRoleReply {
code?: number;
@@ -2187,71 +2014,9 @@ export interface IListRoleReply {
total_nums?: number;
}
-export interface IListSensitiveDataDiscoveryTaskHistoriesData {
- executed_at?: string;
-
- new_sensitive_field_count?: number;
-
- remark?: string;
-
- status?: ListSensitiveDataDiscoveryTaskHistoriesDataStatusEnum;
-}
-
-export interface IListSensitiveDataDiscoveryTaskHistoriesReply {
- code?: number;
-
- data?: IListSensitiveDataDiscoveryTaskHistoriesData[];
-
- message?: string;
-
- total_nums?: number;
-}
-
-export interface IListSensitiveDataDiscoveryTasksData {
- db_service_host?: string;
-
- db_service_name?: string;
-
- db_service_port?: string;
-
- db_service_uid?: string;
-
- execution_frequency?: string;
-
- execution_plan?: ListSensitiveDataDiscoveryTasksDataExecutionPlanEnum;
-
- id?: number;
-
- identification_method?: ListSensitiveDataDiscoveryTasksDataIdentificationMethodEnum;
-
- is_periodic_scan_enabled?: boolean;
-
- masking_template_id?: number;
-
- masking_template_name?: string;
-
- next_execution_at?: string;
-
- status?: ListSensitiveDataDiscoveryTasksDataStatusEnum;
-
- task_type?: ListSensitiveDataDiscoveryTasksDataTaskTypeEnum;
-}
-
-export interface IListSensitiveDataDiscoveryTasksReply {
- code?: number;
-
- data?: IListSensitiveDataDiscoveryTasksData[];
-
- message?: string;
-
- total_nums?: number;
-}
-
export interface IListUser {
authentication_type?: ListUserAuthenticationTypeEnum;
- business_write_permission?: boolean;
-
email?: string;
is_deleted?: boolean;
@@ -2331,53 +2096,9 @@ export interface IMaintenanceTime {
maintenance_stop_time?: ITime;
}
-export interface IMaskingOverviewDashboard {
- configured_masking_columns?: number;
-
- pending_confirm_masking_columns?: number;
-
- total_sensitive_tables?: number;
-}
-
-export interface IMaskingOverviewDatabaseNode {
- tables?: {
- [key: string]: any;
- };
-}
-
-export interface IMaskingOverviewTableData {
- configured_masking_columns?: number;
-
- pending_confirm_masking_columns?: number;
-
- table_id?: number;
-}
-
-export interface IMaskingPreviewData {
- columns?: string[];
-
- rows?: string[][];
-}
-
-export interface IMaskingRuleConfig {
- column_name: string;
-
- db_service_uid: string;
-
- is_masking_enabled: boolean;
-
- masking_rule_id: number;
-
- schema_name: string;
-
- table_name: string;
-}
-
export interface IMember {
is_project_admin?: boolean;
- project_manage_permissions?: string[];
-
role_with_op_ranges?: IMemberRoleWithOpRange[];
user_uid: string;
@@ -2388,8 +2109,6 @@ export interface IMemberGroup {
name: string;
- project_manage_permissions?: string[];
-
role_with_op_ranges?: IMemberRoleWithOpRange[];
user_uids: string[];
@@ -2420,8 +2139,6 @@ export interface INotificationReply {
export interface IOauth2Configuration {
access_token_tag?: string;
- auto_bind_same_name_user?: boolean;
-
auto_create_user?: boolean;
auto_create_user_pwd?: string;
@@ -2432,8 +2149,6 @@ export interface IOauth2Configuration {
client_key?: string;
- enable_manually_bind?: boolean;
-
enable_oauth2?: boolean;
login_perm_expr?: string;
@@ -2541,18 +2256,6 @@ export interface IParam {
export type IParams = IParam[];
-export interface IPendingApprovalRequestData {
- applicant_name?: string;
-
- applied_at?: string;
-
- data_scope?: string;
-
- id?: number;
-
- reason?: string;
-}
-
export interface IPersonalizationReq {
file?: IFileHeader;
@@ -2601,20 +2304,6 @@ export interface IPreviewImportProjectsV2 {
name?: string;
}
-export interface IProcessApprovalRequestReply {
- code?: number;
-
- message?: string;
-}
-
-export interface IProcessApprovalRequestReq {
- action: ProcessApprovalRequestReqActionEnum;
-
- approve_remark?: string;
-
- reject_reason?: string;
-}
-
export interface IProjectInfo {
project_name?: string;
@@ -2623,40 +2312,6 @@ export interface IProjectInfo {
project_uid?: string;
}
-export interface IProjectManagePermission {
- member_group?: string;
-
- name?: string;
-
- uid?: string;
-}
-
-export interface IProjectMemberGroup {
- name?: string;
-
- op_permissions?: IUidWithName[];
-
- uid?: string;
-
- users?: IUidWithName[];
-}
-
-export interface IProjectOpPermission {
- data_source?: string;
-
- roles?: IProjectRole[];
-}
-
-export interface IProjectRole {
- member_group?: IProjectMemberGroup;
-
- name?: string;
-
- op_permissions?: IUidWithName[];
-
- uid?: string;
-}
-
export interface IProjectTips {
business?: string[];
@@ -2842,8 +2497,6 @@ export interface ISQLQueryConfig {
audit_enabled?: boolean;
- maintenance_times?: IMaintenanceTime[];
-
max_pre_query_rows?: number;
query_timeout_second?: number;
@@ -2851,8 +2504,6 @@ export interface ISQLQueryConfig {
rule_template_id?: string;
rule_template_name?: string;
-
- workflow_exec_enabled?: boolean;
}
export interface ISendSmsCodeReply {
@@ -2873,34 +2524,6 @@ export interface ISendSmsCodeReq {
username?: string;
}
-export interface ISensitiveFieldScanResult {
- confidence?: SensitiveFieldScanResultConfidenceEnum;
-
- recommended_masking_rule_id?: number;
-
- recommended_masking_rule_name?: string;
-
- scan_info?: string;
-}
-
-export interface ISuspectedSensitiveDatabaseNode {
- tables?: {
- [key: string]: any;
- };
-}
-
-export interface ISuspectedSensitiveFieldsTree {
- databases?: {
- [key: string]: any;
- };
-}
-
-export interface ISuspectedSensitiveTableNode {
- fields?: {
- [key: string]: any;
- };
-}
-
export interface ISyncGatewayReq {
gateways?: IGateway[];
}
@@ -2919,18 +2542,6 @@ export interface ISystemVariablesResV1 {
url?: string;
}
-export interface ITableColumnMaskingDetail {
- column_name?: string;
-
- confidence?: TableColumnMaskingDetailConfidenceEnum;
-
- masking_rule_id?: number;
-
- masking_rule_name?: string;
-
- status?: TableColumnMaskingDetailStatusEnum;
-}
-
export interface ITask {
task_uid?: string;
}
@@ -3120,6 +2731,8 @@ export interface IUpdateDBService {
host: string;
+ is_enable_masking?: boolean;
+
maintenance_times: IMaintenanceTime[];
password?: string;
@@ -3168,6 +2781,8 @@ export interface IUpdateDBServiceV2 {
host: string;
+ is_enable_masking?: boolean;
+
maintenance_times: IMaintenanceTime[];
password?: string;
@@ -3221,33 +2836,15 @@ export interface IUpdateLoginConfigurationReq {
login?: ILoginConfiguration;
}
-export interface IUpdateMaskingTemplate {
- rule_ids: number[];
-}
-
-export interface IUpdateMaskingTemplateReply {
- code?: number;
-
- message?: string;
-}
-
-export interface IUpdateMaskingTemplateReq {
- masking_template: IUpdateMaskingTemplate;
-}
-
export interface IUpdateMember {
is_project_admin?: boolean;
- project_manage_permissions?: string[];
-
role_with_op_ranges?: IMemberRoleWithOpRange[];
}
export interface IUpdateMemberGroup {
is_project_admin?: boolean;
- project_manage_permissions?: string[];
-
role_with_op_ranges?: IMemberRoleWithOpRange[];
user_uids: string[];
@@ -3317,34 +2914,6 @@ export interface IUpdateSMTPConfigurationReq {
smtp_configuration?: IUpdateSMTPConfiguration;
}
-export interface IUpdateSensitiveDataDiscoveryTask {
- cron_expression?: string;
-
- execution_plan?: UpdateSensitiveDataDiscoveryTaskExecutionPlanEnum;
-
- identification_method?: UpdateSensitiveDataDiscoveryTaskIdentificationMethodEnum;
-
- masking_template_id?: number;
-}
-
-export interface IUpdateSensitiveDataDiscoveryTaskData {
- suspected_sensitive_fields_tree?: ISuspectedSensitiveFieldsTree;
-}
-
-export interface IUpdateSensitiveDataDiscoveryTaskReply {
- code?: number;
-
- data?: IUpdateSensitiveDataDiscoveryTaskData;
-
- message?: string;
-}
-
-export interface IUpdateSensitiveDataDiscoveryTaskReq {
- action: UpdateSensitiveDataDiscoveryTaskReqActionEnum;
-
- task?: IUpdateSensitiveDataDiscoveryTask;
-}
-
export interface IUpdateSmsConfiguration {
configuration?: {
[key: string]: string;
@@ -3376,8 +2945,6 @@ export interface IUpdateSystemVariablesReqV1 {
}
export interface IUpdateUser {
- business_write_permission?: boolean;
-
email?: string;
is_disabled?: boolean;
@@ -3442,8 +3009,6 @@ export interface IUpdateWebHookConfigurationReq {
}
export interface IUser {
- business_write_permission?: boolean;
-
desc?: string;
email?: string;
diff --git a/packages/shared/lib/api/sqle/service/OperationRecord/index.d.ts b/packages/shared/lib/api/sqle/service/OperationRecord/index.d.ts
index 9e16ea36c6..b6bf5b013a 100644
--- a/packages/shared/lib/api/sqle/service/OperationRecord/index.d.ts
+++ b/packages/shared/lib/api/sqle/service/OperationRecord/index.d.ts
@@ -1,8 +1,42 @@
-import {
- IGetOperationRecordListResV1,
- IGetOperationActionListResV1,
- IGetOperationTypeNamesListResV1
-} from '../common.d';
+export interface IOperationTypeNameListItem {
+ operation_type_name?: string;
+
+ desc?: string;
+}
+
+export interface IGetOperationTypeNamesListResV1 {
+ code?: number;
+
+ data?: IOperationTypeNameListItem[];
+
+ message?: string;
+}
+
+export interface IOperationActionListItem {
+ operation_type?: string;
+
+ operation_action?: string;
+
+ desc?: string;
+}
+
+export interface IGetOperationActionListResV1 {
+ code?: number;
+
+ data?: IOperationActionListItem[];
+
+ message?: string;
+}
+
+export interface IGetOperationRecordListResV1 {
+ code?: number;
+
+ data?: import('../../base/service/common').IOperationRecordListItem[];
+
+ message?: string;
+
+ total_nums?: number;
+}
export interface IGetOperationRecordListV1Params {
filter_operate_time_from?: string;
@@ -13,9 +47,15 @@ export interface IGetOperationRecordListV1Params {
fuzzy_search_operate_user_name?: string;
- filter_operate_type_name?: string;
+ fuzzy_search_operate_content?: string;
- filter_operate_action?: string;
+ filter_fuzzy_operate_user_name?: string;
+
+ filter_operate_type_names?: string[];
+
+ filter_operate_actions?: string[];
+
+ filter_operate_status?: string;
page_index: number;
@@ -34,9 +74,15 @@ export interface IGetExportOperationRecordListV1Params {
fuzzy_search_operate_user_name?: string;
- filter_operate_type_name?: string;
+ fuzzy_search_operate_content?: string;
+
+ filter_fuzzy_operate_user_name?: string;
+
+ filter_operate_type_names?: string[];
+
+ filter_operate_actions?: string[];
- filter_operate_action?: string;
+ filter_operate_status?: string;
}
export interface IGetOperationActionListReturn
diff --git a/packages/shared/lib/testUtil/mockApi/sqle/operationRecord/index.ts b/packages/shared/lib/testUtil/mockApi/sqle/operationRecord/index.ts
index 97302e9c6f..3cfcf10aab 100644
--- a/packages/shared/lib/testUtil/mockApi/sqle/operationRecord/index.ts
+++ b/packages/shared/lib/testUtil/mockApi/sqle/operationRecord/index.ts
@@ -1,11 +1,36 @@
+import operationRecord from '../../../../api/sqle/service/OperationRecord';
import baseOperationRecord from '../../../../api/base/service/OperationRecord';
import { MockSpyApy, createSpySuccessResponse } from '../../common';
import { operationRecordListMockData } from './data';
+const operationTypeNameMockData = [
+ { operation_type_name: 'user', desc: '用户' },
+ { operation_type_name: 'workflow', desc: '工单' }
+];
+
+const operationActionMockData = [
+ {
+ operation_type: 'workflow',
+ operation_action: 'create_workflow',
+ desc: '创建工单'
+ }
+];
+
+const operationUserNameMockData = [
+ {
+ operation_user_name: 'admin',
+ operation_req_ip: '127.0.0.1',
+ desc: 'admin (127.0.0.1)'
+ }
+];
+
class MockOperationRecordApi implements MockSpyApy {
public mockAllApi(): void {
this.getOperationRecordList();
this.exportOperationRecordList();
+ this.getOperationTypeNameList();
+ this.getOperationActionList();
+ this.getOperationUserNameList();
}
public getOperationRecordList() {
@@ -24,6 +49,38 @@ class MockOperationRecordApi implements MockSpyApy {
spy.mockImplementation(() => createSpySuccessResponse({}));
return spy;
}
+
+ public getOperationTypeNameList() {
+ const dmsSpy = jest.spyOn(baseOperationRecord, 'GetOperationTypeNameList');
+ dmsSpy.mockImplementation(() =>
+ createSpySuccessResponse({ data: operationTypeNameMockData })
+ );
+ const sqleSpy = jest.spyOn(operationRecord, 'GetOperationTypeNameList');
+ sqleSpy.mockImplementation(() =>
+ createSpySuccessResponse({ data: operationTypeNameMockData })
+ );
+ return { dmsSpy, sqleSpy };
+ }
+
+ public getOperationActionList() {
+ const dmsSpy = jest.spyOn(baseOperationRecord, 'GetOperationActionList');
+ dmsSpy.mockImplementation(() =>
+ createSpySuccessResponse({ data: operationActionMockData })
+ );
+ const sqleSpy = jest.spyOn(operationRecord, 'getOperationActionList');
+ sqleSpy.mockImplementation(() =>
+ createSpySuccessResponse({ data: operationActionMockData })
+ );
+ return { dmsSpy, sqleSpy };
+ }
+
+ public getOperationUserNameList() {
+ const spy = jest.spyOn(baseOperationRecord, 'GetOperationUserNameList');
+ spy.mockImplementation(() =>
+ createSpySuccessResponse({ data: operationUserNameMockData })
+ );
+ return spy;
+ }
}
export default new MockOperationRecordApi();
diff --git a/packages/sqle/src/hooks/useOperationActions/index.tsx b/packages/sqle/src/hooks/useOperationActions/index.tsx
new file mode 100644
index 0000000000..d935f9a241
--- /dev/null
+++ b/packages/sqle/src/hooks/useOperationActions/index.tsx
@@ -0,0 +1,115 @@
+import { useCallback, useState } from 'react';
+import { useBoolean } from 'ahooks';
+import { ResponseCode } from '../../data/common';
+import baseOperationRecord from '@actiontech/shared/lib/api/base/service/OperationRecord';
+import sqleOperationRecord from '@actiontech/shared/lib/api/sqle/service/OperationRecord';
+
+type OperationAction = {
+ operation_type?: string;
+ operation_action?: string;
+ desc?: string;
+};
+
+const useOperationActions = () => {
+ const [operationActionList, setOperationActionList] = useState<
+ OperationAction[]
+ >([]);
+ const [loading, { setTrue, setFalse }] = useBoolean();
+
+ const updateOperationActions = useCallback(() => {
+ setTrue();
+ Promise.all([
+ baseOperationRecord.GetOperationActionList(),
+ sqleOperationRecord.getOperationActionList()
+ ])
+ .then(([dmsRes, sqleRes]) => {
+ const merged = new Map();
+ const appendList = (list?: OperationAction[]) => {
+ list?.forEach((item) => {
+ if (!item.operation_action) {
+ return;
+ }
+ const key = `${item.operation_type ?? ''}:${item.operation_action}`;
+ merged.set(key, item);
+ });
+ };
+ if (dmsRes.data.code === ResponseCode.SUCCESS) {
+ appendList(dmsRes.data.data);
+ }
+ if (sqleRes.data.code === ResponseCode.SUCCESS) {
+ appendList(sqleRes.data.data);
+ }
+ setOperationActionList(Array.from(merged.values()));
+ })
+ .catch(() => {
+ setOperationActionList([]);
+ })
+ .finally(() => {
+ setFalse();
+ });
+ }, [setFalse, setTrue]);
+
+ const operationActionOptions = useCallback(
+ (
+ operationTypeName?: string | string[],
+ operationTypeDescMap: Record = {}
+ ) => {
+ const selectedTypes = Array.isArray(operationTypeName)
+ ? operationTypeName
+ : operationTypeName
+ ? [operationTypeName]
+ : [];
+ const uniqueByValue = new Map();
+ operationActionList.forEach((action) => {
+ if (selectedTypes.length > 0) {
+ if (!selectedTypes.includes(action.operation_type ?? '')) {
+ return;
+ }
+ }
+ const value = action.operation_action ?? '';
+ if (!value || uniqueByValue.has(value)) {
+ return;
+ }
+ uniqueByValue.set(value, action);
+ });
+
+ const actions = Array.from(uniqueByValue.values());
+ const labelCount = actions.reduce>(
+ (acc, action) => {
+ const label = action.desc ?? action.operation_action ?? '';
+ acc[label] = (acc[label] ?? 0) + 1;
+ return acc;
+ },
+ {}
+ );
+
+ return actions.map((action) => {
+ const baseLabel = action.desc ?? action.operation_action ?? '';
+ const typeDesc =
+ operationTypeDescMap[action.operation_type ?? ''] ??
+ action.operation_type ??
+ '';
+ const shouldAppendType =
+ selectedTypes.length === 0 || (labelCount[baseLabel] ?? 0) > 1;
+ const label =
+ shouldAppendType && typeDesc
+ ? `${baseLabel} (${typeDesc})`
+ : baseLabel;
+ return {
+ label,
+ value: action.operation_action ?? ''
+ };
+ });
+ },
+ [operationActionList]
+ );
+
+ return {
+ operationActionList,
+ loading,
+ updateOperationActions,
+ operationActionOptions
+ };
+};
+
+export default useOperationActions;
diff --git a/packages/sqle/src/hooks/useOperationTypeName/index.tsx b/packages/sqle/src/hooks/useOperationTypeName/index.tsx
new file mode 100644
index 0000000000..19b5e87513
--- /dev/null
+++ b/packages/sqle/src/hooks/useOperationTypeName/index.tsx
@@ -0,0 +1,76 @@
+import { useCallback, useMemo, useState } from 'react';
+import { useBoolean } from 'ahooks';
+import { ResponseCode } from '../../data/common';
+import baseOperationRecord from '@actiontech/shared/lib/api/base/service/OperationRecord';
+import sqleOperationRecord from '@actiontech/shared/lib/api/sqle/service/OperationRecord';
+
+type OperationTypeName = {
+ operation_type_name?: string;
+ desc?: string;
+};
+
+const useOperationTypeName = () => {
+ const [operationTypeNameList, setOperationTypeNameList] = useState<
+ OperationTypeName[]
+ >([]);
+ const [loading, { setTrue, setFalse }] = useBoolean();
+
+ const updateOperationTypeNameList = useCallback(() => {
+ setTrue();
+ Promise.all([
+ baseOperationRecord.GetOperationTypeNameList(),
+ sqleOperationRecord.GetOperationTypeNameList()
+ ])
+ .then(([dmsRes, sqleRes]) => {
+ const merged = new Map();
+ const appendList = (list?: OperationTypeName[]) => {
+ list?.forEach((item) => {
+ if (!item.operation_type_name) {
+ return;
+ }
+ merged.set(item.operation_type_name, item);
+ });
+ };
+ if (dmsRes.data.code === ResponseCode.SUCCESS) {
+ appendList(dmsRes.data.data);
+ }
+ if (sqleRes.data.code === ResponseCode.SUCCESS) {
+ appendList(sqleRes.data.data);
+ }
+ setOperationTypeNameList(Array.from(merged.values()));
+ })
+ .catch(() => {
+ setOperationTypeNameList([]);
+ })
+ .finally(() => {
+ setFalse();
+ });
+ }, [setFalse, setTrue]);
+
+ const operationTypeNameOptions = useMemo(() => {
+ return operationTypeNameList.map((typeName) => ({
+ label: typeName.desc ?? typeName.operation_type_name ?? '',
+ value: typeName.operation_type_name ?? ''
+ }));
+ }, [operationTypeNameList]);
+
+ const operationTypeDescMap = useMemo(() => {
+ return operationTypeNameList.reduce>((acc, item) => {
+ if (item.operation_type_name) {
+ acc[item.operation_type_name] =
+ item.desc ?? item.operation_type_name ?? '';
+ }
+ return acc;
+ }, {});
+ }, [operationTypeNameList]);
+
+ return {
+ operationTypeNameList,
+ loading,
+ updateOperationTypeNameList,
+ operationTypeNameOptions,
+ operationTypeDescMap
+ };
+};
+
+export default useOperationTypeName;
diff --git a/packages/sqle/src/hooks/useOperationUserNames/index.tsx b/packages/sqle/src/hooks/useOperationUserNames/index.tsx
new file mode 100644
index 0000000000..55e2160acd
--- /dev/null
+++ b/packages/sqle/src/hooks/useOperationUserNames/index.tsx
@@ -0,0 +1,67 @@
+import { useCallback, useMemo, useState } from 'react';
+import { useBoolean } from 'ahooks';
+import { ResponseCode } from '../../data/common';
+import baseOperationRecord from '@actiontech/shared/lib/api/base/service/OperationRecord';
+
+type OperationUserName = {
+ operation_user_name?: string;
+ operation_req_ip?: string;
+ desc?: string;
+};
+
+const useOperationUserNames = (projectName?: string) => {
+ const [operationUserNameList, setOperationUserNameList] = useState<
+ OperationUserName[]
+ >([]);
+ const [loading, { setTrue, setFalse }] = useBoolean();
+
+ const updateOperationUserNameList = useCallback(() => {
+ setTrue();
+ const params = projectName
+ ? { filter_operate_project_name: projectName }
+ : undefined;
+ baseOperationRecord
+ .GetOperationUserNameList(params)
+ .then((res) => {
+ if (res.data.code === ResponseCode.SUCCESS) {
+ setOperationUserNameList(res.data.data ?? []);
+ return;
+ }
+ setOperationUserNameList([]);
+ })
+ .catch(() => {
+ setOperationUserNameList([]);
+ })
+ .finally(() => {
+ setFalse();
+ });
+ }, [projectName, setFalse, setTrue]);
+
+ const operationUserNameOptions = useMemo(() => {
+ const seen = new Set();
+ return operationUserNameList.reduce<{ label: string; value: string }[]>(
+ (options, userName) => {
+ const name = userName.operation_user_name ?? '';
+ if (!name || seen.has(name)) {
+ return options;
+ }
+ seen.add(name);
+ options.push({
+ label: name,
+ value: name
+ });
+ return options;
+ },
+ []
+ );
+ }, [operationUserNameList]);
+
+ return {
+ operationUserNameList,
+ loading,
+ updateOperationUserNameList,
+ operationUserNameOptions
+ };
+};
+
+export default useOperationUserNames;
diff --git a/packages/sqle/src/locale/en-US/operationRecord.ts b/packages/sqle/src/locale/en-US/operationRecord.ts
index b4b6300806..a9648c8c74 100644
--- a/packages/sqle/src/locale/en-US/operationRecord.ts
+++ b/packages/sqle/src/locale/en-US/operationRecord.ts
@@ -13,7 +13,10 @@ export default {
operator: 'Operator',
operationType: 'Operation type',
operationAction: 'Operation content',
- platformOperation: '-- (platform operation)'
+ platformOperation: '-- (platform operation)',
+ globalOperation: 'Global operation',
+ searchOperatorPlaceholder:
+ 'Search operator or content (username, IP, keywords)'
},
column: {
operatingTime: 'Operation time',
diff --git a/packages/sqle/src/locale/zh-CN/operationRecord.ts b/packages/sqle/src/locale/zh-CN/operationRecord.ts
index 034ac19ac5..5ad7449fd3 100644
--- a/packages/sqle/src/locale/zh-CN/operationRecord.ts
+++ b/packages/sqle/src/locale/zh-CN/operationRecord.ts
@@ -15,7 +15,9 @@ export default {
operationType: '操作类型',
operationAction: '操作内容',
platformOperation: '-- (平台操作)',
- globalOperation: '全局操作'
+ globalOperation: '全局操作',
+ searchOperatorPlaceholder:
+ '搜索操作人或操作内容(用户名、IP、内容关键字)'
},
column: {
operatingTime: '操作时间',
diff --git a/packages/sqle/src/page/OperationRecord/List/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/OperationRecord/List/__snapshots__/index.test.tsx.snap
index 5a0b29f021..5018daf44e 100644
--- a/packages/sqle/src/page/OperationRecord/List/__snapshots__/index.test.tsx.snap
+++ b/packages/sqle/src/page/OperationRecord/List/__snapshots__/index.test.tsx.snap
@@ -22,7 +22,7 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
class="ant-space-item"
>
@@ -66,11 +65,12 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
>
@@ -103,7 +103,6 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
>
@@ -113,7 +112,7 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
class="ant-space-item"
>
@@ -159,7 +158,7 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
class="ant-space-item"
>
@@ -195,7 +193,7 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
class="css-1y8q0oh"
>
@@ -254,10 +251,216 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
+
+
+
+
+
+
+
+
+ 操作人
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 操作类型
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 操作内容
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 状态
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
操作人
@@ -464,7 +725,7 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
2024-01-03 11:28:34
admin 192.168.22.31
@@ -604,7 +865,7 @@ exports[`sqle/OperationRecord/List render action when filter item show 1`] = `
2024-01-03 11:27:27
admin 192.168.22.33
@@ -913,7 +1174,7 @@ exports[`sqle/OperationRecord/List render operation record table when project na
class="ant-space-item"
>
@@ -957,11 +1217,12 @@ exports[`sqle/OperationRecord/List render operation record table when project na
>
@@ -994,7 +1255,6 @@ exports[`sqle/OperationRecord/List render operation record table when project na
>
@@ -1004,7 +1264,7 @@ exports[`sqle/OperationRecord/List render operation record table when project na
class="ant-space-item"
>
@@ -1015,20 +1275,21 @@ exports[`sqle/OperationRecord/List render operation record table when project na
class="ant-space-item"
style="margin-right: 2px;"
>
- 筛选
+ 收起筛选
@@ -1049,7 +1310,7 @@ exports[`sqle/OperationRecord/List render operation record table when project na
class="ant-space-item"
>
@@ -1074,131 +1334,464 @@ exports[`sqle/OperationRecord/List render operation record table when project na
+
+
+
+
+
+
+
+
+
-
-
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+ 操作类型
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ 操作内容
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 状态
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 操作时间
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+ 操作类型
+
+
+ 请选择{{name}}
-
-
-
+
+
+
+
-
-
-
-
-
-
-
@@ -2606,7 +3979,7 @@ exports[`sqle/OperationRecord/List render table when request return error 1`] =
操作时间
操作人
diff --git a/packages/sqle/src/page/OperationRecord/List/column.tsx b/packages/sqle/src/page/OperationRecord/List/column.tsx
index 388a08406f..e088dcb453 100644
--- a/packages/sqle/src/page/OperationRecord/List/column.tsx
+++ b/packages/sqle/src/page/OperationRecord/List/column.tsx
@@ -1,83 +1,122 @@
-import { formatTime, BasicTypographyEllipsis } from '@actiontech/dms-kit';
-import { IOperationRecordListItem } from '@actiontech/shared/lib/api/base/service/common';
+import { formatTime } from '@actiontech/shared/lib/utils/Common';
import {
ActiontechTableColumn,
PageInfoWithoutIndexAndSize
-} from '@actiontech/dms-kit/es/components/ActiontechTable';
-import { IGetOperationRecordListParams } from '@actiontech/shared/lib/api/base/service/OperationRecord/index.d';
+} from '@actiontech/shared/lib/components/ActiontechTable';
import { t } from '../../../locale';
import OperationStatus from '../components/OperationStatus';
+import { IGetOperationRecordListParams } from '@actiontech/shared/lib/api/base/service/OperationRecord/index.d';
+import { IOperationRecordListItem } from '@actiontech/shared/lib/api/base/service/common';
+import { BasicTypographyEllipsis } from '@actiontech/shared';
+import { OperationRecordListItemStatusEnum } from '@actiontech/shared/lib/api/base/service/common.enum';
export type OperationRecordListFilterParamType = PageInfoWithoutIndexAndSize<
IGetOperationRecordListParams,
- 'fuzzy_search_operate_user_name'
+ 'fuzzy_search_operate_user_name' | 'fuzzy_search_operate_content'
>;
-export const OperationRecordListColumn: ActiontechTableColumn<
+export const createOperationRecordListColumns = (
+ operationTypeDescMap: Record,
+ showProjectColumn: boolean
+): ActiontechTableColumn<
IOperationRecordListItem,
OperationRecordListFilterParamType
-> = [
- {
- dataIndex: 'operation_time',
- title: () => t('operationRecord.list.column.operatingTime'),
- render: (time) => {
- return formatTime(time);
+> => {
+ const columns: ActiontechTableColumn<
+ IOperationRecordListItem,
+ OperationRecordListFilterParamType
+ > = [
+ {
+ dataIndex: 'operation_time',
+ title: () => t('operationRecord.list.column.operatingTime'),
+ render: (time) => {
+ return formatTime(time);
+ },
+ filterCustomType: 'date-range',
+ filterKey: ['filter_operate_time_from', 'filter_operate_time_to']
},
- filterCustomType: 'date-range',
- filterKey: ['filter_operate_time_from', 'filter_operate_time_to']
- },
- {
- dataIndex: 'operation_user',
- title: () => t('operationRecord.list.column.operator'),
- className: 'whitespace-pre',
- render: (userInfo) => {
- if (!userInfo) {
- return '-';
+ {
+ dataIndex: 'operation_user',
+ title: () => t('operationRecord.list.column.operator'),
+ render: (userInfo) => {
+ if (!userInfo) {
+ return '-';
+ }
+ return `${userInfo.user_name ?? ''} ${userInfo.ip ?? ''}`;
+ },
+ filterCustomType: 'select',
+ filterKey: 'filter_fuzzy_operate_user_name'
+ },
+ {
+ dataIndex: 'operation_type_name',
+ title: () => t('operationRecord.list.column.operationType'),
+ render: (typeName?: string) => {
+ if (!typeName) {
+ return '-';
+ }
+ return operationTypeDescMap[typeName] ?? typeName;
+ },
+ filterCustomType: 'select',
+ filterKey: 'filter_operate_type_names'
+ },
+ {
+ dataIndex: 'operation_content',
+ title: () => t('operationRecord.list.column.operationAction'),
+ filterCustomType: 'select',
+ filterKey: 'filter_operate_actions'
+ },
+ {
+ dataIndex: 'operation_user_agent',
+ title: () => 'UserAgent',
+ className: 'ellipsis-column-width',
+ render: (userAgent?: string) => {
+ return ;
}
- return `${userInfo.user_name ?? ''} ${userInfo.ip ?? ''}`;
+ },
+ {
+ dataIndex: 'project_name',
+ title: () => t('operationRecord.list.column.projectName'),
+ render(name?: string) {
+ if (!name) {
+ return '-';
+ }
+ return name;
+ },
+ filterCustomType: 'select',
+ filterKey: 'filter_operate_project_name'
+ },
+ {
+ dataIndex: 'status',
+ title: () => t('operationRecord.list.column.status'),
+ render: (status) => {
+ if (!status) {
+ return '-';
+ }
+ return ;
+ },
+ filterCustomType: 'select',
+ filterKey: 'filter_operate_status'
}
- },
- {
- dataIndex: 'operation_type_name',
- title: () => t('operationRecord.list.column.operationType')
- // filterCustomType: 'select',
- // filterKey: 'filter_operate_type_name',
- },
- {
- dataIndex: 'operation_content',
- title: () => t('operationRecord.list.column.operationAction')
- // filterCustomType: 'select',
- // filterKey: 'filter_operate_action',
- },
+ ];
+ if (!showProjectColumn) {
+ return columns.filter((column) => column.dataIndex !== 'project_name');
+ }
+ return columns;
+};
+
+export const OperationRecordListColumn = createOperationRecordListColumns(
+ {},
+ true
+);
+
+export const operationRecordStatusFilterOptions = [
{
- dataIndex: 'operation_user_agent',
- title: () => 'UserAgent',
- className: 'ellipsis-column-width',
- render: (userAgent?: string) => {
- return ;
- }
- },
- {
- dataIndex: 'project_name',
- title: () => t('operationRecord.list.column.projectName'),
- render(name?: string) {
- if (!name) {
- return '-';
- }
- return name;
- },
- filterCustomType: 'select',
- filterKey: 'filter_operate_project_name'
+ label: t('common.success'),
+ value: OperationRecordListItemStatusEnum.succeeded
},
{
- dataIndex: 'status',
- title: () => t('operationRecord.list.column.status'),
- render: (status) => {
- if (!status) {
- return '-';
- }
- return ;
- }
+ label: t('common.fail'),
+ value: OperationRecordListItemStatusEnum.failed
}
];
diff --git a/packages/sqle/src/page/OperationRecord/List/index.test.tsx b/packages/sqle/src/page/OperationRecord/List/index.test.tsx
index 9612cbdf9b..eef3e5a855 100644
--- a/packages/sqle/src/page/OperationRecord/List/index.test.tsx
+++ b/packages/sqle/src/page/OperationRecord/List/index.test.tsx
@@ -1,6 +1,6 @@
import { cleanup, screen, act, fireEvent } from '@testing-library/react';
import { superRender } from '@actiontech/shared/lib/testUtil/superRender';
-import OperationRecordList from '.';
+import OperationRecordList, { buildOperationRecordFilterParams } from '.';
import operationRecord from '@actiontech/shared/lib/testUtil/mockApi/sqle/operationRecord';
import { operationRecordListMockData } from '@actiontech/shared/lib/testUtil/mockApi/sqle/operationRecord/data';
import { mockUseCurrentProject } from '@actiontech/shared/lib/testUtil/mockHook/mockUseCurrentProject';
@@ -10,7 +10,6 @@ import {
getBySelector
} from '@actiontech/shared/lib/testUtil/customQuery';
import { mockProjectInfo } from '@actiontech/shared/lib/testUtil/mockHook/data';
-import { mockUseCurrentUser } from '@actiontech/shared/lib/testUtil';
describe('sqle/OperationRecord/List', () => {
beforeEach(() => {
@@ -19,7 +18,6 @@ describe('sqle/OperationRecord/List', () => {
mockUseCurrentProject({
projectName: undefined
});
- mockUseCurrentUser();
});
beforeAll(() => {
@@ -29,17 +27,28 @@ describe('sqle/OperationRecord/List', () => {
it('render operation record table when request return data', async () => {
const operationRecordListSpy = operationRecord.getOperationRecordList();
+ const typeNameSpy = operationRecord.getOperationTypeNameList();
+ const actionSpy = operationRecord.getOperationActionList();
+ const userNameSpy = operationRecord.getOperationUserNameList();
const { baseElement } = superRender( );
await act(async () => jest.advanceTimersByTime(3000));
expect(baseElement).toMatchSnapshot();
expect(operationRecordListSpy).toHaveBeenCalledTimes(1);
- expect(operationRecordListSpy).toHaveBeenNthCalledWith(1, {
- page_index: 1,
- page_size: 20,
- fuzzy_search_operate_user_name: ''
- });
- // expect(actionSpy).toHaveBeenCalledTimes(1);
- // expect(typeNameSpy).toHaveBeenCalledTimes(1);
+ expect(operationRecordListSpy).toHaveBeenNthCalledWith(
+ 1,
+ {
+ page_index: 1,
+ page_size: 20
+ },
+ {
+ paramsSerializer: expect.any(Function)
+ }
+ );
+ expect(typeNameSpy.dmsSpy).toHaveBeenCalledTimes(1);
+ expect(typeNameSpy.sqleSpy).toHaveBeenCalledTimes(1);
+ expect(actionSpy.dmsSpy).toHaveBeenCalledTimes(1);
+ expect(actionSpy.sqleSpy).toHaveBeenCalledTimes(1);
+ expect(userNameSpy).toHaveBeenCalledTimes(1);
expect(
screen.getByText(`共 ${operationRecordListMockData.length} 条数据`)
).toBeInTheDocument();
@@ -54,12 +63,17 @@ describe('sqle/OperationRecord/List', () => {
await act(async () => jest.advanceTimersByTime(3000));
expect(baseElement).toMatchSnapshot();
expect(operationRecordListSpy).toHaveBeenCalledTimes(1);
- expect(operationRecordListSpy).toHaveBeenNthCalledWith(1, {
- page_index: 1,
- page_size: 20,
- filter_operate_project_name: mockProjectInfo.projectName,
- fuzzy_search_operate_user_name: ''
- });
+ expect(operationRecordListSpy).toHaveBeenNthCalledWith(
+ 1,
+ {
+ page_index: 1,
+ page_size: 20,
+ filter_operate_project_name: mockProjectInfo.projectName
+ },
+ {
+ paramsSerializer: expect.any(Function)
+ }
+ );
});
it('render table when request return error', async () => {
@@ -73,7 +87,7 @@ describe('sqle/OperationRecord/List', () => {
expect(baseElement).toMatchSnapshot();
});
- it('render table list when action filter', async () => {
+ it('render table list when toolbar search admin', async () => {
const operationRecordListSpy = operationRecord.getOperationRecordList();
const { baseElement } = superRender( );
await act(async () => jest.advanceTimersByTime(3000));
@@ -84,7 +98,7 @@ describe('sqle/OperationRecord/List', () => {
);
await act(async () => {
fireEvent.input(searchInputEle, {
- target: { value: 'test' }
+ target: { value: 'admin' }
});
await jest.advanceTimersByTime(300);
});
@@ -98,11 +112,17 @@ describe('sqle/OperationRecord/List', () => {
});
await act(async () => jest.advanceTimersByTime(3000));
expect(operationRecordListSpy).toHaveBeenCalled();
- expect(operationRecordListSpy).toHaveBeenCalledWith({
- fuzzy_search_operate_user_name: 'test',
- page_index: 1,
- page_size: 20
- });
+ expect(operationRecordListSpy).toHaveBeenLastCalledWith(
+ {
+ fuzzy_search_operate_user_name: 'admin',
+ fuzzy_search_operate_content: 'admin',
+ page_index: 1,
+ page_size: 20
+ },
+ {
+ paramsSerializer: expect.any(Function)
+ }
+ );
});
it('render action when filter item show', async () => {
@@ -111,61 +131,24 @@ describe('sqle/OperationRecord/List', () => {
await act(async () => jest.advanceTimersByTime(3000));
expect(operationRecordListSpy).toHaveBeenCalledTimes(1);
- fireEvent.click(screen.getByText('筛选'));
- await act(async () => jest.advanceTimersByTime(0));
const filterItems = getAllBySelector(
'.actiontech-table-filter-container-namespace .ant-space-item',
baseElement
);
- expect(filterItems.length).toBe(2);
+ expect(filterItems.length).toBe(6);
expect(baseElement).toMatchSnapshot();
-
- fireEvent.mouseDown(getBySelector('.ant-select-selector', filterItems[1]));
- await act(async () => jest.advanceTimersByTime(0));
- expect(
- getAllBySelector('.ant-select-item-option', baseElement).length
- ).toBe(3);
});
- it('render project filter options when user is project manager', async () => {
- mockUseCurrentUser({
- bindProjects: [
- {
- is_manager: true,
- project_name: 'default',
- project_id: '1',
- archived: false
- },
- {
- is_manager: false,
- project_name: 'test',
- project_id: '2',
- archived: false
- }
- ],
- userRoles: {
- admin: false,
- certainProjectManager: true,
- systemAdministrator: false,
- auditAdministrator: false
- }
- });
- const operationRecordListSpy = operationRecord.getOperationRecordList();
- const { baseElement } = superRender( );
- await act(async () => jest.advanceTimersByTime(3000));
- expect(operationRecordListSpy).toHaveBeenCalledTimes(1);
-
- fireEvent.click(screen.getByText('筛选'));
- await act(async () => jest.advanceTimersByTime(0));
- const filterItems = getAllBySelector(
- '.actiontech-table-filter-container-namespace .ant-space-item',
- baseElement
+ it('buildOperationRecordFilterParams keeps filter_fuzzy_operate_user_name', () => {
+ const params = buildOperationRecordFilterParams(
+ {
+ filter_fuzzy_operate_user_name: 'admin'
+ } as never,
+ '',
+ undefined
);
- fireEvent.mouseDown(getBySelector('.ant-select-selector', filterItems[1]));
- await act(async () => jest.advanceTimersByTime(0));
- expect(
- getAllBySelector('.ant-select-item-option', baseElement).length
- ).toBe(1);
+ expect(params.filter_fuzzy_operate_user_name).toBe('admin');
+ expect(params).not.toHaveProperty('filter_operate_user_names');
});
it('should export data file when click export button', async () => {
@@ -177,10 +160,9 @@ describe('sqle/OperationRecord/List', () => {
expect(screen.getByText('正在导出操作记录列表...')).toBeInTheDocument();
expect(exportListSpy).toHaveBeenCalledTimes(1);
expect(exportListSpy).toHaveBeenCalledWith(
+ {},
{
- fuzzy_search_operate_user_name: ''
- },
- {
+ paramsSerializer: expect.any(Function),
responseType: 'blob'
}
);
@@ -201,10 +183,10 @@ describe('sqle/OperationRecord/List', () => {
expect(exportListSpy).toHaveBeenCalledTimes(1);
expect(exportListSpy).toHaveBeenCalledWith(
{
- fuzzy_search_operate_user_name: '',
filter_operate_project_name: mockProjectInfo.projectName
},
{
+ paramsSerializer: expect.any(Function),
responseType: 'blob'
}
);
diff --git a/packages/sqle/src/page/OperationRecord/List/index.tsx b/packages/sqle/src/page/OperationRecord/List/index.tsx
index 16b577fc0a..fce004ef69 100644
--- a/packages/sqle/src/page/OperationRecord/List/index.tsx
+++ b/packages/sqle/src/page/OperationRecord/List/index.tsx
@@ -1,12 +1,12 @@
-import { useMemo } from 'react';
+import { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Space, message } from 'antd';
import { useRequest, useBoolean } from 'ahooks';
-import { BasicButton, PageHeader } from '@actiontech/dms-kit';
+import { BasicButton, PageHeader, paramsSerializer } from '@actiontech/shared';
import operationRecord from '@actiontech/shared/lib/api/base/service/OperationRecord';
import {
- IGetOperationRecordListV1Params,
- IGetExportOperationRecordListV1Params
+ IGetExportOperationRecordListV1Params,
+ IGetOperationRecordListV1Params
} from '@actiontech/shared/lib/api/sqle/service/OperationRecord/index.d';
import { IOperationRecordListItem } from '@actiontech/shared/lib/api/base/service/common';
import {
@@ -17,22 +17,99 @@ import {
useTableFilterContainer,
FilterCustomProps,
TableToolbar
-} from '@actiontech/dms-kit/es/components/ActiontechTable';
+} from '@actiontech/shared/lib/components/ActiontechTable';
+import { mergeFilterButtonMeta } from '@actiontech/shared/lib/components/ActiontechTable/hooks/useTableFilterContainer';
import {
useCurrentProject,
useCurrentUser
} from '@actiontech/shared/lib/features';
import {
- OperationRecordListColumn,
- OperationRecordListFilterParamType
+ createOperationRecordListColumns,
+ OperationRecordListFilterParamType,
+ operationRecordStatusFilterOptions
} from './column';
import { ResponseCode } from '../../../data/common';
import { DownArrowLineOutlined } from '@actiontech/icons';
+import useOperationTypeName from '../../../hooks/useOperationTypeName';
+import useOperationActions from '../../../hooks/useOperationActions';
+import useOperationUserNames from '../../../hooks/useOperationUserNames';
+
+const normalizeArray = (value?: string | string[]) => {
+ if (!value) {
+ return undefined;
+ }
+ if (Array.isArray(value)) {
+ return value.length ? value : undefined;
+ }
+ return [value];
+};
+
+export const buildOperationRecordFilterParams = (
+ tableFilterInfo: OperationRecordListFilterParamType,
+ searchKeyword?: string,
+ projectName?: string
+): IGetExportOperationRecordListV1Params => {
+ const params: IGetExportOperationRecordListV1Params = {
+ ...tableFilterInfo,
+ filter_operate_type_names: normalizeArray(
+ tableFilterInfo.filter_operate_type_names
+ ),
+ filter_operate_actions: normalizeArray(
+ tableFilterInfo.filter_operate_actions
+ ),
+ filter_fuzzy_operate_user_name:
+ tableFilterInfo.filter_fuzzy_operate_user_name || undefined
+ };
+
+ if (searchKeyword) {
+ params.fuzzy_search_operate_user_name = searchKeyword;
+ params.fuzzy_search_operate_content = searchKeyword;
+ }
+
+ delete (params as Record).filter_operate_user_names;
+
+ if (projectName) {
+ params.filter_operate_project_name = projectName;
+ }
+
+ return params;
+};
+
+const buildOperationRecordListParams = (
+ pagination: { page_index: number; page_size: number },
+ tableFilterInfo: OperationRecordListFilterParamType,
+ searchKeyword?: string,
+ projectName?: string
+): IGetOperationRecordListV1Params => {
+ return {
+ ...buildOperationRecordFilterParams(
+ tableFilterInfo,
+ searchKeyword,
+ projectName
+ ),
+ ...pagination
+ };
+};
+
const OperationRecordList: React.FC = () => {
const { t } = useTranslation();
+
const [messageApi, contextHolder] = message.useMessage();
const { projectName } = useCurrentProject();
- const { bindProjects, userRoles } = useCurrentUser();
+ const { bindProjects } = useCurrentUser();
+ const [currentOperationTypeName, setCurrentOperationTypeName] = useState<
+ string | string[] | undefined
+ >();
+
+ const {
+ operationTypeNameOptions,
+ operationTypeDescMap,
+ updateOperationTypeNameList
+ } = useOperationTypeName();
+ const { operationActionOptions, updateOperationActions } =
+ useOperationActions();
+ const { operationUserNameOptions, updateOperationUserNameList } =
+ useOperationUserNames(projectName);
const [
exportButtonEnableStatus,
@@ -51,55 +128,36 @@ const OperationRecordList: React.FC = () => {
IOperationRecordListItem,
OperationRecordListFilterParamType
>();
+
const { requestErrorMessage, handleTableRequestError } =
useTableRequestError();
+
const {
data: operationRecordList,
loading,
refresh
} = useRequest(
() => {
- const params: IGetOperationRecordListV1Params = {
- ...pagination,
- ...tableFilterInfo,
- fuzzy_search_operate_user_name: searchKeyword
- };
- if (!!projectName) {
- params.filter_operate_project_name = projectName;
- }
+ const params = buildOperationRecordListParams(
+ pagination,
+ tableFilterInfo,
+ searchKeyword,
+ projectName
+ );
return handleTableRequestError(
- operationRecord.GetOperationRecordList(params)
+ operationRecord.GetOperationRecordList(params, { paramsSerializer })
);
},
{
- refreshDeps: [pagination, tableFilterInfo]
+ refreshDeps: [pagination, tableFilterInfo, searchKeyword, projectName]
}
);
+
+ const columns = useMemo(() => {
+ return createOperationRecordListColumns(operationTypeDescMap, !projectName);
+ }, [operationTypeDescMap, projectName]);
+
const filterCustomProps = useMemo(() => {
- let operationOptions;
- if (
- userRoles.admin ||
- userRoles.auditAdministrator ||
- userRoles.systemAdministrator
- ) {
- operationOptions = [
- {
- label: t('operationRecord.list.filterForm.globalOperation'),
- value: ''
- },
- ...bindProjects.map((v) => ({
- label: v.project_name,
- value: v.project_name
- }))
- ];
- } else {
- operationOptions = bindProjects
- .filter((i) => i.is_manager)
- .map((v) => ({
- label: v.project_name,
- value: v.project_name
- }));
- }
return new Map([
[
'operation_time',
@@ -107,26 +165,94 @@ const OperationRecordList: React.FC = () => {
showTime: true
}
],
+ [
+ 'operation_user',
+ {
+ options: operationUserNameOptions,
+ showSearch: true
+ }
+ ],
+ [
+ 'operation_type_name',
+ {
+ options: operationTypeNameOptions,
+ mode: 'multiple',
+ onChange: (value: unknown) => {
+ setCurrentOperationTypeName(value as string | string[]);
+ updateTableFilterInfo((filterInfo) => ({
+ ...filterInfo,
+ filter_operate_actions: undefined
+ }));
+ }
+ }
+ ],
+ [
+ 'operation_content',
+ {
+ options: operationActionOptions(
+ currentOperationTypeName,
+ operationTypeDescMap
+ ),
+ mode: 'multiple'
+ }
+ ],
[
'project_name',
{
- options: operationOptions
+ options: [
+ {
+ label: t('operationRecord.list.filterForm.globalOperation'),
+ value: ''
+ },
+ ...bindProjects.map((v) => ({
+ label: v.project_name,
+ value: v.project_name
+ }))
+ ]
+ }
+ ],
+ [
+ 'status',
+ {
+ options: operationRecordStatusFilterOptions
}
]
]);
- }, [bindProjects, t, userRoles]);
+ }, [
+ bindProjects,
+ currentOperationTypeName,
+ operationActionOptions,
+ operationTypeDescMap,
+ operationTypeNameOptions,
+ operationUserNameOptions,
+ t,
+ updateTableFilterInfo
+ ]);
- const columns = useMemo(() => {
- if (!!projectName) {
- return OperationRecordListColumn.filter(
- (column) => column.dataIndex !== 'project_name'
- );
- }
- return OperationRecordListColumn;
- }, [projectName]);
+ const {
+ filterButtonMeta,
+ filterContainerMeta,
+ updateAllSelectedFilterItem,
+ updateFilterButtonMeta
+ } = useTableFilterContainer(columns, updateTableFilterInfo);
- const { filterButtonMeta, filterContainerMeta, updateAllSelectedFilterItem } =
- useTableFilterContainer(columns, updateTableFilterInfo);
+ useEffect(() => {
+ const meta = mergeFilterButtonMeta(columns);
+ meta.forEach((value, key) => {
+ meta.set(key, { ...value, checked: true });
+ });
+ updateFilterButtonMeta(meta);
+ }, [columns, updateFilterButtonMeta]);
+
+ useEffect(() => {
+ updateOperationTypeNameList();
+ updateOperationActions();
+ updateOperationUserNameList();
+ }, [
+ updateOperationActions,
+ updateOperationTypeNameList,
+ updateOperationUserNameList
+ ]);
const onExport = () => {
startExport();
@@ -134,15 +260,14 @@ const OperationRecordList: React.FC = () => {
t('operationRecord.list.exporting'),
0
);
- const param: IGetExportOperationRecordListV1Params = {
- ...tableFilterInfo,
- fuzzy_search_operate_user_name: searchKeyword
- };
- if (!!projectName) {
- param.filter_operate_project_name = projectName;
- }
+ const param = buildOperationRecordFilterParams(
+ tableFilterInfo,
+ searchKeyword,
+ projectName
+ );
operationRecord
.ExportOperationRecordList(param, {
+ paramsSerializer,
responseType: 'blob'
})
.then((res) => {
@@ -155,6 +280,7 @@ const OperationRecordList: React.FC = () => {
finishExport();
});
};
+
return (
{contextHolder}
@@ -178,18 +304,16 @@ const OperationRecordList: React.FC = () => {
}
/>
{
refreshBySearchKeyword();
@@ -217,4 +341,5 @@ const OperationRecordList: React.FC = () => {
);
};
+
export default OperationRecordList;
diff --git a/packages/sqle/src/page/OperationRecord/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/OperationRecord/__snapshots__/index.test.tsx.snap
index fd6f092cba..8aec32db0f 100644
--- a/packages/sqle/src/page/OperationRecord/__snapshots__/index.test.tsx.snap
+++ b/packages/sqle/src/page/OperationRecord/__snapshots__/index.test.tsx.snap
@@ -22,7 +22,7 @@ exports[`slqe/OperationRecord should render operation record list 1`] = `
class="ant-space-item"
>
@@ -66,11 +65,12 @@ exports[`slqe/OperationRecord should render operation record list 1`] = `
>
@@ -103,7 +103,6 @@ exports[`slqe/OperationRecord should render operation record list 1`] = `
>
@@ -113,7 +112,7 @@ exports[`slqe/OperationRecord should render operation record list 1`] = `
class="ant-space-item"
>
@@ -124,20 +123,21 @@ exports[`slqe/OperationRecord should render operation record list 1`] = `
class="ant-space-item"
style="margin-right: 2px;"
>
- 筛选
+ 收起筛选
@@ -158,8 +158,7 @@ exports[`slqe/OperationRecord should render operation record list 1`] = `
class="ant-space-item"
>
@@ -184,40 +182,349 @@ exports[`slqe/OperationRecord should render operation record list 1`] = `
-
+
+
+
+
+
+
-
+
+
+
+ 操作人
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 操作类型
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 操作内容
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 状态
+
+
+ 请选择{{name}}
+
+
+
+
+
+
+
diff --git a/packages/sqle/src/page/OperationRecord/index.test.tsx b/packages/sqle/src/page/OperationRecord/index.test.tsx
index 9332bac567..8aa84145ec 100644
--- a/packages/sqle/src/page/OperationRecord/index.test.tsx
+++ b/packages/sqle/src/page/OperationRecord/index.test.tsx
@@ -1,4 +1,4 @@
-import { screen, cleanup } from '@testing-library/react';
+import { screen, cleanup, act } from '@testing-library/react';
import { superRender } from '@actiontech/shared/lib/testUtil/superRender';
import operationRecord from '@actiontech/shared/lib/testUtil/mockApi/sqle/operationRecord';
import { mockUseCurrentProject } from '@actiontech/shared/lib/testUtil/mockHook/mockUseCurrentProject';
@@ -9,6 +9,7 @@ describe('slqe/OperationRecord', () => {
let operationRecordListSpy: jest.SpyInstance;
beforeEach(() => {
jest.useFakeTimers();
+ operationRecord.mockAllApi();
operationRecordListSpy = operationRecord.getOperationRecordList();
mockUseCurrentProject();
mockUseCurrentUser();
@@ -21,6 +22,7 @@ describe('slqe/OperationRecord', () => {
test('should render operation record list', async () => {
const { baseElement } = superRender(
);
+ await act(async () => jest.advanceTimersByTime(3000));
expect(baseElement).toMatchSnapshot();
expect(operationRecordListSpy).toHaveBeenCalledTimes(1);
expect(screen.getByText('导出')).toBeInTheDocument();