From 50aaa2a246c766c0d5f72445fe55cfe214f4f8e2 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:56:37 +0800 Subject: [PATCH 01/21] feat: sync audit plan dual-status and pending audit api types Co-authored-by: Cursor --- .../shared/lib/api/sqle/service/common.d.ts | 27 +++++++++++++++++-- .../lib/api/sqle/service/common.enum.ts | 12 ++++++--- .../service/instance_audit_plan/index.d.ts | 2 +- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/packages/shared/lib/api/sqle/service/common.d.ts b/packages/shared/lib/api/sqle/service/common.d.ts index 8b03d1d1f..bf1f74359 100644 --- a/packages/shared/lib/api/sqle/service/common.d.ts +++ b/packages/shared/lib/api/sqle/service/common.d.ts @@ -24,9 +24,10 @@ import { HighPriorityConditionTypeEnum, HighPriorityConditionReqOperatorEnum, InstanceAuditPlanInfoActiveStatusEnum, + InstanceAuditPlanInfoAuditStatusEnum, + InstanceAuditPlanInfoCollectionStatusEnum, InstanceAuditPlanInfoLastCollectStatusEnum, InstanceAuditPlanInfoNextCollectionModeEnum, - InstanceAuditPlanInfoPipelineStatusEnum, InstanceAuditPlanResV1ActiveStatusEnum, MatchConditionReqV1TypeEnum, OperationRecordListStatusEnum, @@ -895,8 +896,12 @@ export interface IGetAuditPlanSQLDataResV1 { data?: IAuditPlanSQLDataResV1; + has_pending_audit?: boolean; + message?: string; + pending_audit_count?: number; + total_nums?: number; } @@ -1443,8 +1448,12 @@ export interface IGetSqlManageListResp { data?: ISqlManage[]; + has_pending_audit?: boolean; + message?: string; + pending_audit_count?: number; + source_extra?: ISourceExtra; sql_manage_bad_num?: number; @@ -1737,10 +1746,20 @@ export interface IInstanceAuditPlanInfo { audit_plan_type?: IAuditPlanTypeResBase; + audit_status?: InstanceAuditPlanInfoAuditStatusEnum | string; + + can_trigger_collect?: boolean; + + collection_status?: InstanceAuditPlanInfoCollectionStatusEnum | string; + exec_cmd?: string; + execution_node_address?: string | null; + id?: number; + last_audit_finished_at?: string | null; + last_collection_time?: string; last_collect_failure_msg?: string | null; @@ -1760,7 +1779,11 @@ export interface IInstanceAuditPlanInfo { next_collection_time?: string; - pipeline_status?: InstanceAuditPlanInfoPipelineStatusEnum | string; + last_task_updated_at?: string | null; + + pending_audit_count?: number; + + task_running?: boolean; total_sql_nums?: number; diff --git a/packages/shared/lib/api/sqle/service/common.enum.ts b/packages/shared/lib/api/sqle/service/common.enum.ts index 34bd405ba..fea404c98 100644 --- a/packages/shared/lib/api/sqle/service/common.enum.ts +++ b/packages/shared/lib/api/sqle/service/common.enum.ts @@ -240,10 +240,14 @@ export enum InstanceAuditPlanInfoActiveStatusEnum { disabled = 'disabled' } -export enum InstanceAuditPlanInfoPipelineStatusEnum { +export enum InstanceAuditPlanInfoCollectionStatusEnum { idle = 'idle', - collecting = 'collecting', + collecting = 'collecting' +} + +export enum InstanceAuditPlanInfoAuditStatusEnum { + idle = 'idle', pending_audit = 'pending_audit', @@ -345,7 +349,9 @@ export enum ScheduleTaskDefaultOptionDefaultSelectorEnum { } export enum SqlManageAuditStatusEnum { - being_audited = 'being_audited' + pending = 'pending', + + audited = 'audited' } export enum SqlManageStatusEnum { diff --git a/packages/shared/lib/api/sqle/service/instance_audit_plan/index.d.ts b/packages/shared/lib/api/sqle/service/instance_audit_plan/index.d.ts index 3447bd25d..933153173 100644 --- a/packages/shared/lib/api/sqle/service/instance_audit_plan/index.d.ts +++ b/packages/shared/lib/api/sqle/service/instance_audit_plan/index.d.ts @@ -134,7 +134,7 @@ export interface ITriggerAuditPlanCollectV1Params { export interface ITriggerAuditPlanCollectResData { audit_plan_id?: number; - pipeline_status?: string; + collection_status?: string; } export interface ITriggerAuditPlanCollectV1Return extends IBaseRes { From 6aedacb1a4f027ea4e565f8facf682a90a0bb944 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:56:40 +0800 Subject: [PATCH 02/21] feat: add ActiontechTable enableBodyScrollY for fixed horizontal scroll Co-authored-by: Cursor --- .../lib/components/ActiontechTable/Table.tsx | 154 +++++++++++++----- .../components/ActiontechTable/index.type.ts | 6 + 2 files changed, 121 insertions(+), 39 deletions(-) diff --git a/packages/shared/lib/components/ActiontechTable/Table.tsx b/packages/shared/lib/components/ActiontechTable/Table.tsx index 94efc0d77..6194da016 100644 --- a/packages/shared/lib/components/ActiontechTable/Table.tsx +++ b/packages/shared/lib/components/ActiontechTable/Table.tsx @@ -8,7 +8,14 @@ import useTableAction, { ACTIONTECH_TABLE_OPERATOR_COLUMN_DATA_INDEX } from './hooks/useTableAction'; import classnames from 'classnames'; -import { useEffect, useMemo } from 'react'; +import { + useCallback, + useEffect, + useLayoutEffect, + useMemo, + useRef, + useState +} from 'react'; import useTableSettings from './hooks/useTableSettings'; const ActiontechTable = < @@ -23,9 +30,14 @@ const ActiontechTable = < columns = [], isPaginationFixed = true, disableRowHover = false, + enableBodyScrollY = false, + scroll, ...props }: ActiontechTableProps) => { const { t } = useTranslation(); + const tableContainerRef = useRef(null); + const [bodyScrollY, setBodyScrollY] = useState(); + const hasPagination = !!props.pagination; const setting = props.setting ?? (toolbar && toolbar.setting); const { tableName = '', username = '' } = setting || {}; @@ -65,6 +77,103 @@ const ActiontechTable = < catchDefaultColumnsInfo(mergerColumns); } }, [catchDefaultColumnsInfo, mergerColumns, tableName, username]); + + const measureBodyScrollY = useCallback(() => { + if (!enableBodyScrollY || !tableContainerRef.current) { + setBodyScrollY(undefined); + return; + } + const container = tableContainerRef.current; + const tableHeader = container.querySelector('.ant-table-thead'); + const pagination = container.querySelector('.ant-table-pagination'); + const containerTop = container.getBoundingClientRect().top; + const headerHeight = tableHeader?.getBoundingClientRect().height ?? 40; + const paginationHeight = + hasPagination && isPaginationFixed + ? pagination?.getBoundingClientRect().height ?? 60 + : 0; + const nextBodyScrollY = Math.max( + 120, + Math.floor( + window.innerHeight - containerTop - headerHeight - paginationHeight + ) + ); + setBodyScrollY((previous) => + previous === nextBodyScrollY ? previous : nextBodyScrollY + ); + }, [enableBodyScrollY, hasPagination, isPaginationFixed]); + + useLayoutEffect(() => { + measureBodyScrollY(); + }); + + useEffect(() => { + if (!enableBodyScrollY || !tableContainerRef.current) { + return; + } + const observedElements: Element[] = []; + let element: Element | null = tableContainerRef.current; + while (element && observedElements.length < 4) { + observedElements.push(element); + element = element.parentElement; + } + window.addEventListener('resize', measureBodyScrollY); + const resizeObserver = + typeof ResizeObserver !== 'undefined' + ? new ResizeObserver(measureBodyScrollY) + : null; + if (resizeObserver) { + observedElements.forEach((item) => resizeObserver.observe(item)); + } + return () => { + resizeObserver?.disconnect(); + window.removeEventListener('resize', measureBodyScrollY); + }; + }, [enableBodyScrollY, measureBodyScrollY]); + + const tableNode = ( + + ) : undefined + }} + {...props} + scroll={{ + x: 'max-content', + ...scroll, + ...(enableBodyScrollY && bodyScrollY ? { y: bodyScrollY } : {}) + }} + columns={innerColumns} + pagination={ + !props.pagination + ? false + : { + defaultPageSize: 20, + showSizeChanger: true, + showTotal: (total) => ( + + {t('common.actiontechTable.pagination.total', { + total + })} + + ), + className: classnames('actiontech-table-pagination', { + 'actiontech-table-pagination-fixed': isPaginationFixed + }), + ...props.pagination + } + } + /> + ); + return ( <> {toolbar && ( @@ -76,44 +185,11 @@ const ActiontechTable = < {!!filterContainerProps && } - - ) : undefined - }} - scroll={{ - x: 'max-content' - }} - {...props} - columns={innerColumns} - pagination={ - !props.pagination - ? false - : { - defaultPageSize: 20, - showSizeChanger: true, - showTotal: (total) => ( - - {t('common.actiontechTable.pagination.total', { - total - })} - - ), - className: classnames('actiontech-table-pagination', { - 'actiontech-table-pagination-fixed': isPaginationFixed - }), - ...props.pagination - } - } - /> + {enableBodyScrollY ? ( +
{tableNode}
+ ) : ( + tableNode + )}
); diff --git a/packages/shared/lib/components/ActiontechTable/index.type.ts b/packages/shared/lib/components/ActiontechTable/index.type.ts index ad533bcdd..1156b141a 100644 --- a/packages/shared/lib/components/ActiontechTable/index.type.ts +++ b/packages/shared/lib/components/ActiontechTable/index.type.ts @@ -421,4 +421,10 @@ export interface ActiontechTableProps< * 禁用表格行 hover 时的背景色变化(sticky 操作列场景下避免左侧内容透出) */ disableRowHover?: boolean; + + /** + * 将表体限制在当前视口内,使原生横向滚动条保持在固定分页器上方。 + * 默认关闭,仅供需要固定横向滚动条的页面选择开启。 + */ + enableBodyScrollY?: boolean; } From b8cb63bc58510a0715ed8dca1e068dbb6af7b914 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:56:40 +0800 Subject: [PATCH 03/21] chore: mock ResizeObserver in jest-setup for table body scroll Co-authored-by: Cursor --- jest-setup.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jest-setup.ts b/jest-setup.ts index 4fc7df3a2..1ed46171f 100644 --- a/jest-setup.ts +++ b/jest-setup.ts @@ -32,6 +32,17 @@ Object.defineProperty(global, 'matchMedia', { }; } }); + +class ResizeObserverMock { + observe = jest.fn(); + unobserve = jest.fn(); + disconnect = jest.fn(); +} +Object.defineProperty(global, 'ResizeObserver', { + writable: true, + configurable: true, + value: ResizeObserverMock +}); i18n.use(initReactI18next).init({ resources: { 'zh-CN': { From 023f11cbe9e02454da9ae0dfcd9967f022afe660 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:56:41 +0800 Subject: [PATCH 04/21] feat: support normal level in AuditLevelIcon map Co-authored-by: Cursor --- .../src/components/AuditResultMessage/AuditLevelIcon.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/sqle/src/components/AuditResultMessage/AuditLevelIcon.tsx b/packages/sqle/src/components/AuditResultMessage/AuditLevelIcon.tsx index f199c5ca1..08133b73b 100644 --- a/packages/sqle/src/components/AuditResultMessage/AuditLevelIcon.tsx +++ b/packages/sqle/src/components/AuditResultMessage/AuditLevelIcon.tsx @@ -3,17 +3,19 @@ import { Space } from 'antd'; import { WarningFilled, InfoHexagonFilled, - CloseCircleFilled + CloseCircleFilled, + ProfileSquareFilled } from '@actiontech/icons'; -/** 与 AuditLevelSummary / 列表「当前审核结果」列同源 */ +/** 与 AuditLevelSummary / 列表「当前审核结果」列 / 规则列表 level-icon 同源 */ export const AUDIT_LEVEL_ICON_MAP: Record< string, FC<{ width?: number; height?: number }> > = { error: CloseCircleFilled, warn: WarningFilled, - notice: InfoHexagonFilled + notice: InfoHexagonFilled, + normal: ProfileSquareFilled }; export type AuditLevelIconProps = { From ec0d70ae6366d2319fe5e20969f6a4bbf79b86b8 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:57:05 +0800 Subject: [PATCH 05/21] feat: show overview dual collect-audit status with hover and can_trigger_collect Co-authored-by: Cursor --- .../sqle/src/locale/en-US/managementConf.ts | 30 ++- .../sqle/src/locale/zh-CN/managementConf.ts | 30 ++- .../Detail/Overview/column.tsx | 181 ++++++++++++++---- .../mockApi/instanceAuditPlan/data.ts | 23 ++- 4 files changed, 205 insertions(+), 59 deletions(-) diff --git a/packages/sqle/src/locale/en-US/managementConf.ts b/packages/sqle/src/locale/en-US/managementConf.ts index ca23e1ab5..d2dcf767d 100644 --- a/packages/sqle/src/locale/en-US/managementConf.ts +++ b/packages/sqle/src/locale/en-US/managementConf.ts @@ -113,7 +113,7 @@ export default { exportRemediationReport: 'Export SQL remediation report', exportDataSourceRemediationReport: 'Export data source remediation report', auditImmediately: 'Audit immediately', - auditImmediatelySuccessTips: 'Audit successfully', + auditImmediatelySuccessTips: 'Audit triggered', exportTips: 'Exporting scan task details', remediationExport: 'SQL remediation', remediationExportTips: 'Exporting SQL management remediation report', @@ -131,14 +131,23 @@ export default { normal: 'Enabled', disabled: 'Disabled' }, - pipelineStatus: { - title: 'Current stage', + taskStatus: { + title: 'Execution status', headerTips: - 'Where this scan type is in the collect–audit flow.\n\n• Idle: not collecting/auditing; can Collect now or wait for schedule\n• Collecting: in progress; Collect now disabled until finished\n• Pending audit: data collected; awaiting audit; Collect now allowed\n• Auditing: audit in progress; Collect now allowed', - idle: 'Idle', - collecting: 'Collecting', - pendingAudit: 'Pending audit', - auditing: 'Auditing' + 'Collection and audit are independent and may both be in progress. Hover to view the current status and update time.', + collection: { + collecting: 'Collecting', + completed: 'Collection completed' + }, + audit: { + pendingAudit: 'Pending audit', + auditing: 'Auditing', + completed: 'Audit completed' + }, + currentStatus: 'Current status: {{value}}', + executionNode: 'Execution node: {{value}}', + updatedAt: 'Updated at: {{value}}', + statusSeparator: ', ' }, nextCollectionTime: { title: 'Next collection time', @@ -172,9 +181,9 @@ export default { deleteConfirmTips: 'After deleting, intelligent scan data of this type will no longer be retained, confirm delete?', triggerCollect: 'Collect now', - triggerCollectSuccessTips: 'Collection triggered', + triggerCollectSuccessTips: 'Collect now triggered', triggerCollectDisabledTips: 'Please enable first', - triggerCollectCollectingTips: 'Collecting in progress' + triggerCollectCollectingTips: 'Collection is in progress' } }, scanTypeSqlCollection: { @@ -199,6 +208,7 @@ export default { auditStatus: 'Audit status', firstAuditResult: 'Initial audit result', currentAuditResult: 'Current audit result', + pendingAudit: 'Pending audit', audited: 'Audited', explanation: { text: 'Explanation', diff --git a/packages/sqle/src/locale/zh-CN/managementConf.ts b/packages/sqle/src/locale/zh-CN/managementConf.ts index b7237ebd7..cbc215251 100644 --- a/packages/sqle/src/locale/zh-CN/managementConf.ts +++ b/packages/sqle/src/locale/zh-CN/managementConf.ts @@ -109,7 +109,7 @@ export default { exportRemediationReport: '导出SQL管控整改报表', exportDataSourceRemediationReport: '导出该数据源整改报表', auditImmediately: '立即审核', - auditImmediatelySuccessTips: '审核成功', + auditImmediatelySuccessTips: '已触发审核', exportTips: '正在导出扫描任务详情', remediationExport: 'SQL 管控整改', remediationExportTips: '正在导出 SQL 管控整改报表', @@ -126,14 +126,23 @@ export default { normal: '已启用', disabled: '已停用' }, - pipelineStatus: { - title: '当前环节', + taskStatus: { + title: '执行状态', headerTips: - '表示当前采集与审核进行到哪一步。\n\n• 空闲:未在采集/审核,可立即采集或等待下次调度\n• 采集中:正在采集,不可再次立即采集;结束后进入空闲或待审核\n• 待审核:本轮已采到数据,等待审核;仍可立即采集\n• 审核中:正在审核;仍可立即采集', - idle: '空闲', - collecting: '采集中', - pendingAudit: '待审核', - auditing: '审核中' + '采集与审核状态相互独立,可同时显示“采集中”和“审核中”。悬停查看当前状态和更新时间。', + collection: { + collecting: '采集中', + completed: '采集完成' + }, + audit: { + pendingAudit: '待审核', + auditing: '审核中', + completed: '审核完成' + }, + currentStatus: '当前状态:{{value}}', + executionNode: '执行节点:{{value}}', + updatedAt: '更新时间:{{value}}', + statusSeparator: '、' }, nextCollectionTime: { title: '下次采集时间', @@ -167,9 +176,9 @@ export default { deleteConfirmTips: '删除后该类型智能扫描数据将不再被保留,是否确认删除?', triggerCollect: '立即采集', - triggerCollectSuccessTips: '已触发采集', + triggerCollectSuccessTips: '已触发立即采集', triggerCollectDisabledTips: '请先启用', - triggerCollectCollectingTips: '正在采集中' + triggerCollectCollectingTips: '正在采集,请等待' } }, scanTypeSqlCollection: { @@ -194,6 +203,7 @@ export default { auditStatus: '审核状态', firstAuditResult: '最初审核结果', currentAuditResult: '当前审核结果', + pendingAudit: '待审核', audited: '已审核', explanation: { text: '说明', diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx index e5fb21d9d..167e7f268 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx @@ -5,11 +5,12 @@ import { import { t } from '../../../../locale'; import { formatTime } from '@actiontech/shared/lib/utils/Common'; import { IInstanceAuditPlanInfo } from '@actiontech/shared/lib/api/sqle/service/common'; -import { BasicToolTips, TokenCom } from '@actiontech/shared'; +import { BasicTag, BasicToolTips, TokenCom } from '@actiontech/shared'; import { InstanceAuditPlanInfoActiveStatusEnum, - InstanceAuditPlanInfoNextCollectionModeEnum, - InstanceAuditPlanInfoPipelineStatusEnum + InstanceAuditPlanInfoAuditStatusEnum, + InstanceAuditPlanInfoCollectionStatusEnum, + InstanceAuditPlanInfoNextCollectionModeEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; import { Link } from 'react-router-dom'; import { TableColumnWithIconStyleWrapper } from '@actiontech/shared/lib/styleWrapper/element'; @@ -18,7 +19,7 @@ import { CloseHexagonOutlined, InfoHexagonOutlined } from '@actiontech/icons'; -import { Typography } from 'antd'; +import { Popover, Space, Typography } from 'antd'; import LastCollectResultCell from './LastCollectResultCell'; const renderColumnHeaderTip = (title: string, tip: string) => ( @@ -31,25 +32,136 @@ const renderColumnHeaderTip = (title: string, tip: string) => ( ); -const renderPipelineStatus = (status?: string) => { - switch (status) { - case InstanceAuditPlanInfoPipelineStatusEnum.collecting: - return t( - 'managementConf.detail.overview.column.pipelineStatus.collecting' - ); - case InstanceAuditPlanInfoPipelineStatusEnum.pending_audit: - return t( - 'managementConf.detail.overview.column.pipelineStatus.pendingAudit' - ); - case InstanceAuditPlanInfoPipelineStatusEnum.auditing: - return t('managementConf.detail.overview.column.pipelineStatus.auditing'); - case InstanceAuditPlanInfoPipelineStatusEnum.idle: - case undefined: - case '': - return t('managementConf.detail.overview.column.pipelineStatus.idle'); - default: - return t('managementConf.detail.overview.column.pipelineStatus.idle'); +type TaskStatusItem = { + key: 'collection' | 'audit'; + color: 'blue' | 'green' | 'orange'; + text: string; +}; + +const isCollectingStatus = (record: IInstanceAuditPlanInfo) => + record.collection_status === + InstanceAuditPlanInfoCollectionStatusEnum.collecting; + +const hasPendingAuditBacklog = (record: IInstanceAuditPlanInfo) => + (record.pending_audit_count ?? 0) > 0 || + record.audit_status === InstanceAuditPlanInfoAuditStatusEnum.pending_audit || + record.audit_status === 'pending'; + +/** 采集/审核双 Tag 与 Hover「当前状态」共用,避免展示漂移 */ +const getTaskStatusItems = ( + record: IInstanceAuditPlanInfo +): TaskStatusItem[] => { + const items: TaskStatusItem[] = []; + const collecting = isCollectingStatus(record); + + if (collecting) { + items.push({ + key: 'collection', + color: 'blue', + text: t( + 'managementConf.detail.overview.column.taskStatus.collection.collecting' + ) + }); + } else if ( + record.collection_status === + InstanceAuditPlanInfoCollectionStatusEnum.idle && + !!record.last_collection_time + ) { + items.push({ + key: 'collection', + color: 'green', + text: t( + 'managementConf.detail.overview.column.taskStatus.collection.completed' + ) + }); } + + // 审核:auditing > 积压/采集中(待审核) > 已结束完成;采集中禁止「审核完成」 + if (record.audit_status === InstanceAuditPlanInfoAuditStatusEnum.auditing) { + items.push({ + key: 'audit', + color: 'blue', + text: t('managementConf.detail.overview.column.taskStatus.audit.auditing') + }); + } else if (hasPendingAuditBacklog(record) || collecting) { + items.push({ + key: 'audit', + color: 'orange', + text: t( + 'managementConf.detail.overview.column.taskStatus.audit.pendingAudit' + ) + }); + } else if ( + record.audit_status === InstanceAuditPlanInfoAuditStatusEnum.idle && + !!record.last_audit_finished_at + ) { + items.push({ + key: 'audit', + color: 'green', + text: t( + 'managementConf.detail.overview.column.taskStatus.audit.completed' + ) + }); + } + + return items; +}; + +const renderTaskStatus = (record: IInstanceAuditPlanInfo) => { + const statusItems = getTaskStatusItems(record); + const currentStatus = + statusItems.length > 0 + ? statusItems + .map(({ text }) => text) + .join( + t( + 'managementConf.detail.overview.column.taskStatus.statusSeparator' + ) + ) + : '--'; + + return ( + + + {t( + 'managementConf.detail.overview.column.taskStatus.currentStatus', + { + value: currentStatus + } + )} + + + {t( + 'managementConf.detail.overview.column.taskStatus.executionNode', + { + value: record.execution_node_address ?? '--' + } + )} + + + {t('managementConf.detail.overview.column.taskStatus.updatedAt', { + value: formatTime(record.last_task_updated_at ?? undefined, '--') + })} + + + } + > + event.stopPropagation()} + onMouseDown={(event) => event.stopPropagation()} + > + {statusItems.length > 0 + ? statusItems.map(({ key, color, text }) => ( + + {text} + + )) + : '--'} + + + ); }; const renderNextCollectionTime = (record: IInstanceAuditPlanInfo) => { @@ -69,13 +181,13 @@ const renderNextCollectionTime = (record: IInstanceAuditPlanInfo) => { ); } - // 旧后端未带 mode:按 active_status / pipeline_status 兜底 + // 旧后端未带 mode:按 active_status / collection_status 兜底 if (record.active_status === InstanceAuditPlanInfoActiveStatusEnum.disabled) { return t('managementConf.detail.overview.column.nextCollectionTime.none'); } if ( - record.pipeline_status === - InstanceAuditPlanInfoPipelineStatusEnum.collecting + record.collection_status === + InstanceAuditPlanInfoCollectionStatusEnum.collecting ) { return t( 'managementConf.detail.overview.column.nextCollectionTime.afterCollect' @@ -167,13 +279,13 @@ export const ConfDetailOverviewColumns: ( } }, { - dataIndex: 'pipeline_status', + dataIndex: 'collection_status', title: () => renderColumnHeaderTip( - t('managementConf.detail.overview.column.pipelineStatus.title'), - t('managementConf.detail.overview.column.pipelineStatus.headerTips') + t('managementConf.detail.overview.column.taskStatus.title'), + t('managementConf.detail.overview.column.taskStatus.headerTips') ), - render: (status) => renderPipelineStatus(status) + render: (_status, record) => renderTaskStatus(record) }, { dataIndex: 'next_collection_time', @@ -237,7 +349,7 @@ export const ConfDetailOverviewColumnActions: (params: { hasOpPermission }) => { return { - width: 360, + width: 220, buttons: [ { key: 'triggerCollect', @@ -247,18 +359,17 @@ export const ConfDetailOverviewColumnActions: (params: { const isDisabled = record?.active_status === InstanceAuditPlanInfoActiveStatusEnum.disabled; - const isCollecting = - record?.pipeline_status === - InstanceAuditPlanInfoPipelineStatusEnum.collecting; const cannotTrigger = - isDisabled || isCollecting || triggerCollectActionPending; + isDisabled || + record?.can_trigger_collect !== true || + triggerCollectActionPending; let title: string | undefined; if (isDisabled) { title = t( 'managementConf.detail.overview.actions.triggerCollectDisabledTips' ); - } else if (isCollecting) { + } else if (record?.can_trigger_collect !== true) { title = t( 'managementConf.detail.overview.actions.triggerCollectCollectingTips' ); diff --git a/packages/sqle/src/testUtils/mockApi/instanceAuditPlan/data.ts b/packages/sqle/src/testUtils/mockApi/instanceAuditPlan/data.ts index 2db2b2fe1..86169a770 100644 --- a/packages/sqle/src/testUtils/mockApi/instanceAuditPlan/data.ts +++ b/packages/sqle/src/testUtils/mockApi/instanceAuditPlan/data.ts @@ -12,6 +12,8 @@ import { AuditPlanTypesV1InstanceTypeEnum, AuditPlanParamResV1TypeEnum, InstanceAuditPlanInfoActiveStatusEnum, + InstanceAuditPlanInfoCollectionStatusEnum, + InstanceAuditPlanInfoAuditStatusEnum, AuditPlanSQLHeadV1TypeEnum, FilterMetaFilterInputTypeEnum, FilterMetaFilterOpTypeEnum, @@ -475,7 +477,10 @@ export const mockInstanceAuditPlanInfo: IInstanceAuditPlanInfo[] = [ total_sql_nums: 0, unsolved_sql_nums: 0, last_collection_time: '2024-08-06T11:30:43+08:00', - active_status: InstanceAuditPlanInfoActiveStatusEnum.normal + active_status: InstanceAuditPlanInfoActiveStatusEnum.normal, + collection_status: InstanceAuditPlanInfoCollectionStatusEnum.idle, + audit_status: InstanceAuditPlanInfoAuditStatusEnum.idle, + execution_node_address: null }, { id: 2, @@ -495,7 +500,10 @@ export const mockInstanceAuditPlanInfo: IInstanceAuditPlanInfo[] = [ total_sql_nums: 0, unsolved_sql_nums: 0, last_collection_time: undefined, - active_status: InstanceAuditPlanInfoActiveStatusEnum.disabled + active_status: InstanceAuditPlanInfoActiveStatusEnum.disabled, + collection_status: InstanceAuditPlanInfoCollectionStatusEnum.idle, + audit_status: InstanceAuditPlanInfoAuditStatusEnum.idle, + execution_node_address: null }, { id: 3, @@ -514,7 +522,10 @@ export const mockInstanceAuditPlanInfo: IInstanceAuditPlanInfo[] = [ total_sql_nums: 0, unsolved_sql_nums: 0, last_collection_time: undefined, - active_status: InstanceAuditPlanInfoActiveStatusEnum.normal + active_status: InstanceAuditPlanInfoActiveStatusEnum.normal, + collection_status: InstanceAuditPlanInfoCollectionStatusEnum.collecting, + audit_status: InstanceAuditPlanInfoAuditStatusEnum.idle, + execution_node_address: '10.0.0.11' }, { id: 4, @@ -533,7 +544,11 @@ export const mockInstanceAuditPlanInfo: IInstanceAuditPlanInfo[] = [ total_sql_nums: 0, unsolved_sql_nums: 0, last_collection_time: undefined, - active_status: InstanceAuditPlanInfoActiveStatusEnum.normal + active_status: InstanceAuditPlanInfoActiveStatusEnum.normal, + collection_status: InstanceAuditPlanInfoCollectionStatusEnum.idle, + audit_status: InstanceAuditPlanInfoAuditStatusEnum.idle, + last_collect_status: 'failed', + execution_node_address: '10.0.0.22' } ]; From 97d832c030ae87c9d3d18701ff5c6796ba72b570 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:57:05 +0800 Subject: [PATCH 06/21] feat: silently poll overview every 5s and clarify audit trigger tip Co-authored-by: Cursor --- .../Detail/Overview/index.tsx | 80 ++++++++++++++----- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/index.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/index.tsx index cf34fced1..e1941c71c 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/index.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/index.tsx @@ -1,8 +1,5 @@ -import { - ActiontechTable, - useTableRequestError -} from '@actiontech/shared/lib/components/ActiontechTable'; -import { useEffect } from 'react'; +import { ActiontechTable } from '@actiontech/shared/lib/components/ActiontechTable'; +import { useCallback, useEffect, useRef } from 'react'; import { ConfDetailOverviewColumnActions, ConfDetailOverviewColumns @@ -18,6 +15,7 @@ import { useTranslation } from 'react-i18next'; import { ResponseCode } from '@actiontech/shared/lib/enum'; import eventEmitter from '../../../../utils/EventEmitter'; import EmitterKey from '../../../../data/EmitterKey'; +import { IInstanceAuditPlanInfo } from '@actiontech/shared/lib/api/sqle/service/common'; const ConfDetailOverview: React.FC = ({ activeTabKey, @@ -32,9 +30,6 @@ const ConfDetailOverview: React.FC = ({ const columns = ConfDetailOverviewColumns(projectID); - const { requestErrorMessage, handleTableRequestError } = - useTableRequestError(); - const { disabledAction, disabledActionPending, @@ -46,17 +41,59 @@ const ConfDetailOverview: React.FC = ({ triggerCollectActionPending } = useTableAction(); - const { data, loading, refresh } = useRequest( - () => - handleTableRequestError( - instance_audit_plan.getInstanceAuditPlanOverviewV1({ - project_name: projectName, - instance_audit_plan_id: instanceAuditPlanId - }) - ), - { - ready: activeTabKey === SQL_MANAGEMENT_CONF_OVERVIEW_TAB_KEY + const latestRowsRef = useRef([]); + const requestPromiseRef = useRef | null>( + null + ); + const queuedOverviewRefreshRef = useRef(false); + const refreshOverviewRef = useRef<() => void>(() => undefined); + const requestOverview = useCallback(() => { + if (requestPromiseRef.current) { + queuedOverviewRefreshRef.current = true; + return requestPromiseRef.current; } + const request = instance_audit_plan + .getInstanceAuditPlanOverviewV1({ + project_name: projectName, + instance_audit_plan_id: instanceAuditPlanId + }) + .then((res) => { + if (res.data.code !== ResponseCode.SUCCESS) { + throw new Error(res.data.message); + } + const rows = res.data.data ?? []; + latestRowsRef.current = rows; + return rows; + }) + .catch(() => latestRowsRef.current) + .finally(() => { + requestPromiseRef.current = null; + if (queuedOverviewRefreshRef.current) { + queuedOverviewRefreshRef.current = false; + queueMicrotask(() => refreshOverviewRef.current()); + } + }); + requestPromiseRef.current = request; + return request; + }, [instanceAuditPlanId, projectName]); + + const { data, loading, refresh } = useRequest(requestOverview, { + ready: activeTabKey === SQL_MANAGEMENT_CONF_OVERVIEW_TAB_KEY, + pollingInterval: 5000, + pollingWhenHidden: false + }); + refreshOverviewRef.current = refresh; + + useEffect(() => { + latestRowsRef.current = []; + }, [instanceAuditPlanId]); + + useEffect( + () => () => { + queuedOverviewRefreshRef.current = false; + refreshOverviewRef.current = () => undefined; + }, + [] ); useEffect(() => { @@ -71,14 +108,13 @@ const ConfDetailOverview: React.FC = ({ }, [refresh]); return ( - + {messageContextHolder} record.audit_plan_type?.audit_plan_id!} className="table-row-cursor" - dataSource={data?.list} - errorMessage={requestErrorMessage} + dataSource={data} columns={columns} onRow={(record) => { return { @@ -133,6 +169,8 @@ const ConfDetailOverview: React.FC = ({ ) ); refresh(); + } else { + messageApi.error(res.data.message); } } ); From 3765b81e0d2d280ac8932e5cf548962b713a970a Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:57:05 +0800 Subject: [PATCH 07/21] test: update overview dual-status mocks polling and snapshots Co-authored-by: Cursor --- .../__snapshots__/index.test.tsx.snap | 8 +- .../Detail/Overview/__tests__/index.test.tsx | 28 ++++++- .../__snapshots__/index.test.tsx.snap | 78 ++++++++++++++++--- 3 files changed, 97 insertions(+), 17 deletions(-) diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/__tests__/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/__tests__/__snapshots__/index.test.tsx.snap index 4dbf66d28..cc30eae0b 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/__tests__/__snapshots__/index.test.tsx.snap @@ -42,7 +42,7 @@ exports[`test Overview should match snapshot when getUserOperationPermissionLoad - 当前环节 + 执行状态 @@ -314,7 +314,7 @@ exports[`test Overview should match snapshot when hasOpPermission is equal false - 当前环节 + 执行状态 diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/__tests__/index.test.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/__tests__/index.test.tsx index 935419e97..9aedfa8d5 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/__tests__/index.test.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/__tests__/index.test.tsx @@ -102,10 +102,18 @@ describe('test Overview', () => { }); expect(getAllByText('停 用')[0].closest('button')).toBeDisabled(); - await act(async () => jest.advanceTimersByTime(3000)); + await act(async () => { + jest.advanceTimersByTime(3000); + await Promise.resolve(); + }); expect(getAllByText('停 用')[0].closest('button')).not.toBeDisabled(); expect(getByText('停用成功!')).toBeInTheDocument(); expect(getInstanceAuditPlanOverviewSpy).toHaveBeenCalledTimes(2); + // drain overview refresh started by disable success + await act(async () => { + jest.advanceTimersByTime(3000); + await Promise.resolve(); + }); // enabled fireEvent.click(getAllByText('启 用')[0]); @@ -123,10 +131,17 @@ describe('test Overview', () => { }); expect(getAllByText('启 用')[0].closest('button')).toBeDisabled(); - await act(async () => jest.advanceTimersByTime(3000)); + await act(async () => { + jest.advanceTimersByTime(3000); + await Promise.resolve(); + }); expect(getAllByText('启 用')[0].closest('button')).not.toBeDisabled(); expect(getByText('启用成功!')).toBeInTheDocument(); expect(getInstanceAuditPlanOverviewSpy).toHaveBeenCalledTimes(3); + await act(async () => { + jest.advanceTimersByTime(3000); + await Promise.resolve(); + }); //delete fireEvent.click(getAllByText('删 除')[0]); @@ -141,11 +156,18 @@ describe('test Overview', () => { }); expect(getAllByText('删 除')[0].closest('button')).toBeDisabled(); - await act(async () => jest.advanceTimersByTime(3000)); + await act(async () => { + jest.advanceTimersByTime(3000); + await Promise.resolve(); + }); expect(getAllByText('删 除')[0].closest('button')).not.toBeDisabled(); expect(getByText('删除成功!')).toBeInTheDocument(); expect(getInstanceAuditPlanOverviewSpy).toHaveBeenCalledTimes(4); expect(refreshAuditPlanDetailSpy).toHaveBeenCalledTimes(1); + await act(async () => { + jest.advanceTimersByTime(3000); + await Promise.resolve(); + }); }); it('should handle row click events to change the active tab', async () => { diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/__tests__/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/SqlManagementConf/Detail/__tests__/__snapshots__/index.test.tsx.snap index a1386017e..4e856ed4e 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/sqle/src/page/SqlManagementConf/Detail/__tests__/__snapshots__/index.test.tsx.snap @@ -260,7 +260,7 @@ exports[`test SqlManagementConf/Detail/index.tsx should match snapshot 1`] = ` - 当前环节 + 执行状态 @@ -712,7 +712,7 @@ exports[`test SqlManagementConf/Detail/index.tsx should match snapshot 2`] = ` - 当前环节 + 执行状态 @@ -964,7 +964,19 @@ exports[`test SqlManagementConf/Detail/index.tsx should match snapshot 2`] = ` - 空闲 +
+
+ + 采集完成 + +
+
- -
  • - - 1 - -
  • -
  • - -
  • -
  • - -
  • - - - - - - -`; - -exports[`test ScanTypeSqlCollection should open remediation drawer on audit result click 1`] = ` - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - SQL - - - -
    -
    -
    -
    + - - - - - - 审核规则 - - - 请选择{{name}} - - + 审核中 -
    -
    -
    -
    -
    + + - + + + - + + + 299 + + + 2024-08-06T05:29:54Z + + + 11 + + + 11 + + + 0 + + + - + + + - + + + -
    - - - - - - - 用户 + + + SELECT + + SLEEP(?) LIMIT ?,? +
    +
    - 请选择{{name}} + - - -
    -
    -
    -
    -
    -
    +
    + + - - - - - - - schema + + + /* ApplicationName=DBeaver 24.1.2 - SQLEditor <Console> */ + + + + SELECT + + SLEEP( + + 11 + + ) +LIMIT + + 0 + + , + + 200 + +
    +
    - 请选择{{name}} + - +
    +
    + + + + 审核中 -
    -
    -
    -
    - - + - 出现次数 > - - - -
    -
    - - + - 平均执行时间 > - - - -
    -
    - - + - 平均扫描行数 > - - - -
    -
    -
    + + 2024-08-06T05:29:54Z + + + 11 + + + 11 + + + 0 + + + - + + + - + + + -
    - +
    + + + Prepare + + +
    +
    + + + +
    + +
    - + + + Prepare + + +
    +
    - - + + + +
    + + + - + +
    - +
    +
    +
    +
    +
    + + + + + + × + 1 + + +
    +
    +
    +
    +
    + +
    - - - 最后匹配时间 - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    + + - - -
    -
    - 表格设置 -
    -
    - + - - -
    -
    - -
    - - - - - -
    -
    -
    -
    -
    -
    - - - - - + + + + + + + + + + + + + + - - - - - - - - +
    + - SQL指纹 - - + - SQL - - + - 审核状态 - - + - 最初审核结果 - - + - 当前审核结果 - - +
    - - 出现次数 - - -
    +
    + + + + - +
    - -
    +
    - - 最后匹配时间 - - -
    +
    + + + + - +
    - -
    + + + 审核中 + + + - + + - + + 8559 + + 2024-08-06T05:31:21Z + + 0 + + 0 + + 0 + + - + + sqle +
    - - 平均执行时间 - - - +
    +
    + + + +
    - -
    +
    - - 最长执行时间 - - - -
    - -
    -
    - - 平均扫描行数 - - - - -
    -
    - 用户 - - Schema -
    +
    +
    +
    +
      +
    • + + 共 6 条数据 + +
    • +
    • + +
    • +
    • + + 1 + +
    • +
    • + +
    • +
    • + +
    • +
    +
    +
    +
    + + + +`; + +exports[`test ScanTypeSqlCollection should open remediation drawer on audit result click 1`] = ` + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + -
    -   -
    - - - + +
    +
    +
    +
    - -
    - -
    - + 请选择{{name}} -
    -
    - - + +
    +
    +
    +
    +
    +
    -
    -
    - - - /* ApplicationName=DBeaver 24.1.2 - SQLEditor <Console> */ - - - - select - - - - 1 - - ,SLEEP( - - 11 - - ) -LIMIT - - 0 - - , - - 200 - - -
    - -
    - - + 请选择{{name}} + + + +
    +
    +
    +
    +
    +
    - 审核中 + - - - - - - - - - - - 598 - - - 2024-08-06T05:29:54Z - - - 11 - - - 11 - - + + + schema + + + 请选择{{name}} + + + +
    +
    +
    +
    + + - 0 - - + + +
    +
    + + - - - - + + +
    +
    + + - test123 - - - + + +
    +
    +
    -
    -
    - - - SELECT - - ?,?,?,?,?,SLEEP(?) LIMIT ?,? - -
    -
    - - - -
    +
    - -
    -
    - - - /* ApplicationName=DBeaver 24.1.2 - SQLEditor <Console> */ - - - - select - - - - 1 - - , - - 1 - - , - - 1 - - , - - 1 - - , - - 1 - - ,SLEEP( - - 11 - - ) -LIMIT - - 0 - - , - - 200 - - -
    -
    - - - -
    + +
    - - +
    + +
    +
    - 审核中 + + 最后匹配时间 + - - - - - - - - - - - 299 - - - 2024-08-06T05:29:54Z - - - 11 - - - 11 - - - 0 - - - - - - +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + - - - - - - - - - - + + + +
    + SQL指纹 + + SQL + + 审核状态 + + 最初审核结果 + + 当前审核结果 +
    - + + 出现次数 + + - SLEEP(?) LIMIT ?,?
    +
    - + +
    - - -
    -
    +
    - - - /* ApplicationName=DBeaver 24.1.2 - SQLEditor <Console> */ - - - - SELECT - - SLEEP( - - 11 - - ) -LIMIT + + 平均执行时间 + + - , + +
    +
    +
    + + 最长执行时间 + +
    +
    - + +
    - - -
    - + - 审核中 - - - - - - - - - - 299 - - 2024-08-06T05:29:54Z - - 11 - - 11 - - 0 - - - - - - -
    + Schema +
    +
    +
    + + + + + + + + + + + + + + + + - + + + + + + + + + - + - - + + - - - - - - - - - - - + + + + + + + + + + + + + - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - -
    +
    +   +
    +
    +
    +   +
    +
    +
    +   +
    +
    +
    +   +
    +
    +
    +   +
    +
    +
    +   +
    +
    +
    +   +
    +
    - - - Prepare - - +  
    +
    - - - +  
    - -
    -
    +
    - - - Prepare - - +  
    +
    - - - +  
    - -
    - - - -
    +
    -
    + + SELECT + + ?,SLEEP(?) LIMIT ?,? + +
    +
    + - -
    + + +
    - -
    -
    +
    -
    + + /* ApplicationName=DBeaver 24.1.2 - SQLEditor <Console> */ + + + + select + + + + 1 + + ,SLEEP( + + 11 + + ) +LIMIT + + 0 + + , + + 200 + + +
    +
    + - -
    + + +
    - -
    - 2388 - - 2024-08-06T05:31:20Z - - 0 - - 0 - - 0 - - - - - sqle -
    -
    +
    + + 审核中 + + + - + + - + + 598 + + 2024-08-06T05:29:54Z + + 11 + + 11 + + 0 + + - + + test123 +
    - +
    + + + SELECT + + ?,?,?,?,?,SLEEP(?) LIMIT ?,? + +
    +
    - COMMIT + - +
    +
    - - + /* ApplicationName=DBeaver 24.1.2 - SQLEditor <Console> */ + + + + select + + + + 1 + + , + + 1 + + , + + 1 + + , + + 1 + + , + + 1 + + ,SLEEP( + + 11 + + ) +LIMIT + + 0 + + , + + 200 + + +
    +
    + - - - + + +
    - -
    -
    +
    + + 审核中 + + + - + + - + + 299 + + 2024-08-06T05:29:54Z + + 11 + + 11 + + 0 + + - + + - +
    - +
    + + + SELECT + + SLEEP(?) LIMIT ?,? + +
    +
    - COMMIT + - +
    +
    - - + /* ApplicationName=DBeaver 24.1.2 - SQLEditor <Console> */ + + + + SELECT + + SLEEP( + + 11 + + ) +LIMIT + + 0 + + , + + 200 + + +
    +
    + - - - + + +
    - -
    - + - 审核中 - - - - - - - - - 8559 - - 2024-08-06T05:31:21Z - - 0 - - 0 - - 0 - - - - - sqle -
    -
    + 审核中 + +
    + - + + - + + 299 + + 2024-08-06T05:29:54Z + + 11 + + 11 + + 0 + + - + + - +
    +
    +
    + + + Prepare + + +
    +
    + + + +
    +
    +
    - - - INSERT - - - - INTO +
    + + + Prepare + - \`audit_plan_sqls_v2\` (\`audit_plan_id\`,\`fingerprint_md5\`,\`fingerprint\`,\`sql_content\`,\`info\`,\`schema\`) +
    +
    - VALUES + - (?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,? - +
    +
    + - +
    - - - +
    +
    +
    + + + + + + × + 1 + + +
    +
    +
    +
    + - -
    -
    +
    - - +
    - INSERT +
    +
    +
    + + + + + + × + 1 + + +
    +
    +
    +
    +
    + +
    + 2388 + + 2024-08-06T05:31:20Z + + 0 + + 0 + + 0 + + - + + sqle +
    +
    +
    + + + COMMIT + - +
    +
    - INTO + - \`audit_plan_sqls_v2\` (\`audit_plan_id\`,\`fingerprint_md5\`, \`fingerprint\`, \`sql_content\`, \`info\`, \`schema\`) - - VALUES +
    +
    +
    +
    +
    + + + COMMIT + - ( +
    +
    - 3 + - , - - 'a62860c563df5399c2acb800673ae715' +
    +
    +
    + + 审核中 + + + - + + - + + 8559 + + 2024-08-06T05:31:21Z + + 0 + + 0 + + 0 + + - + + sqle +
    +
    +
    + + + INSERT + + + + INTO + + \`audit_plan_sqls_v2\` (\`audit_plan_id\`,\`fingerprint_md5\`,\`fingerprint\`,\`sql_content\`,\`info\`,\`schema\`) + + VALUES + + (?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,?,?),(?,?,?,?,? - , +
    +
    - 'CREATE TABLE \`audit_files\` (\\n \`id + - +
    +
    - - + INSERT + + + + INTO + + \`audit_plan_sqls_v2\` (\`audit_plan_id\`,\`fingerprint_md5\`, \`fingerprint\`, \`sql_content\`, \`info\`, \`schema\`) + + VALUES + + ( + + 3 + + , + + 'a62860c563df5399c2acb800673ae715' + + , + + 'CREATE TABLE \`audit_files\` (\\n \`id + + +
    +
    + - - - + + +
    - -
    - + - 审核中 - - - - - - - - - 299 - - 2024-08-06T05:29:54Z - - 1 - - 1 - - 0 - - - - - sqle -
    + + 审核中 + + + + - + + + - + + + 299 + + + 2024-08-06T05:29:54Z + + + 1 + + + 1 + + + 0 + + + - + + + sqle + + + + +
    -
    -
      -
    • - - 共 6 条数据 - -
    • -
    • - -
    • -
    • - - 1 - -
    • -
    • - -
    • -
    • -
    • -
      - - - - 20 / page + -
      -
    • +
    • + + 1 + +
    • +
    • +
    - - + + +
  • + +
  • + +
    diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/__tests__/index.test.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/__tests__/index.test.tsx index c02054de5..49dbd5500 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/__tests__/index.test.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/__tests__/index.test.tsx @@ -105,6 +105,10 @@ describe('test ScanTypeSqlCollection', () => { } ] }); + await act(async () => { + jest.advanceTimersByTime(3000); + await Promise.resolve(); + }); fireEvent.change(getAllBySelector('.ant-input')[0], { target: { value: '' } @@ -139,7 +143,7 @@ describe('test ScanTypeSqlCollection', () => { expect(baseElement).toMatchSnapshot(); }); - it('should polling request when sql audit status is being_audited', async () => { + it('should polling request when sql has pending audit', async () => { getInstanceAuditPlanSQLDataSpy .mockImplementationOnce(() => { return createSpySuccessResponse({ @@ -151,7 +155,9 @@ describe('test ScanTypeSqlCollection', () => { audit_status: 'being_audited' } ] - } + }, + has_pending_audit: true, + pending_audit_count: 1 }); }) .mockImplementationOnce(() => { @@ -162,7 +168,8 @@ describe('test ScanTypeSqlCollection', () => { ...mockAuditPlanSQLData?.rows?.[0] } ] - } + }, + has_pending_audit: false }); }); @@ -173,7 +180,7 @@ describe('test ScanTypeSqlCollection', () => { expect(getInstanceAuditPlanSQLDataSpy).toHaveBeenCalledTimes(2); }); - it('should stop polling request when sql audit status is not being_audited', async () => { + it('should stop polling request when sql has no pending audit', async () => { getInstanceAuditPlanSQLDataSpy.mockImplementation(() => { return createSpySuccessResponse({ data: { @@ -182,12 +189,15 @@ describe('test ScanTypeSqlCollection', () => { ...mockAuditPlanSQLData?.rows?.[0] } ] - } + }, + has_pending_audit: false }); }); customRender(); await act(async () => jest.advanceTimersByTime(3000)); expect(getInstanceAuditPlanSQLDataSpy).toHaveBeenCalledTimes(1); + await act(async () => jest.advanceTimersByTime(3000)); + expect(getInstanceAuditPlanSQLDataSpy).toHaveBeenCalledTimes(1); }); }); From da85636dd5e098515b5dfb0738e85018ec2ed107 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:57:25 +0800 Subject: [PATCH 11/21] feat: add sql manage audit status column Co-authored-by: Cursor --- .../sqle/src/locale/en-US/sqlManagement.ts | 6 +++ .../sqle/src/locale/zh-CN/sqlManagement.ts | 6 +++ .../component/SQLEEIndex/column.tsx | 44 ++++++++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/packages/sqle/src/locale/en-US/sqlManagement.ts b/packages/sqle/src/locale/en-US/sqlManagement.ts index 3b8212a2b..fc291fead 100644 --- a/packages/sqle/src/locale/en-US/sqlManagement.ts +++ b/packages/sqle/src/locale/en-US/sqlManagement.ts @@ -72,6 +72,7 @@ export default { auditResult: 'Audit result', firstAuditResult: 'Initial audit result', currentAuditResult: 'Current audit result', + auditStatus: 'Audit status', viewAuditResultCompare: 'View audit result comparison', viewFirstAuditResultDetail: 'View audit result comparison', viewCurrentAuditResultDetail: 'View audit result comparison', @@ -85,6 +86,11 @@ export default { endpoints: 'Client IP', sourceExtraTips: 'shown only when a source filter is applied' }, + auditStatus: { + pending: 'Pending audit', + audited: 'Audited', + beingAudited: 'Auditing' + }, remediationStatus: { resolved: 'Resolved', partially_fixed: 'Partially fixed', diff --git a/packages/sqle/src/locale/zh-CN/sqlManagement.ts b/packages/sqle/src/locale/zh-CN/sqlManagement.ts index 091ec44b2..9af70a91a 100644 --- a/packages/sqle/src/locale/zh-CN/sqlManagement.ts +++ b/packages/sqle/src/locale/zh-CN/sqlManagement.ts @@ -75,6 +75,7 @@ export default { auditResult: '审核结果', firstAuditResult: '最初审核结果', currentAuditResult: '当前审核结果', + auditStatus: '审核状态', viewAuditResultCompare: '查看审核结果对比', viewFirstAuditResultDetail: '查看审核结果对比', viewCurrentAuditResultDetail: '查看审核结果对比', @@ -88,6 +89,11 @@ export default { endpoints: '客户端 IP', sourceExtraTips: '仅在筛选来源时展示' }, + auditStatus: { + pending: '待审核', + audited: '已审核', + beingAudited: '审核中' + }, remediationStatus: { resolved: '已整改', partially_fixed: '部分整改', diff --git a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/column.tsx b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/column.tsx index 0bb32f86d..9fe76f0bd 100644 --- a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/column.tsx +++ b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/column.tsx @@ -213,6 +213,7 @@ const SqlManagementColumn: ( { className: 'ellipsis-column-width', dataIndex: 'sql_fingerprint', + width: 320, title: () => t('sqlManagement.table.column.SQLFingerprint'), render: (sql_fingerprint, record) => { if (!sql_fingerprint) return null; @@ -233,6 +234,7 @@ const SqlManagementColumn: ( { dataIndex: 'sql', className: 'ellipsis-column-width', + width: 320, title: 'SQL', render: (sql, record) => { if (!sql) return null; @@ -252,6 +254,7 @@ const SqlManagementColumn: ( }, { dataIndex: 'source', + width: 160, title: () => t('sqlManagement.table.column.source'), render: (source) => { if ( @@ -284,6 +287,36 @@ const SqlManagementColumn: ( return '-'; } }, + { + dataIndex: 'audit_status', + width: 110, + title: () => t('sqlManagement.table.column.auditStatus'), + render: (status) => { + const value = status as string | undefined; + if (value === 'pending') { + return ( + + {t('sqlManagement.table.auditStatus.pending')} + + ); + } + if (value === 'audited') { + return ( + + {t('sqlManagement.table.auditStatus.audited')} + + ); + } + if (value === 'being_audited') { + return ( + + {t('sqlManagement.table.auditStatus.beingAudited')} + + ); + } + return '-'; + } + }, { dataIndex: 'first_audit_result', width: 200, @@ -340,6 +373,7 @@ const SqlManagementColumn: ( }, { dataIndex: 'instance_name', + width: 160, title: () => t('sqlManagement.table.column.instanceName'), render: (instance_name) => { return instance_name || '-'; @@ -347,6 +381,7 @@ const SqlManagementColumn: ( }, { dataIndex: 'schema_name', + width: 140, title: () => 'Schema', render: (schemaName) => { return schemaName || '-'; @@ -354,6 +389,7 @@ const SqlManagementColumn: ( }, { dataIndex: 'priority', + width: 100, title: () => t('sqlManagement.table.column.priority'), render: (priority) => { if (priority === 'high') { @@ -369,12 +405,14 @@ const SqlManagementColumn: ( { dataIndex: 'fp_count', align: 'right', + width: 120, title: () => t('sqlManagement.table.column.occurrenceCount'), sorter: true, sortDirections: ['descend', 'ascend'] }, { dataIndex: 'first_appear_timestamp', + width: 180, title: () => t('sqlManagement.table.column.firstOccurrence'), render: (value) => { return formatTime(value, '-'); @@ -384,6 +422,7 @@ const SqlManagementColumn: ( }, { dataIndex: 'last_receive_timestamp', + width: 180, title: () => t('sqlManagement.table.column.lastOccurrence'), render: (value) => { return formatTime(value, '-'); @@ -394,7 +433,7 @@ const SqlManagementColumn: ( { dataIndex: 'assignees', title: () => t('sqlManagement.table.column.personInCharge'), - width: 200, + width: 160, render: (assignees) => { if (!Array.isArray(assignees)) { return '-'; @@ -413,6 +452,7 @@ const SqlManagementColumn: ( }, { dataIndex: 'endpoints', + width: 160, title: () => t('sqlManagement.table.column.endpoints'), render: (endpoints) => { if (!endpoints) { @@ -424,6 +464,7 @@ const SqlManagementColumn: ( }, { dataIndex: 'status', + width: 110, title: () => t('sqlManagement.table.column.status'), render: (status) => { if (!status) return '-'; @@ -434,6 +475,7 @@ const SqlManagementColumn: ( dataIndex: 'remark', title: () => t('sqlManagement.table.column.comment'), className: 'ellipsis-column-width', + width: 200, render: (remark, record) => { if (!hasPermissionAndNotArchive) return remark ? : '-'; From 58b4e2bcdf3b810820fc6a9719f983398b5ba3e5 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:57:25 +0800 Subject: [PATCH 12/21] feat: poll sql manage list by has_pending_audit Co-authored-by: Cursor --- .../component/SQLEEIndex/index.tsx | 150 +++++++++++------- 1 file changed, 95 insertions(+), 55 deletions(-) diff --git a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx index a0e550f48..9fd79108a 100644 --- a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx +++ b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx @@ -6,7 +6,6 @@ import { BasicButton, PageHeader } from '@actiontech/shared'; import SQLStatistics, { ISQLStatisticsProps } from '../SQLStatistics'; import { ActiontechTable, - useTableRequestError, TableFilterContainer, TableToolbar, ColumnsSettingProps, @@ -59,10 +58,7 @@ import { DownArrowLineOutlined } from '@actiontech/icons'; import useSqlManagementExceptionRedux from '../../../SqlManagementException/hooks/useSqlManagementExceptionRedux'; import useWhitelistRedux from '../../../Whitelist/hooks/useWhitelistRedux'; import { toSqlManageRuleExceptionRecord } from '../../../RuleException/index.data'; -import { - BlacklistResV1TypeEnum, - SqlManageAuditStatusEnum -} from '@actiontech/shared/lib/api/sqle/service/common.enum'; +import { BlacklistResV1TypeEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; import { SqlManagementListStyleWrapper } from './style'; import { pickStaticSqlManageFilters } from './sourceExtra.utils'; import useSqlManageSourceExtra from './hooks/useSqlManageSourceExtra'; @@ -79,18 +75,29 @@ import { SqlManageOptimisticWritePayload, willLeaveCurrentTab } from './optimisticWrite'; +import { getErrorMessage } from '@actiontech/shared/lib/utils/Common'; const REFRESH_SUCCESS_VISIBLE_MS = 1000; const OPTIMISTIC_GREEN_MIN_MS = 650; +type SqlManageListRequestResult = { + list: ISqlManage[]; + total: number; + otherData: { + sql_manage_total_num?: number; + source_extra?: ISourceExtra; + has_pending_audit?: boolean; + pending_audit_count?: number; + }; +}; + const SQLEEIndex = () => { const { t } = useTranslation(); const [messageApi, messageContextHolder] = message.useMessage(); // api const { projectID, projectName, projectArchive } = useCurrentProject(); const { isAdmin, username, isProjectManager, uid } = useCurrentUser(); - const { requestErrorMessage, handleTableRequestError } = - useTableRequestError(); + const [listRequestError, setListRequestError] = useState(''); const [filterStatus, setFilterStatus] = useState( GetSqlManageListV2FilterStatusEnum.unhandled ); @@ -455,60 +462,90 @@ const SQLEEIndex = () => { return filterParams; }, [buildListRequestParams]); + const listRequestRef = useRef | null>( + null + ); + const queuedListRefreshRef = useRef(false); + const refreshListRef = useRef<() => void>(() => undefined); + const requestSqlManageList = useCallback(() => { + if (listRequestRef.current) { + queuedListRefreshRef.current = true; + return listRequestRef.current; + } + const request = SqlManage.GetSqlManageListV2(buildListRequestParams()) + .then((res) => { + setListRequestError(''); + return { + list: res.data.data ?? [], + total: res.data.data?.length ?? 0, + otherData: { + sql_manage_total_num: res.data.sql_manage_total_num, + source_extra: res.data.source_extra, + has_pending_audit: res.data.has_pending_audit, + pending_audit_count: res.data.pending_audit_count + } + }; + }) + .catch((error) => { + setListRequestError(getErrorMessage(error)); + throw error; + }) + .finally(() => { + listRequestRef.current = null; + if (queuedListRefreshRef.current) { + queuedListRefreshRef.current = false; + queueMicrotask(() => refreshListRef.current()); + } + }); + listRequestRef.current = request; + return request; + }, [buildListRequestParams]); + const { data: sqlList, loading: getListLoading, refresh, cancel: cancelListRequest - } = useRequest( - () => { - return handleTableRequestError( - SqlManage.GetSqlManageListV2(buildListRequestParams()) - ); - }, - { - refreshDeps: [ - pagination, - projectName, - filterStatus, - isAssigneeSelf, - isHighPriority, - tableFilterInfo, - sortInfo - ], - pollingInterval: 1000, - pollingErrorRetryCount: 3, - onFinally: (_params, data, error) => { - // AC-008:有审核中则继续列表轮询且不打统计;离开审核中后停轮询并补打一次统计 - const hasBeingAudited = - !error && - !!data?.list?.some( - (item) => - item?.audit_status === SqlManageAuditStatusEnum.being_audited - ); - - if (!error) { - handleSourceExtraFromResponse( - data?.otherData?.source_extra as ISourceExtra | undefined - ); - } + } = useRequest(requestSqlManageList, { + refreshDeps: [ + pagination, + projectName, + filterStatus, + isAssigneeSelf, + isHighPriority, + tableFilterInfo, + sortInfo + ], + pollingInterval: 3000, + pollingWhenHidden: false, + pollingErrorRetryCount: 3, + onFinally: (_params, data, error) => { + const hasPendingAudit = + !error && data?.otherData?.has_pending_audit === true; + + if (!error) { + setListTotal(data?.otherData?.sql_manage_total_num ?? 0); + handleSourceExtraFromResponse( + data?.otherData?.source_extra as ISourceExtra | undefined + ); + } - if (hasBeingAudited) { - auditPollingActiveRef.current = true; - startAuditPollRequest(); - return; - } + if (hasPendingAudit) { + auditPollingActiveRef.current = true; + startAuditPollRequest(); + return; + } - const shouldRefreshStatisticsAfterPoll = auditPollingActiveRef.current; - auditPollingActiveRef.current = false; - cancelListRequest(); - finishAuditPollRequest(); - if (shouldRefreshStatisticsAfterPoll) { - refreshStatisticsRef.current(); - } + const shouldRefreshStatisticsAfterPoll = auditPollingActiveRef.current; + auditPollingActiveRef.current = false; + cancelListRequest(); + finishAuditPollRequest(); + if (shouldRefreshStatisticsAfterPoll) { + refreshStatisticsRef.current(); } } - ); + }); + refreshListRef.current = refresh; const { refresh: refreshStatistics, loading: getStatisticsLoading } = useRequest( @@ -546,7 +583,7 @@ const SQLEEIndex = () => { ); refreshStatisticsRef.current = refreshStatistics; - // 审核中轮询:列表 loading 不驱动刷新按钮长时间转圈 + // 待审核轮询:列表 loading 不驱动刷新按钮长时间转圈 const listLoadingForUi = auditPolling ? false : getListLoading; const refreshBusy = listLoadingForUi || getStatisticsLoading; @@ -580,6 +617,8 @@ const SQLEEIndex = () => { if (optimisticClearTimerRef.current) { clearTimeout(optimisticClearTimerRef.current); } + queuedListRefreshRef.current = false; + refreshListRef.current = () => undefined; }; }, []); @@ -999,6 +1038,7 @@ const SQLEEIndex = () => { /> { current: pagination.page_index }} columns={columns} - errorMessage={requestErrorMessage} + errorMessage={listRequestError} onChange={tableChange} actions={projectArchive ? undefined : actions} - {...(requestErrorMessage + {...(listRequestError ? {} : { locale: { From 0040cff3c7ec301a4aead5d54e02686c4b64a048 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 16:57:25 +0800 Subject: [PATCH 13/21] style: tighten sql manage columns and enable body scroll y Co-authored-by: Cursor --- .../src/page/SqlManagement/component/SQLEEIndex/style.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/style.ts b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/style.ts index ca0d2cbdf..2225377d5 100644 --- a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/style.ts +++ b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/style.ts @@ -19,6 +19,11 @@ export const SqlManagementListStyleWrapper = styled('section')` } .actiontech-table-namespace { + .ant-table-thead > tr > th { + white-space: nowrap; + word-break: keep-all; + } + tr.sql-manage-optimistic-green > td { background-color: ${({ theme }) => `${theme.sharedTheme.uiToken.colorSuccess}22`} !important; From 26ff8dcd59fd0f5dbc0638b5482a35e50af7c438 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Fri, 28 Aug 2026 17:06:48 +0800 Subject: [PATCH 14/21] fix: restore SQLEEIndex after zjrc rebase by dropping orphan setListTotal Rebase left a setListTotal call without state; pagination total already comes from statistics SQLNum, and list sql_manage_total_num must not be written. Co-authored-by: Cursor --- .../sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx index 9fd79108a..3989de42d 100644 --- a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx +++ b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/index.tsx @@ -524,7 +524,6 @@ const SQLEEIndex = () => { !error && data?.otherData?.has_pending_audit === true; if (!error) { - setListTotal(data?.otherData?.sql_manage_total_num ?? 0); handleSourceExtraFromResponse( data?.otherData?.source_extra as ISourceExtra | undefined ); From 7b972c34a60e737cb4504e32811b2ba6f9afdcd5 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Mon, 31 Aug 2026 16:23:16 +0800 Subject: [PATCH 15/21] =?UTF-8?q?feat(overview):=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E9=87=87=E9=9B=86/=E5=AE=A1=E6=A0=B8=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E5=88=97=E5=B9=B6=E5=B1=95=E7=A4=BA=E6=9C=80=E8=BF=91=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 概览用最近采集/审核结果替代散落计数列,hover 查看明细与失败信息。 Co-authored-by: Cursor --- packages/base/src/scripts/version.ts | 4 + .../shared/lib/api/sqle/service/common.d.ts | 5 + .../lib/api/sqle/service/common.enum.ts | 8 ++ .../sqle/src/locale/en-US/managementConf.ts | 16 ++- .../sqle/src/locale/zh-CN/managementConf.ts | 18 ++- .../Detail/Overview/LastAuditResultCell.tsx | 113 +++++++++++++++ .../Detail/Overview/LastCollectResultCell.tsx | 134 +++++++++--------- .../Detail/Overview/column.tsx | 18 +-- 8 files changed, 231 insertions(+), 85 deletions(-) create mode 100644 packages/sqle/src/page/SqlManagementConf/Detail/Overview/LastAuditResultCell.tsx diff --git a/packages/base/src/scripts/version.ts b/packages/base/src/scripts/version.ts index fa34b11d7..599781fa6 100644 --- a/packages/base/src/scripts/version.ts +++ b/packages/base/src/scripts/version.ts @@ -1 +1,5 @@ +<<<<<<< HEAD export const UI_VERSION = 'dms-ui/feat-3127 9e4430d27'; +======= +export const UI_VERSION = 'dev-zjrc-scan-collect-audit-lb-v3 0da534e4f'; +>>>>>>> 8c9343247 (feat(overview): 合并采集/审核结果列并展示最近审核状态) diff --git a/packages/shared/lib/api/sqle/service/common.d.ts b/packages/shared/lib/api/sqle/service/common.d.ts index bf1f74359..d15057cd2 100644 --- a/packages/shared/lib/api/sqle/service/common.d.ts +++ b/packages/shared/lib/api/sqle/service/common.d.ts @@ -27,6 +27,7 @@ import { InstanceAuditPlanInfoAuditStatusEnum, InstanceAuditPlanInfoCollectionStatusEnum, InstanceAuditPlanInfoLastCollectStatusEnum, + InstanceAuditPlanInfoLastAuditStatusEnum, InstanceAuditPlanInfoNextCollectionModeEnum, InstanceAuditPlanResV1ActiveStatusEnum, MatchConditionReqV1TypeEnum, @@ -1760,6 +1761,10 @@ export interface IInstanceAuditPlanInfo { last_audit_finished_at?: string | null; + last_audit_status?: InstanceAuditPlanInfoLastAuditStatusEnum | string | null; + + last_audit_failure_msg?: string | null; + last_collection_time?: string; last_collect_failure_msg?: string | null; diff --git a/packages/shared/lib/api/sqle/service/common.enum.ts b/packages/shared/lib/api/sqle/service/common.enum.ts index fea404c98..c86fd54c0 100644 --- a/packages/shared/lib/api/sqle/service/common.enum.ts +++ b/packages/shared/lib/api/sqle/service/common.enum.ts @@ -270,6 +270,14 @@ export enum InstanceAuditPlanInfoLastCollectStatusEnum { failed = 'failed' } +export enum InstanceAuditPlanInfoLastAuditStatusEnum { + success = 'success', + + partial_failed = 'partial_failed', + + failed = 'failed' +} + export enum InstanceAuditPlanResV1ActiveStatusEnum { normal = 'normal', diff --git a/packages/sqle/src/locale/en-US/managementConf.ts b/packages/sqle/src/locale/en-US/managementConf.ts index d2dcf767d..44271a863 100644 --- a/packages/sqle/src/locale/en-US/managementConf.ts +++ b/packages/sqle/src/locale/en-US/managementConf.ts @@ -150,7 +150,7 @@ export default { statusSeparator: ', ' }, nextCollectionTime: { - title: 'Next collection time', + title: 'Next execution time', afterCollect: 'Show after collection', none: '—' }, @@ -164,7 +164,19 @@ export default { success: 'Success', successEmpty: 'Success with no data', failed: 'Failed', - successCountTips: 'Collected {{n}} SQL(s) this round', + collectedSqlCount: 'Collected SQL count: {{n}}', + roundSuccessCount: 'Collected this round: {{n}}', + lastCollectionTime: 'Last collection time: {{time}}', + copy: 'Copy' + }, + lastAuditResult: { + title: 'Last audit result', + none: '—', + success: 'Success', + partialFailed: 'Partially failed', + failed: 'Failed', + problematicSqlCount: 'Problematic SQL count: {{n}}', + lastAuditTime: 'Last audit time: {{time}}', copy: 'Copy' }, lastCollectionTime: 'Last collection time' diff --git a/packages/sqle/src/locale/zh-CN/managementConf.ts b/packages/sqle/src/locale/zh-CN/managementConf.ts index cbc215251..c830f1c25 100644 --- a/packages/sqle/src/locale/zh-CN/managementConf.ts +++ b/packages/sqle/src/locale/zh-CN/managementConf.ts @@ -145,7 +145,7 @@ export default { statusSeparator: '、' }, nextCollectionTime: { - title: '下次采集时间', + title: '下次执行时间', afterCollect: '采集后展示', none: '—' }, @@ -154,12 +154,24 @@ export default { collectedSqlCount: '采集到的SQL数', problematicSqlCount: '审核有问题的SQL数', lastCollectResult: { - title: '最近一次采集结果', + title: '最近采集结果', none: '—', success: '成功', successEmpty: '成功无数据', failed: '失败', - successCountTips: '本轮采集成功 {{n}} 条', + collectedSqlCount: '采集到的 SQL 数:{{n}}', + roundSuccessCount: '本轮采集成功:{{n}}', + lastCollectionTime: '最近采集时间:{{time}}', + copy: '复制' + }, + lastAuditResult: { + title: '最近审核结果', + none: '—', + success: '成功', + partialFailed: '部分失败', + failed: '失败', + problematicSqlCount: '审核有问题的 SQL 数:{{n}}', + lastAuditTime: '最近审核时间:{{time}}', copy: '复制' }, lastCollectionTime: '最近一次采集时间' diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/LastAuditResultCell.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/LastAuditResultCell.tsx new file mode 100644 index 000000000..f5dc0870c --- /dev/null +++ b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/LastAuditResultCell.tsx @@ -0,0 +1,113 @@ +import { BasicButton } from '@actiontech/shared'; +import { IInstanceAuditPlanInfo } from '@actiontech/shared/lib/api/sqle/service/common'; +import { InstanceAuditPlanInfoLastAuditStatusEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; +import { formatTime } from '@actiontech/shared/lib/utils/Common'; +import Copy from '@actiontech/shared/lib/utils/Copy'; +import { Popover, Space, Typography, message } from 'antd'; +import { t } from '../../../../locale'; + +const mapLastAuditStatusText = (status?: string | null) => { + if (status === undefined || status === null || status === '') { + return t('managementConf.detail.overview.column.lastAuditResult.none'); + } + switch (status) { + case InstanceAuditPlanInfoLastAuditStatusEnum.success: + return t('managementConf.detail.overview.column.lastAuditResult.success'); + case InstanceAuditPlanInfoLastAuditStatusEnum.partial_failed: + return t( + 'managementConf.detail.overview.column.lastAuditResult.partialFailed' + ); + case InstanceAuditPlanInfoLastAuditStatusEnum.failed: + return t('managementConf.detail.overview.column.lastAuditResult.failed'); + default: + return t('managementConf.detail.overview.column.lastAuditResult.none'); + } +}; + +const copyFailureMsg = async (text: string) => { + try { + await navigator.clipboard.writeText(text); + } catch { + Copy.copyTextByTextarea(text); + } + message.success(t('common.copied')); +}; + +const isFailureStatus = (status?: string | null) => + status === InstanceAuditPlanInfoLastAuditStatusEnum.failed || + status === InstanceAuditPlanInfoLastAuditStatusEnum.partial_failed; + +const LastAuditResultCell: React.FC<{ + record: IInstanceAuditPlanInfo; +}> = ({ record }) => { + const status = record.last_audit_status; + const mainText = mapLastAuditStatusText(status); + const hasStatus = !(status === undefined || status === null || status === ''); + const failureMsg = record.last_audit_failure_msg ?? ''; + + if (!hasStatus) { + return {mainText}; + } + + return ( + { + e.stopPropagation(); + }} + onMouseDown={(e) => { + e.stopPropagation(); + }} + > + + + {t( + 'managementConf.detail.overview.column.lastAuditResult.problematicSqlCount', + { n: record.unsolved_sql_nums ?? 0 } + )} + + + {t( + 'managementConf.detail.overview.column.lastAuditResult.lastAuditTime', + { + time: formatTime( + record.last_audit_finished_at ?? undefined, + '—' + ) + } + )} + + {isFailureStatus(status) ? ( + <> + + {failureMsg} + + { + e.stopPropagation(); + if (!failureMsg) return; + void copyFailureMsg(failureMsg); + }} + > + {t( + 'managementConf.detail.overview.column.lastAuditResult.copy' + )} + + + ) : null} + + } + > + {mainText} + + + ); +}; + +export default LastAuditResultCell; diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/LastCollectResultCell.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/LastCollectResultCell.tsx index c6426e966..295fe6cf5 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/LastCollectResultCell.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/LastCollectResultCell.tsx @@ -1,6 +1,7 @@ import { BasicButton } from '@actiontech/shared'; import { IInstanceAuditPlanInfo } from '@actiontech/shared/lib/api/sqle/service/common'; import { InstanceAuditPlanInfoLastCollectStatusEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; +import { formatTime } from '@actiontech/shared/lib/utils/Common'; import Copy from '@actiontech/shared/lib/utils/Copy'; import { Popover, Space, Typography, message } from 'antd'; import { t } from '../../../../locale'; @@ -41,78 +42,79 @@ const LastCollectResultCell: React.FC<{ }> = ({ record }) => { const status = record.last_collect_status; const mainText = mapLastCollectStatusText(status); + const hasStatus = !(status === undefined || status === null || status === ''); + const failureMsg = record.last_collect_failure_msg ?? ''; + const isFailed = status === InstanceAuditPlanInfoLastCollectStatusEnum.failed; - if (status === InstanceAuditPlanInfoLastCollectStatusEnum.success) { - const count = record.last_collect_success_count ?? 0; - return ( - { - e.stopPropagation(); - }} - onMouseDown={(e) => { - e.stopPropagation(); - }} - > - {mainText}; + } + + return ( + { + e.stopPropagation(); + }} + onMouseDown={(e) => { + e.stopPropagation(); + }} + > + {t( - 'managementConf.detail.overview.column.lastCollectResult.successCountTips', - { n: count } + 'managementConf.detail.overview.column.lastCollectResult.collectedSqlCount', + { n: record.total_sql_nums ?? 0 } )} - } - > - {mainText} - - - ); - } - - if (status === InstanceAuditPlanInfoLastCollectStatusEnum.failed) { - const failureMsg = record.last_collect_failure_msg ?? ''; - return ( - { - e.stopPropagation(); - }} - onMouseDown={(e) => { - e.stopPropagation(); - }} + + {t( + 'managementConf.detail.overview.column.lastCollectResult.roundSuccessCount', + { n: record.last_collect_success_count ?? 0 } + )} + + + {t( + 'managementConf.detail.overview.column.lastCollectResult.lastCollectionTime', + { + time: formatTime( + record.last_collection_time ?? undefined, + '—' + ) + } + )} + + {isFailed ? ( + <> + + {failureMsg} + + { + e.stopPropagation(); + if (!failureMsg) return; + void copyFailureMsg(failureMsg); + }} + > + {t( + 'managementConf.detail.overview.column.lastCollectResult.copy' + )} + + + ) : null} + + } > - - - {failureMsg} - - { - e.stopPropagation(); - if (!failureMsg) return; - void copyFailureMsg(failureMsg); - }} - > - {t( - 'managementConf.detail.overview.column.lastCollectResult.copy' - )} - - - } - > - {mainText} - - - ); - } - - return {mainText}; + {mainText} + + + ); }; export default LastCollectResultCell; diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx index 167e7f268..b7664acde 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx @@ -21,6 +21,7 @@ import { } from '@actiontech/icons'; import { Popover, Space, Typography } from 'antd'; import LastCollectResultCell from './LastCollectResultCell'; +import LastAuditResultCell from './LastAuditResultCell'; const renderColumnHeaderTip = (title: string, tip: string) => ( ; } }, - { - dataIndex: 'total_sql_nums', - title: () => t('managementConf.detail.overview.column.collectedSqlCount') - }, - // #if [ee] - { - dataIndex: 'unsolved_sql_nums', - title: () => - t('managementConf.detail.overview.column.problematicSqlCount') - }, - // #endif { dataIndex: 'last_collect_status', title: () => @@ -319,10 +309,10 @@ export const ConfDetailOverviewColumns: ( render: (_status, record) => }, { - dataIndex: 'last_collection_time', + dataIndex: 'last_audit_status', title: () => - t('managementConf.detail.overview.column.lastCollectionTime'), - render: (time) => formatTime(time, '-') + t('managementConf.detail.overview.column.lastAuditResult.title'), + render: (_status, record) => } ]; }; From 2b106019f782bc1a15b294ba5ab4143aa5573a3e Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Tue, 1 Sep 2026 09:12:27 +0800 Subject: [PATCH 16/21] =?UTF-8?q?fix(overview):=20=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E9=87=87=E9=9B=86=20tip=20=E5=8C=BA=E5=88=86=E9=87=87=E9=9B=86?= =?UTF-8?q?=E4=B8=AD=E4=B8=8E=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- packages/sqle/src/locale/en-US/managementConf.ts | 3 ++- packages/sqle/src/locale/zh-CN/managementConf.ts | 3 ++- .../SqlManagementConf/Detail/Overview/column.tsx | 12 +++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/sqle/src/locale/en-US/managementConf.ts b/packages/sqle/src/locale/en-US/managementConf.ts index 44271a863..768aee5bf 100644 --- a/packages/sqle/src/locale/en-US/managementConf.ts +++ b/packages/sqle/src/locale/en-US/managementConf.ts @@ -195,7 +195,8 @@ export default { triggerCollect: 'Collect now', triggerCollectSuccessTips: 'Collect now triggered', triggerCollectDisabledTips: 'Please enable first', - triggerCollectCollectingTips: 'Collection is in progress' + triggerCollectCollectingTips: 'Collection is in progress', + triggerCollectTaskRunningTips: 'Task is running, please wait' } }, scanTypeSqlCollection: { diff --git a/packages/sqle/src/locale/zh-CN/managementConf.ts b/packages/sqle/src/locale/zh-CN/managementConf.ts index c830f1c25..ae6d934c9 100644 --- a/packages/sqle/src/locale/zh-CN/managementConf.ts +++ b/packages/sqle/src/locale/zh-CN/managementConf.ts @@ -190,7 +190,8 @@ export default { triggerCollect: '立即采集', triggerCollectSuccessTips: '已触发立即采集', triggerCollectDisabledTips: '请先启用', - triggerCollectCollectingTips: '正在采集,请等待' + triggerCollectCollectingTips: '正在采集,请等待', + triggerCollectTaskRunningTips: '任务执行中,请等待' } }, scanTypeSqlCollection: { diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx index b7664acde..e016d7759 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/Overview/column.tsx @@ -360,9 +360,15 @@ export const ConfDetailOverviewColumnActions: (params: { 'managementConf.detail.overview.actions.triggerCollectDisabledTips' ); } else if (record?.can_trigger_collect !== true) { - title = t( - 'managementConf.detail.overview.actions.triggerCollectCollectingTips' - ); + title = + record?.collection_status === + InstanceAuditPlanInfoCollectionStatusEnum.collecting + ? t( + 'managementConf.detail.overview.actions.triggerCollectCollectingTips' + ) + : t( + 'managementConf.detail.overview.actions.triggerCollectTaskRunningTips' + ); } return { From 6837f0e30d49938d509e0d0c9b04f8e517894388 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Tue, 1 Sep 2026 09:23:09 +0800 Subject: [PATCH 17/21] =?UTF-8?q?fix(ui):=20BasicTag=20=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E9=9A=8F=E6=96=87=E5=AD=97=E8=87=AA=E9=80=82=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- packages/shared/lib/components/BasicTag/style.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/shared/lib/components/BasicTag/style.ts b/packages/shared/lib/components/BasicTag/style.ts index 4e535eaee..7336b68df 100644 --- a/packages/shared/lib/components/BasicTag/style.ts +++ b/packages/shared/lib/components/BasicTag/style.ts @@ -10,6 +10,7 @@ export const BasicTagStyleWrapper = styled(Tag)<{ color: BasicTagColor }>` padding: 0 8px 0 6px; align-items: center; border-radius: 4px; + width: max-content; svg:first-of-type { margin-right: 6px; From 474b0b3df0505a6ac54db8a0a729e60f5800292c Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Wed, 2 Sep 2026 10:31:57 +0800 Subject: [PATCH 18/21] =?UTF-8?q?fix(ui):=20=E5=AE=A1=E6=A0=B8=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=BB=85=E5=B1=95=E7=A4=BA=20pending/audited=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=20being=5Faudited?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与后端双状态对齐,待审核用橙色标签,SQL 列表不再拦截点击。 Co-authored-by: Cursor --- .../sqle/src/locale/en-US/sqlManagement.ts | 3 +- .../sqle/src/locale/zh-CN/sqlManagement.ts | 3 +- .../component/SQLEEIndex/column.tsx | 7 ---- .../ScanTypeSqlCollection/AuditStatusTag.tsx | 12 ++---- .../__snapshots__/index.test.tsx.snap | 40 +++++++++---------- .../__tests__/index.test.tsx | 2 +- .../Detail/ScanTypeSqlCollection/index.tsx | 11 ++--- .../Detail/ScanTypeSqlCollection/utils.ts | 1 - .../mockApi/instanceAuditPlan/data.ts | 10 ++--- 9 files changed, 35 insertions(+), 54 deletions(-) diff --git a/packages/sqle/src/locale/en-US/sqlManagement.ts b/packages/sqle/src/locale/en-US/sqlManagement.ts index fc291fead..bfc583917 100644 --- a/packages/sqle/src/locale/en-US/sqlManagement.ts +++ b/packages/sqle/src/locale/en-US/sqlManagement.ts @@ -88,8 +88,7 @@ export default { }, auditStatus: { pending: 'Pending audit', - audited: 'Audited', - beingAudited: 'Auditing' + audited: 'Audited' }, remediationStatus: { resolved: 'Resolved', diff --git a/packages/sqle/src/locale/zh-CN/sqlManagement.ts b/packages/sqle/src/locale/zh-CN/sqlManagement.ts index 9af70a91a..336553ec7 100644 --- a/packages/sqle/src/locale/zh-CN/sqlManagement.ts +++ b/packages/sqle/src/locale/zh-CN/sqlManagement.ts @@ -91,8 +91,7 @@ export default { }, auditStatus: { pending: '待审核', - audited: '已审核', - beingAudited: '审核中' + audited: '已审核' }, remediationStatus: { resolved: '已整改', diff --git a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/column.tsx b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/column.tsx index 9fe76f0bd..1389dc6b6 100644 --- a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/column.tsx +++ b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/column.tsx @@ -307,13 +307,6 @@ const SqlManagementColumn: ( ); } - if (value === 'being_audited') { - return ( - - {t('sqlManagement.table.auditStatus.beingAudited')} - - ); - } return '-'; } }, diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/AuditStatusTag.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/AuditStatusTag.tsx index 5663994ca..b6276c82f 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/AuditStatusTag.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/AuditStatusTag.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next'; import { ResultIconTagStyleWrapper } from '../../../../components/AuditResultMessage/style'; -import { AUDITED, BEING_AUDITED, PENDING } from './utils'; +import { AUDITED, PENDING } from './utils'; type AuditStatusTagProps = { status?: string; @@ -9,14 +9,10 @@ type AuditStatusTagProps = { const AuditStatusTag: React.FC = ({ status }) => { const { t } = useTranslation(); - if (status === BEING_AUDITED || status === PENDING) { + if (status === PENDING) { return ( - - {status === BEING_AUDITED - ? t('components.auditResultMessage.auditing') - : t( - 'managementConf.detail.scanTypeSqlCollection.column.pendingAudit' - )} + + {t('managementConf.detail.scanTypeSqlCollection.column.pendingAudit')} ); } diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/__tests__/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/__tests__/__snapshots__/index.test.tsx.snap index 398f61087..207255435 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/__tests__/__snapshots__/index.test.tsx.snap @@ -1264,9 +1264,9 @@ LIMIT class="ant-table-cell" > - 审核中 + 待审核 - 审核中 + 待审核 - 审核中 + 待审核 - 审核中 + 待审核 - 审核中 + 待审核 - 审核中 + 待审核 - 审核中 + 待审核 - 审核中 + 待审核 - 审核中 + 待审核 - 审核中 + 待审核 { { ...mockAuditPlanSQLData?.rows?.[0], audit_results: '[]', - audit_status: 'being_audited' + audit_status: 'pending' } ] }, diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/index.tsx b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/index.tsx index 94d52ba74..6f517b438 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/index.tsx +++ b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/index.tsx @@ -39,7 +39,6 @@ import AuditLevelSummary from '../../../../components/AuditResultMessage/AuditLe import AuditResultExemptionSummary from '../../../../components/AuditResultMessage/AuditResultExemptionSummary'; import AuditStatusTag from './AuditStatusTag'; import { - BEING_AUDITED, buildTableHeadWithAuditStatus, parseAuditResult, parseScanAuditResult, @@ -538,8 +537,8 @@ const ScanTypeSqlCollection: React.FC = ({ record: ScanTypeSqlTableDataSourceItem, fieldName: 'first_audit_results' | 'audit_results' ) => { - // 「审核中」只在 audit_status 列展示(AuditStatusTag),审核结果列不重复显示。 - // 审核进行中时仍渲染已有结果;无结果则显示 "-"。 + // 审核状态只在 audit_status 列展示(AuditStatusTag),审核结果列不重复显示。 + // 待审核时仍渲染已有结果;无结果则显示 "-"。 // 智能扫描详情特例:例外留在 audit_results,用 is_exempted 标记, // 不拆到 skipped_by_rule_exception(与 SQL 管控 / 工单不同)。 @@ -602,8 +601,6 @@ const ScanTypeSqlCollection: React.FC = ({ columnClassName: (type) => type === 'sql' ? 'ellipsis-column-large-width' : undefined, customRender: (text, record, fieldName, type) => { - const isBeingAudited = record['audit_status'] === BEING_AUDITED; - if (fieldName === 'audit_status') { return ; } @@ -630,9 +627,7 @@ const ScanTypeSqlCollection: React.FC = ({ tooltip={false} className="pointer" onClick={() => { - if (!isBeingAudited) { - onClickSql(record); - } + onClickSql(record); }} sql={text} rows={1} diff --git a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/utils.ts b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/utils.ts index 67bb7194b..d9d3af81e 100644 --- a/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/utils.ts +++ b/packages/sqle/src/page/SqlManagementConf/Detail/ScanTypeSqlCollection/utils.ts @@ -4,7 +4,6 @@ import { ISkippedByRuleExceptionItem } from '@actiontech/shared/lib/api/sqle/service/common'; -export const BEING_AUDITED = 'being_audited'; export const PENDING = 'pending'; export const AUDITED = 'audited'; diff --git a/packages/sqle/src/testUtils/mockApi/instanceAuditPlan/data.ts b/packages/sqle/src/testUtils/mockApi/instanceAuditPlan/data.ts index 86169a770..979a44841 100644 --- a/packages/sqle/src/testUtils/mockApi/instanceAuditPlan/data.ts +++ b/packages/sqle/src/testUtils/mockApi/instanceAuditPlan/data.ts @@ -745,7 +745,7 @@ export const mockAuditPlanSQLData: IAuditPlanSQLDataResV1 = { { id: '1', audit_results: 'null', - audit_status: 'being_audited', + audit_status: 'pending', counter: '598', db_user: '', fingerprint: 'SELECT ?,SLEEP(?) LIMIT ?,?', @@ -759,7 +759,7 @@ export const mockAuditPlanSQLData: IAuditPlanSQLDataResV1 = { { id: '12', audit_results: 'null', - audit_status: 'being_audited', + audit_status: 'pending', counter: '299', db_user: '', fingerprint: 'SELECT ?,?,?,?,?,SLEEP(?) LIMIT ?,?', @@ -773,7 +773,7 @@ export const mockAuditPlanSQLData: IAuditPlanSQLDataResV1 = { { id: '123', audit_results: 'null', - audit_status: 'being_audited', + audit_status: 'pending', counter: '299', db_user: '', fingerprint: 'SELECT SLEEP(?) LIMIT ?,?', @@ -803,7 +803,7 @@ export const mockAuditPlanSQLData: IAuditPlanSQLDataResV1 = { { id: '12345', audit_results: 'null', - audit_status: 'being_audited', + audit_status: 'pending', counter: '8559', db_user: '', fingerprint: 'COMMIT', @@ -817,7 +817,7 @@ export const mockAuditPlanSQLData: IAuditPlanSQLDataResV1 = { { id: '123456', audit_results: 'null', - audit_status: 'being_audited', + audit_status: 'pending', counter: '299', db_user: '', fingerprint: From df75d7d744eb999f2001217d36852b522c295e00 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Wed, 2 Sep 2026 15:09:45 +0800 Subject: [PATCH 19/21] =?UTF-8?q?fix(build):=20=E6=B8=85=E7=90=86=20rebase?= =?UTF-8?q?=20=E6=AE=8B=E7=95=99=E7=9A=84=20version.ts=20=E5=86=B2?= =?UTF-8?q?=E7=AA=81=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- packages/base/src/scripts/version.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/base/src/scripts/version.ts b/packages/base/src/scripts/version.ts index 599781fa6..1aa2fcbb5 100644 --- a/packages/base/src/scripts/version.ts +++ b/packages/base/src/scripts/version.ts @@ -1,5 +1 @@ -<<<<<<< HEAD -export const UI_VERSION = 'dms-ui/feat-3127 9e4430d27'; -======= export const UI_VERSION = 'dev-zjrc-scan-collect-audit-lb-v3 0da534e4f'; ->>>>>>> 8c9343247 (feat(overview): 合并采集/审核结果列并展示最近审核状态) From 46a2660ef35c21524a744f72653d4418b9991474 Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Wed, 2 Sep 2026 15:29:14 +0800 Subject: [PATCH 20/21] =?UTF-8?q?fix(ui):=20=E4=BF=AE=E5=A4=8D=20SQL=20?= =?UTF-8?q?=E7=AE=A1=E6=8E=A7=E5=88=97=E8=A1=A8=E7=AD=9B=E9=80=89=E4=B8=8D?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E4=B8=8E=E8=BD=AE=E8=AF=A2=20cancel=20?= =?UTF-8?q?=E5=89=AF=E4=BD=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去掉会吞掉并发刷新的请求合并,并仅在待审核时开启轮询,避免 cancel 阻断 refreshDeps。 Co-authored-by: Cursor --- .../__snapshots__/index.test.tsx.snap | 10135 ++++++++-------- .../component/SQLEEIndex/index.tsx | 46 +- .../__snapshots__/index.test.tsx.snap | 80 +- 3 files changed, 5250 insertions(+), 5011 deletions(-) diff --git a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/__snapshots__/index.test.tsx.snap index 50ee4b644..0889d6cc1 100644 --- a/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/__snapshots__/index.test.tsx.snap +++ b/packages/sqle/src/page/SqlManagement/component/SQLEEIndex/__snapshots__/index.test.tsx.snap @@ -4,7 +4,7 @@ exports[`page/SqlManagement/SQLEEIndex filter data with rule name 1`] = `
    -
    +
    - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - + + + + + + + + + + - + - + - - - - - - - - + + + + + + + + +
    - - - - SQL指纹 - - SQL - - 来源 - - 最初审核结果 - - 当前审核结果 - - 数据源 - - Schema - - 优先级 - -
    + + + + +
    +
    + SQL指纹 + + SQL + + 来源 + + 审核状态 + + 最初审核结果 + + 当前审核结果 + + 数据源 + + Schema + + 优先级 + - - 出现数量 - - + - - + + - - + + - - - -
    +
    - - 初次出现时间 - - + - - + + - - + + - - - -
    +
    - - 最后一次出现时间 - - + - - + + - - + + - - - - 负责人 - - 客户端 IP - - 状态 - - 备注 - - 操作 -
    + 负责人 + + 客户端 IP + + 状态 + + 备注 + + 操作 +
    +
    +
    + - + + + + + + + + + + + + + + + + + + + + - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - - - - - + + + + - - - - - - - + + + + + + - - - + + + - + - - -
    -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - -
    +   + + +
    +   +
    +
    - - - - - - - - -
    + + + + +
    + + + - + + - + + - +
    - - - - - × - 2 + + + + + × + 2 + - +
    - -
    - mysql - - dms - - 高优先 - - 0 - - 2024-01-02 11:28:34 - - 2024-01-03 11:28:34 - -
    +
    + mysql + + dms + + 高优先 + + 0 + + 2024-01-02 11:28:34 + + 2024-01-03 11:28:34 +
    - - T + + T + - -
    - -
    - - 12 - - - - 未处理 - - -
    - this is remark text -
    - - - +
    +
    + + +
    + this is remark text
    - -
    -
    - +
    - -
    -
    - +
    +
    - - 变更状态 - - + +
    - - - -
    + + + + + +
    + + + + +
    -
    -
      -
    • - - 共 2 条数据 - -
    • -
    • - -
    • -
    • - +
    • - 1 - -
    • -
    • - -
    • -
    • -
    • +
    • + + 1 + +
    • +
    • +
    - - + + +
  • + +
  • + +
    @@ -2248,7 +2311,7 @@ exports[`page/SqlManagement/SQLEEIndex filter data with sort 1`] = `
    -
    +
    - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - + + + + + + + + + + - + - + - - - - - - - - + + + + + + + + +
    -
    +
    - - - - SQL指纹 - - SQL - - 来源 - - 最初审核结果 - - 当前审核结果 - - 数据源 - - Schema - - 优先级 - -
    + + + + +
    +
    + SQL指纹 + + SQL + + 来源 + + 审核状态 + + 最初审核结果 + + 当前审核结果 + + 数据源 + + Schema + + 优先级 + - - 出现数量 - - + - - + + - - + + - - - -
    +
    - - 初次出现时间 - - + - - + + - - + + - - - -
    +
    - - 最后一次出现时间 - - + - - + + - - + + - - - - 负责人 - - 客户端 IP - - 状态 - - 备注 - - 操作 -
    + 负责人 + + 客户端 IP + + 状态 + + 备注 + + 操作 +
    +
    +
    + - + + + + + + + + + + + + + + + + + + + + - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + -
    - -
    - -
    -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - -
    +   + + +
    +   +
    +
    + +
    + + + + +
    @@ -3268,7 +3384,7 @@ exports[`page/SqlManagement/SQLEEIndex render sql statics data 1`] = `
    -
    +
    - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - + + + + + + + + + + - + - + - - - - - - - - + + + + + + + + +
    - - - - SQL指纹 - - SQL - - 来源 - - 最初审核结果 - - 当前审核结果 - - 数据源 - - Schema - - 优先级 - -
    + + + + +
    +
    + SQL指纹 + + SQL + + 来源 + + 审核状态 + + 最初审核结果 + + 当前审核结果 + + 数据源 + + Schema + + 优先级 + - - 出现数量 - - + - - + + - - + + - - - -
    +
    - - 初次出现时间 - - + - - + + - - + + - - - -
    +
    - - 最后一次出现时间 - - + - - + + - - + + - - - - 负责人 - - 客户端 IP - - 状态 - - 备注 - - 操作 -
    + 负责人 + + 客户端 IP + + 状态 + + 备注 + + 操作 +
    +
    +
    + - + + + + + + + + + + + + + + + + + + + + - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + - - - + + -
    -
    -
    -
    -
    -
    - - - - + + + + + +
    + + + - - - - - - - + + + + + + - - - + + + - + - - -
    -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - -
    - - - - - - - - - - - - - - - +
    + + + - + + - + + - + +
    +
    +
    +
    +
    +
    - × - 2 + + + + + × + 2 + - +
    - -
    - mysql - - dms - - 高优先 - - 0 - - 2024-01-02 11:28:34 - - 2024-01-03 11:28:34 - -
    +
    + mysql + + dms + + 高优先 + + 0 + + 2024-01-02 11:28:34 + + 2024-01-03 11:28:34 +
    - - T + + T + - -
    - -
    - - 12 - - - - 未处理 - - -
    - this is remark text -
    - - - +
    +
    + + +
    + this is remark text
    - -
    -
    - +
    - -
    -
    - +
    +
    - - 变更状态 - - + +
    - - - -
    + + + + + +
    + + + + +
    -
    -
      -
    • - - 共 1 条数据 - -
    • -
    • - -
    • -
    • - - 1 - -
    • -
    • - -
    • -
    • -
    • -
      - - - - 20 / page + -
      -
    • +
    • + + 1 + +
    • +
    • +
    - - -
    -
    -
    - -
    - -`; - -exports[`page/SqlManagement/SQLEEIndex render table data 1`] = ` - -
    -
    -
    -
    - SQL管控 -
    -
    -
    +
    +
    +
    + + + +`; + +exports[`page/SqlManagement/SQLEEIndex render table data 1`] = ` + +
    +
    +
    +
    + SQL管控 +
    +
    +
    -
    +
    - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - + + + + + + + + + + - + - + - - - - - - - - + + + + + + + + +
    - - - - SQL指纹 - - SQL - - 来源 - - 最初审核结果 - - 当前审核结果 - - 数据源 - - Schema - - 优先级 - -
    + + + + +
    +
    + SQL指纹 + + SQL + + 来源 + + 审核状态 + + 最初审核结果 + + 当前审核结果 + + 数据源 + + Schema + + 优先级 + - - 出现数量 - - + - - + + - - + + - - - -
    +
    - - 初次出现时间 - - + - - + + - - + + - - - -
    +
    - - 最后一次出现时间 - - + - - + + - - + + - - - - 负责人 - - 客户端 IP - - 状态 - - 备注 - - 操作 -
    + 负责人 + + 客户端 IP + + 状态 + + 备注 + + 操作 +
    +
    +
    + - + + + + + + + + + + + + + + + + + + + + - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - - - - - + + + + - - - - - - - + + + + + + - - - + + + - + + + - - - - - - - - - - - - - - + - - - - + + + + + + + + + + + + + - - - - + + - + + - - - + + + - - - - - - - - - - + + + + + + + + - - - - - + + - + + - - - + + + - - - - - - - - - - + + + + + + + - + - - - - - + + - - - + - - - - - - - + + + + + - - - - + + + + + + + + + - - -
    -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - - -
    +   +
    +
    -   - -
    +   + + +
    +   +
    +
    - - - - - - - - -
    + + + + +
    + + + - + + - + + - +
    - - - - - × - 2 + + + + + × + 2 + - +
    - -
    - mysql - - dms - - 高优先 - - 0 - - 2024-01-02 11:28:34 - - 2024-01-03 11:28:34 - -
    +
    + mysql + + dms + + 高优先 + + 0 + + 2024-01-02 11:28:34 + + 2024-01-03 11:28:34 +
    - - T + + T + - -
    - -
    - - 12 - - - - 未处理 - - -
    - this is remark text -
    - - - +
    +
    + + +
    + this is remark text
    - -
    -
    - +
    - + +
    +
    + +
    -
    - -
    + + + + + -
    +
    - - -
    -
    - - - CREATE - - - - TABLE - - \`plugins\` ( - \`name\` - - varchar - - ( - - 200 - - ) - - COLLATE - - utf8mb4_unicode_ci - - NOT - - - - NULL - - -) ENGINE - - = - - InnoDB - - DEFAULT - - CHARSET - - = - - utf8mb4 - - COLLATE - + - = - - utf8mb4_unicode_ci - -
    -
    - - + class="ant-checkbox-inner" + /> -
    -
    -
    - - - 慢日志 - - - - - - - - - - - - - - - 低优先 - - 0 - - - - - - - -
    +
    - + - T + CREATE + + + + TABLE + + \`plugins\` ( + \`name\` + + varchar + + ( + + 200 + + ) + + COLLATE + + utf8mb4_unicode_ci + + NOT + + + + NULL + + +) ENGINE + + = + + InnoDB + + DEFAULT + + CHARSET + + = + + utf8mb4 + + COLLATE + + + = + utf8mb4_unicode_ci
    -
    -
    - + +
    - -
    - - - - - - - + - - - - - - - -
    + 慢日志 + +
    + - + + - + + - + + - + + - + + 低优先 + + 0 + + - + + - +
    - +
    - +
    +
    + - + + - + - -
    - - -
    +
    - - - CREATE - - - - TABLE - - \`projects\` ( - - - UNIQUE - - KEY \`name\` (\`name\`) -) ENGINE - - = - - InnoDB - - DEFAULT - - CHARSET - +
    - = - - utf8mb4 - + + 指派负责人 + + +
    +
    - COLLATE - + +
    +
    + -
    +
    + -
    + + + +
    - - - CREATE - - - - TABLE - - \`projects\` ( +
    + + + CREATE + + + + TABLE + + \`projects\` ( - - UNIQUE - - KEY \`name\` (\`name\`) + + UNIQUE + + KEY \`name\` (\`name\`) ) ENGINE - - = - - InnoDB - - DEFAULT - - CHARSET - - = - - utf8mb4 - - COLLATE + + = + + InnoDB + + DEFAULT + + CHARSET + + = + + utf8mb4 + + COLLATE + + + = + + utf8mb4_unicode_ci +
    +
    - = + - utf8mb4_unicode_ci - +
    +
    - - + CREATE + + + + TABLE + + \`projects\` ( + + + UNIQUE + + KEY \`name\` (\`name\`) +) ENGINE + + = + + InnoDB + + DEFAULT + + CHARSET + + = + + utf8mb4 + + COLLATE + + + = + + utf8mb4_unicode_ci + +
    +
    + - - - + + +
    - -
    - - 慢日志 - - - - - -
    +
    + + 慢日志 + + + - + + - +
    - - - - - × - 1 + + + + + × + 1 + - +
    - -
    - mysql - - dms - - - - - 0 - - - - - - - - - - - - - - - 未处理 - - - + mysql + + dms + + - + + 0 + + - + + - + + - + + - + - - - + class="ant-tag ant-tag-red basic-tag-wrapper basic-small-tag-wrapper css-3qh3vw css-dev-only-do-not-override-bj9uhl" + > + 未处理 - - -
    +
    -
    -
    - -
    -
    - -
    -
    - -
    - - -
    +
    - - - CREATE - - - - TABLE - - \`projects\` ( - - - UNIQUE - - KEY \`name\` (\`name\`) -) ENGINE - - = - - InnoDB - - DEFAULT - - CHARSET - +
    - = - - utf8mb4 - + + 指派负责人 + + +
    +
    - COLLATE - + +
    +
    + -
    +
    + -
    +
    - - - CREATE - - - - TABLE - - \`projects\` ( +
    + + + CREATE + + + + TABLE + + \`projects\` ( - - UNIQUE - - KEY \`name\` (\`name\`) + + UNIQUE + + KEY \`name\` (\`name\`) ) ENGINE - - = - - InnoDB - - DEFAULT - - CHARSET - - = - - utf8mb4 - - COLLATE + + = + + InnoDB + + DEFAULT + + CHARSET + + = + + utf8mb4 + + COLLATE + + + = + + utf8mb4_unicode_ci +
    +
    - = + - utf8mb4_unicode_ci - +
    +
    - - + CREATE + + + + TABLE + + \`projects\` ( + + + UNIQUE + + KEY \`name\` (\`name\`) +) ENGINE + + = + + InnoDB + + DEFAULT + + CHARSET + + = + + utf8mb4 + + COLLATE + + + = + + utf8mb4_unicode_ci + +
    +
    + - - - + + +
    - -
    - - 慢日志 - - - - - -
    +
    + + 慢日志 + + + - + + - +
    - - - - - × - 1 + + + + + × + 1 + - +
    - -
    - mysql - - dms - - - - - 0 - - - - - - - - - - - - 34 - - - - 未处理 - - - + mysql + + dms + + - + + 0 + + - + + - + + - + - - - + class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1q0j97r css-dev-only-do-not-override-bj9uhl" + style="margin-right: 0px;" + > + 34 - - -
    +
    -
    -
    - -
    -
    - -
    -
    + 未处理 + +
    - -
    - - -
    +
    - - - SELECT - - ? - -
    -
    - - - -
    - -
    -
    -
    - - + + 指派负责人 + + +
    +
    - SELECT - - + +
    +
    + -
    +
    + - - SQL审核 - - - - - -
    +
    -
    - - - - - + - 审核通过 + SELECT -
    + ? +
    -
    - -
    - MYSQL_3307 - - db1 - - - - - 0 - - - - - - - -
    + + + +
    + +
    - + - T + SELECT + + + + 1 + ; + +
    +
    + +
    +
    + + SQL审核 + + + - + + - +
    - - - T - - + + + + + + + 审核通过 + +
    +
    - -
    - - - - - 未处理 - - - - -
    +
    + MYSQL_3307 + + db1 + + - + + 0 + + - + + - +
    - +
    - +
    +
    + - + + + 未处理 + + - -
    + + +
    +
    +
    + +
    +
    + +
    +
    + +
    + + + + +
    -
    -
      -
    • - - 共 2 条数据 - -
    • -
    • - -
    • -
    • - - 1 - -
    • -
    • - -
    • -
    • -
    • -
      - - - - 20 / page + -
      -
    • +
    • + + 1 + +
    • +
    • +
    - - -
    -
    -
    - - - -`; - -exports[`page/SqlManagement/SQLEEIndex render table for not admin 1`] = ` - -