From 1377fc59e280924bd2bc36338a379b82396ea46b Mon Sep 17 00:00:00 2001 From: jianghongfei Date: Tue, 15 Feb 2022 19:36:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=97=AE=E9=A2=98:=20mongodb=E8=A1=A8?= =?UTF-8?q?=E5=90=8D=E5=B8=A6=E5=A4=9A=E4=B8=AA.=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B,=20=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=88=AA=E5=8F=96methodStr.=20=E5=8E=9F=E5=9B=A0=E6=98=AF=20?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=88=AA=E5=8F=96=E7=AC=AC=E4=BA=8C=E4=B8=AA?= =?UTF-8?q?=20"."=20=E5=88=B0"("=20=E4=B9=8B=E9=97=B4=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E4=BD=9C=E4=B8=BAmethod=20(#1381)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 问题:mongodb表名带-和.符号无法申请上线,原因:\w只匹配[a-zA-Z0-9_],修正:(\w*) -> ([\w\.-]+) * 问题: mongodb表名带多个.的情况下, 无法正确截取methodStr. 原因是 默认截取第二个 "." 到"(" 之间的字符串作为method Co-authored-by: 蒋宏飞 --- sql/engines/mongo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/engines/mongo.py b/sql/engines/mongo.py index 9d281b5375..e3edaeba86 100644 --- a/sql/engines/mongo.py +++ b/sql/engines/mongo.py @@ -439,8 +439,9 @@ def execute_check(self, db_name=None, sql=''): check_result.rows += [result] continue else: - method = sql_str.split('.')[2] - methodStr = method.split('(')[0].strip() + # method = sql_str.split('.')[2] + # methodStr = method.split('(')[0].strip() + methodStr = sql_str.split('(')[0].split('.')[-1].strip() # 最后一个.和括号(之间的字符串作为方法 if methodStr in is_exist_premise_method and not is_in: check_result.error = "文档不存在" check_result.error_count += 1 From 3f6770f6b8b78710cdbb568f45c2257263997d73 Mon Sep 17 00:00:00 2001 From: Nick Wang <33473924+nick2wang@users.noreply.github.com> Date: Tue, 15 Feb 2022 19:40:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?redis=E6=9F=A5=E8=AF=A2=E7=BB=93=E6=9E=9Cjs?= =?UTF-8?q?on=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=98=BE=E7=A4=BA=20#1376=20(#138?= =?UTF-8?q?2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * redis查询结果json格式化显示 #1376 redis查询结果json格式化显示 #1376 * 报错提示 报错提示 * 提示优化 提示优化 --- sql/templates/sqlquery.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sql/templates/sqlquery.html b/sql/templates/sqlquery.html index 60deae3657..e1d8902a65 100644 --- a/sql/templates/sqlquery.html +++ b/sql/templates/sqlquery.html @@ -779,7 +779,7 @@ //初始化查询结果 var isdetail = false var optgroup = $('#instance_name :selected').parent().attr('label'); - if (optgroup == 'Mongo') { + if (optgroup === 'Mongo' || optgroup === 'Redis') { isdetail = true } var showExport = {{can_download}}===1 @@ -811,6 +811,17 @@ $.each(row, function (key, value) { if (key === 0) {//mongodb这里要修改 let rs = value; + if (optgroup === 'Redis') { + try { + rs = JSON.parse(rs); + if (typeof rs == 'object' && rs) { + rs = JSON.stringify(rs, null, 2) + } + } catch (e) { + html.push('' + "非json格式,无法格式化!" + ''); + return false; + } + } html.push('
' + highLight(rs) + '
'); } }); From ca10a8f0d55c9a1662b33deef399d805d2b29399 Mon Sep 17 00:00:00 2001 From: heisaman Date: Tue, 15 Feb 2022 20:01:14 +0800 Subject: [PATCH 3/3] Fix mis-leading comments in sql workflow submit view (#1385) --- sql/sql_workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_workflow.py b/sql/sql_workflow.py index 3d03c0d51a..5055310550 100644 --- a/sql/sql_workflow.py +++ b/sql/sql_workflow.py @@ -218,7 +218,7 @@ def submit(request): workflow_id = sql_workflow.id # 自动审核通过了,才调用工作流 if workflow_status == 'workflow_manreviewing': - # 调用工作流插入审核信息, 查询权限申请workflow_type=2 + # 调用工作流插入审核信息, SQL上线权限申请workflow_type=2 Audit.add(WorkflowDict.workflow_type['sqlreview'], workflow_id) except Exception as msg: logger.error(f"提交工单报错,错误信息:{traceback.format_exc()}")