GLUE远程任务init

v1.3
xueli.xue 9 years ago
parent cfae320ff6
commit 4b2b6d8256

@ -5,6 +5,10 @@ import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xxl.job.core.model.ReturnT;
import com.xxl.job.core.model.XxlJobInfo;
/**
* job code controller
@ -19,4 +23,11 @@ public class JobCodeController {
return "jobcode/index";
}
@RequestMapping("/save")
@ResponseBody
public ReturnT<String> save(Model model, XxlJobInfo jobInfo, HttpServletRequest request) {
return ReturnT.SUCCESS;
}
}

@ -15,7 +15,7 @@
}
</style>
</head>
<body>
<body class=" layout-top-nav">
<div class="wrapper">
@ -27,12 +27,11 @@
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-4">
<div class="input-group margin">
<div class="input-group-btn">
<button type="button" class="btn btn-default">版本回溯</button>
<button type="button" class="btn btn-info">版本回溯</button>
</div>
<select class="form-control" id="jobGroup" >
<option value="999" >逻辑调整版本C</option>
@ -45,15 +44,15 @@
<div class="col-xs-4">
<div class="input-group margin">
<div class="input-group-btn">
<button type="button" class="btn btn-default">Action</button>
<button type="button" class="btn btn-info">备注</button>
</div>
<input type="text" class="form-control" id="jobName" value="${jobName}" autocomplete="on" >
<input type="text" class="form-control" id="codeRemark" value="${jobName}" autocomplete="on" >
</div>
</div>
<div class="col-xs-2">
<div class="input-group margin">
<div class="input-group-btn">
<button type="button" class="btn btn-info">保存</button>
<button type="button" class="btn btn-primary" id="save" >保存</button>
</div>
</div>
</div>
@ -61,8 +60,18 @@
<div class="row">
<div class="col-xs-12">
<div class="box">
<textarea id="editor" >
<div class="box callout callout-info">
<textarea id="codeSource" ></textarea>
</div>
</div>
</div>
</section>
</div>
<!-- footer -->
<@netCommon.commonFooter />
</div>
<textarea id="demoCode" >
package com.xxl.job.service.handler;
import org.slf4j.Logger;
@ -83,16 +92,7 @@ public class DemoJobHandler extends IJobHandler {
return JobHandleStatus.SUCCESS;
}
}
</textarea>
</div>
</div>
</div>
</section>
</div>
<!-- footer -->
<@netCommon.commonFooter />
</div>
</textarea>
<@netCommon.comAlert />
<@netCommon.commonScript />
@ -100,6 +100,9 @@ public class DemoJobHandler extends IJobHandler {
<script src="${request.contextPath}/static/plugins/codemirror/mode/clike/clike.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>
var id = ${id!-1};
</script>
<script src="${request.contextPath}/static/js/jobcode.index.1.js"></script>
</body>
</html>

@ -1,16 +1,55 @@
$(function() {
var javaEditor = CodeMirror.fromTextArea(document.getElementById("editor"), {
// init code editor
var codeEditor = CodeMirror.fromTextArea(document.getElementById("codeSource"), {
mode : "text/x-java",
lineNumbers : true,
matchBrackets : true,
extraKeys: {
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
matchBrackets : true
});
codeEditor.setValue( $("#demoCode").val() );
$("#save").click(function() {
var codeSource = codeEditor.getValue();
var codeRemark = $("#codeRemark").val();
if (!codeRemark) {
ComAlert.show(1, "请输入备注");
return;
}
if (codeRemark.length < 6|| codeRemark.length > 100) {
ComAlert.show(1, "备注长度应该在6至100之间");
return;
}
ComConfirm.show("是否执行保存操作?", function(){
$.ajax({
type : 'POST',
url : base_url + '/jobcode/save',
data : {
'jobInfo.id' : id,
'jobInfo.codeSource' : codeSource,
'jobInfo.codeRemark' : codeRemark
},
dataType : "json",
success : function(data){
if (data.code == 200) {
ComAlert.show(1, '提交成功', function(){
//$(window).unbind('beforeunload');
window.location.reload();
});
} else {
ComAlert.alert(data.msg);
}
}
});
});
});
// before upload
/*$(window).bind('beforeunload',function(){
return 'Glue尚未保存确定离开Glue编辑器';
});*/
});

@ -111,7 +111,7 @@ $(function() {
pause_resume +
'<button class="btn btn-primary btn-xs" type="job_del" type="button" onclick="javascript:window.open(\'' + logUrl + '\')" >日志</button><br> '+
'<button class="btn btn-warning btn-xs update" type="button">编辑</button> '+
'<button class="btn btn-warning btn-xs" type="button" onclick="javascript:window.open(\'' + codeUrl + '\')" >CODE</button> '+
'<button class="btn btn-warning btn-xs" type="button" onclick="javascript:window.open(\'' + codeUrl + '\')" >GLUE</button> '+
'<button class="btn btn-danger btn-xs job_operate" type="job_del" type="button">删除</button> '+
'</p>';

Loading…
Cancel
Save