提交 f5ebe8f7 authored 作者: Kevin's avatar Kevin

1.添加GLUE_NODEJS支持

上级 2d160021
......@@ -113,6 +113,7 @@
<script src="${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js"></script>
<script src="${request.contextPath}/static/plugins/codemirror/mode/shell/shell.js"></script>
<script src="${request.contextPath}/static/plugins/codemirror/mode/python/python.js"></script>
<script src="${request.contextPath}/static/plugins/codemirror/mode/javascript/javascript.js"></script>
<script src="${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.js"></script>
<script src="${request.contextPath}/static/plugins/codemirror/addon/hint/anyword-hint.js"></script>
<script>
......
......@@ -233,7 +233,17 @@ logging.basicConfig(level=logging.DEBUG)
logging.info("脚本文件:" + sys.argv[0])
-->
</textarea>
<textarea class="glueSource_nodejs" style="display:none;" >
// #!/usr/bin/node
console.log("xxl-job: hello nodejs")
var arguments = process.argv
console.log("脚本文件: " + arguments[1])
for (var i = 2; i < arguments.length; i++){
console.log("参数: %s, %s", i, arguments[i]);
}
console.log("Good bye!")
process.exit(0)
</textarea>
</form>
</div>
</div>
......
......@@ -16,6 +16,8 @@ $(function() {
ideMode = "text/x-sh";
} else if ('GLUE_PYTHON'==glueType){
ideMode = "text/x-python";
} else if ('GLUE_NODEJS'==glueType){
ideMode = "text/javascript"
}
codeEditor = CodeMirror(document.getElementById("ideWindow"), {
......
......@@ -55,6 +55,8 @@ $(function() {
return "GLUE模式(Shell)";
} else if ('GLUE_PYTHON'==row.glueType) {
return "GLUE模式(Python)";
}else if ('GLUE_NODEJS'==row.glueType){
return "GLUE模式(Nodejs)";
} else if ('BEAN'==row.glueType) {
return "BEAN模式:" + row.executorHandler;
}
......@@ -341,6 +343,8 @@ $(function() {
$("#addModal .form textarea[name='glueSource']").val( $("#addModal .form .glueSource_shell").val() );
} else if ('GLUE_PYTHON'==glueType){
$("#addModal .form textarea[name='glueSource']").val( $("#addModal .form .glueSource_python").val() );
} else if ('GLUE_NODEJS'==glueType){
$("#addModal .form textarea[name='glueSource']").val( $("#addModal .form .glueSource_nodejs").val() );
}
});
......
......@@ -105,6 +105,8 @@ $(function() {
glueTypeTitle = "GLUE模式(Shell)";
} else if ('GLUE_PYTHON'==row.glueType) {
glueTypeTitle = "GLUE模式(Python)";
}else if ('GLUE_NODEJS'==row.glueType) {
glueTypeTitle = "GLUE模式(Nodejs)";
} else if ('BEAN'==row.glueType) {
glueTypeTitle = "BEAN模式:" + row.executorHandler;
}
......
......@@ -120,7 +120,8 @@ public class ExecutorBizImpl implements ExecutorBiz {
}
}
} else if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(triggerParam.getGlueType())
|| GlueTypeEnum.GLUE_PYTHON==GlueTypeEnum.match(triggerParam.getGlueType()) ) {
|| GlueTypeEnum.GLUE_PYTHON==GlueTypeEnum.match(triggerParam.getGlueType())
|| GlueTypeEnum.GLUE_NODEJS==GlueTypeEnum.match(triggerParam.getGlueType())) {
// valid old jobThread
if (jobThread != null &&
......
......@@ -8,7 +8,8 @@ public enum GlueTypeEnum {
BEAN("BEAN模式"),
GLUE_GROOVY("GLUE模式(Java)"),
GLUE_SHELL("GLUE模式(Shell)"),
GLUE_PYTHON("GLUE模式(Python)");
GLUE_PYTHON("GLUE模式(Python)"),
GLUE_NODEJS("GLUE模式(Nodejs)");
private String desc;
private GlueTypeEnum(String desc) {
......
......@@ -40,6 +40,9 @@ public class ScriptJobHandler extends IJobHandler {
} else if (GlueTypeEnum.GLUE_PYTHON == glueType) {
cmd = "python";
scriptFileName = XxlJobFileAppender.logPath.concat("gluesource/").concat(String.valueOf(jobId)).concat("_").concat(String.valueOf(glueUpdatetime)).concat(".py");
} else if (GlueTypeEnum.GLUE_NODEJS == glueType) {
cmd = "node";
scriptFileName = XxlJobFileAppender.logPath.concat("gluesource/").concat(String.valueOf(jobId)).concat("_").concat(String.valueOf(glueUpdatetime)).concat(".js");
}
// make script file
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论