Skip to content

Commit

Permalink
[feature](SQLManagement): Add scan name filter item and display format
Browse files Browse the repository at this point in the history
  • Loading branch information
zzyangh committed Feb 23, 2024
1 parent 6a8de82 commit 742a345
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/api/SqlManage/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export interface IExportSqlManageV1Params {

fuzzy_search_sql_fingerprint?: string;

fuzzy_search_audit_plan_name?: string;

filter_assignee?: string;

filter_instance_name?: string;
Expand Down Expand Up @@ -127,6 +129,8 @@ export interface IGetSqlManageListV2Params {

filter_source?: GetSqlManageListV2FilterSourceEnum;

fuzzy_search_audit_plan_name?: string;

filter_audit_level?: GetSqlManageListV2FilterAuditLevelEnum;

filter_last_audit_start_time_from?: string;
Expand Down
2 changes: 2 additions & 0 deletions src/api/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3211,6 +3211,8 @@ export interface IAuditTaskSQLResV2 {
number?: number;

rollback_sql?: string;

sql_source_file?: string;
}

export interface IBatchCancelWorkflowsReqV2 {
Expand Down
1 change: 1 addition & 0 deletions src/locale/zh-CN/sqlManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default {
rule: '审核规则',
endpoint: '端点信息',
endpointSearchPlaceHolder: '请输入端点信息',
auditPlanName: '智能扫描名',
},

table: {
Expand Down
12 changes: 12 additions & 0 deletions src/page/SQLManagement/SQLPanel/FilterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ const FilterForm: React.FC<SQLPanelFilterFormProps> = ({
/>
</Form.Item>
</Col>
<Col {...FilterFormColLayout}>
<Form.Item
label={t('sqlManagement.filterForm.auditPlanName')}
name="fuzzy_search_audit_plan_name"
>
<Input
placeholder={t('common.form.placeholder.input', {
name: t('sqlManagement.filterForm.auditPlanName'),
})}
/>
</Form.Item>
</Col>

<Col
{...{
Expand Down
23 changes: 19 additions & 4 deletions src/page/SQLManagement/SQLPanel/column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,29 @@ export const SQLPanelColumns: (params: {
{
dataIndex: 'source',
title: () => t('sqlManagement.table.source'),
className: 'table-column-source',
render: (source: ISource) => {
if (source.type && source.type === SourceTypeEnum.audit_plan) {
return (
<Link
to={`project/${projectName}/auditPlan/detail/${source.audit_plan_name}`}
<Typography.Paragraph
ellipsis={{
expandable: false,
tooltip: (
<div>
{t(sourceDictionary[source.type])}:
{source.audit_plan_name || '--'}

Check warning on line 97 in src/page/SQLManagement/SQLPanel/column.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 97 in src/page/SQLManagement/SQLPanel/column.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
</div>
),
}}
className="margin-bottom-0"
>
{t(sourceDictionary[source.type])}
</Link>
<Link
to={`project/${projectName}/auditPlan/detail/${source.audit_plan_name}`}
>
{t(sourceDictionary[source.type])}:
{source.audit_plan_name || '--'}

Check warning on line 107 in src/page/SQLManagement/SQLPanel/column.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 107 in src/page/SQLManagement/SQLPanel/column.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
</Link>
</Typography.Paragraph>
);

Check warning on line 110 in src/page/SQLManagement/SQLPanel/column.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
} else if (
source.type &&
Expand Down
3 changes: 3 additions & 0 deletions src/page/SQLManagement/SQLPanel/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
.table-column-sql {
max-width: 420px;
}
.table-column-source {
max-width: 200px;
}
}
2 changes: 2 additions & 0 deletions src/page/SQLManagement/SQLPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const SQLPanel: React.FC = () => {
DB_TYPE_RULE_NAME_SEPARATOR
)?.[1],
fuzzy_search_endpoint: filterInfo.fuzzy_search_endpoint,
fuzzy_search_audit_plan_name: filterInfo.fuzzy_search_audit_plan_name,
sort_field: getSortField(),
sort_order: getSortOrder(),
}).then((res) => {
Expand Down Expand Up @@ -351,6 +352,7 @@ const SQLPanel: React.FC = () => {
DB_TYPE_RULE_NAME_SEPARATOR
)?.[1],
fuzzy_search_endpoint: filterValues.fuzzy_search_endpoint,
fuzzy_search_audit_plan_name: filterValues.fuzzy_search_audit_plan_name
};

Check warning on line 356 in src/page/SQLManagement/SQLPanel/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

SqlManage.exportSqlManageV1(params, { responseType: 'blob' })
Expand Down
2 changes: 2 additions & 0 deletions src/page/SQLManagement/SQLPanel/index.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export type SQLPanelFilterFormFields = {
fuzzy_search_endpoint?: string;

fuzzy_search_schema_name?: string;

fuzzy_search_audit_plan_name?: string;
};

export type SQLPanelFilterFormProps = {
Expand Down

0 comments on commit 742a345

Please sign in to comment.