Skip to content

Commit 999ecd2

Browse files
committed
Merge remote-tracking branch 'origin/dev-1.1.4' into dev-1.1.4
2 parents b80e1cd + 06e0ce2 commit 999ecd2

File tree

10 files changed

+53
-8
lines changed

10 files changed

+53
-8
lines changed

db/dss_dml.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ insert into `dss_workflow_node_ui_validate` (`id`, `validate_type`, `validate_ra
309309
insert into `dss_workflow_node_ui_validate` (`id`, `validate_type`, `validate_range`, `error_msg`, `error_msg_en`, `trigger`) values('58','Regex','(.+)@(.+)@(.+)','此格式错误,例如:ProjectName@WFName@jobName','Invalid format,example:ProjectName@WFName@jobName','blur');
310310
INSERT INTO `dss_workflow_node_ui_validate` (`id`, `validate_type`, `validate_range`, `error_msg`, `error_msg_en`, `trigger`) values('59','OFT','["true","false"]','请填写是否复用引擎,false:不复用,true:复用','Please fill in whether or not to reuse engine, true: reuse, false: not reuse','blur');
311311
insert into `dss_workflow_node_ui_validate` (`id`, `validate_type`, `validate_range`, `error_msg`, `error_msg_en`, `trigger`) values('60', 'Regex', '^[0-9.]*g{0,1}$', 'Spark内存设置如2g', 'Drive memory size, default value: 2', 'blur');
312-
insert into `dss_workflow_node_ui_validate` (`id`, `validate_type`, `validate_range`, `error_msg`, `error_msg_en`, `trigger`) values('61','Regex','^.{1,5000}$','长度在1到5000个字符','The length is between 1 and 5000 characters','blur');
312+
insert into `dss_workflow_node_ui_validate` (`id`, `validate_type`, `validate_range`, `error_msg`, `error_msg_en`, `trigger`) values('61','Regex','^(.|\s){1,500}$','长度在1到5000个字符','The length is between 1 and 5000 characters','blur');
313313
insert into `dss_workflow_node_ui_validate` (`id`, `validate_type`, `validate_range`, `error_msg`, `error_msg_en`, `trigger`) values('62','Regex','^.{1,150}$','长度在1到150个字符','The length is between 1 and 150 characters','blur');
314314

315315
DELETE FROM dss_workflow_node_ui_to_validate;

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/java/com/webank/wedatasphere/dss/appconn/sendemail/email/Email.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ public interface Email {
4141
String getBcc();
4242
void setBcc(String bcc);
4343

44+
String getEmailType();
45+
void setEmailType(String emailType);
4446
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/conf/SendEmailAppConnConfiguration.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ object SendEmailAppConnConfiguration {
2525

2626
val EMAIL_HOOK_CLASSES = CommonVars("wds.dss.appconn.email.hook.classes",
2727
"com.webank.wedatasphere.dss.appconn.sendemail.hook.SendEmailItsmCheckHook," +
28-
"com.webank.wedatasphere.dss.appconn.sendemail.hook.SendEmailContentLimitHook")
28+
"com.webank.wedatasphere.dss.appconn.sendemail.hook.SendEmailVisualisContentLimitHook," +
29+
"com.webank.wedatasphere.dss.appconn.sendemail.hook.SendEmailTableauCheckHook")
2930

3031
val EMAIL_IMAGE_HEIGHT = CommonVars("wds.dss.appconn.email.image.height", 500)
3132
val EMAIL_IMAGE_WIDTH = CommonVars("wds.dss.appconn.email.image.width", 1920)
@@ -44,4 +45,6 @@ object SendEmailAppConnConfiguration {
4445
val EMAIL_SMTP_SSL_ENABLED = CommonVars("wds.dss.appconn.email.smtp.ssl.enable", "true")
4546
val EMAIL_SMTP_TIMEOUT: CommonVars[Integer] = CommonVars("wds.dss.appconn.email.smtp.timeout", 25000)
4647

48+
val EMAIL_ENTITY_CLASSES = CommonVars("wds.dss.appconn.email.hook.entity.classes","com.webank.wedatasphere.dss.appconn.sendemail.hook.entity.newvisualis.NewVisualisEmailInfo," +
49+
"com.webank.wedatasphere.dss.appconn.sendemail.hook.entity.visualis.VisualisEmailInfo")
4750
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/cs/EmailCSHelper.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
package com.webank.wedatasphere.dss.appconn.sendemail.cs
1818

19+
20+
import java.util
21+
22+
import com.google.gson.internal.LinkedTreeMap
1923
import com.webank.wedatasphere.dss.appconn.sendemail.exception.EmailSendFailedException
2024
import com.webank.wedatasphere.dss.standard.app.development.listener.core.ExecutionRequestRefContext
2125
import org.apache.linkis.common.utils.Logging
@@ -25,6 +29,7 @@ import org.apache.linkis.cs.common.entity.enumeration.{ContextScope, ContextType
2529
import org.apache.linkis.cs.common.entity.source.CommonContextKey
2630
import org.apache.linkis.cs.common.utils.CSCommonUtils
2731
import org.apache.linkis.server.JSONUtils
32+
import org.springframework.util.CollectionUtils
2833

2934
import scala.collection.JavaConversions._
3035

@@ -57,4 +62,16 @@ object EmailCSHelper extends Logging{
5762
info(s"Job IDs is ${jobIds.toList}.")
5863
jobIds
5964
}
65+
66+
def getJobTypes(refContext: ExecutionRequestRefContext):util.ArrayList[String] = {
67+
val jobTypes = new util.ArrayList[String]()
68+
getJobIds(refContext).foreach { jobId =>
69+
jobTypes.add(refContext.fetchLinkisJob(jobId).getParams.get("labels").asInstanceOf[LinkedTreeMap[_,_]].get("codeType").toString)
70+
}
71+
if (CollectionUtils.isEmpty(jobTypes)) {
72+
throw new EmailSendFailedException(80003 ,"empty result set is not allowed")
73+
}
74+
info(s"Job Types is $jobTypes.")
75+
jobTypes
76+
}
6077
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/domain/AbstractEmail.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class AbstractEmail extends Email {
2929
private var to: String = _
3030
private var cc: String = _
3131
private var bcc: String = _
32+
private var emialType: String = _
3233

3334
override def getContent: String = content
3435
override def setContent(content: String): Unit = this.content = content
@@ -52,4 +53,7 @@ class AbstractEmail extends Email {
5253

5354
override def getBcc: String = bcc
5455
override def setBcc(bcc: String): Unit = this.bcc = bcc
56+
57+
override def getEmailType: String = emialType
58+
override def setEmailType(emailType: String): Unit = this.emialType = emailType
5559
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/domain/MultiContentEmail.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ class MultiContentEmail extends AbstractEmail {
3030

3131
def getEmailContents: Array[EmailContent[_]] = emailContents.toIterator.toArray
3232

33+
34+
3335
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/generate/MultiContentEmailGenerator.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616

1717
package com.webank.wedatasphere.dss.appconn.sendemail.email.generate
1818

19+
import com.google.gson.internal.LinkedTreeMap
1920
import com.webank.wedatasphere.dss.appconn.sendemail.cs.EmailCSHelper
2021
import com.webank.wedatasphere.dss.appconn.sendemail.email.domain.{AbstractEmail, MultiContentEmail}
2122
import com.webank.wedatasphere.dss.appconn.sendemail.emailcontent.domain.PictureEmailContent
2223
import com.webank.wedatasphere.dss.appconn.sendemail.exception.EmailSendFailedException
24+
import com.webank.wedatasphere.dss.common.utils.DSSCommonUtils
2325
import com.webank.wedatasphere.dss.standard.app.development.listener.ref.RefExecutionRequestRef
26+
import org.apache.commons.lang3.StringUtils
2427
import org.apache.linkis.storage.resultset.ResultSetFactory
2528

2629
class MultiContentEmailGenerator extends AbstractEmailGenerator {
@@ -45,6 +48,10 @@ class MultiContentEmailGenerator extends AbstractEmailGenerator {
4548
}
4649
multiContentEmail.addEmailContent(emailContent)
4750
}
51+
if (StringUtils.isBlank(multiContentEmail.getEmailType)) {
52+
val emailType = refContext.fetchLinkisJob(jobId).getParams.get("labels").asInstanceOf[LinkedTreeMap[_,_]].get("codeType").toString
53+
multiContentEmail.setEmailType(emailType)
54+
}
4855
}
4956
case "file" => throw new EmailSendFailedException(80003 ,"file content is not allowed") //addContentEmail(c => new FileEmailContent(new FsPath(c)))
5057
case "text" => throw new EmailSendFailedException(80003 ,"text content is not allowed")//addContentEmail(new TextEmailContent(_))

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/emailcontent/parser/PictureEmailContentParser.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ object PictureEmailContentParser extends AbstractEmailContentParser[PictureEmail
4545
val imageUUID: String = UUID.randomUUID.toString
4646
val width: Int = bufferedImage.getWidth
4747
val height: Int = bufferedImage.getHeight
48-
val imagesCuts = if (height > EMAIL_IMAGE_HEIGHT.getValue) {
48+
// 只支持修改visualis图片大小,后续如果有新增其他类型的邮件需要修改图片大小,需要在if中加上该邮件类型
49+
val imagesCuts = if (email.getEmailType.contains("visualis") && height > EMAIL_IMAGE_HEIGHT.getValue) {
4950
val numOfCut = Math.ceil(height.toDouble / EMAIL_IMAGE_HEIGHT.getValue).toInt
5051
val realHeight = height / numOfCut
5152
(0 until numOfCut).map(i => bufferedImage.getSubimage(0, i * realHeight, width, realHeight)).toArray
@@ -62,7 +63,7 @@ object PictureEmailContentParser extends AbstractEmailContentParser[PictureEmail
6263
var iHeight = image.getHeight
6364
var iWidth = image.getWidth
6465

65-
if (iWidth > EMAIL_IMAGE_WIDTH.getValue) {
66+
if (email.getEmailType.contains("visualis") && iWidth > EMAIL_IMAGE_WIDTH.getValue) {
6667
iHeight = ((EMAIL_IMAGE_WIDTH.getValue.toDouble / iWidth.toDouble) * iHeight.toDouble).toInt
6768
iWidth = EMAIL_IMAGE_WIDTH.getValue
6869
}

dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/service/impl/DSSFlowServiceImpl.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.webank.wedatasphere.dss.common.label.DSSLabel;
2929
import com.webank.wedatasphere.dss.common.utils.DSSCommonUtils;
3030
import com.webank.wedatasphere.dss.common.utils.IoUtils;
31+
import com.webank.wedatasphere.dss.common.utils.MapUtils;
3132
import com.webank.wedatasphere.dss.contextservice.service.ContextService;
3233
import com.webank.wedatasphere.dss.contextservice.service.impl.ContextServiceImpl;
3334
import com.webank.wedatasphere.dss.standard.app.development.utils.DSSJobContentConstant;
@@ -311,6 +312,11 @@ public DSSFlow copyRootFlow(Long rootFlowId, String userName, Workspace workspac
311312
String projectName, String version, String contextIdStr,
312313
String description, List<DSSLabel> dssLabels) throws DSSErrorException, IOException {
313314
DSSFlow dssFlow = flowMapper.selectFlowByID(rootFlowId);
315+
if(dssFlow == null) {
316+
throw new DSSErrorException(50030, "Workflow " + rootFlowId + " is not exists[工作流不存在,请检查是否已被删除].");
317+
}
318+
logger.info("User {} try to copy workflow {} in project {} with newVersion {} and contextId {}.", userName,
319+
dssFlow.getName(), projectName, version, contextIdStr);
314320
DSSFlow rootFlowWithSubFlows = copyFlowAndSetSubFlowInDB(dssFlow, userName, description);
315321
updateFlowJson(userName, projectName, rootFlowWithSubFlows, version, null,
316322
contextIdStr, workspace, dssLabels);
@@ -348,7 +354,7 @@ private void updateFlowJson(String userName, String projectName, DSSFlow rootFlo
348354
String flowJson = bmlService.readFlowJsonFromBML(userName, rootFlow.getResourceId(), rootFlow.getBmlVersion());
349355
//如果包含subflow,需要一同导入subflow内容,并更新parrentflow的json内容
350356
// TODO: 2020/7/31 优化update方法里面的saveContent
351-
String updateFlowJson = updateFlowContextId(flowJson, contextIdStr);
357+
String updateFlowJson = updateFlowContextIdAndVersion(flowJson, contextIdStr, version);
352358
//重新上传工作流资源
353359
updateFlowJson = uploadFlowResourceToBml(userName, updateFlowJson, projectName, rootFlow);
354360
//上传节点的资源或调用appconn的copyRef
@@ -408,8 +414,9 @@ private DSSFlow uploadFlowJsonToBml(String userName, String projectName, DSSFlow
408414
return dssFlow;
409415
}
410416

411-
private String updateFlowContextId(String flowJson, String contextIdStr) throws IOException {
412-
return workFlowParser.updateFlowJsonWithKey(flowJson, CSCommonUtils.CONTEXT_ID_STR, contextIdStr);
417+
private String updateFlowContextIdAndVersion(String flowJson, String contextIdStr, String orcVersion) throws IOException {
418+
return workFlowParser.updateFlowJsonWithMap(flowJson, MapUtils.newCommonMap(CSCommonUtils.CONTEXT_ID_STR, contextIdStr,
419+
DSSJobContentConstant.ORC_VERSION_KEY, orcVersion));
413420
}
414421

415422
private String updateWorkFlowNodeJson(String userName, String projectName,

web/packages/workflows/module/process/module.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,9 @@ export default {
701701
this.workflowExeteId = currentExecutorFlow[0].execID
702702
this.workflowTaskId = currentExecutorFlow[0].taskID
703703
}
704-
this.getToolbarsConfig()
704+
if (!this.myReadonly) {
705+
this.getToolbarsConfig()
706+
}
705707
// 基础信息
706708
this.setShapes().then(() => {
707709
this.getBaseInfo();

0 commit comments

Comments
 (0)