refactor(biz): 重构任务管理模块前端路径与接口

- 调整任务代码页面返回路径至 biz/job.code
- 修改任务信息页面返回路径至 biz/job.list
- 更新任务新增接口地址为 /insert
- 更改任务删除接口地址为 /delete 并支持批量操作
- 调整任务停止接口地址为 /pause 并支持批量操作
- 修改任务启动接口地址为 /start 并支持批量操作
- 增强调度时间计算接口参数校验
- 优化表格组件事件监听逻辑
- 新增任务代码编辑页面模板
- 新增任务列表展示页面模板
3.3.0-release
xuxueli 3 weeks ago
parent 5fe79778b4
commit d100e47a64

@ -58,7 +58,7 @@ public class JobCodeController {
model.addAttribute("jobInfo", jobInfo);
model.addAttribute("jobLogGlues", jobLogGlues);
return "jobcode/jobcode.index";
return "biz/job.code";
}
@RequestMapping("/save")

@ -16,8 +16,10 @@ import com.xxl.sso.core.helper.XxlSsoHelper;
import com.xxl.sso.core.model.LoginInfo;
import com.xxl.tool.core.CollectionTool;
import com.xxl.tool.core.DateTool;
import com.xxl.tool.core.StringTool;
import com.xxl.tool.response.PageModel;
import com.xxl.tool.response.Response;
import com.xxl.tool.response.ResponseCode;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
@ -65,10 +67,16 @@ public class JobInfoController {
throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
}
// parse jobGroup
if (!(CollectionTool.isNotEmpty(jobGroupList)
&& jobGroupList.stream().map(XxlJobGroup::getId).toList().contains(jobGroup))) {
jobGroup = -1;
}
model.addAttribute("JobGroupList", jobGroupList);
model.addAttribute("jobGroup", jobGroup);
return "jobinfo/jobinfo.index";
return "biz/job.list";
}
@RequestMapping("/pageList")
@ -89,7 +97,7 @@ public class JobInfoController {
return xxlJobService.pageList(offset, pagesize, jobGroup, triggerStatus, jobDesc, executorHandler, author);
}
@RequestMapping("/add")
@RequestMapping("/insert")
@ResponseBody
public Response<String> add(HttpServletRequest request, XxlJobInfo jobInfo) {
// valid permission
@ -109,25 +117,46 @@ public class JobInfoController {
return xxlJobService.update(jobInfo, loginInfo);
}
@RequestMapping("/remove")
@RequestMapping("/delete")
@ResponseBody
public Response<String> remove(HttpServletRequest request, @RequestParam("id") int id) {
public Response<String> delete(HttpServletRequest request, @RequestParam("ids[]") List<Integer> ids) {
// valid
if (CollectionTool.isEmpty(ids) || ids.size()!=1) {
return Response.ofFail(I18nUtil.getString("system_please_choose") + I18nUtil.getString("system_one") + I18nUtil.getString("system_data"));
}
// invoke
Response<LoginInfo> loginInfoResponse = XxlSsoHelper.loginCheckWithAttr(request);
return xxlJobService.remove(id, loginInfoResponse.getData());
return xxlJobService.remove(ids.get(0), loginInfoResponse.getData());
}
@RequestMapping("/stop")
@ResponseBody
public Response<String> pause(HttpServletRequest request, @RequestParam("id") int id) {
public Response<String> pause(HttpServletRequest request, @RequestParam("ids[]") List<Integer> ids) {
// valid
if (CollectionTool.isEmpty(ids) || ids.size()!=1) {
return Response.ofFail(I18nUtil.getString("system_please_choose") + I18nUtil.getString("system_one") + I18nUtil.getString("system_data"));
}
// invoke
Response<LoginInfo> loginInfoResponse = XxlSsoHelper.loginCheckWithAttr(request);
return xxlJobService.stop(id, loginInfoResponse.getData());
return xxlJobService.stop(ids.get(0), loginInfoResponse.getData());
}
@RequestMapping("/start")
@ResponseBody
public Response<String> start(HttpServletRequest request, @RequestParam("id") int id) {
public Response<String> start(HttpServletRequest request, @RequestParam("ids[]") List<Integer> ids) {
// valid
if (CollectionTool.isEmpty(ids) || ids.size()!=1) {
return Response.ofFail(I18nUtil.getString("system_please_choose") + I18nUtil.getString("system_one") + I18nUtil.getString("system_data"));
}
// invoke
Response<LoginInfo> loginInfoResponse = XxlSsoHelper.loginCheckWithAttr(request);
return xxlJobService.start(id, loginInfoResponse.getData());
return xxlJobService.start(ids.get(0), loginInfoResponse.getData());
}
@RequestMapping("/trigger")
@ -145,10 +174,17 @@ public class JobInfoController {
public Response<List<String>> nextTriggerTime(@RequestParam("scheduleType") String scheduleType,
@RequestParam("scheduleConf") String scheduleConf) {
// valid
if (StringTool.isBlank(scheduleType) || StringTool.isBlank(scheduleConf)) {
return Response.of(ResponseCode.FAILURE.getCode(), null, new ArrayList<>());
}
// param
XxlJobInfo paramXxlJobInfo = new XxlJobInfo();
paramXxlJobInfo.setScheduleType(scheduleType);
paramXxlJobInfo.setScheduleConf(scheduleConf);
// generate
List<String> result = new ArrayList<>();
try {
Date lastTime = new Date();
@ -166,7 +202,7 @@ public class JobInfoController {
}
}
} catch (Exception e) {
logger.error(">>>>>>>>>>> nextTriggerTime error. scheduleType = {}, scheduleConf= {}", scheduleType, scheduleConf, e);
logger.error(">>>>>>>>>>> nextTriggerTime error. scheduleType = {}, scheduleConf= {}, error:{} ", scheduleType, scheduleConf, e.getMessage());
return Response.ofFail((I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) + e.getMessage());
}
return Response.ofSuccess(result);

@ -178,7 +178,7 @@
// onLoadSuccess: function(data) {}
onAll: function(name, args) {
// filter
if (!(['check.bs.table', "uncheck.bs.table", "check-all.bs.table", "uncheck-all.bs.table"].indexOf(name) > -1)) {
if (!(['check.bs.table', "uncheck.bs.table", "check-all.bs.table", "uncheck-all.bs.table", 'post-body.bs.table'].indexOf(name) > -1)) {
return false;
}
var rows = $(table).bootstrapTable('getSelections');

@ -0,0 +1,280 @@
<!DOCTYPE html>
<html>
<head>
<#-- import macro -->
<#import "../common/common.macro.ftl" as netCommon>
<!-- 1-style start -->
<@netCommon.commonStyle />
<link rel="stylesheet" href="${request.contextPath}/static/plugins/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.css">
<title>${I18n.admin_name}</title>
<style type="text/css" >
.CodeMirror {
font-size:16px;
width: 100%;
height: 100%;
/*bottom: 0;
top: 0px;*/
position: absolute;
}
</style>
<!-- 1-style end -->
</head>
<body class="hold-transition skin-blue layout-top-nav" >
<div class="wrapper" >
<!-- 2-header start -->
<header class="main-header">
<nav class="navbar navbar-static-top">
<div class="container">
<#-- icon -->
<div class="navbar-header">
<a class="navbar-brand" href="javascript:void(0);" ><b>Web</b>IDE</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
<i class="fa fa-bars"></i>
</button>
</div>
<#-- left nav -->
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
<ul class="nav navbar-nav">
<li class="active" >
<a href="javascript:;">${I18n.jobinfo_job}${jobInfo.jobDesc} <#list GlueTypeEnum as item><#if item == jobInfo.glueType>${item.desc}</#if></#list></a>
</li>
</ul>
</div>
<#-- right nav -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">${I18n.jobinfo_glue_rollback} <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li <#if jobLogGlues?exists && jobLogGlues?size gt 0 >style="display: none;"</#if> >
<a href="javascript:;" class="source_version" version="version_now" glueType="${jobInfo.glueType}" >
<#list GlueTypeEnum as item><#if item == jobInfo.glueType>${item.desc}</#if></#list> ${jobInfo.glueRemark}
</a>
</li>
<textarea id="version_now" style="display:none;" >${jobInfo.glueSource}</textarea>
<#if jobLogGlues?exists && jobLogGlues?size gt 0 >
<#list jobLogGlues as glue>
<li>
<a href="javascript:;" class="source_version" version="version_${glue.id}" glueType="${glue.glueType}" >
${glue.addTime?string["yyyy-MM-dd HH:mm:ss"]} ${glue.glueRemark}
</a>
</li>
<textarea id="version_${glue.id}" style="display:none;" >${glue.glueSource}</textarea>
</#list>
</#if>
</ul>
</li>
<li id="save" >
<a href="javascript:;" >
<i class="fa fa-fw fa-save" ></i>
${I18n.system_save}
</a>
</li>
<li>
<a href="javascript:window.close();" >
<i class="fa fa-fw fa-close" ></i>
${I18n.system_close}
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!-- 2-header end -->
<!-- 3-content start -->
<div class="content-wrapper" id="ideWindow" >
</div>
<!-- . -->
<div class="modal fade" id="saveModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog ">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" ><i class="fa fa-fw fa-save"></i>${I18n.system_save}</h4>
</div>
<div class="modal-body">
<div class="form-horizontal form" role="form" >
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_glue_remark}<font color="red">*</font></label>
<div class="col-sm-10"><input type="text" class="form-control" id="glueRemark" placeholder="${I18n.system_please_input}${I18n.jobinfo_glue_remark}" maxlength="64" ></div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="button" class="btn btn-primary ok" >${I18n.system_save}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">${I18n.system_cancel}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 3-content end -->
<!-- 4-footer start -->
<footer class="main-footer">
Powered by <b>XXL-JOB</b> ${I18n.admin_version}
<div class="pull-right hidden-xs">
<strong>Copyright &copy; 2015-${.now?string('yyyy')} &nbsp;
<a href="https://www.xuxueli.com/" target="_blank" >xuxueli</a>
&nbsp;
<a href="https://github.com/xuxueli/xxl-job" target="_blank" >github</a>
</strong><!-- All rights reserved. -->
</div>
</footer>
<!-- 4-footer end -->
</div>
<!-- 5-script start -->
<#-- glueModel -->
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" />
<#assign glueTypeIdeMode = "text/x-java" />
<#if jobInfo.glueType == "GLUE_GROOVY" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" />
<#assign glueTypeIdeMode = "text/x-java" />
<#elseif jobInfo.glueType == "GLUE_SHELL" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/shell/shell.js" />
<#assign glueTypeIdeMode = "text/x-sh" />
<#elseif jobInfo.glueType == "GLUE_PYTHON" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/python/python.js" />
<#assign glueTypeIdeMode = "text/x-python" />
<#elseif jobInfo.glueType == "GLUE_PYTHON2" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/python/python.js" />
<#assign glueTypeIdeMode = "text/x-python" />
<#elseif jobInfo.glueType == "GLUE_PHP" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/php/php.js" />
<#assign glueTypeIdeMode = "text/x-php" />
<#assign glueTypeModeSrc02 = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" />
<#elseif jobInfo.glueType == "GLUE_NODEJS" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/javascript/javascript.js" />
<#assign glueTypeIdeMode = "text/javascript" />
<#elseif jobInfo.glueType == "GLUE_POWERSHELL" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/powershell/powershell.js" />
<#assign glueTypeIdeMode = "powershell" />
</#if>
<#-- script -->
<@netCommon.commonScript />
<script src="${request.contextPath}/static/biz/common/admin.setting.js?v=${I18n.admin_version}"></script>
<#-- glue ide -->
<script src="${request.contextPath}/static/plugins/codemirror/lib/codemirror.js"></script>
<script src="${glueTypeModeSrc}"></script>
<#if glueTypeModeSrc02?exists>
<script src="${glueTypeModeSrc02}"></script>
</#if>
<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>
$(function() {
// init param
var id = '${jobInfo.id}';
var ideMode = '${glueTypeIdeMode}';
/**
* init code editor
*/
var codeEditor;
function initIde(glueSource) {
if (codeEditor == null) {
codeEditor = CodeMirror(document.getElementById("ideWindow"), {
mode : ideMode,
lineNumbers : true,
matchBrackets : true,
value: glueSource
});
} else {
codeEditor.setValue(glueSource);
}
}
initIde($("#version_now").val());
// code change
$(".source_version").click(function(){
var sourceId = $(this).attr('version');
var temp = $( "#" + sourceId ).val();
//codeEditor.setValue('');
initIde(temp);
});
// code source save
$("#save").click(function() {
$('#saveModal').modal({backdrop: false, keyboard: false}).modal('show');
});
$("#saveModal .ok").click(function() {
var glueSource = codeEditor.getValue();
var glueRemark = $("#glueRemark").val();
if (!glueRemark) {
layer.open({
title: I18n.system_tips,
btn: [ I18n.system_ok],
content: I18n.system_please_input + I18n.jobinfo_glue_remark ,
icon: '2'
});
return;
}
if (glueRemark.length <4 || glueRemark.length > 100) {
layer.open({
title: I18n.system_tips ,
btn: [ I18n.system_ok ],
content: I18n.jobinfo_glue_remark_limit ,
icon: '2'
});
return;
}
$.ajax({
type : 'POST',
url : base_url + '/jobcode/save',
data : {
'id' : id,
'glueSource' : glueSource,
'glueRemark' : glueRemark
},
dataType : "json",
success : function(data){
if (data.code == 200) {
layer.open({
title: I18n.system_tips,
btn: [ I18n.system_ok ],
content: (I18n.system_save + I18n.system_success) ,
icon: '1',
end: function(layero, index){
//$(window).unbind('beforeunload');
window.location.reload();
}
});
} else {
layer.open({
title: I18n.system_tips,
btn: [ I18n.system_ok ],
content: (data.msg || (I18n.system_save + I18n.system_fail) ),
icon: '2'
});
}
}
});
});
});
</script>
<!-- 5-script end -->
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -27,7 +27,9 @@
<#-- left nav -->
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
<ul class="nav navbar-nav">
<#--<li class="active" ><a href="javascript:;"><span class="sr-only">(current)</span></a></li>-->
<li class="active" >
<a href="javascript:;">${I18n.jobinfo_job}${jobInfo.jobDesc}</a>
</li>
</ul>
</div>
@ -40,6 +42,12 @@
${I18n.joblog_rolling_log_refresh}
</a>
</li>
<li>
<a href="javascript:window.close();" >
<i class="fa fa-fw fa-close" ></i>
${I18n.system_close}
</a>
</li>
</ul>
</div>

@ -82,14 +82,10 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header pull-left" id="data_operation" >
<button class="btn btn-sm btn-info selectOnlyOne logDetail" type="button"><#--<i class="fa fa-edit"></i>-->${I18n.joblog_rolling_log}</button>
<button class="btn btn-sm btn-warning selectOnlyOne logKill" type="button">${I18n.joblog_kill_log}</button>
<button class="btn btn-sm btn-danger selectAny clearLog" type="button">${I18n.joblog_clean_log}</button>
<#--warning
danger
info
default-->
<button class="btn btn-sm btn-primary selectOnlyOne logDetail" type="button"><#--<i class="fa fa-edit"></i>-->${I18n.joblog_rolling_log}</button>
</div>
<div class="box-body" >
<table id="data_list" class="table table-bordered table-striped" width="100%" >
@ -226,13 +222,8 @@
var jobGroup = '${jobGroup}';
var jobId = '${jobId}';
function resetFilter(){
$('#filterTime').data("daterangepicker").setStartDate( rangesConf[I18n.daterangepicker_ranges_today][0] );
$('#filterTime').data("daterangepicker").setEndDate( rangesConf[I18n.daterangepicker_ranges_today][1] );
// todo
$('#filterTime').data("daterangepicker").setStartDate( rangesConf[I18n.daterangepicker_ranges_recent_month][0] );
$('#filterTime').data("daterangepicker").setEndDate( rangesConf[I18n.daterangepicker_ranges_recent_month][1] );
$('#filterTime').data("daterangepicker").setStartDate( rangesConf[I18n.daterangepicker_ranges_recent_week][0] );
$('#filterTime').data("daterangepicker").setEndDate( rangesConf[I18n.daterangepicker_ranges_recent_week][1] );
$("#jobGroup").val( jobGroup );
$("#jobId").val( jobId );

@ -1,186 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<#-- import macro -->
<#import "../common/common.macro.ftl" as netCommon>
<#-- commonStyle -->
<@netCommon.commonStyle />
<#-- biz start1/5 style -->
<link rel="stylesheet" href="${request.contextPath}/static/plugins/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.css">
<title>${I18n.admin_name}</title>
<style type="text/css">
.CodeMirror {
font-size:16px;
width: 100%;
height: 100%;
/*bottom: 0;
top: 0px;*/
position: absolute;
}
</style>
<#-- biz end1/5 end -->
</head>
<body class="skin-blue fixed layout-top-nav">
<div class="wrapper">
<!-- header -->
<#-- biz start2/5 header -->
<header class="main-header">
<nav class="navbar navbar-static-top">
<div class="container">
<#-- icon -->
<div class="navbar-header">
<a class="navbar-brand"><b>Web</b>IDE</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
<i class="fa fa-bars"></i>
</button>
</div>
<#-- left nav -->
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
<ul class="nav navbar-nav">
<li class="active" ><a href="javascript:;">
<span class="sr-only">(current)</span>
<#list GlueTypeEnum as item><#if item == jobInfo.glueType>${item.desc}</#if></#list>
${jobInfo.jobDesc}
</a></li>
</ul>
</div>
<#-- right nav -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">${I18n.jobinfo_glue_rollback} <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li <#if jobLogGlues?exists && jobLogGlues?size gt 0 >style="display: none;"</#if> >
<a href="javascript:;" class="source_version" version="version_now" glueType="${jobInfo.glueType}" >
<#list GlueTypeEnum as item><#if item == jobInfo.glueType>${item.desc}</#if></#list> ${jobInfo.glueRemark}
</a>
</li>
<textarea id="version_now" style="display:none;" >${jobInfo.glueSource}</textarea>
<#if jobLogGlues?exists && jobLogGlues?size gt 0 >
<#list jobLogGlues as glue>
<li>
<a href="javascript:;" class="source_version" version="version_${glue.id}" glueType="${glue.glueType}" >
${glue.addTime?string["yyyy-MM-dd HH:mm:ss"]} ${glue.glueRemark}
</a>
</li>
<textarea id="version_${glue.id}" style="display:none;" >${glue.glueSource}</textarea>
</#list>
</#if>
</ul>
</li>
<li id="save" >
<a href="javascript:;" >
<i class="fa fa-fw fa-save" ></i>
${I18n.system_save}
</a>
</li>
<li>
<a href="javascript:window.close();" >
<i class="fa fa-fw fa-close" ></i>
${I18n.system_close}
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<#-- biz end2/5 header -->
<!-- left -->
<!-- right start -->
<div class="content-wrapper" id="ideWindow" ></div>
<#-- biz start3/5 content-header -->
<#-- biz start4/5 content-main -->
<!-- . -->
<div class="modal fade" id="saveModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog ">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" ><i class="fa fa-fw fa-save"></i>${I18n.system_save}</h4>
</div>
<div class="modal-body">
<div class="form-horizontal form" role="form" >
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_glue_remark}<font color="red">*</font></label>
<div class="col-sm-10"><input type="text" class="form-control" id="glueRemark" placeholder="${I18n.system_please_input}${I18n.jobinfo_glue_remark}" maxlength="64" ></div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="button" class="btn btn-primary ok" >${I18n.system_save}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">${I18n.system_cancel}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- right end -->
<!-- footer -->
<#--<@netCommon.commonFooter />-->
</div>
<@netCommon.commonScript />
<#-- biz start5/5 script -->
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" />
<#assign glueTypeIdeMode = "text/x-java" />
<#if jobInfo.glueType == "GLUE_GROOVY" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" />
<#assign glueTypeIdeMode = "text/x-java" />
<#elseif jobInfo.glueType == "GLUE_SHELL" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/shell/shell.js" />
<#assign glueTypeIdeMode = "text/x-sh" />
<#elseif jobInfo.glueType == "GLUE_PYTHON" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/python/python.js" />
<#assign glueTypeIdeMode = "text/x-python" />
<#elseif jobInfo.glueType == "GLUE_PYTHON2" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/python/python.js" />
<#assign glueTypeIdeMode = "text/x-python" />
<#elseif jobInfo.glueType == "GLUE_PHP" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/php/php.js" />
<#assign glueTypeIdeMode = "text/x-php" />
<#assign glueTypeModeSrc02 = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" />
<#elseif jobInfo.glueType == "GLUE_NODEJS" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/javascript/javascript.js" />
<#assign glueTypeIdeMode = "text/javascript" />
<#elseif jobInfo.glueType == "GLUE_POWERSHELL" >
<#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/powershell/powershell.js" />
<#assign glueTypeIdeMode = "powershell" />
</#if>
<script src="${request.contextPath}/static/plugins/codemirror/lib/codemirror.js"></script>
<script src="${glueTypeModeSrc}"></script>
<#if glueTypeModeSrc02?exists>
<script src="${glueTypeModeSrc02}"></script>
</#if>
<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 = '${jobInfo.id}';
var ideMode = '${glueTypeIdeMode}';
</script>
<script src="${request.contextPath}/static/js/jobcode.index.1.js"></script>
<#-- biz end5/5 script -->
</body>
</html>

@ -1,581 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<#-- import macro -->
<#import "../common/common.macro.ftl" as netCommon>
<#-- commonStyle -->
<@netCommon.commonStyle />
<#-- biz start1/5 style -->
<!-- DataTables -->
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
<#-- biz end1/5 end -->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<!-- header -->
<@netCommon.commonHeader />
<!-- left -->
<#-- biz start2/5 left -->
<@netCommon.commonLeft "jobinfo" />
<#-- biz end2/5 left -->
<!-- right start -->
<div class="content-wrapper">
<!-- content-header -->
<section class="content-header">
<#-- biz start3/5 name -->
<h1>${I18n.jobinfo_name}</h1>
<#-- biz end3/5 name -->
</section>
<!-- content-main -->
<section class="content">
<#-- biz start4/5 content -->
<!-- filter -->
<div class="row">
<div class="col-xs-3">
<div class="input-group">
<span class="input-group-addon">${I18n.jobinfo_field_jobgroup}</span>
<select class="form-control" id="jobGroup" >
<#list JobGroupList as group>
<option value="${group.id}" <#if jobGroup==group.id>selected</#if> >${group.title}</option>
</#list>
</select>
</div>
</div>
<div class="col-xs-1">
<div class="input-group">
<select class="form-control" id="triggerStatus" >
<option value="-1" >${I18n.system_all}</option>
<option value="0" >${I18n.jobinfo_opt_stop}</option>
<option value="1" >${I18n.jobinfo_opt_start}</option>
</select>
</div>
</div>
<div class="col-xs-2">
<div class="input-group">
<input type="text" class="form-control" id="jobDesc" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_jobdesc}" >
</div>
</div>
<div class="col-xs-2">
<div class="input-group">
<input type="text" class="form-control" id="executorHandler" placeholder="${I18n.system_please_input}JobHandler" >
</div>
</div>
<div class="col-xs-2">
<div class="input-group">
<input type="text" class="form-control" id="author" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_author}" >
</div>
</div>
<div class="col-xs-1">
<button class="btn btn-block btn-info" id="searchBtn">${I18n.system_search}</button>
</div>
<div class="col-xs-1">
<button class="btn btn-block btn-success add" type="button">${I18n.jobinfo_field_add}</button>
</div>
</div>
<!-- table -->
<div class="row">
<div class="col-xs-12">
<div class="box">
<#--<div class="box-header hide">
<h3 class="box-title"></h3>
</div>-->
<div class="box-body" >
<table id="job_list" class="table table-bordered table-striped" width="100%" >
<thead>
<tr>
<th name="id" >${I18n.jobinfo_field_id}</th>
<th name="jobGroup" >${I18n.jobinfo_field_jobgroup}</th>
<th name="jobDesc" >${I18n.jobinfo_field_jobdesc}</th>
<th name="scheduleType" >${I18n.schedule_type}</th>
<th name="glueType" >${I18n.jobinfo_field_gluetype}</th>
<th name="executorParam" >${I18n.jobinfo_field_executorparam}</th>
<th name="addTime" >addTime</th>
<th name="updateTime" >updateTime</th>
<th name="author" >${I18n.jobinfo_field_author}</th>
<th name="alarmEmail" >${I18n.jobinfo_field_alarmemail}</th>
<th name="triggerStatus" >${I18n.system_status}</th>
<th>${I18n.system_opt}</th>
</tr>
</thead>
<tbody></tbody>
<tfoot></tfoot>
</table>
</div>
</div>
</div>
</div>
</section>
<#-- biz end4/5 content -->
</div>
<!-- right end -->
<!-- footer -->
<@netCommon.commonFooter />
</div>
<!-- job. -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >${I18n.jobinfo_field_add}</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_base}</p> <#-- -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_jobgroup}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="jobGroup" >
<#list JobGroupList as group>
<option value="${group.id}" <#if jobGroup==group.id>selected</#if> >${group.title}</option>
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_jobdesc}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobDesc" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_jobdesc}" maxlength="50" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_author}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_author}" maxlength="50" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_alarmemail}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="${I18n.jobinfo_field_alarmemail_placeholder}" maxlength="100" ></div>
</div>
<br>
<p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_schedule}</p> <#-- -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.schedule_type}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control scheduleType" name="scheduleType" >
<#list ScheduleTypeEnum as item>
<option value="${item}" <#if 'CRON' == item >selected</#if> >${item.title}</option>
</#list>
</select>
</div>
<input type="hidden" name="scheduleConf" />
<div class="schedule_conf schedule_conf_NONE" style="display: none" >
</div>
<div class="schedule_conf schedule_conf_CRON" >
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_CRON" placeholder="${I18n.system_please_input}Cron" maxlength="128" ></div>
</div>
<div class="schedule_conf schedule_conf_FIX_RATE" style="display: none" >
<label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_rate}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_RATE" placeholder="${I18n.system_please_input} Second " maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
<div class="schedule_conf schedule_conf_FIX_DELAY" style="display: none" >
<label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_delay}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_DELAY" placeholder="${I18n.system_please_input} Second " maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
</div>
<br>
<p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_job}</p> <#-- -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_gluetype}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control glueType" name="glueType" >
<#list GlueTypeEnum as item>
<option value="${item}" >${item.desc}</option>
</#list>
</select>
</div>
<label for="firstname" class="col-sm-2 control-label">JobHandler<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorHandler" placeholder="${I18n.system_please_input}JobHandler" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorparam}<font color="black">*</font></label>
<div class="col-sm-10">
<textarea class="textarea form-control" name="executorParam" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_executorparam}" maxlength="512" style="height: 63px; line-height: 1.2;"></textarea>
</div>
</div>
<br>
<p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_advanced}</p> <#-- -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorRouteStrategy}<font color="black">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorRouteStrategy" >
<#list ExecutorRouteStrategyEnum as item>
<option value="${item}" >${item.title}</option>
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_childJobId}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="childJobId" placeholder="${I18n.jobinfo_field_childJobId_placeholder}" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.misfire_strategy}<font color="black">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="misfireStrategy" >
<#list MisfireStrategyEnum as item>
<option value="${item}" <#if 'DO_NOTHING' == item >selected</#if> >${item.title}</option>
</#list>
</select>
</div>
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorBlockStrategy}<font color="black">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorBlockStrategy" >
<#list ExecutorBlockStrategyEnum as item>
<option value="${item}" >${item.title}</option>
</#list>
</select>
</div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_timeout}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorTimeout" placeholder="${I18n.jobinfo_field_executorTimeout_placeholder}" maxlength="6" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorFailRetryCount}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorFailRetryCount" placeholder="${I18n.jobinfo_field_executorFailRetryCount_placeholder}" maxlength="4" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="submit" class="btn btn-primary" >${I18n.system_save}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">${I18n.system_cancel}</button>
</div>
</div>
<input type="hidden" name="glueRemark" value="GLUE代码初始化" >
<textarea name="glueSource" style="display:none;" ></textarea>
<textarea class="glueSource_java" style="display:none;" >
package com.xxl.job.service.handler;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.IJobHandler;
public class DemoGlueJobHandler extends IJobHandler {
@Override
public void execute() throws Exception {
XxlJobHelper.log("XXL-JOB, Hello World.");
}
}
</textarea>
<textarea class="glueSource_shell" style="display:none;" >
#!/bin/bash
echo "xxl-job: hello shell"
echo "${I18n.jobinfo_script_location}$0"
echo "${I18n.jobinfo_field_executorparam}$1"
echo "${I18n.jobinfo_shard_index} = $2"
echo "${I18n.jobinfo_shard_total} = $3"
<#--echo "参数数量:$#"
for param in $*
do
echo "参数 : $param"
sleep 1s
done-->
echo "Good bye!"
exit 0
</textarea>
<textarea class="glueSource_python" style="display:none;" >
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
import sys
print("xxl-job: hello python")
print("${I18n.jobinfo_script_location}", sys.argv[0])
print("${I18n.jobinfo_field_executorparam}", sys.argv[1])
print("${I18n.jobinfo_shard_index}", sys.argv[2])
print("${I18n.jobinfo_shard_total}", sys.argv[3])
print("Good bye!")
exit(0)
</textarea>
<textarea class="glueSource_python2" style="display:none;" >
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
import sys
print "xxl-job: hello python"
print "${I18n.jobinfo_script_location}", sys.argv[0]
print "${I18n.jobinfo_field_executorparam}", sys.argv[1]
print "${I18n.jobinfo_shard_index}", sys.argv[2]
print "${I18n.jobinfo_shard_total}", sys.argv[3]
<#--for i in range(1, len(sys.argv)):
time.sleep(1)
print "参数", i, sys.argv[i]-->
print "Good bye!"
exit(0)
<#--
import logging
logging.basicConfig(level=logging.DEBUG)
logging.info("脚本文件:" + sys.argv[0])
-->
</textarea>
<textarea class="glueSource_php" style="display:none;" >
<?php
echo "xxl-job: hello php \n";
echo "${I18n.jobinfo_script_location}$argv[0] \n";
echo "${I18n.jobinfo_field_executorparam}$argv[1] \n";
echo "${I18n.jobinfo_shard_index} = $argv[2] \n";
echo "${I18n.jobinfo_shard_total} = $argv[3] \n";
echo "Good bye! \n";
exit(0);
?>
</textarea>
<textarea class="glueSource_nodejs" style="display:none;" >
#!/usr/bin/env node
console.log("xxl-job: hello nodejs")
var arguments = process.argv
console.log("${I18n.jobinfo_script_location}: " + arguments[1])
console.log("${I18n.jobinfo_field_executorparam}: " + arguments[2])
console.log("${I18n.jobinfo_shard_index}: " + arguments[3])
console.log("${I18n.jobinfo_shard_total}: " + arguments[4])
<#--for (var i = 2; i < arguments.length; i++){
console.log("参数 %s = %s", (i-1), arguments[i]);
}-->
console.log("Good bye!")
process.exit(0)
</textarea>
<textarea class="glueSource_powershell" style="display:none;" >
Write-Host "xxl-job: hello powershell"
Write-Host "${I18n.jobinfo_script_location}: " $MyInvocation.MyCommand.Definition
Write-Host "${I18n.jobinfo_field_executorparam}: "
if ($args.Count -gt 2) { $args[0..($args.Count-3)] }
Write-Host "${I18n.jobinfo_shard_index}: " $args[$args.Count-2]
Write-Host "${I18n.jobinfo_shard_total}: " $args[$args.Count-1]
Write-Host "Good bye!"
exit 0
</textarea>
</form>
</div>
</div>
</div>
</div>
<!-- . -->
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >${I18n.jobinfo_field_update}</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_base}</p> <#-- -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_jobgroup}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="jobGroup" >
<#list JobGroupList as group>
<option value="${group.id}" >${group.title}</option>
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_jobdesc}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobDesc" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_jobdesc}" maxlength="50" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_author}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_author}" maxlength="50" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_alarmemail}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="${I18n.jobinfo_field_alarmemail_placeholder}" maxlength="100" ></div>
</div>
<br>
<p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_schedule}</p> <#-- -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.schedule_type}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control scheduleType" name="scheduleType" >
<#list ScheduleTypeEnum as item>
<option value="${item}" >${item.title}</option>
</#list>
</select>
</div>
<input type="hidden" name="scheduleConf" />
<div class="schedule_conf schedule_conf_NONE" style="display: none" >
</div>
<div class="schedule_conf schedule_conf_CRON" >
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_CRON" placeholder="${I18n.system_please_input}Cron" maxlength="128" ></div>
</div>
<div class="schedule_conf schedule_conf_FIX_RATE" style="display: none" >
<label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_rate}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_RATE" placeholder="${I18n.system_please_input} Second " maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
<div class="schedule_conf schedule_conf_FIX_DELAY" style="display: none" >
<label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_delay}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_DELAY" placeholder="${I18n.system_please_input} Second " maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
</div>
<br>
<p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_job}</p> <#-- -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_gluetype}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control glueType" name="glueType" disabled >
<#list GlueTypeEnum as item>
<option value="${item}" >${item.desc}</option>
</#list>
</select>
</div>
<label for="firstname" class="col-sm-2 control-label">JobHandler<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorHandler" placeholder="${I18n.system_please_input}JobHandler" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorparam}<font color="black">*</font></label>
<div class="col-sm-10">
<textarea class="textarea form-control" name="executorParam" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_executorparam}" maxlength="512" style="height: 63px; line-height: 1.2;"></textarea>
</div>
</div>
<br>
<p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_advanced}</p> <#-- -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorRouteStrategy}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorRouteStrategy" >
<#list ExecutorRouteStrategyEnum as item>
<option value="${item}" >${item.title}</option>
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_childJobId}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="childJobId" placeholder="${I18n.jobinfo_field_childJobId_placeholder}" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.misfire_strategy}<font color="black">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="misfireStrategy" >
<#list MisfireStrategyEnum as item>
<option value="${item}" <#if 'DO_NOTHING' == item >selected</#if> >${item.title}</option>
</#list>
</select>
</div>
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorBlockStrategy}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorBlockStrategy" >
<#list ExecutorBlockStrategyEnum as item>
<option value="${item}" >${item.title}</option>
</#list>
</select>
</div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_timeout}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorTimeout" placeholder="${I18n.jobinfo_field_executorTimeout_placeholder}" maxlength="6" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorFailRetryCount}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorFailRetryCount" placeholder="${I18n.jobinfo_field_executorFailRetryCount_placeholder}" maxlength="4" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="submit" class="btn btn-primary" >${I18n.system_save}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">${I18n.system_cancel}</button>
<input type="hidden" name="id" >
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<#-- trigger -->
<div class="modal fade" id="jobTriggerModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog ">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >${I18n.jobinfo_opt_run}</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorparam}<font color="black">*</font></label>
<div class="col-sm-10">
<textarea class="textarea form-control" name="executorParam" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_executorparam}" maxlength="512" style="height: 63px; line-height: 1.2;"></textarea>
</div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobgroup_field_registryList}<font color="black">*</font></label>
<div class="col-sm-10">
<textarea class="textarea form-control" name="addressList" placeholder="${I18n.jobinfo_opt_run_tips}" maxlength="512" style="height: 63px; line-height: 1.2;"></textarea>
</div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="button" class="btn btn-primary ok" >${I18n.system_save}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">${I18n.system_cancel}</button>
<input type="hidden" name="id" >
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<@netCommon.commonScript />
<#-- biz start5/5 script -->
<!-- DataTables -->
<script src="${request.contextPath}/static/adminlte/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="${request.contextPath}/static/adminlte/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<!-- moment -->
<script src="${request.contextPath}/static/adminlte/bower_components/moment/moment.min.js"></script>
<#-- cronGen -->
<script src="${request.contextPath}/static/plugins/cronGen/cronGen<#if I18n.admin_i18n?default('')?length gt 0 >_${I18n.admin_i18n}</#if>.js"></script>
<script src="${request.contextPath}/static/js/jobinfo.index.1.js"></script>
<#-- biz end5/5 script -->
</body>
</html>

@ -1,97 +0,0 @@
$(function() {
// init code editor
var codeEditor;
function initIde(glueSource) {
if (codeEditor == null) {
codeEditor = CodeMirror(document.getElementById("ideWindow"), {
mode : ideMode,
lineNumbers : true,
matchBrackets : true,
value: glueSource
});
} else {
codeEditor.setValue(glueSource);
}
}
initIde($("#version_now").val());
// code change
$(".source_version").click(function(){
var sourceId = $(this).attr('version');
var temp = $( "#" + sourceId ).val();
//codeEditor.setValue('');
initIde(temp);
});
// code source save
$("#save").click(function() {
$('#saveModal').modal({backdrop: false, keyboard: false}).modal('show');
});
$("#saveModal .ok").click(function() {
var glueSource = codeEditor.getValue();
var glueRemark = $("#glueRemark").val();
if (!glueRemark) {
layer.open({
title: I18n.system_tips,
btn: [ I18n.system_ok],
content: I18n.system_please_input + I18n.jobinfo_glue_remark ,
icon: '2'
});
return;
}
if (glueRemark.length <4 || glueRemark.length > 100) {
layer.open({
title: I18n.system_tips ,
btn: [ I18n.system_ok ],
content: I18n.jobinfo_glue_remark_limit ,
icon: '2'
});
return;
}
$.ajax({
type : 'POST',
url : base_url + '/jobcode/save',
data : {
'id' : id,
'glueSource' : glueSource,
'glueRemark' : glueRemark
},
dataType : "json",
success : function(data){
if (data.code == 200) {
layer.open({
title: I18n.system_tips,
btn: [ I18n.system_ok ],
content: (I18n.system_save + I18n.system_success) ,
icon: '1',
end: function(layero, index){
//$(window).unbind('beforeunload');
window.location.reload();
}
});
} else {
layer.open({
title: I18n.system_tips,
btn: [ I18n.system_ok ],
content: (data.msg || (I18n.system_save + I18n.system_fail) ),
icon: '2'
});
}
}
});
});
// before upload
/*$(window).bind('beforeunload',function(){
return 'GlueGlue';
});*/
});

@ -1,749 +0,0 @@
$(function() {
// init date tables
var jobTable = $("#job_list").dataTable({
"deferRender": true,
"processing" : true,
"serverSide": true,
"ajax": {
url: base_url + "/jobinfo/pageList",
type:"post",
data : function ( d ) {
var obj = {};
obj.offset = d.start;
obj.pagesize = d.length;
obj.jobGroup = $('#jobGroup').val();
obj.triggerStatus = $('#triggerStatus').val();
obj.jobDesc = $('#jobDesc').val();
obj.executorHandler = $('#executorHandler').val();
obj.author = $('#author').val();
return obj;
},
dataFilter: function (json ) {
var result = JSON.parse(json);
return JSON.stringify({
"recordsTotal": result.data.total,
"recordsFiltered": result.data.total,
"data": result.data.data
});
}
},
"searching": false,
"ordering": false,
//"scrollX": true, // scroll xclose self-adaption
"columns": [
{
"data": 'id',
"bSortable": false,
"visible" : true,
"width":'7%'
},
{
"data": 'jobGroup',
"visible" : false,
"render": function ( data, type, row ) {
var groupMenu = $("#jobGroup").find("option");
for ( var index in $("#jobGroup").find("option")) {
if ($(groupMenu[index]).attr('value') == data) {
return $(groupMenu[index]).html();
}
}
return data;
}
},
{
"data": 'jobDesc',
"visible" : true,
"width":'25%'
},
{
"data": 'scheduleType',
"visible" : true,
"width":'13%',
"render": function ( data, type, row ) {
if (row.scheduleConf) {
return row.scheduleType + ''+ row.scheduleConf;
} else {
return row.scheduleType;
}
}
},
{
"data": 'glueType',
"width":'25%',
"visible" : true,
"render": function ( data, type, row ) {
var glueTypeTitle = findGlueTypeTitle(row.glueType);
if (row.executorHandler) {
return glueTypeTitle +"" + row.executorHandler;
} else {
return glueTypeTitle;
}
}
},
{ "data": 'executorParam', "visible" : false},
{
"data": 'addTime',
"visible" : false,
"render": function ( data, type, row ) {
return data?moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"):"";
}
},
{
"data": 'updateTime',
"visible" : false,
"render": function ( data, type, row ) {
return data?moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"):"";
}
},
{ "data": 'author', "visible" : true, "width":'10%'},
{ "data": 'alarmEmail', "visible" : false},
{
"data": 'triggerStatus',
"width":'10%',
"visible" : true,
"render": function ( data, type, row ) {
// status
if (1 == data) {
return '<small class="label label-success" >RUNNING</small>';
} else {
return '<small class="label label-default" >STOP</small>';
}
return data;
}
},
{
"data": I18n.system_opt ,
"width":'10%',
"render": function ( data, type, row ) {
return function(){
// status
var start_stop_div = "";
if (1 == row.triggerStatus ) {
start_stop_div = '<li><a href="javascript:void(0);" class="job_operate" _type="job_pause" >'+ I18n.jobinfo_opt_stop +'</a></li>\n';
} else {
start_stop_div = '<li><a href="javascript:void(0);" class="job_operate" _type="job_resume" >'+ I18n.jobinfo_opt_start +'</a></li>\n';
}
// job_next_time_html
var job_next_time_html = '';
if (row.scheduleType == 'CRON' || row.scheduleType == 'FIX_RATE') {
job_next_time_html = '<li><a href="javascript:void(0);" class="job_next_time" >' + I18n.jobinfo_opt_next_time + '</a></li>\n';
}
// log url
var logHref = base_url +'/joblog?jobId='+ row.id;
// code url
var codeBtn = "";
if ('BEAN' != row.glueType) {
var codeUrl = base_url +'/jobcode?jobId='+ row.id;
codeBtn = '<li><a href="'+ codeUrl +'" target="_blank" >GLUE IDE</a></li>\n';
codeBtn += '<li class="divider"></li>\n';
}
// data
tableData['key'+row.id] = row;
// opt
var html = '<div class="btn-group">\n' +
' <button type="button" class="btn btn-primary btn-sm">'+ I18n.system_opt +'</button>\n' +
' <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">\n' +
' <span class="caret"></span>\n' +
' <span class="sr-only">Toggle Dropdown</span>\n' +
' </button>\n' +
' <ul class="dropdown-menu" role="menu" _id="'+ row.id +'" >\n' +
' <li><a href="javascript:void(0);" class="job_trigger" >'+ I18n.jobinfo_opt_run +'</a></li>\n' +
' <li><a href="'+ logHref +'">'+ I18n.jobinfo_opt_log +'</a></li>\n' +
' <li><a href="javascript:void(0);" class="job_registryinfo" >' + I18n.jobinfo_opt_registryinfo + '</a></li>\n' +
job_next_time_html +
' <li class="divider"></li>\n' +
codeBtn +
start_stop_div +
' <li><a href="javascript:void(0);" class="update" >'+ I18n.system_opt_edit +'</a></li>\n' +
' <li><a href="javascript:void(0);" class="job_operate" _type="job_del" >'+ I18n.system_opt_del +'</a></li>\n' +
' <li><a href="javascript:void(0);" class="job_copy" >'+ I18n.system_opt_copy +'</a></li>\n' +
' </ul>\n' +
' </div>';
return html;
};
}
}
],
"language" : {
"sProcessing" : I18n.dataTable_sProcessing ,
"sLengthMenu" : I18n.dataTable_sLengthMenu ,
"sZeroRecords" : I18n.dataTable_sZeroRecords ,
"sInfo" : I18n.dataTable_sInfo ,
"sInfoEmpty" : I18n.dataTable_sInfoEmpty ,
"sInfoFiltered" : I18n.dataTable_sInfoFiltered ,
"sInfoPostFix" : "",
"sSearch" : I18n.dataTable_sSearch ,
"sUrl" : "",
"sEmptyTable" : I18n.dataTable_sEmptyTable ,
"sLoadingRecords" : I18n.dataTable_sLoadingRecords ,
"sInfoThousands" : ",",
"oPaginate" : {
"sFirst" : I18n.dataTable_sFirst ,
"sPrevious" : I18n.dataTable_sPrevious ,
"sNext" : I18n.dataTable_sNext ,
"sLast" : I18n.dataTable_sLast
},
"oAria" : {
"sSortAscending" : I18n.dataTable_sSortAscending ,
"sSortDescending" : I18n.dataTable_sSortDescending
}
}
});
// table data
var tableData = {};
// search btn
$('#searchBtn').on('click', function(){
jobTable.fnDraw();
});
// jobGroup change
$('#jobGroup').on('change', function(){
//reload
var jobGroup = $('#jobGroup').val();
window.location.href = base_url + "/jobinfo?jobGroup=" + jobGroup;
});
// job operate
$("#job_list").on('click', '.job_operate',function() {
var typeName;
var url;
var needFresh = false;
var type = $(this).attr("_type");
if ("job_pause" == type) {
typeName = I18n.jobinfo_opt_stop ;
url = base_url + "/jobinfo/stop";
needFresh = true;
} else if ("job_resume" == type) {
typeName = I18n.jobinfo_opt_start ;
url = base_url + "/jobinfo/start";
needFresh = true;
} else if ("job_del" == type) {
typeName = I18n.system_opt_del ;
url = base_url + "/jobinfo/remove";
needFresh = true;
} else {
return;
}
var id = $(this).parents('ul').attr("_id");
layer.confirm( I18n.system_ok + typeName + '?', {
icon: 3,
title: I18n.system_tips ,
btn: [ I18n.system_ok, I18n.system_cancel ]
}, function(index){
layer.close(index);
$.ajax({
type : 'POST',
url : url,
data : {
"id" : id
},
dataType : "json",
success : function(data){
if (data.code == 200) {
layer.msg( typeName + I18n.system_success );
if (needFresh) {
//window.location.reload();
jobTable.fnDraw(false);
}
} else {
layer.msg( data.msg || typeName + I18n.system_fail );
}
}
});
});
});
// job trigger
$("#job_list").on('click', '.job_trigger',function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
$("#jobTriggerModal .form input[name='id']").val( row.id );
$("#jobTriggerModal .form textarea[name='executorParam']").val( row.executorParam );
$('#jobTriggerModal').modal({backdrop: false, keyboard: false}).modal('show');
});
$("#jobTriggerModal .ok").on('click',function() {
$.ajax({
type : 'POST',
url : base_url + "/jobinfo/trigger",
data : {
"id" : $("#jobTriggerModal .form input[name='id']").val(),
"executorParam" : $("#jobTriggerModal .textarea[name='executorParam']").val(),
"addressList" : $("#jobTriggerModal .textarea[name='addressList']").val()
},
dataType : "json",
success : function(data){
if (data.code == 200) {
$('#jobTriggerModal').modal('hide');
layer.msg( I18n.jobinfo_opt_run + I18n.system_success );
} else {
layer.msg( data.msg || I18n.jobinfo_opt_run + I18n.system_fail );
}
}
});
});
$("#jobTriggerModal").on('hide.bs.modal', function () {
$("#jobTriggerModal .form")[0].reset();
});
// job registryinfo
$("#job_list").on('click', '.job_registryinfo',function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
var jobGroup = row.jobGroup;
$.ajax({
type : 'POST',
url : base_url + "/jobgroup/loadById",
data : {
"id" : jobGroup
},
dataType : "json",
success : function(data){
var html = '<div>';
if (data.code == 200 && data.data.registryList) {
for (var index in data.data.registryList) {
html += (parseInt(index)+1) + '. <span class="badge bg-green" >' + data.data.registryList[index] + '</span><br>';
}
}
html += '</div>';
layer.open({
title: I18n.jobinfo_opt_registryinfo ,
btn: [ I18n.system_ok ],
content: html
});
}
});
});
// job_next_time
$("#job_list").on('click', '.job_next_time',function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
$.ajax({
type : 'POST',
url : base_url + "/jobinfo/nextTriggerTime",
data : {
"scheduleType" : row.scheduleType,
"scheduleConf" : row.scheduleConf
},
dataType : "json",
success : function(data){
if (data.code != 200) {
layer.open({
title: I18n.jobinfo_opt_next_time ,
btn: [ I18n.system_ok ],
content: data.msg
});
} else {
var html = '<center>';
if (data.code == 200 && data.data) {
for (var index in data.data) {
html += '<span>' + data.data[index] + '</span><br>';
}
}
html += '</center>';
layer.open({
title: I18n.jobinfo_opt_next_time ,
btn: [ I18n.system_ok ],
content: html
});
}
}
});
});
// add
$(".add").click(function(){
// init-cronGen
$("#addModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#addModal .form input[name='schedule_conf_CRON']").cronGen({});
// 》init scheduleType
$("#updateModal .form select[name=scheduleType]").change();
// 》init glueType
$("#updateModal .form select[name=glueType]").change();
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
});
var addModalValidate = $("#addModal .form").validate({
errorElement : 'span',
errorClass : 'help-block',
focusInvalid : true,
rules : {
jobDesc : {
required : true,
maxlength: 50
},
author : {
required : true
}/*,
executorTimeout : {
digits:true
},
executorFailRetryCount : {
digits:true
}*/
},
messages : {
jobDesc : {
required : I18n.system_please_input + I18n.jobinfo_field_jobdesc
},
author : {
required : I18n.system_please_input + I18n.jobinfo_field_author
}/*,
executorTimeout : {
digits: I18n.system_please_input + I18n.system_digits
},
executorFailRetryCount : {
digits: I18n.system_please_input + I18n.system_digits
}*/
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
},
success : function(label) {
label.closest('.form-group').removeClass('has-error');
label.remove();
},
errorPlacement : function(error, element) {
element.parent('div').append(error);
},
submitHandler : function(form) {
// process executorTimeout+executorFailRetryCount
var executorTimeout = $("#addModal .form input[name='executorTimeout']").val();
if(!/^\d+$/.test(executorTimeout)) {
executorTimeout = 0;
}
$("#addModal .form input[name='executorTimeout']").val(executorTimeout);
var executorFailRetryCount = $("#addModal .form input[name='executorFailRetryCount']").val();
if(!/^\d+$/.test(executorFailRetryCount)) {
executorFailRetryCount = 0;
}
$("#addModal .form input[name='executorFailRetryCount']").val(executorFailRetryCount);
// process schedule_conf
var scheduleType = $("#addModal .form select[name='scheduleType']").val();
var scheduleConf;
if (scheduleType == 'CRON') {
scheduleConf = $("#addModal .form input[name='cronGen_display']").val();
} else if (scheduleType == 'FIX_RATE') {
scheduleConf = $("#addModal .form input[name='schedule_conf_FIX_RATE']").val();
} else if (scheduleType == 'FIX_DELAY') {
scheduleConf = $("#addModal .form input[name='schedule_conf_FIX_DELAY']").val();
}
$("#addModal .form input[name='scheduleConf']").val( scheduleConf );
$.post(base_url + "/jobinfo/add", $("#addModal .form").serialize(), function(data, status) {
if (data.code == "200") {
$('#addModal').modal('hide');
layer.open({
title: I18n.system_tips ,
btn: [ I18n.system_ok ],
content: I18n.system_add_suc ,
icon: '1',
end: function(layero, index){
jobTable.fnDraw();
//window.location.reload();
}
});
} else {
layer.open({
title: I18n.system_tips ,
btn: [ I18n.system_ok ],
content: (data.msg || I18n.system_add_fail),
icon: '2'
});
}
});
}
});
$("#addModal").on('hide.bs.modal', function () {
addModalValidate.resetForm();
$("#addModal .form")[0].reset();
$("#addModal .form .form-group").removeClass("has-error");
$(".remote_panel").show(); // remote
$("#addModal .form input[name='executorHandler']").removeAttr("readonly");
});
// scheduleType change
$(".scheduleType").change(function(){
var scheduleType = $(this).val();
$(this).parents("form").find(".schedule_conf").hide();
$(this).parents("form").find(".schedule_conf_" + scheduleType).show();
});
// glueType change
$(".glueType").change(function(){
// executorHandler
var $executorHandler = $(this).parents("form").find("input[name='executorHandler']");
var glueType = $(this).val();
if ('BEAN' != glueType) {
$executorHandler.val("");
$executorHandler.attr("readonly","readonly");
} else {
$executorHandler.removeAttr("readonly");
}
});
$("#addModal .glueType").change(function(){
// glueSource
var glueType = $(this).val();
if ('GLUE_GROOVY'==glueType){
$("#addModal .form textarea[name='glueSource']").val( $("#addModal .form .glueSource_java").val() );
} else if ('GLUE_SHELL'==glueType){
$("#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_PYTHON2'==glueType){
$("#addModal .form textarea[name='glueSource']").val( $("#addModal .form .glueSource_python2").val() );
} else if ('GLUE_PHP'==glueType){
$("#addModal .form textarea[name='glueSource']").val( $("#addModal .form .glueSource_php").val() );
} else if ('GLUE_NODEJS'==glueType){
$("#addModal .form textarea[name='glueSource']").val( $("#addModal .form .glueSource_nodejs").val() );
} else if ('GLUE_POWERSHELL'==glueType){
$("#addModal .form textarea[name='glueSource']").val( $("#addModal .form .glueSource_powershell").val() );
} else {
$("#addModal .form textarea[name='glueSource']").val("");
}
});
// update
$("#job_list").on('click', '.update',function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
// fill base
$("#updateModal .form input[name='id']").val( row.id );
$('#updateModal .form select[name=jobGroup] option[value='+ row.jobGroup +']').prop('selected', true);
$("#updateModal .form input[name='jobDesc']").val( row.jobDesc );
$("#updateModal .form input[name='author']").val( row.author );
$("#updateModal .form input[name='alarmEmail']").val( row.alarmEmail );
// fill trigger
$('#updateModal .form select[name=scheduleType] option[value='+ row.scheduleType +']').prop('selected', true);
$("#updateModal .form input[name='scheduleConf']").val( row.scheduleConf );
if (row.scheduleType == 'CRON') {
$("#updateModal .form input[name='schedule_conf_CRON']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_RATE') {
$("#updateModal .form input[name='schedule_conf_FIX_RATE']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_DELAY') {
$("#updateModal .form input[name='schedule_conf_FIX_DELAY']").val( row.scheduleConf );
}
// 》init scheduleType
$("#updateModal .form select[name=scheduleType]").change();
// fill job
$('#updateModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
$("#updateModal .form input[name='executorHandler']").val( row.executorHandler );
$("#updateModal .form textarea[name='executorParam']").val( row.executorParam );
// 》init glueType
$("#updateModal .form select[name=glueType]").change();
// 》init-cronGen
$("#updateModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#updateModal .form input[name='schedule_conf_CRON']").cronGen({});
// fill advanced
$('#updateModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
$("#updateModal .form input[name='childJobId']").val( row.childJobId );
$('#updateModal .form select[name=misfireStrategy] option[value='+ row.misfireStrategy +']').prop('selected', true);
$('#updateModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$("#updateModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#updateModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
// show
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
});
var updateModalValidate = $("#updateModal .form").validate({
errorElement : 'span',
errorClass : 'help-block',
focusInvalid : true,
rules : {
jobDesc : {
required : true,
maxlength: 50
},
author : {
required : true
}
},
messages : {
jobDesc : {
required : I18n.system_please_input + I18n.jobinfo_field_jobdesc
},
author : {
required : I18n.system_please_input + I18n.jobinfo_field_author
}
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
},
success : function(label) {
label.closest('.form-group').removeClass('has-error');
label.remove();
},
errorPlacement : function(error, element) {
element.parent('div').append(error);
},
submitHandler : function(form) {
// process executorTimeout + executorFailRetryCount
var executorTimeout = $("#updateModal .form input[name='executorTimeout']").val();
if(!/^\d+$/.test(executorTimeout)) {
executorTimeout = 0;
}
$("#updateModal .form input[name='executorTimeout']").val(executorTimeout);
var executorFailRetryCount = $("#updateModal .form input[name='executorFailRetryCount']").val();
if(!/^\d+$/.test(executorFailRetryCount)) {
executorFailRetryCount = 0;
}
$("#updateModal .form input[name='executorFailRetryCount']").val(executorFailRetryCount);
// process schedule_conf
var scheduleType = $("#updateModal .form select[name='scheduleType']").val();
var scheduleConf;
if (scheduleType == 'CRON') {
scheduleConf = $("#updateModal .form input[name='cronGen_display']").val();
} else if (scheduleType == 'FIX_RATE') {
scheduleConf = $("#updateModal .form input[name='schedule_conf_FIX_RATE']").val();
} else if (scheduleType == 'FIX_DELAY') {
scheduleConf = $("#updateModal .form input[name='schedule_conf_FIX_DELAY']").val();
}
$("#updateModal .form input[name='scheduleConf']").val( scheduleConf );
// post
$.post(base_url + "/jobinfo/update", $("#updateModal .form").serialize(), function(data, status) {
if (data.code == "200") {
$('#updateModal').modal('hide');
layer.open({
title: I18n.system_tips ,
btn: [ I18n.system_ok ],
content: I18n.system_update_suc ,
icon: '1',
end: function(layero, index){
//window.location.reload();
jobTable.fnDraw();
}
});
} else {
layer.open({
title: I18n.system_tips ,
btn: [ I18n.system_ok ],
content: (data.msg || I18n.system_update_fail ),
icon: '2'
});
}
});
}
});
$("#updateModal").on('hide.bs.modal', function () {
updateModalValidate.resetForm();
$("#updateModal .form")[0].reset();
$("#updateModal .form .form-group").removeClass("has-error");
});
/**
* find title by name, GlueType
*/
function findGlueTypeTitle(glueType) {
var glueTypeTitle;
$("#addModal .form select[name=glueType] option").each(function () {
var name = $(this).val();
var title = $(this).text();
if (glueType == name) {
glueTypeTitle = title;
return false
}
});
return glueTypeTitle;
}
// job_copy
$("#job_list").on('click', '.job_copy',function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
// fill base
$('#addModal .form select[name=jobGroup] option[value='+ row.jobGroup +']').prop('selected', true);
$("#addModal .form input[name='jobDesc']").val( row.jobDesc );
$("#addModal .form input[name='author']").val( row.author );
$("#addModal .form input[name='alarmEmail']").val( row.alarmEmail );
// fill trigger
$('#addModal .form select[name=scheduleType] option[value='+ row.scheduleType +']').prop('selected', true);
$("#addModal .form input[name='scheduleConf']").val( row.scheduleConf );
if (row.scheduleType == 'CRON') {
$("#addModal .form input[name='schedule_conf_CRON']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_RATE') {
$("#addModal .form input[name='schedule_conf_FIX_RATE']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_DELAY') {
$("#addModal .form input[name='schedule_conf_FIX_DELAY']").val( row.scheduleConf );
}
// 》init scheduleType
$("#addModal .form select[name=scheduleType]").change();
// fill job
$('#addModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
$("#addModal .form input[name='executorHandler']").val( row.executorHandler );
$("#addModal .form textarea[name='executorParam']").val( row.executorParam );
// 》init glueType
$("#addModal .form select[name=glueType]").change();
// 》init-cronGen
$("#addModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#addModal .form input[name='schedule_conf_CRON']").cronGen({});
// fill advanced
$('#addModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
$("#addModal .form input[name='childJobId']").val( row.childJobId );
$('#addModal .form select[name=misfireStrategy] option[value='+ row.misfireStrategy +']').prop('selected', true);
$('#addModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$("#addModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#addModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
// show
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
});
});
Loading…
Cancel
Save