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

[fix]: Add audit status check for render audit result info #325

Merged
merged 1 commit into from
Oct 11, 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
15 changes: 15 additions & 0 deletions src/page/Order/AuditResult/AuditResultInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import './index.less';
import RuleLevelIcon from '../../../../components/RuleList/RuleLevelIcon';
import useStyles from '../../../../theme';
import { useTranslation } from 'react-i18next';

const AuditResultInfo: React.FC<AuditResultColumnProps> = ({
auditResult = [],
auditStatus,
}) => {
const auditResultNum = auditResult?.length ?? 0;
const styles = useStyles();
const { t } = useTranslation();

const renderResultBox = (
ruleLevel: RuleResV1LevelEnum | 'passed',
Expand Down Expand Up @@ -60,6 +63,18 @@
);
};
const renderAuditColumn = () => {
if (!!auditStatus && auditStatus !== 'finished') {
return (
<AuditResultErrorMessage
auditResult={[
{
level: RuleResV1LevelEnum.normal,
message: t('sqlAudit.list.auditing'),
},
]}
/>
);

Check warning on line 76 in src/page/Order/AuditResult/AuditResultInfo/index.tsx

View workflow job for this annotation

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

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 77 in src/page/Order/AuditResult/AuditResultInfo/index.tsx

View workflow job for this annotation

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

🌿 Branch is not covered

Warning! Not covered branch
if (auditResultNum === 1)
return <AuditResultErrorMessage auditResult={auditResult} />;

Expand Down
6 changes: 4 additions & 2 deletions src/page/Order/AuditResult/AuditResultInfo/index.type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {AuditResultErrorMessageProps} from '../../../../components/AuditResultErrorMessage/index.type'
import { AuditResultErrorMessageProps } from '../../../../components/AuditResultErrorMessage/index.type';

export interface AuditResultColumnProps extends AuditResultErrorMessageProps {}
export interface AuditResultColumnProps extends AuditResultErrorMessageProps {
auditStatus?: string;
}
18 changes: 14 additions & 4 deletions src/page/Order/AuditResult/column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,31 @@
dataIndex?: keyof IAuditTaskSQLResV2 | 'operator';
}
> => {
return [
{
dataIndex: 'number',
title: () => t('sqlAudit.create.result.table.number'),
width: 60,
},
{
dataIndex: 'exec_sql',
title: () => t('sqlAudit.create.result.table.auditSql'),
width: 300,
render: (sql?: string) => {
return <RenderExecuteSql sql={sql} />;
},
},
{
dataIndex: 'audit_result',
title: () => t('sqlAudit.create.result.table.auditResult'),
width: 200,
render: (auditResult: IAuditResult[]) => {
return <AuditResultInfo auditResult={auditResult} />;
render: (auditResult: IAuditResult[], record) => {

Check warning on line 59 in src/page/Order/AuditResult/column.tsx

View workflow job for this annotation

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

🕹️ Function is not covered

Warning! Not covered function
return (
<AuditResultInfo
auditResult={auditResult}
auditStatus={record.audit_status}
/>
);

Check warning on line 65 in src/page/Order/AuditResult/column.tsx

View workflow job for this annotation

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

🧾 Statement is not covered

Warning! Not covered statement
},
},
Table.EXPAND_COLUMN,
Expand Down Expand Up @@ -123,8 +128,13 @@
dataIndex: 'audit_result',
title: () => t('audit.table.auditResult'),
width: 200,
render: (auditResult: IAuditResult[]) => {
return <AuditResultInfo auditResult={auditResult} />;
render: (auditResult: IAuditResult[], record) => {
return (
<AuditResultInfo
auditResult={auditResult}
auditStatus={record.audit_status}
/>
);
},
},
Table.EXPAND_COLUMN,
Expand Down