Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/actiontech/sqle-ui into fea…
Browse files Browse the repository at this point in the history
…ture/upgrad-dependencies
  • Loading branch information
LZS911 committed Apr 23, 2023
2 parents bf7d493 + 8703ae6 commit c2f2822
Show file tree
Hide file tree
Showing 79 changed files with 8,846 additions and 6,644 deletions.
2 changes: 1 addition & 1 deletion src/api/Service.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ServiceBase {
options?: AxiosRequestConfig
) {
return ApiBase.delete<T>(url, {
params: data,
data,
...options
});
}
Expand Down
32 changes: 31 additions & 1 deletion src/api/audit_plan/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import {
IFullSyncAuditPlanSQLsReqV1,
IPartialSyncAuditPlanSQLsReqV1,
ITriggerAuditPlanResV1,
IGetAuditPlansResV2
IGetAuditPlansResV2,
IGetAuditPlanReportSQLsResV2,
IGetAuditPlanAnalysisDataResV2
} from '../common.d';

export interface IGetAuditPlanMetasV1Params {
Expand Down Expand Up @@ -209,3 +211,31 @@ export interface IGetAuditPlansV2Params {
}

export interface IGetAuditPlansV2Return extends IGetAuditPlansResV2 {}

export interface IGetAuditPlanReportsSQLsParams {
project_name: string;

audit_plan_name: string;

audit_plan_report_id: string;

page_index: number;

page_size: number;
}

export interface IGetAuditPlanReportsSQLsReturn
extends IGetAuditPlanReportSQLsResV2 {}

export interface IGetAuditPlantAnalysisDataV2Params {
project_name: string;

audit_plan_name: string;

audit_plan_report_id: string;

number: string;
}

export interface IGetAuditPlantAnalysisDataV2Return
extends IGetAuditPlanAnalysisDataResV2 {}
51 changes: 50 additions & 1 deletion src/api/audit_plan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ import {
ITriggerAuditPlanV1Params,
ITriggerAuditPlanV1Return,
IGetAuditPlansV2Params,
IGetAuditPlansV2Return
IGetAuditPlansV2Return,
IGetAuditPlanReportsSQLsParams,
IGetAuditPlanReportsSQLsReturn,
IGetAuditPlantAnalysisDataV2Params,
IGetAuditPlantAnalysisDataV2Return
} from './index.d';

class AuditPlanService extends ServiceBase {
Expand Down Expand Up @@ -375,6 +379,51 @@ class AuditPlanService extends ServiceBase {
options
);
}

public getAuditPlanReportsSQLs(
params: IGetAuditPlanReportsSQLsParams,
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<IGetAuditPlanReportsSQLsReturn>(
`/v2/projects/${project_name}/audit_plans/${audit_plan_name}/reports/${audit_plan_report_id}/sqls`,
paramsData,
options
);
}

public getAuditPlantAnalysisDataV2(
params: IGetAuditPlantAnalysisDataV2Params,
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;

const number = paramsData.number;
delete paramsData.number;

return this.get<IGetAuditPlantAnalysisDataV2Return>(
`/v2/projects/${project_name}/audit_plans/${audit_plan_name}/reports/${audit_plan_report_id}/sqls/${number}/analysis`,
paramsData,
options
);
}
}

export default new AuditPlanService();
144 changes: 143 additions & 1 deletion src/api/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {
WorkflowStepResV1StateEnum,
WorkflowStepResV1TypeEnum,
WorkflowTemplateDetailResV1AllowSubmitWhenLessAuditLevelEnum,
AuditResDataV2AuditLevelEnum,
DirectAuditReqV2SqlTypeEnum,
GetWorkflowTasksItemV2StatusEnum,
WorkflowRecordResV2StatusEnum,
WorkflowResV2ModeEnum,
Expand Down Expand Up @@ -1882,7 +1884,7 @@ export interface ISMTPConfigurationResV1 {
export interface ISQLExplain {
classic_result?: IExplainClassicResult;

message?: string;
err_message?: string;

sql?: string;
}
Expand Down Expand Up @@ -2595,6 +2597,20 @@ export interface IWorkflowTemplateDetailResV1 {
workflow_template_name?: string;
}

export interface IAffectRows {
count?: number;

err_message?: string;
}

export interface IAuditPlanReportSQLResV2 {
audit_plan_report_sql?: string;

audit_plan_report_sql_audit_result?: IAuditResult[];

number?: number;
}

export interface IAuditPlanResV2 {
audit_plan_cron?: string;

Expand All @@ -2613,6 +2629,54 @@ export interface IAuditPlanResV2 {
rule_template?: IRuleTemplateV2;
}

export interface IAuditResDataV2 {
audit_level?: AuditResDataV2AuditLevelEnum;

pass_rate?: number;

score?: number;

sql_results?: IAuditSQLResV2[];
}

export interface IAuditResult {
level?: string;

message?: string;

rule_name?: string;
}

export interface IAuditSQLResV2 {
audit_level?: string;

audit_result?: IAuditResult[];

exec_sql?: string;

number?: number;
}

export interface IAuditTaskSQLResV2 {
audit_level?: string;

audit_result?: IAuditResult[];

audit_status?: string;

description?: string;

exec_result?: string;

exec_sql?: string;

exec_status?: string;

number?: number;

rollback_sql?: string;
}

export interface IBatchCancelWorkflowsReqV2 {
workflow_id_list?: string[];
}
Expand Down Expand Up @@ -2653,6 +2717,40 @@ export interface ICreateWorkflowReqV2 {
workflow_subject?: string;
}

export interface IDirectAuditReqV2 {
instance_type?: string;

sql_content?: string;

sql_type?: DirectAuditReqV2SqlTypeEnum;
}

export interface IDirectAuditResV2 {
code?: number;

data?: IAuditResDataV2;

message?: string;
}

export interface IGetAuditPlanAnalysisDataResV2 {
code?: number;

data?: ITaskAnalysisDataV2;

message?: string;
}

export interface IGetAuditPlanReportSQLsResV2 {
code?: number;

data?: IAuditPlanReportSQLResV2[];

message?: string;

total_nums?: number;
}

export interface IGetAuditPlansResV2 {
code?: number;

Expand All @@ -2663,6 +2761,24 @@ export interface IGetAuditPlansResV2 {
total_nums?: number;
}

export interface IGetAuditTaskSQLsResV2 {
code?: number;

data?: IAuditTaskSQLResV2[];

message?: string;

total_nums?: number;
}

export interface IGetInstanceResV2 {
code?: number;

data?: IInstanceResV2;

message?: string;
}

export interface IGetInstancesResV2 {
code?: number;

Expand All @@ -2673,6 +2789,14 @@ export interface IGetInstancesResV2 {
total_nums?: number;
}

export interface IGetTaskAnalysisDataResV2 {
code?: number;

data?: ITaskAnalysisDataV2;

message?: string;
}

export interface IGetWorkflowResV2 {
code?: number;

Expand Down Expand Up @@ -2737,6 +2861,10 @@ export interface IInstanceResV2 {
sql_query_config?: ISQLQueryConfigResV1;
}

export interface IPerformanceStatistics {
affect_rows?: IAffectRows;
}

export interface IRejectWorkflowReqV2 {
reason?: string;
}
Expand All @@ -2747,6 +2875,20 @@ export interface IRuleTemplateV2 {
name?: string;
}

export interface ITableMetas {
err_message?: string;

table_meta_items?: ITableMeta[];
}

export interface ITaskAnalysisDataV2 {
performance_statistics?: IPerformanceStatistics;

sql_explain?: ISQLExplain;

table_metas?: ITableMetas;
}

export interface IUpdateWorkflowReqV2 {
task_ids?: number[];
}
Expand Down
20 changes: 20 additions & 0 deletions src/api/common.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,26 @@ export enum WorkflowTemplateDetailResV1AllowSubmitWhenLessAuditLevelEnum {
'error' = 'error'
}

export enum AuditResDataV2AuditLevelEnum {
'normal' = 'normal',

'notice' = 'notice',

'warn' = 'warn',

'error' = 'error',

'UNKNOWN' = ''
}

export enum DirectAuditReqV2SqlTypeEnum {
'sql' = 'sql',

'mybatis' = 'mybatis',

'UNKNOWN' = ''
}

export enum GetWorkflowTasksItemV2StatusEnum {
'wait_for_audit' = 'wait_for_audit',

Expand Down
11 changes: 10 additions & 1 deletion src/api/instance/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
IListTableBySchemaResV1,
IGetTableMetadataResV1,
IGetInstancesResV2,
ICreateInstanceReqV2
ICreateInstanceReqV2,
IGetInstanceResV2
} from '../common.d';

import { getInstanceTipListV1FunctionalModuleEnum } from './index.enum';
Expand Down Expand Up @@ -175,3 +176,11 @@ export interface ICreateInstanceV2Params extends ICreateInstanceReqV2 {
}

export interface ICreateInstanceV2Return extends IBaseRes {}

export interface IGetInstanceV2Params {
project_name: string;

instance_name: string;
}

export interface IGetInstanceV2Return extends IGetInstanceResV2 {}
Loading

0 comments on commit c2f2822

Please sign in to comment.