This is an automated email from the ASF dual-hosted git repository.
chenxingchun pushed a commit to branch 1.3.6-prepare
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/1.3.6-prepare by this push:
new 7df22bd [1.3.6-prepare][Feature-5087][SqlTask] Add a switch to send
mail and print head logs in SqlTask #5088 (#5104)
7df22bd is described below
commit 7df22bd52147f8bec8e3b8fe82e4192d6bd0ed09
Author: Shiwen Cheng <[email protected]>
AuthorDate: Mon Mar 22 15:06:57 2021 +0800
[1.3.6-prepare][Feature-5087][SqlTask] Add a switch to send mail and print
head logs in SqlTask #5088 (#5104)
* [1.3.6-prepare][Improvement][UI] Rename from-mirror to form-mirror and
from-model to form-model
* [1.3.6-prepare][Feature-5087][SqlTask] Add a switch to send mail and
print head logs in SqlTask #5088
---
.../alert/plugin/EmailAlertPlugin.java | 15 ++---
.../dolphinscheduler/alert/utils/Constants.java | 2 -
.../dolphinscheduler/alert/utils/MailUtils.java | 39 +++++++-----
.../alert/plugin/EmailAlertPluginTest.java | 15 ++---
.../apache/dolphinscheduler/common/Constants.java | 5 ++
.../common/task/sql/SqlParameters.java | 32 ++++++++++
.../common/task/SqlParametersTest.java | 65 +++++++++++++++++++
.../server/worker/task/sql/SqlTask.java | 72 ++++++++++++++--------
.../src/js/conf/home/pages/dag/_source/dag.scss | 2 +-
.../pages/dag/_source/formModel/formModel.scss | 2 +-
.../home/pages/dag/_source/formModel/formModel.vue | 2 +-
.../_source/formModel/tasks/_source/scriptBox.vue | 4 +-
.../pages/dag/_source/formModel/tasks/datax.vue | 4 +-
.../pages/dag/_source/formModel/tasks/python.vue | 2 +-
.../pages/dag/_source/formModel/tasks/shell.vue | 2 +-
.../home/pages/dag/_source/formModel/tasks/sql.vue | 55 ++++++++++++-----
.../pages/dag/_source/formModel/tasks/sqoop.vue | 4 +-
.../pages/definition/pages/list/_source/email.vue | 2 +-
.../pages/definition/pages/list/_source/timing.vue | 4 +-
dolphinscheduler-ui/src/js/conf/login/App.vue | 4 +-
.../js/module/components/conditions/conditions.vue | 2 +-
.../components/crontab/source/_times/day.vue | 2 +-
.../components/crontab/source/_times/hour.vue | 2 +-
.../components/crontab/source/_times/minute.vue | 2 +-
.../components/crontab/source/_times/month.vue | 2 +-
.../components/crontab/source/_times/second.vue | 2 +-
.../components/crontab/source/_times/year.vue | 2 +-
.../js/module/components/crontab/source/index.scss | 2 +-
.../src/js/module/i18n/locale/en_US.js | 4 ++
.../src/js/module/i18n/locale/zh_CN.js | 4 ++
dolphinscheduler-ui/src/sass/common/index.scss | 2 +-
dolphinscheduler-ui/src/sass/conf/login/index.scss | 2 +-
pom.xml | 1 +
33 files changed, 265 insertions(+), 96 deletions(-)
diff --git
a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java
b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java
index 27fb301..50ab137 100644
---
a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java
+++
b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java
@@ -26,11 +26,16 @@ import org.apache.dolphinscheduler.plugin.api.AlertPlugin;
import org.apache.dolphinscheduler.plugin.model.AlertData;
import org.apache.dolphinscheduler.plugin.model.AlertInfo;
import org.apache.dolphinscheduler.plugin.model.PluginName;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.*;
-
/**
* EmailAlertPlugin
*
@@ -104,12 +109,8 @@ public class EmailAlertPlugin implements AlertPlugin {
return retMaps;
}
- boolean enabled =
Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.MAIL_ENABLED)));
boolean status =
Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.STATUS)));
- if (!enabled) {
- logger.warn("mail wasn't sent since the mail config isn't set");
- retMaps.put(Constants.MESSAGE, "mail wasn't sent since the mail
config isn't set");
- } else if (status) {
+ if (status) {
logger.info("alert send success");
retMaps.put(Constants.MESSAGE, "email send success.");
if (EnterpriseWeChatUtils.isEnable()) {
diff --git
a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java
b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java
index 2fc4749..966a760 100644
---
a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java
+++
b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java
@@ -39,8 +39,6 @@ public class Constants {
public static final String MESSAGE = "message";
- public static final String MAIL_ENABLED = "mail.enabled";
-
public static final String MAIL_PROTOCOL = "mail.protocol";
public static final String MAIL_SERVER_HOST = "mail.server.host";
diff --git
a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
index 98f7b75..9698eea 100644
---
a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
+++
b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
@@ -19,18 +19,34 @@ package org.apache.dolphinscheduler.alert.utils;
import org.apache.dolphinscheduler.alert.template.AlertTemplate;
import org.apache.dolphinscheduler.alert.template.AlertTemplateFactory;
import org.apache.dolphinscheduler.common.enums.ShowType;
-import org.apache.commons.mail.EmailException;
-import org.apache.commons.mail.HtmlEmail;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
+
+import org.apache.commons.mail.EmailException;
+import org.apache.commons.mail.HtmlEmail;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.MimeUtility;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.mail.*;
-import javax.mail.internet.*;
-import java.io.*;
-import java.util.*;
-
/**
* mail utils
@@ -85,15 +101,6 @@ public class MailUtils {
*/
public static Map<String,Object> sendMails(Collection<String> receivers,
Collection<String> receiversCc, String title, String content, String showType) {
Map<String,Object> retMap = new HashMap<>();
-
- // if mail is default config, no need to process
- if (StringUtils.isEmpty(MAIL_SERVER_HOST) ||
"xxx.xxx.com".equals(MAIL_SERVER_HOST)) {
- retMap.put(Constants.MAIL_ENABLED, false);
- retMap.put(Constants.STATUS, true);
- return retMap;
- }
-
- retMap.put(Constants.MAIL_ENABLED, true);
retMap.put(Constants.STATUS, false);
// if there is no receivers && no receiversCc, no need to process
diff --git
a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
index 93ffe9a..4ec6a4c 100644
---
a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
+++
b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
@@ -16,22 +16,24 @@
*/
package org.apache.dolphinscheduler.alert.plugin;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
import org.apache.dolphinscheduler.alert.utils.Constants;
import org.apache.dolphinscheduler.common.enums.ShowType;
import org.apache.dolphinscheduler.plugin.api.AlertPlugin;
import org.apache.dolphinscheduler.plugin.model.AlertData;
import org.apache.dolphinscheduler.plugin.model.AlertInfo;
import org.apache.dolphinscheduler.plugin.model.PluginName;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class EmailAlertPluginTest {
@@ -75,7 +77,6 @@ public class EmailAlertPluginTest {
List<String> list = new ArrayList<String>(){{ add("[email protected]"); }};
alertInfo.addProp("receivers", list);
Map<String, Object> ret = plugin.process(alertInfo);
-
assertFalse(Boolean.parseBoolean(String.valueOf(ret.get(Constants.MAIL_ENABLED))));
-
assertTrue(Boolean.parseBoolean(String.valueOf(ret.get(Constants.STATUS))));
+
assertFalse(Boolean.parseBoolean(String.valueOf(ret.get(Constants.STATUS))));
}
}
\ No newline at end of file
diff --git
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
index aa01edd..163af3c 100644
---
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
@@ -326,6 +326,11 @@ public final class Constants {
public static final Pattern REGEX_MAIL_NAME =
Pattern.compile("^([a-z0-9A-Z]+[_|\\-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$");
/**
+ * default display rows
+ */
+ public static final int DEFAULT_DISPLAY_ROWS = 10;
+
+ /**
* read permission
*/
public static final int READ_PERMISSION = 2 * 1;
diff --git
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
index 4604234..37f46f9 100644
---
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
@@ -50,9 +50,20 @@ public class SqlParameters extends AbstractParameters {
private int sqlType;
/**
+ * send email
+ */
+ private Boolean sendEmail;
+
+ /**
+ * display rows
+ */
+ private int displayRows;
+
+ /**
* udf list
*/
private String udfs;
+
/**
* show type
* 0 TABLE
@@ -61,14 +72,17 @@ public class SqlParameters extends AbstractParameters {
* 3 TABLE+attachment
*/
private String showType;
+
/**
* SQL connection parameters
*/
private String connParams;
+
/**
* Pre Statements
*/
private List<String> preStatements;
+
/**
* Post Statements
*/
@@ -129,6 +143,22 @@ public class SqlParameters extends AbstractParameters {
this.sqlType = sqlType;
}
+ public Boolean getSendEmail() {
+ return sendEmail;
+ }
+
+ public void setSendEmail(Boolean sendEmail) {
+ this.sendEmail = sendEmail;
+ }
+
+ public int getDisplayRows() {
+ return displayRows;
+ }
+
+ public void setDisplayRows(int displayRows) {
+ this.displayRows = displayRows;
+ }
+
public String getShowType() {
return showType;
}
@@ -201,6 +231,8 @@ public class SqlParameters extends AbstractParameters {
", datasource=" + datasource +
", sql='" + sql + '\'' +
", sqlType=" + sqlType +
+ ", sendEmail=" + sendEmail +
+ ", displayRows=" + displayRows +
", udfs='" + udfs + '\'' +
", showType='" + showType + '\'' +
", connParams='" + connParams + '\'' +
diff --git
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/task/SqlParametersTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/task/SqlParametersTest.java
new file mode 100644
index 0000000..3c1612c
--- /dev/null
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/task/SqlParametersTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.common.task;
+
+import org.apache.dolphinscheduler.common.task.sql.SqlParameters;
+import org.apache.dolphinscheduler.common.utils.CollectionUtils;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SqlParametersTest {
+
+ private final String type = "MYSQL";
+ private final String sql = "select * from t_ds_user";
+ private final String udfs = "test-udfs-1.0.0-SNAPSHOT.jar";
+ private final int datasource = 1;
+ private final int sqlType = 0;
+ private final Boolean sendEmail = true;
+ private final int displayRows = 10;
+ private final String showType = "TABLE";
+ private final String title = "sql test";
+
+ @Test
+ public void testSqlParameters() {
+ SqlParameters sqlParameters = new SqlParameters();
+
Assert.assertTrue(CollectionUtils.isEmpty(sqlParameters.getResourceFilesList()));
+
+ sqlParameters.setType(type);
+ sqlParameters.setSql(sql);
+ sqlParameters.setUdfs(udfs);
+ sqlParameters.setDatasource(datasource);
+ sqlParameters.setSqlType(sqlType);
+ sqlParameters.setSendEmail(sendEmail);
+ sqlParameters.setDisplayRows(displayRows);
+ sqlParameters.setShowType(showType);
+ sqlParameters.setTitle(title);
+
+ Assert.assertEquals(type, sqlParameters.getType());
+ Assert.assertEquals(sql, sqlParameters.getSql());
+ Assert.assertEquals(udfs, sqlParameters.getUdfs());
+ Assert.assertEquals(datasource, sqlParameters.getDatasource());
+ Assert.assertEquals(sqlType, sqlParameters.getSqlType());
+ Assert.assertEquals(sendEmail, sqlParameters.getSendEmail());
+ Assert.assertEquals(displayRows, sqlParameters.getDisplayRows());
+ Assert.assertEquals(showType, sqlParameters.getShowType());
+ Assert.assertEquals(title, sqlParameters.getTitle());
+
+ Assert.assertTrue(sqlParameters.checkParameters());
+ }
+}
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
index 687d049..fa2940a 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
+++
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
@@ -16,12 +16,17 @@
*/
package org.apache.dolphinscheduler.server.worker.task.sql;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import org.apache.commons.lang.StringUtils;
+import static org.apache.dolphinscheduler.common.Constants.COMMA;
+import static org.apache.dolphinscheduler.common.Constants.HIVE_CONF;
+import static org.apache.dolphinscheduler.common.Constants.PASSWORD;
+import static org.apache.dolphinscheduler.common.Constants.SEMICOLON;
+import static org.apache.dolphinscheduler.common.Constants.STATUS;
+import static org.apache.dolphinscheduler.common.Constants.USER;
+import static org.apache.dolphinscheduler.common.enums.DbType.HIVE;
+
import org.apache.dolphinscheduler.alert.utils.MailUtils;
import org.apache.dolphinscheduler.common.Constants;
-import org.apache.dolphinscheduler.common.enums.*;
+import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.DbType;
import org.apache.dolphinscheduler.common.enums.ShowType;
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy;
@@ -30,7 +35,11 @@ import
org.apache.dolphinscheduler.common.task.AbstractParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlBinds;
import org.apache.dolphinscheduler.common.task.sql.SqlParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlType;
-import org.apache.dolphinscheduler.common.utils.*;
+import org.apache.dolphinscheduler.common.utils.CollectionUtils;
+import org.apache.dolphinscheduler.common.utils.CommonUtils;
+import org.apache.dolphinscheduler.common.utils.EnumUtils;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
+import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.datasource.BaseDataSource;
import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory;
@@ -41,17 +50,30 @@ import org.apache.dolphinscheduler.server.utils.ParamUtils;
import org.apache.dolphinscheduler.server.utils.UDFUtils;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
-import org.slf4j.Logger;
-import java.sql.*;
-import java.util.*;
+import org.apache.commons.lang.StringUtils;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import static org.apache.dolphinscheduler.alert.utils.Constants.MAIL_ENABLED;
-import static org.apache.dolphinscheduler.common.Constants.*;
-import static org.apache.dolphinscheduler.common.enums.DbType.HIVE;
+import org.slf4j.Logger;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
/**
* sql task
*/
@@ -142,7 +164,7 @@ public class SqlTask extends AbstractTask {
} catch (Exception e) {
setExitStatusCode(Constants.EXIT_CODE_FAILURE);
- logger.error("sql task error", e);
+ logger.error("sql task error: {}", e.toString());
throw e;
}
}
@@ -208,7 +230,7 @@ public class SqlTask extends AbstractTask {
public void executeFuncAndSql(SqlBinds mainSqlBinds,
List<SqlBinds> preStatementsBinds,
List<SqlBinds> postStatementsBinds,
- List<String> createFuncs){
+ List<String> createFuncs) throws
Exception {
Connection connection = null;
PreparedStatement stmt = null;
ResultSet resultSet = null;
@@ -240,8 +262,8 @@ public class SqlTask extends AbstractTask {
postSql(connection,postStatementsBinds);
} catch (Exception e) {
- logger.error("execute sql error",e);
- throw new RuntimeException("execute sql error");
+ logger.error("execute sql error: {}", e.getMessage());
+ throw e;
} finally {
close(resultSet,stmt,connection);
}
@@ -269,15 +291,20 @@ public class SqlTask extends AbstractTask {
rowCount++;
}
String result = JSONUtils.toJsonString(resultJSONArray);
- logger.debug("execute sql : {}", result);
+ logger.debug("execute sql result : {}", result);
+
+ int displayRows = sqlParameters.getDisplayRows() > 0 ?
sqlParameters.getDisplayRows() : Constants.DEFAULT_DISPLAY_ROWS;
+ displayRows = Math.min(displayRows, resultJSONArray.size());
+ logger.info("display sql result {} rows as follows:", displayRows);
+ for (int i = 0; i < displayRows; i++) {
+ String row = JSONUtils.toJsonString(resultJSONArray.get(i));
+ logger.info("row {} : {}", i + 1, row);
+ }
- try {
+ if (sqlParameters.getSendEmail() == null ||
sqlParameters.getSendEmail()) {
sendAttachment(StringUtils.isNotEmpty(sqlParameters.getTitle()) ?
sqlParameters.getTitle() : taskExecutionContext.getTaskName() + " query result
sets",
JSONUtils.toJsonString(resultJSONArray));
- } catch (Exception e) {
- logger.warn("sql task sendAttachment error! msg : {} ",
e.getMessage());
}
-
}
/**
@@ -457,10 +484,7 @@ public class SqlTask extends AbstractTask {
if(EnumUtils.isValidEnum(ShowType.class,showTypeName)){
Map<String, Object> mailResult = MailUtils.sendMails(receiversList,
receiversCcList, title, content,
ShowType.valueOf(showTypeName).getDescp());
- if(!(boolean) mailResult.get(MAIL_ENABLED)){
- logger.info("mail info : {} {}", title, content);
- logger.warn("mail wasn't sent since the mail config isn't
set");
- }else if(!(boolean) mailResult.get(STATUS)){
+ if(!(boolean) mailResult.get(STATUS)){
throw new RuntimeException("send mail failed!");
}
}else{
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
index 18925d1..5cbc7d8 100755
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
@@ -543,7 +543,7 @@ svg path:hover {
}
}
-.from-mirror {
+.form-mirror {
width: 100%;
position: relative;
z-index: 0;
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.scss
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.scss
index 9d9667f..f3b3e0e 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.scss
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.scss
@@ -76,7 +76,7 @@
padding-bottom: 60px;
}
}
-.from-model {
+.form-model {
padding-top: 26px;
>div {
clear: both;
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
index 69d5e5f..24a910a 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
@@ -28,7 +28,7 @@
</span>
</div>
<div class="content-box" v-if="isContentBox">
- <div class="from-model">
+ <div class="form-model">
<!-- Node name -->
<div class="clearfix list">
<div class="text-box"><span>{{$t('Node name')}}</span></div>
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/scriptBox.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/scriptBox.vue
index 91e1cb7..1c16408 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/scriptBox.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/scriptBox.vue
@@ -18,7 +18,7 @@
<div class="script-model">
<m-list-box>
<div slot="content">
- <div class="from-mirror1">
+ <div class="form-mirror1">
<textarea
id="code-shell-mirror1"
name="code-shell-mirror1"
@@ -115,7 +115,7 @@
.script-model {
width:100%;
}
- .from-mirror1 {
+ .form-mirror1 {
.CodeMirror {
min-height: 600px;
max-height: 700px;
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/datax.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/datax.vue
index 46c8c17..4f254e2 100755
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/datax.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/datax.vue
@@ -41,7 +41,7 @@
<m-list-box>
<div slot="text">{{$t('SQL Statement')}}</div>
<div slot="content">
- <div class="from-mirror">
+ <div class="form-mirror">
<textarea
id="code-sql-mirror"
name="code-sql-mirror"
@@ -117,7 +117,7 @@
<m-list-box>
<div slot="text">json</div>
<div slot="content">
- <div class="from-mirror">
+ <div class="form-mirror">
<textarea
id="code-json-mirror"
name="code-json-mirror"
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
index 78d5469..7ca7c0e 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
@@ -19,7 +19,7 @@
<m-list-box>
<div slot="text">{{$t('Script')}}</div>
<div slot="content">
- <div class="from-mirror">
+ <div class="form-mirror">
<textarea id="code-python-mirror" name="code-python-mirror"
style="opacity: 0;">
</textarea>
</div>
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
index 0c07a9a..cc64385 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
@@ -19,7 +19,7 @@
<m-list-box>
<div slot="text">{{$t('Script')}}</div>
<div slot="content">
- <div class="from-mirror">
+ <div class="form-mirror">
<textarea id="code-shell-mirror" name="code-shell-mirror"
style="opacity: 0"></textarea>
<a class="ans-modal-box-max">
<em class="ans-icon-max" @click="setEditorVal"></em>
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue
index 17a09e6..bfecfe3 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue
@@ -35,15 +35,29 @@
:sql-type="sqlType">
</m-sql-type>
</div>
- <div v-if="sqlType==0" style="display: inline-block;padding-left:
10px;margin-top: 2px;">
- <x-checkbox-group v-model="showType">
- <x-checkbox :label="'TABLE'"
:disabled="isDetails">{{$t('TableMode')}}</x-checkbox>
- <x-checkbox :label="'ATTACHMENT'"
:disabled="isDetails">{{$t('Attachment')}}</x-checkbox>
- </x-checkbox-group>
+ <div style="display: inline-block;" v-if="sqlType==0">
+ <span class="text-b">{{$t('Send Email')}}</span>
+ <x-switch v-model="sendEmail" style="margin-top: -4px;"></x-switch>
+ </div>
+ <div style="display: inline-block;" v-if="sqlType==0">
+ <span class="text-b">{{$t('Log display')}}</span>
+ <m-select-input v-model="displayRows" :list="[1,10,25,50,100]"
style="width: 70px;"></m-select-input>
+ <span>{{$t('rows of result')}}</span>
</div>
</div>
</m-list-box>
- <template v-if="sqlType==0">
+ <template v-if="sqlType==0 && sendEmail">
+ <m-list-box>
+ <div slot="text">{{$t('Show Type')}}</div>
+ <div slot="content">
+ <div style="margin-top: 6px;">
+ <x-checkbox-group v-model="showType">
+ <x-checkbox :label="'TABLE'"
:disabled="isDetails">{{$t('TableMode')}}</x-checkbox>
+ <x-checkbox :label="'ATTACHMENT'"
:disabled="isDetails">{{$t('Attachment')}}</x-checkbox>
+ </x-checkbox-group>
+ </div>
+ </div>
+ </m-list-box>
<m-list-box>
<div slot="text"><strong
class='requiredIcon'>*</strong>{{$t('Title')}}</div>
<div slot="content">
@@ -58,7 +72,7 @@
<m-list-box>
<div slot="text"><strong
class='requiredIcon'>*</strong>{{$t('Recipient')}}</div>
<div slot="content">
- <m-email ref="refEmail" v-model="receivers" :disabled="isDetails"
:repeat-data="receiversCc"></m-email>
+ <m-email ref="refEmail" v-model="receivers" :disabled="isDetails"
:repeat-data="receiversCc" style="min-width: 300px;"></m-email>
</div>
</m-list-box>
<m-list-box>
@@ -83,7 +97,7 @@
<m-list-box>
<div slot="text">{{$t('SQL Statement')}}</div>
<div slot="content">
- <div class="from-mirror">
+ <div class="form-mirror">
<textarea
id="code-sql-mirror"
name="code-sql-mirror"
@@ -144,6 +158,7 @@
import mDatasource from './_source/datasource'
import mLocalParams from './_source/localParams'
import mStatementList from './_source/statementList'
+ import mSelectInput from '../_source/selectInput'
import disabledState from '@/module/mixin/disabledState'
import mEmail from
'@/conf/home/pages/projects/pages/definition/pages/list/_source/email'
import codemirror from
'@/conf/home/pages/resource/pages/file/pages/_source/codemirror'
@@ -168,6 +183,10 @@
udfs: '',
// Sql type
sqlType: '0',
+ // Send email
+ sendEmail: false,
+ // Display rows
+ displayRows: 10,
// Email title
title: '',
// Form/attachment
@@ -243,24 +262,24 @@
if (!this.$refs.refDs._verifDatasource()) {
return false
}
- if (this.sqlType==0 && !this.showType.length) {
+ if (this.sqlType==0 && this.sendEmail && !this.showType.length) {
this.$message.warning(`${i18n.$t('One form or attachment must be
selected')}`)
return false
}
- if (this.sqlType==0 && !this.title) {
+ if (this.sqlType==0 && this.sendEmail && !this.title) {
this.$message.warning(`${i18n.$t('Mail subject required')}`)
return false
}
- if (this.sqlType==0 && !this.receivers.length) {
+ if (this.sqlType==0 && this.sendEmail && !this.receivers.length) {
this.$message.warning(`${i18n.$t('Recipient required')}`)
return false
}
// receivers Subcomponent verification
- if (this.sqlType==0 && !this.$refs.refEmail._manualEmail()) {
+ if (this.sqlType==0 && this.sendEmail &&
!this.$refs.refEmail._manualEmail()) {
return false
}
// receiversCc Subcomponent verification
- if (this.sqlType==0 && !this.$refs.refCc._manualEmail()) {
+ if (this.sqlType==0 && this.sendEmail &&
!this.$refs.refCc._manualEmail()) {
return false
}
// udfs Subcomponent verification Verification only if the data type
is HIVE
@@ -292,6 +311,8 @@
sql: editor.getValue(),
udfs: this.udfs,
sqlType: this.sqlType,
+ sendEmail: this.sendEmail,
+ displayRows: this.displayRows,
title: this.title,
receivers: this.receivers.join(','),
receiversCc: this.receiversCc.join(','),
@@ -367,6 +388,8 @@
sql: editor ? editor.getValue() : '',
udfs: this.udfs,
sqlType: this.sqlType,
+ sendEmail: this.sendEmail,
+ displayRows: this.displayRows,
title: this.title,
receivers: this.receivers.join(','),
receiversCc: this.receiversCc.join(','),
@@ -427,6 +450,8 @@
this.sql = o.params.sql || ''
this.udfs = o.params.udfs || ''
this.sqlType = o.params.sqlType
+ this.sendEmail = o.params.sendEmail || false
+ this.displayRows = o.params.displayRows || 10
this.connParams = o.params.connParams || ''
this.localParams = o.params.localParams || []
if(o.params.showType == '') {
@@ -471,6 +496,8 @@
datasource: this.rtDatasource,
udfs: this.udfs,
sqlType: this.sqlType,
+ sendEmail: this.sendEmail,
+ displayRows: this.displayRows,
title: this.title,
receivers: this.receivers.join(','),
receiversCc: this.receiversCc.join(','),
@@ -490,7 +517,7 @@
}
}
},
- components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType,
mStatementList, mEmail }
+ components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType,
mStatementList, mSelectInput, mEmail }
}
</script>
<style lang="scss" rel="stylesheet/scss">
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue
index 6503ad4..f3fbbe7 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue
@@ -30,7 +30,7 @@
<m-list-box v-show="isCustomTask">
<div slot="text">{{$t('Custom Script')}}</div>
<div slot="content">
- <div class="from-mirror">
+ <div class="form-mirror">
<textarea
id="code-shell-mirror"
name="code-shell-mirror"
@@ -243,7 +243,7 @@
<m-list-box v-show="srcQueryType === '1' && sourceType ==='MYSQL'">
<div slot="text">{{$t('SQL Statement')}}</div>
<div slot="content">
- <div class="from-mirror">
+ <div class="form-mirror">
<textarea
id="code-sqoop-mirror"
name="code-sqoop-mirror"
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue
index 2585744..20ea2b3 100755
---
a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue
@@ -76,7 +76,7 @@
activeIndex: null,
emailList: [],
index: 0,
- emailWidth: 100,
+ emailWidth: 150,
isCn: false
}
},
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/timing.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/timing.vue
index 82a82de..f7682ad 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/timing.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/timing.vue
@@ -387,7 +387,7 @@
.v-crontab {
}
}
- .from-model {
+ .form-model {
padding-top: 0;
}
.title-box {
@@ -420,7 +420,7 @@
padding-bottom: 30px;
}
}
- .v-crontab-from-model {
+ .v-crontab-form-model {
.list-box {
padding: 0;
}
diff --git a/dolphinscheduler-ui/src/js/conf/login/App.vue
b/dolphinscheduler-ui/src/js/conf/login/App.vue
index 14e9efc..af5d765 100644
--- a/dolphinscheduler-ui/src/js/conf/login/App.vue
+++ b/dolphinscheduler-ui/src/js/conf/login/App.vue
@@ -19,7 +19,7 @@
<div class="text-1">
<a href="javascript:"></a>
</div>
- <div class="from-model">
+ <div class="form-model">
<div class="list">
<label>{{$t('User Name')}}</label>
<div>
@@ -170,7 +170,7 @@
margin: 0 auto;
}
}
- .from-model {
+ .form-model {
padding: 30px 20px;
.list {
margin-bottom: 24px;
diff --git
a/dolphinscheduler-ui/src/js/module/components/conditions/conditions.vue
b/dolphinscheduler-ui/src/js/module/components/conditions/conditions.vue
index d160566..025e50d 100644
--- a/dolphinscheduler-ui/src/js/module/components/conditions/conditions.vue
+++ b/dolphinscheduler-ui/src/js/module/components/conditions/conditions.vue
@@ -20,7 +20,7 @@
<slot name="button-group"></slot>
</div>
<div class="right">
- <div class="from-box">
+ <div class="form-box">
<slot name="search-group" v-if="isShow"></slot>
<template v-if="!isShow">
<div class="list">
diff --git
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue
index 83303b7..12dec98 100755
--- a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue
+++ b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue
@@ -16,7 +16,7 @@
*/
<template>
<div class="day-model">
- <div class="v-crontab-from-model">
+ <div class="v-crontab-form-model">
<x-radio-group v-model="radioDay" vertical>
<div class="list-box">
<x-radio label="everyDay">
diff --git
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/hour.vue
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/hour.vue
index 0317a8a..74019ca 100755
---
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/hour.vue
+++
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/hour.vue
@@ -16,7 +16,7 @@
*/
<template>
<div class="hour-model">
- <div class="v-crontab-from-model">
+ <div class="v-crontab-form-model">
<x-radio-group v-model="radioHour" vertical>
<div class="list-box">
<x-radio label="everyHour">
diff --git
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/minute.vue
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/minute.vue
index dd018e0..f907e16 100755
---
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/minute.vue
+++
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/minute.vue
@@ -16,7 +16,7 @@
*/
<template>
<div class="minute-model">
- <div class="v-crontab-from-model">
+ <div class="v-crontab-form-model">
<x-radio-group v-model="radioMinute" vertical>
<div class="list-box">
<x-radio label="everyMinute">
diff --git
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/month.vue
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/month.vue
index a58e7e8..89d3ce9 100755
---
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/month.vue
+++
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/month.vue
@@ -16,7 +16,7 @@
*/
<template>
<div class="month-model">
- <div class="v-crontab-from-model">
+ <div class="v-crontab-form-model">
<x-radio-group v-model="radioMonth" vertical>
<div class="list-box">
<x-radio label="everyMonth">
diff --git
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/second.vue
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/second.vue
index 40f7bb5..94d060b 100755
---
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/second.vue
+++
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/second.vue
@@ -16,7 +16,7 @@
*/
<template>
<div class="second-model">
- <div class="v-crontab-from-model">
+ <div class="v-crontab-form-model">
<x-radio-group v-model="radioSecond" vertical>
<div class="list-box">
<x-radio label="everySecond">
diff --git
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/year.vue
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/year.vue
index f51c5d6..e281ce0 100755
---
a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/year.vue
+++
b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/year.vue
@@ -16,7 +16,7 @@
*/
<template>
<div class="year-model">
- <div class="v-crontab-from-model">
+ <div class="v-crontab-form-model">
<x-radio-group v-model="radioYear" vertical>
<div class="list-box">
<x-radio label="everyYear">
diff --git
a/dolphinscheduler-ui/src/js/module/components/crontab/source/index.scss
b/dolphinscheduler-ui/src/js/module/components/crontab/source/index.scss
index 6b215a1..bd8346b 100755
--- a/dolphinscheduler-ui/src/js/module/components/crontab/source/index.scss
+++ b/dolphinscheduler-ui/src/js/module/components/crontab/source/index.scss
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-.v-crontab-from-model {
+.v-crontab-form-model {
.list-box {
//padding: 6px 0;
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
index 5c983ab..535d556 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
@@ -125,6 +125,10 @@ export default {
'App Name': 'App Name',
'Please enter app name(optional)': 'Please enter app name(optional)',
'SQL Type': 'SQL Type',
+ 'Send Email': 'Send Email',
+ 'Log display': 'Log display',
+ 'rows of result': 'rows of result',
+ 'Show Type': 'Show Type',
Title: 'Title',
'Please enter the title of email': 'Please enter the title of email',
Table: 'Table',
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
index 88382b5..6d9e232 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
@@ -125,6 +125,10 @@ export default {
'App Name': '任务名称',
'Please enter app name(optional)': '请输入任务名称(选填)',
'SQL Type': 'sql类型',
+ 'Send Email': '发送邮件',
+ 'Log display': '日志显示',
+ 'rows of result': '行查询结果',
+ 'Show Type': '呈现方式',
Title: '主题',
'Please enter the title of email': '请输入邮件主题',
Table: '表名',
diff --git a/dolphinscheduler-ui/src/sass/common/index.scss
b/dolphinscheduler-ui/src/sass/common/index.scss
index 957d6c4..67adf88 100644
--- a/dolphinscheduler-ui/src/sass/common/index.scss
+++ b/dolphinscheduler-ui/src/sass/common/index.scss
@@ -91,7 +91,7 @@ body{
position: absolute;
right: 8px;
top: 13px;
- .from-box {
+ .form-box {
.list {
float: right;
margin-right: 4px;
diff --git a/dolphinscheduler-ui/src/sass/conf/login/index.scss
b/dolphinscheduler-ui/src/sass/conf/login/index.scss
index aef779a..9081c24 100644
--- a/dolphinscheduler-ui/src/sass/conf/login/index.scss
+++ b/dolphinscheduler-ui/src/sass/conf/login/index.scss
@@ -57,7 +57,7 @@ body {
font-size: 50px;
}
}
- .from-model {
+ .form-model {
padding: 30px 40px 0 40px;
.list {
margin-bottom: 32px;
diff --git a/pom.xml b/pom.xml
index d1485d9..f54bb07 100644
--- a/pom.xml
+++ b/pom.xml
@@ -753,6 +753,7 @@
<include>**/common/shell/ShellExecutorTest.java</include>
<include>**/common/task/EntityTestUtils.java</include>
<include>**/common/task/FlinkParametersTest.java</include>
+
<include>**/common/task/SqlParametersTest.java</include>
<include>**/common/task/SqoopParameterEntityTest.java</include>
<include>**/common/threadutils/ThreadPoolExecutorsTest.java</include>
<include>**/common/threadutils/ThreadUtilsTest.java</include>