From 6f5fce620f0a28635188b9b9ec1bb0ffa3af62f0 Mon Sep 17 00:00:00 2001 From: datagear Date: Thu, 21 Mar 2019 10:26:27 +0800 Subject: [PATCH] =?UTF-8?q?SQL=E5=B7=A5=E4=BD=9C=E5=8F=B0=EF=BC=9A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E5=9B=9E=E6=BB=9A=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=8C=89=E9=92=AE=EF=BC=8C=E5=AE=8C=E5=96=84=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=96=B9=E5=BC=8F=E6=8E=A7=E5=88=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/locales/datagear.properties | 1 + .../webapp/WEB-INF/view/sqlpad/sqlpad.ftl | 57 +++++++++++-------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/datagear-web/src/main/resources/locales/datagear.properties b/datagear-web/src/main/resources/locales/datagear.properties index 218de3b6..ca6ba054 100644 --- a/datagear-web/src/main/resources/locales/datagear.properties +++ b/datagear-web/src/main/resources/locales/datagear.properties @@ -340,6 +340,7 @@ changelog.viewAll=\u67E5\u770B\u5168\u90E8 sqlpad.sqlpad=SQL\u5DE5\u4F5C\u53F0 sqlpad.executeWithShortcut=\u6267\u884C\uFF08Ctrl+Enter\uFF09 sqlpad.commit=\u63D0\u4EA4 +sqlpad.rollback=\u56DE\u6EDA sqlpad.stopExecution=\u505C\u6B62\u6267\u884C sqlpad.clearEditSql=\u6E05\u9664SQL sqlpad.moreOperation=\u8BBE\u7F6E diff --git a/datagear-web/src/main/webapp/WEB-INF/view/sqlpad/sqlpad.ftl b/datagear-web/src/main/webapp/WEB-INF/view/sqlpad/sqlpad.ftl index 8c91376b..ec402a30 100644 --- a/datagear-web/src/main/webapp/WEB-INF/view/sqlpad/sqlpad.ftl +++ b/datagear-web/src/main/webapp/WEB-INF/view/sqlpad/sqlpad.ftl @@ -22,6 +22,7 @@ Schema schema 数据库,不允许为null
+
@@ -30,21 +31,21 @@ Schema schema 数据库,不允许为null
-
+
-
- - - +
+ +
-
+
-
- - +
+ + +
@@ -99,8 +100,8 @@ select count(*) from t_order where id = 3 and name = 'jack'; po.sqlResultContentElement = po.element("#${pageId}-sql-result > .result-content"); $.initButtons(po.element(".head")); - po.element("#sqlExceptionHandleModeSet").buttonset(); po.element("#sqlCommitModeSet").buttonset(); + po.element("#sqlExceptionHandleModeSet").buttonset(); po.element(".more-operation-panel").hide(); $(document.body).bind("click", function(event) @@ -281,20 +282,30 @@ select count(*) from t_order where id = 3 and name = 'jack'; po.element(".more-operation-panel").toggle(); }); - po.updateCommitSqlButtonStatus = function(enable) - { - if(enable == undefined) - enable = (po.element("input[name='sqlCommitMode']").val() == "manual"); - - if(enable) - po.element("#commitSqlButton").button("enable"); - else - po.element("#commitSqlButton").button("disable"); - }; - po.element("input[name='sqlCommitMode']").change(function() { - po.updateCommitSqlButtonStatus($(this).val() == "manual"); + var value = $(this).val(); + + console.log(value); + + if(value == "manual") + { + po.element("#commitSqlButton").button("enable"); + po.element("#rollbackSqlButton").button("enable"); + + var $rollbackExceptionHandle = po.element("input[name='sqlExceptionHandleModel'][value='rollback']"); + $rollbackExceptionHandle.attr("disabled", "disabled"); + if($rollbackExceptionHandle.is(":checked")) + po.element("input[name='sqlExceptionHandleModel'][value='abort']").prop("checked", true); + po.element("#sqlExceptionHandleModeSet").buttonset("refresh"); + } + else + { + po.element("#commitSqlButton").button("disable"); + po.element("#rollbackSqlButton").button("disable"); + po.element("input[name='sqlExceptionHandleModel'][value='rollback']").removeAttr("disabled"); + po.element("#sqlExceptionHandleModeSet").buttonset("refresh"); + } }); po.element("#toggleResultTimeButton").click(function() @@ -318,7 +329,7 @@ select count(*) from t_order where id = 3 and name = 'jack'; po.sqlResultContentElement.empty(); }); - po.updateCommitSqlButtonStatus(); + po.element("input[name='sqlCommitMode'][value='auto']").click(); }) (${pageId});