Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: Support export audit report #312

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,36 @@
* [x] [test]: 完成遗留的单元测试问题 <https://github.com/actiontech/sqle-ui/pull/264>
* [x] [feature]: API服务里,工单执行完成后,可以提供一个回调地址去通知调用API的服务 <https://github.com/actiontech/sqle-ui/pull/266>
* [x] [fix]: 修复 sql 审核结果列表中的 执行语句未高亮的问题 <https://github.com/actiontech/sqle-ui/pull/267>
* [x] [fix]: 添加 renderOrderDesc 并修改创建工单的工单名称的正则校验 <https://github.com/actiontech/sqle-ui/pull/268>
* [x] [feature]: 工单上线中止功能. 补充 useGenerateOrderStepInfo 单元测试 <https://github.com/actiontech/sqle-ui/pull/269>
* [x] [fix]: 问题修复: 在点击工单概览中被禁用的按钮时,会切换到其他的tab选项卡 <https://github.com/actiontech/sqle-ui/pull/275>
* [ ]
* [x] [chore]: 2.2305.0 界面优化 <https://github.com/actiontech/sqle/issues/1508>
* [x] [fix]: react-monaco-editor 组件全部添加属性: automaticLayout: true, 解决生产环境下在弹窗里第一次打开时无法输入的问题. <https://github.com/actiontech/sqle-ui/pull/276> (dms 中已更换成 @monaco-editor/react)
* [ ] [chore]: 2.2306.0 界面优化 <https://github.com/actiontech/sqle/issues/1549>
* [ ] [feature]: 工单列表支持工单号展示以及筛选 <https://github.com/actiontech/sqle-ui/pull/280>
* [ ] [chore]: 项目成员界面优化(dms中已移除此页面) <https://github.com/actiontech/sqle-ui/pull/278>
* [ ] [feature]: 全局配置添加 操作记录的过期时间配置项 <https://github.com/actiontech/sqle-ui/pull/281>
* [x] [chore]: 2.2306.0 界面优化 <https://github.com/actiontech/sqle/issues/1549>
* [x] [feature]: 工单列表支持工单号展示以及筛选 <https://github.com/actiontech/sqle-ui/pull/280>
* [x] [chore]: 项目成员界面优化(dms中已移除此页面) <https://github.com/actiontech/sqle-ui/pull/278> (该页面在 dms 已移除)
* [x] [feature]: 全局配置添加 操作记录的过期时间配置项 <https://github.com/actiontech/sqle-ui/pull/281> (需要后端支持)
* [x] [feature]: 优化系统配置中开关的交互流程 <https://github.com/actiontech/sqle-ui/pull/283> (已将 sqle 下的登录对接已经消息推送迁移至dms下, 并更新为最新版本代码)
* [ ] [feature]: 支持格式化 SQL 语句 <https://github.com/actiontech/sqle-ui/pull/284>
* [ ] [feature]: 添加公共组件 EnterpriseFeatureDisplay 统一处理 ce 模式与 ee 模式下的某些页面的不同表现 <https://github.com/actiontech/sqle-ui/pull/285> (公共组件已添加, 处理部分页面)
* [ ] [fix]: 修复: 对创建好的扫描任务中的数据源跟数据库进行移除,点击保存之后还存在 <https://github.com/actiontech/sqle-ui/pull/287>
* [ ] [fix]: 修复: 格式化 SQL 语句后审核时解析出错(后续格式化功能可能会移至后端处理) <https://github.com/actiontech/sqle-ui/pull/288>
* [ ] [chore]: 一些界面优化: <https://github.com/actiontech/sqle-ui/pull/289> <https://github.com/actiontech/sqle-ui/pull/290>
* [ ] [fix]:系统设置中 Webhook 配置文案错误 以及 测试微信推送永远显示成功 <https://github.com/actiontech/sqle-ui/pull/291>
* [ ] [feature]: 重构项目概览页面 <https://github.com/actiontech/sqle-ui/pull/292>
* [ ] [chore]: 界面优化长期任务【2.2307.0】 <https://github.com/actiontech/sqle/issues/1658>
* [ ] [feature]: 新增自定义规则页面 <https://github.com/actiontech/sqle-ui/pull/294>
* [ ] [fix]: 在不同时间段执行 Order/Detail/index.test.tsx 和 AuditResultCollection.test.tsx 时, 生成的快照文件不一致. 原因: 这两个页面中有些按钮的状态需要通过当前时间和工单概览接口返回的数据源运维时间做判断, 由于在 test case 中未 mock 当前时间, 导致不同时间段的按钮状态不一致. <https://github.com/actiontech/sqle-ui/pull/298>
* [ ] [fix]: 将 RuleList 中的 ALL Tab 固定在第一位. 优化自定义规则表单. 优化创建完自定义规则后的页面展示. 创建规则模板和修改规则模板新增参数: is_custom_rule. <https://github.com/actiontech/sqle-ui/pull/299>
* [ ] [feature]: 页面增加数据库Logo 遗留问题: 1. selectOptionByIndex 方法改造, 支持自定义的 option. 2. 图片资源缓存问题 <https://github.com/actiontech/sqle-ui/pull/301>
* [ ] [test]: 增加 selectCustomOptionByClassName 并修改部分单元测试 <https://github.com/actiontech/sqle-ui/pull/303>
* [ ] [fix]: 补充系统配置的单元测试, 测试企业微信配置时添加字段校验 <https://github.com/actiontech/sqle-ui/pull/302>
* [ ] [fix]: 规则列表分类进行排序, 优化编辑规则模板时的规则列表样式 <https://github.com/actiontech/sqle-ui/pull/304>
* [ ] [chore]: 项目概览界面中数据源最小单位改成1,数据源tips提示文案修改, 没有任何工单时总计显示 0. <https://github.com/actiontech/sqle-ui/pull/305>
* [ ] [fix]:修复在创建自定义规则时先修改了按钮状态然后才进行表单校验, 导致按钮状态未复原的问题 <https://github.com/actiontech/sqle-ui/pull/306>
* [ ] [feature]: 项目概览的工单状态报表添加 正在上线 状态 <https://github.com/actiontech/sqle-ui/pull/308>
* [ ] [chore]: 测试企业微信配置时接收着UserId 添加 tips <https://github.com/actiontech/sqle-ui/pull/309>
* [x] [feature]: 支持格式化 SQL 语句 <https://github.com/actiontech/sqle-ui/pull/284>
* [x] [feature]: 添加公共组件 EnterpriseFeatureDisplay 统一处理 ce 模式与 ee 模式下的某些页面的不同表现 <https://github.com/actiontech/sqle-ui/pull/285>
* [x] [fix]: 修复: 对创建好的扫描任务中的数据源跟数据库进行移除,点击保存之后还存在 <https://github.com/actiontech/sqle-ui/pull/287>
* [x] [fix]: 修复: 格式化 SQL 语句后审核时解析出错(后续格式化功能可能会移至后端处理) <https://github.com/actiontech/sqle-ui/pull/288>
* [x] [chore]: 一些界面优化: <https://github.com/actiontech/sqle-ui/pull/289> <https://github.com/actiontech/sqle-ui/pull/290>
* [x] [fix]:系统设置中 Webhook 配置文案错误 以及 测试微信推送永远显示成功 <https://github.com/actiontech/sqle-ui/pull/291>
* [x] [feature]: 重构项目概览页面 <https://github.com/actiontech/sqle-ui/pull/292>
* [x] [chore]: 界面优化长期任务【2.2307.0】 <https://github.com/actiontech/sqle/issues/1658>
* [x] [feature]: 新增自定义规则页面 <https://github.com/actiontech/sqle-ui/pull/294>
* [x] [fix]: 在不同时间段执行 Order/Detail/index.test.tsx 和 AuditResultCollection.test.tsx 时, 生成的快照文件不一致. 原因: 这两个页面中有些按钮的状态需要通过当前时间和工单概览接口返回的数据源运维时间做判断, 由于在 test case 中未 mock 当前时间, 导致不同时间段的按钮状态不一致. <https://github.com/actiontech/sqle-ui/pull/298>
* [x] [fix]: 将 RuleList 中的 ALL Tab 固定在第一位. 优化自定义规则表单. 优化创建完自定义规则后的页面展示. 创建规则模板和修改规则模板新增参数: is_custom_rule. <https://github.com/actiontech/sqle-ui/pull/299>
* [x] [feature]: 页面增加数据库Logo 遗留问题: 1. selectOptionByIndex 方法改造, 支持自定义的 option. 2. 图片资源缓存问题 <https://github.com/actiontech/sqle-ui/pull/301>
* [x] [test]: 增加 selectCustomOptionByClassName 并修改部分单元测试 <https://github.com/actiontech/sqle-ui/pull/303>
* [x] [fix]: 补充系统配置的单元测试, 测试企业微信配置时添加字段校验 <https://github.com/actiontech/sqle-ui/pull/302>
* [x] [fix]: 规则列表分类进行排序, 优化编辑规则模板时的规则列表样式 <https://github.com/actiontech/sqle-ui/pull/304>
* [x] [chore]: 项目概览界面中数据源最小单位改成1,数据源tips提示文案修改, 没有任何工单时总计显示 0. <https://github.com/actiontech/sqle-ui/pull/305>
* [x] [fix]:修复在创建自定义规则时先修改了按钮状态然后才进行表单校验, 导致按钮状态未复原的问题 <https://github.com/actiontech/sqle-ui/pull/306>
* [x] [feature]: 项目概览的工单状态报表添加 正在上线 状态 <https://github.com/actiontech/sqle-ui/pull/308>
* [x] [chore]: 测试企业微信配置时接收着UserId 添加 tips <https://github.com/actiontech/sqle-ui/pull/309>

* [ ] [chore]: 扩宽部分表单 name 限制长度: <https://github.com/actiontech/sqle-ui/pull/310>
* [ ] [feature]: 工单列表添加筛选项, 导出历史工单同时添加该筛选条件 <https://github.com/actiontech/sqle-ui/pull/311>
* [ ] [feature]: 支持导出 智能扫描 审核报告 <https://github.com/actiontech/sqle-ui/pull/312>
2 changes: 1 addition & 1 deletion craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ module.exports = {
const res = {};
for (let i = 0; i < 10; i++) {
res[`/v${i}`] = {
target: 'http://124.70.158.246:8889',
target: 'http://10.186.60.56:10001',
secure: false,
changeOrigin: true,
ws: true,
Expand Down
8 changes: 8 additions & 0 deletions src/api/audit_plan/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ export interface IGetAuditPlanReportV1Params {

export interface IGetAuditPlanReportV1Return extends IGetAuditPlanReportResV1 {}

export interface IExportAuditPlanReportV1Params {
project_name: string;

audit_plan_name: string;

audit_plan_report_id: string;
}

export interface IGetAuditPlanReportsSQLsV1Params {
project_name: string;

Expand Down
22 changes: 22 additions & 0 deletions src/api/audit_plan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
IGetAuditPlanReportsV1Return,
IGetAuditPlanReportV1Params,
IGetAuditPlanReportV1Return,
IExportAuditPlanReportV1Params,
IGetAuditPlanReportsSQLsV1Params,
IGetAuditPlanReportsSQLsV1Return,
IGetTaskAnalysisDataParams,
Expand Down Expand Up @@ -248,6 +249,27 @@ class AuditPlanService extends ServiceBase {
);
}

public exportAuditPlanReportV1(
params: IExportAuditPlanReportV1Params,
options?: AxiosRequestConfig
) {
const paramsData = this.cloneDeep(params);
const project_name = paramsData.project_name;
delete paramsData.project_name;

const audit_plan_name = paramsData.audit_plan_name;
delete paramsData.audit_plan_name;

const audit_plan_report_id = paramsData.audit_plan_report_id;
delete paramsData.audit_plan_report_id;

return this.get<any>(
`/v1/projects/${project_name}/audit_plans/${audit_plan_name}/reports/${audit_plan_report_id}/export`,
paramsData,
options
);
}

public getAuditPlanReportsSQLsV1(
params: IGetAuditPlanReportsSQLsV1Params,
options?: AxiosRequestConfig
Expand Down
25 changes: 24 additions & 1 deletion src/api/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CreateAuditWhitelistReqV1MatchTypeEnum,
CreateCustomRuleReqV1LevelEnum,
CustomRuleResV1LevelEnum,
DirectAuditFileReqV1SqlTypeEnum,
DirectAuditReqV1SqlTypeEnum,
GetWorkflowTasksItemV1StatusEnum,
InstanceTaskResV1LastSyncStatusEnum,
Expand Down Expand Up @@ -37,7 +38,7 @@ import {
WorkflowRecordResV2StatusEnum,
WorkflowResV2ModeEnum,
WorkflowStepResV2StateEnum,
WorkflowStepResV2TypeEnum,
WorkflowStepResV2TypeEnum
} from './common.enum';

export interface IBaseRes {
Expand Down Expand Up @@ -544,6 +545,20 @@ export interface IDingTalkConfigurationV1 {
is_enable_ding_talk_notify?: boolean;
}

export interface IDirectAuditFileReqV1 {
file_contents?: string[];

instance_name?: string;

instance_type?: string;

project_name?: string;

schema_name?: string;

sql_type?: DirectAuditFileReqV1SqlTypeEnum;
}

export interface IDirectAuditReqV1 {
instance_name?: string;

Expand Down Expand Up @@ -782,6 +797,14 @@ export interface IGetDriversResV1 {
message?: string;
}

export interface IGetFeishuAuditConfigurationResV1 {
code?: number;

data?: IFeishuConfigurationV1;

message?: string;
}

export interface IGetFeishuConfigurationResV1 {
code?: number;

Expand Down
8 changes: 8 additions & 0 deletions src/api/common.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ export enum CustomRuleResV1LevelEnum {
'error' = 'error'
}

export enum DirectAuditFileReqV1SqlTypeEnum {
'sql' = 'sql',

'mybatis' = 'mybatis',

'UNKNOWN' = ''
}

export enum DirectAuditReqV1SqlTypeEnum {
'sql' = 'sql',

Expand Down
12 changes: 12 additions & 0 deletions src/api/configuration/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
IUpdateFeishuConfigurationReqV1,
ITestFeishuConfigurationReqV1,
ITestFeishuConfigResV1,
IGetFeishuAuditConfigurationResV1,
IGetLDAPConfigurationResV1,
ILDAPConfigurationReqV1,
IGetLicenseResV1,
Expand Down Expand Up @@ -59,6 +60,17 @@ export interface ITestFeishuConfigV1Params

export interface ITestFeishuConfigV1Return extends ITestFeishuConfigResV1 {}

export interface IGetFeishuAuditConfigurationV1Return
extends IGetFeishuAuditConfigurationResV1 {}

export interface IUpdateFeishuAuditConfigurationV1Params
extends IUpdateFeishuConfigurationReqV1 {}

export interface IUpdateFeishuAuditConfigurationV1Return extends IBaseRes {}

export interface ITestFeishuAuditConfigV1Return
extends ITestFeishuConfigResV1 {}

export interface IGetLDAPConfigurationV1Return
extends IGetLDAPConfigurationResV1 {}

Expand Down
32 changes: 32 additions & 0 deletions src/api/configuration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import {
IUpdateFeishuConfigurationV1Return,
ITestFeishuConfigV1Params,
ITestFeishuConfigV1Return,
IGetFeishuAuditConfigurationV1Return,
IUpdateFeishuAuditConfigurationV1Params,
IUpdateFeishuAuditConfigurationV1Return,
ITestFeishuAuditConfigV1Return,
IGetLDAPConfigurationV1Return,
IUpdateLDAPConfigurationV1Params,
IUpdateLDAPConfigurationV1Return,
Expand Down Expand Up @@ -124,6 +128,34 @@ class ConfigurationService extends ServiceBase {
);
}

public getFeishuAuditConfigurationV1(options?: AxiosRequestConfig) {
return this.get<IGetFeishuAuditConfigurationV1Return>(
'/v1/configurations/feishu_audit',
undefined,
options
);
}

public updateFeishuAuditConfigurationV1(
params: IUpdateFeishuAuditConfigurationV1Params,
options?: AxiosRequestConfig
) {
const paramsData = this.cloneDeep(params);
return this.patch<IUpdateFeishuAuditConfigurationV1Return>(
'/v1/configurations/feishu_audit',
paramsData,
options
);
}

public testFeishuAuditConfigV1(options?: AxiosRequestConfig) {
return this.post<ITestFeishuAuditConfigV1Return>(
'/v1/configurations/feishu_audit/test',
undefined,
options
);
}

public getLDAPConfigurationV1(options?: AxiosRequestConfig) {
return this.get<IGetLDAPConfigurationV1Return>(
'/v1/configurations/ldap',
Expand Down
7 changes: 6 additions & 1 deletion src/api/sql_audit/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import {
IDirectAuditReqV1,
IDirectAuditFileReqV1,
IDirectAuditResV1,
IDirectAuditReqV1,
IDirectAuditReqV2,
IDirectAuditResV2
} from '../common.d';

export interface IDirectAuditFilesV1Params extends IDirectAuditFileReqV1 {}

export interface IDirectAuditFilesV1Return extends IDirectAuditResV1 {}

export interface IDirectAuditV1Params extends IDirectAuditReqV1 {}

export interface IDirectAuditV1Return extends IDirectAuditResV1 {}
Expand Down
14 changes: 14 additions & 0 deletions src/api/sql_audit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@ import ServiceBase from '../Service.base';
import { AxiosRequestConfig } from 'axios';

import {
IDirectAuditFilesV1Params,
IDirectAuditFilesV1Return,
IDirectAuditV1Params,
IDirectAuditV1Return,
IDirectAuditV2Params,
IDirectAuditV2Return
} from './index.d';

class SqlAuditService extends ServiceBase {
public directAuditFilesV1(
params: IDirectAuditFilesV1Params,
options?: AxiosRequestConfig
) {
const paramsData = this.cloneDeep(params);
return this.post<IDirectAuditFilesV1Return>(
'/v1/audit_files',
paramsData,
options
);
}

public directAuditV1(
params: IDirectAuditV1Params,
options?: AxiosRequestConfig
Expand Down
4 changes: 4 additions & 0 deletions src/api/workflow/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export interface IGetWorkflowsV1Params {

filter_workflow_id?: string;

fuzzy_search_workflow_desc?: string;

filter_create_time_from?: string;

filter_create_time_to?: string;
Expand Down Expand Up @@ -95,6 +97,8 @@ export interface IBatchCompleteWorkflowsV1Return extends IBaseRes {}
export interface IExportWorkflowV1Params {
filter_subject?: string;

fuzzy_search_workflow_desc?: string;

filter_create_time_from?: string;

filter_create_time_to?: string;
Expand Down
6 changes: 6 additions & 0 deletions src/locale/zh-CN/auditPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ export default {
result: '审核结果',
analyze: '分析',
},

export: {
buttonText: '下载审核报告',
exporting: '正在下载审核报告',
exportSuccessTips: '审核报告下载成功',
},
},

subscribeNotice: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ exports[`AuditPlanReport should match snapshot 1`] = `
auditPlan.report.passRage
</span>
</div>
<div
class="ant-card-extra"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
auditPlan.report.export.buttonText
</span>
</button>
</div>
</div>
</div>
<div
Expand Down Expand Up @@ -197,6 +209,18 @@ exports[`AuditPlanReport should match snapshot 2`] = `
auditPlan.report.passRage
</span>
</div>
<div
class="ant-card-extra"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
auditPlan.report.export.buttonText
</span>
</button>
</div>
</div>
</div>
<div
Expand Down
Loading