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

[chore]: Add filtering for description column in table #311

Merged
merged 1 commit into from
Aug 31, 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
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/page/Order/List/OrderListFilterForm/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ describe('Order/List/OrderListFilterForm', () => {
filter_create_user_name: undefined,
filter_status: undefined,
filter_task_instance_name: undefined,
fuzzy_search_workflow_desc: undefined,
});

const assigneeInput = getBySelector(
Expand Down Expand Up @@ -121,6 +122,9 @@ describe('Order/List/OrderListFilterForm', () => {
fireEvent.input(screen.getByLabelText('order.order.id'), {
target: { value: '1234' },
});
fireEvent.input(screen.getByLabelText('order.order.desc'), {
target: { value: 'desc' },
});
expect(result.current[0].getFieldsValue()).toEqual({
filter_current_step_assignee_user_name: 'user_name1',
filter_create_user_name: undefined,
Expand All @@ -131,6 +135,7 @@ describe('Order/List/OrderListFilterForm', () => {
filter_order_createTime: undefined,
filter_order_executeTime: undefined,
filter_workflow_id: '1234',
fuzzy_search_workflow_desc: 'desc',
});

expect(screen.getByText('common.collapse')).toBeInTheDocument();
Expand All @@ -155,6 +160,7 @@ describe('Order/List/OrderListFilterForm', () => {
filter_subject: undefined,
filter_order_createTime: undefined,
filter_order_executeTime: undefined,
fuzzy_search_workflow_desc: undefined,
})
).toBeTruthy();
expect(submitMock).toBeCalledTimes(1);
Expand Down
17 changes: 16 additions & 1 deletion src/page/Order/List/OrderListFilterForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const OrderListFilterForm: React.FC<OrderListFilterFormProps> = (props) => {
filter_order_createTime: undefined,
filter_subject: undefined,
filter_order_executeTime: undefined,
fuzzy_search_workflow_desc: undefined,
});
props.submit();
}
Expand Down Expand Up @@ -140,6 +141,7 @@ const OrderListFilterForm: React.FC<OrderListFilterFormProps> = (props) => {
/>
</Form.Item>
</Col>

<Col xs={24} xl={16} xxl={12} hidden={currentCollapse}>
<Form.Item
name="filter_order_createTime"
Expand All @@ -153,6 +155,19 @@ const OrderListFilterForm: React.FC<OrderListFilterFormProps> = (props) => {
</Form.Item>
</Col>

<Col {...FilterFormColLayout} hidden={currentCollapse}>
<Form.Item
name="fuzzy_search_workflow_desc"
label={t('order.order.desc')}
>
<Input
placeholder={t('common.form.placeholder.searchInput', {
name: t('order.order.desc'),
})}
/>
</Form.Item>
</Col>

<Col xs={24} xl={16} xxl={12} hidden={currentCollapse}>
<Form.Item
name="filter_order_executeTime"
Expand All @@ -170,7 +185,7 @@ const OrderListFilterForm: React.FC<OrderListFilterFormProps> = (props) => {
{...filterFormButtonLayoutFactory(
currentCollapse ? 12 : 12,
currentCollapse ? 8 : 0,
currentCollapse ? 18 : 6
currentCollapse ? 18 : 0
)}
className="text-align-right"
>
Expand Down
Loading