Skip to content

Commit

Permalink
Merge pull request #335 from actiontech/fix/sql_audit_create_result_ui
Browse files Browse the repository at this point in the history
[fix]: update sql audit create result show methods
  • Loading branch information
Rain-1214 authored Nov 16, 2023
2 parents 3eec557 + bfc9eb5 commit 3f5613a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/page/SqlAuditRecord/Create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useCurrentProjectName } from '../../ProjectManage/ProjectDetail';
import AuditResult from '../../Order/AuditResult';
import sql_audit_record from '../../../api/sql_audit_record';
import { ICreateSQLAuditRecordV1Params } from '../../../api/sql_audit_record/index.d';
import { useRef, useState } from 'react';
import { useRef, useState, useEffect } from "react";
import { IAuditTaskResV1, ISQLAuditRecordResData } from '../../../api/common';
import { ResponseCode } from '../../../data/common';
import EmptyBox from '../../../components/EmptyBox';
Expand Down Expand Up @@ -65,8 +65,6 @@ const SQLAuditCreate: React.FC = () => {
return updateTags(res.data.data, baseValues);
} else {
setTask(res.data.data.task);
message.success(t('sqlAudit.create.SQLInfo.successTips'));
scrollToAuditResult();
}
}
});
Expand All @@ -85,8 +83,6 @@ const SQLAuditCreate: React.FC = () => {
.then((res) => {
if (res.data.code === ResponseCode.SUCCESS) {
setTask(record.task);
message.success(t('sqlAudit.create.SQLInfo.successTips'));
scrollToAuditResult();
}
});
};
Expand All @@ -97,6 +93,13 @@ const SQLAuditCreate: React.FC = () => {
setTask(undefined);
};

useEffect(() => {
if (typeof task?.task_id === 'number') {
message.success(t("sqlAudit.create.SQLInfo.successTips"));
scrollToAuditResult();
}
}, [task, t]);

return (
<>
<PageHeader title={t('sqlAudit.create.title')} ghost={false}>
Expand Down

0 comments on commit 3f5613a

Please sign in to comment.