Browse Source

[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
Shiwen Cheng 4 years ago committed by GitHub
parent
commit
7df22bd521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java
  2. 2
      dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java
  3. 39
      dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
  4. 15
      dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
  5. 5
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
  6. 32
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
  7. 65
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/task/SqlParametersTest.java
  8. 72
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
  9. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
  10. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.scss
  11. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  12. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/scriptBox.vue
  13. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/datax.vue
  14. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
  15. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
  16. 55
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue
  17. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue
  18. 2
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue
  19. 4
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/timing.vue
  20. 4
      dolphinscheduler-ui/src/js/conf/login/App.vue
  21. 2
      dolphinscheduler-ui/src/js/module/components/conditions/conditions.vue
  22. 2
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue
  23. 2
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/hour.vue
  24. 2
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/minute.vue
  25. 2
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/month.vue
  26. 2
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/second.vue
  27. 2
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/year.vue
  28. 2
      dolphinscheduler-ui/src/js/module/components/crontab/source/index.scss
  29. 4
      dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
  30. 4
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
  31. 2
      dolphinscheduler-ui/src/sass/common/index.scss
  32. 2
      dolphinscheduler-ui/src/sass/conf/login/index.scss
  33. 1
      pom.xml

15
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()) {

2
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";

39
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

15
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("xx@xx.com"); }};
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))));
}
}

5
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java

@ -325,6 +325,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
*/

32
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java

@ -49,10 +49,21 @@ 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 + '\'' +

65
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());
}
}

72
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{

2
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;

2
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;

2
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>

4
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;

4
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"

2
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>

2
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>

55
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">

4
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"

2
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
}
},

4
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;
}

4
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;

2
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">

2
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">

2
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">

2
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">

2
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">

2
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">

2
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">

2
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;

4
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',

4
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: '表名',

2
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;

2
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;

1
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>

Loading…
Cancel
Save