From f24dd43f43a2be1250cd7ff01036ce6a0406e5cd Mon Sep 17 00:00:00 2001
From: WinfredLIN
Date: Fri, 17 Jul 2026 16:34:39 +0800
Subject: [PATCH 1/6] chore(api): sync SQLE clients for source_extra and
blacklist
Regenerate SqlManage/common types for source_extra and extra_filters, and align blacklist callers with the updated enums.
Co-authored-by: Cursor
---
.../lib/api/sqle/service/SqlManage/index.d.ts | 10 ++--
.../api/sqle/service/SqlManage/index.enum.ts | 16 ------
.../lib/api/sqle/service/blacklist/index.d.ts | 18 +-----
.../api/sqle/service/blacklist/index.enum.ts | 4 +-
.../lib/api/sqle/service/blacklist/index.ts | 20 -------
.../shared/lib/api/sqle/service/common.d.ts | 56 +++++++++++--------
.../lib/api/sqle/service/common.enum.ts | 12 +---
.../sqle/src/page/RuleException/index.data.ts | 3 +-
.../page/SqlManagementException/index.data.ts | 3 -
9 files changed, 46 insertions(+), 96 deletions(-)
diff --git a/packages/shared/lib/api/sqle/service/SqlManage/index.d.ts b/packages/shared/lib/api/sqle/service/SqlManage/index.d.ts
index 962de9b72e..4da46a09d2 100644
--- a/packages/shared/lib/api/sqle/service/SqlManage/index.d.ts
+++ b/packages/shared/lib/api/sqle/service/SqlManage/index.d.ts
@@ -8,14 +8,12 @@ import {
exportSqlManageV1FilterSourceEnum,
exportSqlManageV1FilterAuditLevelEnum,
exportSqlManageV1FilterStatusEnum,
- exportSqlManageV1SortFieldEnum,
exportSqlManageV1SortOrderEnum,
exportSqlManageRemediationV1ExportScopeEnum,
GetSqlManageListV2FilterSourceEnum,
GetSqlManageListV2FilterAuditLevelEnum,
GetSqlManageListV2FilterStatusEnum,
GetSqlManageListV2FilterPriorityEnum,
- GetSqlManageListV2SortFieldEnum,
GetSqlManageListV2SortOrderEnum
} from './index.enum';
@@ -103,9 +101,11 @@ export interface IExportSqlManageV1Params {
fuzzy_search_schema_name?: string;
- sort_field?: exportSqlManageV1SortFieldEnum;
+ sort_field?: string;
sort_order?: exportSqlManageV1SortOrderEnum;
+
+ extra_filters?: string;
}
export interface IExportSqlManageRemediationV1Params {
@@ -176,10 +176,12 @@ export interface IGetSqlManageListV2Params {
fuzzy_search_schema_name?: string;
- sort_field?: GetSqlManageListV2SortFieldEnum;
+ sort_field?: string;
sort_order?: GetSqlManageListV2SortOrderEnum;
+ extra_filters?: string;
+
page_index: number;
page_size: number;
diff --git a/packages/shared/lib/api/sqle/service/SqlManage/index.enum.ts b/packages/shared/lib/api/sqle/service/SqlManage/index.enum.ts
index 9a43d3ba1c..438f4022a0 100644
--- a/packages/shared/lib/api/sqle/service/SqlManage/index.enum.ts
+++ b/packages/shared/lib/api/sqle/service/SqlManage/index.enum.ts
@@ -72,14 +72,6 @@ export enum exportSqlManageV1FilterStatusEnum {
manual_audited = 'manual_audited'
}
-export enum exportSqlManageV1SortFieldEnum {
- first_appear_timestamp = 'first_appear_timestamp',
-
- last_receive_timestamp = 'last_receive_timestamp',
-
- fp_count = 'fp_count'
-}
-
export enum exportSqlManageV1SortOrderEnum {
asc = 'asc',
@@ -126,14 +118,6 @@ export enum GetSqlManageListV2FilterPriorityEnum {
low = 'low'
}
-export enum GetSqlManageListV2SortFieldEnum {
- first_appear_timestamp = 'first_appear_timestamp',
-
- last_receive_timestamp = 'last_receive_timestamp',
-
- fp_count = 'fp_count'
-}
-
export enum GetSqlManageListV2SortOrderEnum {
asc = 'asc',
diff --git a/packages/shared/lib/api/sqle/service/blacklist/index.d.ts b/packages/shared/lib/api/sqle/service/blacklist/index.d.ts
index 893a3643b7..c45526af34 100644
--- a/packages/shared/lib/api/sqle/service/blacklist/index.d.ts
+++ b/packages/shared/lib/api/sqle/service/blacklist/index.d.ts
@@ -3,8 +3,6 @@ import { getBlacklistV1FilterTypeEnum } from './index.enum';
import {
IGetBlacklistResV1,
ICreateBlacklistReqV1,
- ICreateBlacklistResV1,
- IGetBlacklistDetailResV1,
IBaseRes,
IUpdateBlacklistReqV1
} from '../common.d';
@@ -16,12 +14,6 @@ export interface IGetBlacklistV1Params {
fuzzy_search_content?: string;
- filter_created_by?: string;
-
- filter_created_at_from?: string;
-
- filter_created_at_to?: string;
-
page_index: string;
page_size: string;
@@ -33,15 +25,7 @@ export interface ICreateBlacklistV1Params extends ICreateBlacklistReqV1 {
project_name: string;
}
-export interface ICreateBlacklistV1Return extends ICreateBlacklistResV1 {}
-
-export interface IGetBlacklistByIDV1Params {
- project_name: string;
-
- blacklist_id: string;
-}
-
-export interface IGetBlacklistByIDV1Return extends IGetBlacklistDetailResV1 {}
+export interface ICreateBlacklistV1Return extends IBaseRes {}
export interface IDeleteBlackListParams {
project_name: string;
diff --git a/packages/shared/lib/api/sqle/service/blacklist/index.enum.ts b/packages/shared/lib/api/sqle/service/blacklist/index.enum.ts
index df55663b14..1a18e969ea 100644
--- a/packages/shared/lib/api/sqle/service/blacklist/index.enum.ts
+++ b/packages/shared/lib/api/sqle/service/blacklist/index.enum.ts
@@ -11,7 +11,5 @@ export enum getBlacklistV1FilterTypeEnum {
host = 'host',
- instance = 'instance',
-
- db_user = 'db_user'
+ instance = 'instance'
}
diff --git a/packages/shared/lib/api/sqle/service/blacklist/index.ts b/packages/shared/lib/api/sqle/service/blacklist/index.ts
index 2b727323de..6725a8eb7d 100644
--- a/packages/shared/lib/api/sqle/service/blacklist/index.ts
+++ b/packages/shared/lib/api/sqle/service/blacklist/index.ts
@@ -11,8 +11,6 @@ import {
IGetBlacklistV1Return,
ICreateBlacklistV1Params,
ICreateBlacklistV1Return,
- IGetBlacklistByIDV1Params,
- IGetBlacklistByIDV1Return,
IDeleteBlackListParams,
IDeleteBlackListReturn,
IUpdateBlacklistV1Params,
@@ -50,24 +48,6 @@ class BlacklistService extends ServiceBase {
);
}
- public getBlacklistByIDV1(
- params: IGetBlacklistByIDV1Params,
- options?: AxiosRequestConfig
- ) {
- const paramsData = this.cloneDeep(params);
- const project_name = paramsData.project_name;
- delete paramsData.project_name;
-
- const blacklist_id = paramsData.blacklist_id;
- delete paramsData.blacklist_id;
-
- return this.get(
- `/v1/projects/${project_name}/blacklist/${blacklist_id}`,
- paramsData,
- options
- );
- }
-
public deleteBlackList(
params: IDeleteBlackListParams,
options?: AxiosRequestConfig
diff --git a/packages/shared/lib/api/sqle/service/common.d.ts b/packages/shared/lib/api/sqle/service/common.d.ts
index 3d2edf02cf..dd3ae618f7 100644
--- a/packages/shared/lib/api/sqle/service/common.d.ts
+++ b/packages/shared/lib/api/sqle/service/common.d.ts
@@ -438,8 +438,6 @@ export interface IBlacklistResV1 {
content?: string;
- created_at?: string;
-
desc?: string;
last_match_time?: string;
@@ -553,10 +551,6 @@ export interface ICreateAuditWhitelistResV1 {
message?: string;
}
-export interface ICreateBlacklistDataV1 {
- blacklist_id?: number;
-}
-
export interface ICreateBlacklistReqV1 {
content?: string;
@@ -565,14 +559,6 @@ export interface ICreateBlacklistReqV1 {
type?: CreateBlacklistReqV1TypeEnum;
}
-export interface ICreateBlacklistResV1 {
- code?: number;
-
- data?: ICreateBlacklistDataV1;
-
- message?: string;
-}
-
export interface ICreateCustomRuleReqV1 {
annotation?: string;
@@ -995,14 +981,6 @@ export interface IGetAuditWhitelistResV1 {
total_nums?: number;
}
-export interface IGetBlacklistDetailResV1 {
- code?: number;
-
- data?: IBlacklistResV1;
-
- message?: string;
-}
-
export interface IGetBlacklistResV1 {
code?: number;
@@ -1460,6 +1438,8 @@ export interface IGetSqlManageListResp {
message?: string;
+ source_extra?: ISourceExtra;
+
sql_manage_bad_num?: number;
sql_manage_optimized_num?: number;
@@ -3527,6 +3507,38 @@ export interface IRuleTemplateV2 {
name?: string;
}
+export interface ISourceExtra {
+ enabled?: boolean;
+
+ filter_meta_list?: IFilterMeta[];
+
+ head?: ISourceExtraHead[];
+
+ rows?: ISourceExtraRow[];
+
+ source?: string;
+
+ source_desc?: string;
+}
+
+export interface ISourceExtraHead {
+ desc?: string;
+
+ name?: string;
+
+ sortable?: boolean;
+
+ type?: string;
+}
+
+export interface ISourceExtraRow {
+ id?: number;
+
+ values?: {
+ [key: string]: string;
+ };
+}
+
export interface ITaskAnalysisDataV2 {
performance_statistics?: IPerformanceStatistics;
diff --git a/packages/shared/lib/api/sqle/service/common.enum.ts b/packages/shared/lib/api/sqle/service/common.enum.ts
index 08431fe272..d73f93382e 100644
--- a/packages/shared/lib/api/sqle/service/common.enum.ts
+++ b/packages/shared/lib/api/sqle/service/common.enum.ts
@@ -119,9 +119,7 @@ export enum BlacklistResV1TypeEnum {
host = 'host',
- instance = 'instance',
-
- db_user = 'db_user'
+ instance = 'instance'
}
export enum CreateAuditTaskReqV1ExecModeEnum {
@@ -147,9 +145,7 @@ export enum CreateBlacklistReqV1TypeEnum {
host = 'host',
- instance = 'instance',
-
- db_user = 'db_user'
+ instance = 'instance'
}
export enum CreateCustomRuleReqV1LevelEnum {
@@ -365,9 +361,7 @@ export enum UpdateBlacklistReqV1TypeEnum {
host = 'host',
- instance = 'instance',
-
- db_user = 'db_user'
+ instance = 'instance'
}
export enum UpdateCustomRuleReqV1LevelEnum {
diff --git a/packages/sqle/src/page/RuleException/index.data.ts b/packages/sqle/src/page/RuleException/index.data.ts
index 517beb1acf..fec5b67895 100644
--- a/packages/sqle/src/page/RuleException/index.data.ts
+++ b/packages/sqle/src/page/RuleException/index.data.ts
@@ -228,8 +228,7 @@ export const BASE_MATCH_TYPE_VALUES = [
CreateBlacklistReqV1TypeEnum.ip,
CreateBlacklistReqV1TypeEnum.cidr,
CreateBlacklistReqV1TypeEnum.host,
- CreateBlacklistReqV1TypeEnum.instance,
- CreateBlacklistReqV1TypeEnum.db_user
+ CreateBlacklistReqV1TypeEnum.instance
] as const;
export const EXTENDED_MATCH_CONDITION_TYPES = [
diff --git a/packages/sqle/src/page/SqlManagementException/index.data.ts b/packages/sqle/src/page/SqlManagementException/index.data.ts
index 68b64aa69a..3341184fad 100644
--- a/packages/sqle/src/page/SqlManagementException/index.data.ts
+++ b/packages/sqle/src/page/SqlManagementException/index.data.ts
@@ -13,9 +13,6 @@ export const SqlManagementExceptionMatchTypeDirection: {
[BlacklistResV1TypeEnum.host]: t('sqlManagementException.matchType.host'),
[BlacklistResV1TypeEnum.instance]: t(
'sqlManagementException.matchType.instance'
- ),
- [BlacklistResV1TypeEnum.db_user]: t(
- 'sqlManagementException.matchType.databaseUser'
)
};
From 82fc4d4abb6453ff7f69f41ea54c9623b1479896 Mon Sep 17 00:00:00 2001
From: WinfredLIN
Date: Fri, 17 Jul 2026 16:34:48 +0800
Subject: [PATCH 2/6] feat(table): support dynamic columns and merged filters
Allow ActiontechTable to insert newly appeared columns before the operator column, merge external filter meta, and keep filter UI consistent for source-extra scenarios.
Co-authored-by: Cursor
---
.../lib/components/ActiontechTable/Table.tsx | 16 +-
.../__snapshots__/index.test.tsx.snap | 20 +-
.../components/ColumnsItems.tsx | 10 +-
.../components/FilterButton.tsx | 47 ++--
.../ActiontechTable/components/style.ts | 19 +-
.../__snapshots__/ColumnsItems.test.tsx.snap | 14 +-
.../ColumnsSetting.test.tsx.snap | 10 +-
.../__snapshots__/FilterButton.test.tsx.snap | 124 +++++----
.../hooks/useTableFilterContainer.tsx | 12 +-
.../hooks/useTableSettings.tsx | 243 ++++++++++++++++--
.../components/ActiontechTable/index.type.ts | 18 +-
.../lib/components/ActiontechTable/style.tsx | 21 ++
.../__snapshots__/index.test.tsx.snap | 8 +-
packages/shared/lib/locale/en-US/common.ts | 3 +-
packages/shared/lib/locale/zh-CN/common.ts | 3 +-
15 files changed, 428 insertions(+), 140 deletions(-)
diff --git a/packages/shared/lib/components/ActiontechTable/Table.tsx b/packages/shared/lib/components/ActiontechTable/Table.tsx
index 5341c81ca9..94efc0d770 100644
--- a/packages/shared/lib/components/ActiontechTable/Table.tsx
+++ b/packages/shared/lib/components/ActiontechTable/Table.tsx
@@ -22,6 +22,7 @@ const ActiontechTable = <
filterContainerProps,
columns = [],
isPaginationFixed = true,
+ disableRowHover = false,
...props
}: ActiontechTableProps) => {
const { t } = useTranslation();
@@ -47,11 +48,14 @@ const ActiontechTable = <
return mergerColumns;
}
return mergerColumns
- .filter((v) => localColumns?.[v.dataIndex]?.show)
- .map((v) => ({
+ .filter((v) => localColumns?.[v.dataIndex]?.show ?? true)
+ .map((v, index) => ({
...v,
- fixed: localColumns?.[v.dataIndex]?.fixed,
- order: localColumns?.[v.dataIndex]?.order
+ fixed: localColumns?.[v.dataIndex]
+ ? localColumns[v.dataIndex].fixed
+ : v.fixed,
+ // 尚未写入 localStorage 的动态列沿用 mergerColumns 下标,避免 order 为 0 被排到最前
+ order: localColumns?.[v.dataIndex]?.order ?? index + 1
}))
.sort((prev, current) => prev.order - current.order);
}, [localColumns, mergerColumns, props.setting]);
@@ -73,7 +77,9 @@ const ActiontechTable = <
>({
-
+
- {getColumnsLabel(data.title)}
+ {data.settingMarked ? (
+
+ {getColumnsLabel(data.title)}
+
+ ) : (
+ getColumnsLabel(data.title)
+ )}
diff --git a/packages/shared/lib/components/ActiontechTable/components/FilterButton.tsx b/packages/shared/lib/components/ActiontechTable/components/FilterButton.tsx
index ef25536833..bff78cc991 100644
--- a/packages/shared/lib/components/ActiontechTable/components/FilterButton.tsx
+++ b/packages/shared/lib/components/ActiontechTable/components/FilterButton.tsx
@@ -2,6 +2,7 @@ import { TableFilterButtonProps } from '../index.type';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import BasicButton from '../../BasicButton';
+import BasicToolTips from '../../BasicToolTips';
import { DownOutlined, UpOutlined } from '@actiontech/icons';
import { ColumnsSettingStyleWrapper } from './style';
@@ -18,27 +19,35 @@ const FilterButton =
>({
);
return (
- updateAllSelectedFilterItem(!hasSelectedFilter)}
- style={{
- padding: '0 6px 0 10px'
- }}
+
-
- {hasSelectedFilter
- ? t('common.actiontechTable.filterButton.clearFilter')
- : t('common.actiontechTable.filterButton.filter')}
+ updateAllSelectedFilterItem(!hasSelectedFilter)}
+ style={{
+ padding: '0 6px 0 10px'
+ }}
+ >
+
+ {hasSelectedFilter
+ ? t('common.actiontechTable.filterButton.clearFilter')
+ : t('common.actiontechTable.filterButton.filter')}
- {hasSelectedFilter ? (
-
- ) : (
-
- )}
-
-
+ {hasSelectedFilter ? (
+
+ ) : (
+
+ )}
+
+
+
);
};
diff --git a/packages/shared/lib/components/ActiontechTable/components/style.ts b/packages/shared/lib/components/ActiontechTable/components/style.ts
index d5260d528e..1e48b70a23 100644
--- a/packages/shared/lib/components/ActiontechTable/components/style.ts
+++ b/packages/shared/lib/components/ActiontechTable/components/style.ts
@@ -30,7 +30,7 @@ export const SearchInputStyleWrapper = styled(BasicInput)`
`;
export const ColumnsSettingDropdownStyleWrapper = styled('div')`
- width: 220px;
+ width: 280px;
background-color: ${({ theme }) =>
theme.sharedTheme.components.columnsSetting.dropdown.backgroundColor};
border-radius: 8px;
@@ -93,6 +93,23 @@ export const ColumnsSettingDropdownStyleWrapper = styled('div')`
theme.sharedTheme.components.columnsSetting.dropdown.item.iconColor};
}
+ .actiontech-table-setting-extra-mark {
+ position: relative;
+ display: inline-block;
+ padding-right: 0.55em;
+ max-width: 100%;
+
+ &::after {
+ content: '*';
+ position: absolute;
+ top: 0.2em;
+ right: 0;
+ font-size: 12px;
+ line-height: 1;
+ color: ${({ theme }) => theme.sharedTheme.uiToken.colorPrimary};
+ }
+ }
+
&-label {
font-weight: 500;
font-size: 13px;
diff --git a/packages/shared/lib/components/ActiontechTable/components/test/__snapshots__/ColumnsItems.test.tsx.snap b/packages/shared/lib/components/ActiontechTable/components/test/__snapshots__/ColumnsItems.test.tsx.snap
index 67cb00f2d6..9e0d285487 100644
--- a/packages/shared/lib/components/ActiontechTable/components/test/__snapshots__/ColumnsItems.test.tsx.snap
+++ b/packages/shared/lib/components/ActiontechTable/components/test/__snapshots__/ColumnsItems.test.tsx.snap
@@ -42,7 +42,7 @@ exports[`lib/ActiontechTable-ColumnsItems render column item left | right 1`] =
-
-
+
-
-
+