任务编辑界面交互调整

v1.4
xueli.xue 8 years ago
parent f7ff804739
commit 23bd08bf36

@ -193,11 +193,7 @@ public class DemoJobHandler extends IJobHandler {
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">分组<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="jobGroupTitle" disabled>
<#list JobGroupList as group>
<option value="${group}" >${group.desc}</option>
</#list>
</select>
<input type="text" class="form-control" name="jobGroupTitle" maxlength="50" readonly >
<input type="hidden" name="jobGroup" >
<input type="hidden" name="jobName" >
</div>
@ -226,13 +222,12 @@ public class DemoJobHandler extends IJobHandler {
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">任务模式<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="glueSwitch" disabled >
<option value="0" >BEAN模式</option>
<option value="1" >GLUE模式</option>
</select>
<input type="text" class="form-control" name="glueSwitchTitle" readonly >
</div>
<label for="lastname" class="col-sm-2 control-label">JobKey</label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobKey" placeholder="请输入“jobHandler”" readonly ></div>
<div class="col-sm-4">
<input type="text" class="form-control" name="jobKey" placeholder="请输入“jobHandler”" readonly >
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">

@ -303,25 +303,23 @@ $(function() {
$("#updateModal .form input[name='alarmThreshold']").val($(this).parent('p').attr("alarmThreshold"));
// job group selected
$("#updateModal .form select[name='jobGroupTitle']").find("option[value='" + $(this).parent('p').attr("jobGroup") + "']").attr("selected",true);
var jobGroupTitle = $("#addModal .form select[name='jobGroup']").find("option[value='" + $(this).parent('p').attr("jobGroup") + "']").text();
$("#updateModal .form input[name='jobGroupTitle']").val(jobGroupTitle);
// job group selected
$("#updateModal .form select[name='glueSwitch']").find("option[value='" + $(this).parent('p').attr("glueSwitch") + "']").attr("selected",true);
// generate job key
$("#updateModal .form input[name='jobKey']").val( $(this).parent('p').attr("jobGroup") + "_" + $(this).parent('p').attr("jobName") );
// GLUE check
var $glueSwitch = $("#updateModal .form input[name='glueSwitch']");
var $executorHandler = $("#updateModal .form input[name='executorHandler']");
if ($glueSwitch.val() != 0) {
$executorHandler.attr("readonly","readonly");
$("#updateModal .form .ifGLUE").attr("checked", true);
// glueSwitch and jobKey
var glueSwitchTitle;
var jobKey;
if ($(this).parent('p').attr("glueSwitch") == 0) {
glueSwitchTitle = "BEAN模式";
jobKey = $(this).parent('p').attr("jobGroup") + "_" + $(this).parent('p').attr("jobName");
} else {
$executorHandler.removeAttr("readonly");
$("#updateModal .form .ifGLUE").attr("checked", false);
glueSwitchTitle = "GLUE模式";
jobKey = "无";
}
$("#updateModal .form input[name='glueSwitchTitle']").val(glueSwitchTitle);
$("#updateModal .form input[name='jobKey']").val(jobKey);
// show
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
});
var updateModalValidate = $("#updateModal .form").validate({

@ -1,6 +1,6 @@
package com.xxl.job.core.executor.jetty;
import java.util.Map;
import java.util.*;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
@ -88,10 +88,15 @@ public class XxlJobExecutor implements ApplicationContextAware {
Map<String, Object> serviceBeanMap = XxlJobExecutor.applicationContext.getBeansWithAnnotation(JobHander.class);
if (serviceBeanMap!=null && serviceBeanMap.size()>0) {
for (Object serviceBean : serviceBeanMap.values()) {
String jobName = serviceBean.getClass().getAnnotation(JobHander.class).value();
if (jobName!=null && jobName.trim().length()>0 && serviceBean instanceof IJobHandler) {
if (serviceBean instanceof IJobHandler){
String jobKeys = serviceBean.getClass().getAnnotation(JobHander.class).value();
if (jobKeys!=null && jobKeys.trim().length()>0) {
Set<String> jobKeySet = new HashSet<String>(Arrays.asList(jobKeys.split(",")));
for (String jobKey : jobKeySet) {
IJobHandler handler = (IJobHandler) serviceBean;
HandlerRepository.regist(jobName, handler);
HandlerRepository.regist(jobKey, handler);
}
}
}
}
}

@ -102,7 +102,6 @@ public class HandlerRepository {
callback.setMsg("JOB_GROUP or JOB_NAME is null.");
return JacksonUtil.writeValueAsString(callback);
}
String jobKey = job_group.concat("_").concat(job_name);
// glue switch
String handler_glue_switch = _param.get(HandlerParamEnum.GLUE_SWITCH.name());
@ -111,7 +110,8 @@ public class HandlerRepository {
return JacksonUtil.writeValueAsString(callback);
}
HandlerThread handlerThread = handlerTreadMap.get(jobKey);;
String jobKey = job_group.concat("_").concat(job_name);
HandlerThread handlerThread = handlerTreadMap.get(jobKey);
if ("0".equals(handler_glue_switch)) {
// bean model
if (handlerThread == null) {
@ -129,27 +129,6 @@ public class HandlerRepository {
// push data to queue
handlerThread.pushData(_param);
callback.setStatus(RemoteCallBack.SUCCESS);
} else if (namespace.equals(ActionEnum.LOG.name())) {
String log_id = _param.get(HandlerParamEnum.LOG_ID.name());
String log_date = _param.get(HandlerParamEnum.LOG_DATE.name());
if (log_id==null || log_date==null) {
callback.setMsg("LOG_ID | LOG_DATE can not be null.");
return JacksonUtil.writeValueAsString(callback);
}
int logId = -1;
Date triggerDate = null;
try {
logId = Integer.valueOf(log_id);
triggerDate = new Date(Long.valueOf(log_date));
} catch (Exception e) {
}
if (logId<=0 || triggerDate==null) {
callback.setMsg("LOG_ID | LOG_DATE parse error.");
return JacksonUtil.writeValueAsString(callback);
}
String logConteng = XxlJobFileAppender.readLog(triggerDate, log_id);
callback.setStatus(RemoteCallBack.SUCCESS);
callback.setMsg(logConteng);
} else if (namespace.equals(ActionEnum.KILL.name())) {
// generate jobKey
String job_group = _param.get(HandlerParamEnum.JOB_GROUP.name());
@ -172,6 +151,27 @@ public class HandlerRepository {
callback.setMsg("handler for jobKey=[" + jobKey + "] not found.");
}
} else if (namespace.equals(ActionEnum.LOG.name())) {
String log_id = _param.get(HandlerParamEnum.LOG_ID.name());
String log_date = _param.get(HandlerParamEnum.LOG_DATE.name());
if (log_id==null || log_date==null) {
callback.setMsg("LOG_ID | LOG_DATE can not be null.");
return JacksonUtil.writeValueAsString(callback);
}
int logId = -1;
Date triggerDate = null;
try {
logId = Integer.valueOf(log_id);
triggerDate = new Date(Long.valueOf(log_date));
} catch (Exception e) {
}
if (logId<=0 || triggerDate==null) {
callback.setMsg("LOG_ID | LOG_DATE parse error.");
return JacksonUtil.writeValueAsString(callback);
}
String logConteng = XxlJobFileAppender.readLog(triggerDate, log_id);
callback.setStatus(RemoteCallBack.SUCCESS);
callback.setMsg(logConteng);
} else if (namespace.equals(ActionEnum.BEAT.name())) {
callback.setStatus(RemoteCallBack.SUCCESS);
callback.setMsg(null);

@ -16,11 +16,11 @@ import com.xxl.job.core.handler.annotation.JobHander;
*
* 1 IJobHandler
* 2Spring @Service
* 3 @JobHander namename使
* 3 @JobHander valueJobKey;JobKey;
*
* @author xuxueli 2015-12-19 19:43:36
*/
@JobHander(value="defaults_201607192222270796")
@JobHander(value="defaults_201607192256270689,defaults_201607192256270689")
@Service
public class DemoJobHandler extends IJobHandler {
private static transient Logger logger = LoggerFactory.getLogger(DemoJobHandler.class);

Loading…
Cancel
Save