提交 145a9006 authored 作者: 许雪里's avatar 许雪里 提交者: GitHub

Merge pull request #157 from icyblazek/master

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