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

在自动审核模式中,上线工单存在检测错误或警告时,并匹配auto_rwview_wrong参数时,工单状态应为自动审核不通过;在客户端JS脚本中增加脚本错误数的判断 #2692

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 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
4 changes: 3 additions & 1 deletion sql/templates/sqlsubmit.html
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,9 @@ <h4 class="modal-title text-danger">提交信息确认</h4>
sessionStorage.setItem('CheckWarningCount', result.warning_count);
sessionStorage.setItem('CheckErrorCount', result.error_count);
$("#inception-result").show();
$('#btn-submitsql').button('reset').removeClass('disabled').prop("disabled", false);
if (result.error_count==0) {
$('#btn-submitsql').button('reset').removeClass('disabled').prop("disabled", false);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (XMLHttpRequest.responseJSON) {
Expand Down
15 changes: 14 additions & 1 deletion sql/utils/workflow_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class AuditV2:
# 归档表中没有下面两个参数, 所以对归档表来说一下两参数必传
resource_group: str = ""
resource_group_id: int = 0
max_errlevel: int = 0

def __post_init__(self):
if not self.workflow:
Expand Down Expand Up @@ -229,6 +230,8 @@ def is_auto_review(self) -> bool:
return False
# 影响行数加测, 总语句影响行数超过指定数量则需要人工审核
all_affected_rows += int(review_result.affected_rows)
if review_result.errlevel > self.max_errlevel:
self.max_errlevel = review_result.errlevel
if all_affected_rows > int(
self.sys_config.get("auto_review_max_update_rows", 50)
):
Expand All @@ -237,7 +240,17 @@ def is_auto_review(self) -> bool:
return True

def generate_audit_setting(self) -> AuditSetting:
if self.is_auto_review():
auto_review = self.is_auto_review()
peixubin marked this conversation as resolved.
Show resolved Hide resolved
auto_review_wrong = self.sys_config.get("auto_review_wrong", "")
if auto_review_wrong == "":
auto_review_wrong = "2"
auto_review_wrong = int(auto_review_wrong)
should_reject = False
if self.max_errlevel == 1 and auto_review_wrong == 1:
should_reject = True
elif self.max_errlevel == 2 and auto_review_wrong in (1, 2):
should_reject = True
if auto_review and not should_reject:
return AuditSetting(auto_pass=True)
if self.workflow_type in [WorkflowType.SQL_REVIEW, WorkflowType.QUERY]:
group_id = self.workflow.group_id
Expand Down
Loading