Browse Source

Cron下次执行时间查询:支持通过界面在线查看后续连续5次执行时间

xuxueli 5 years ago
parent
commit
6641be1210

+ 1 - 1
doc/XXL-JOB官方文档.md View File

@@ -1548,7 +1548,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
1548 1548
 - 10、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等;
1549 1549
 - 11、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题;
1550 1550
 - 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式;
1551
-- 13、Cron执行时间查询:支持通过界面在线查看后续连续5次执行时间[ING,交互待完善]
1551
+- 13、Cron下次执行时间查询:支持通过界面在线查看后续连续5次执行时间;
1552 1552
 - 14、[ING]xxl-rpc服务端线程优化,降低线程内存开销;
1553 1553
 - 15、[ING]调度日志优化:支持设置日志保留天数,过期日志天维度记录报表,并清理;调度报表汇总实时数据和报表;
1554 1554
 - 16、[ING]父子任务参数传递;流程任务等,透传动态参数;

+ 1 - 5
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java View File

@@ -158,13 +158,9 @@ public class JobInfoController {
158 158
 				}
159 159
 			}
160 160
 		} catch (ParseException e) {
161
-			//
162
-		}
163
-		if (result!=null && result.size()>0) {
164
-			return new ReturnT<List<String>>(result);
165
-		} else {
166 161
 			return new ReturnT<List<String>>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid"));
167 162
 		}
163
+		return new ReturnT<List<String>>(result);
168 164
 	}
169 165
 	
170 166
 }

+ 1 - 0
xxl-job-admin/src/main/resources/i18n/message.properties View File

@@ -129,6 +129,7 @@ jobinfo_opt_start=启动
129 129
 jobinfo_opt_log=查询日志
130 130
 jobinfo_opt_run=执行一次
131 131
 jobinfo_opt_registryinfo=注册节点
132
+jobinfo_opt_next_time=下次执行时间
132 133
 jobinfo_glue_remark=源码备注
133 134
 jobinfo_glue_remark_limit=源码备注长度限制为4~100
134 135
 jobinfo_glue_rollback=版本回溯

+ 1 - 0
xxl-job-admin/src/main/resources/i18n/message_en.properties View File

@@ -129,6 +129,7 @@ jobinfo_opt_start=Start
129 129
 jobinfo_opt_log=Query Log
130 130
 jobinfo_opt_run=Run Once
131 131
 jobinfo_opt_registryinfo=Registry Info
132
+jobinfo_opt_next_time=Next trigger time
132 133
 jobinfo_glue_remark=Resource Remark
133 134
 jobinfo_glue_remark_limit=Resource Remark length is limited to 4~100
134 135
 jobinfo_glue_rollback=Version Backtrack

+ 42 - 0
xxl-job-admin/src/main/resources/static/js/jobinfo.index.1.js View File

@@ -135,6 +135,7 @@ $(function() {
135 135
                                     '       <li><a href="javascript:void(0);" class="job_trigger" >'+ I18n.jobinfo_opt_run +'</a></li>\n' +
136 136
                                     '       <li><a href="'+ logHref +'">'+ I18n.jobinfo_opt_log +'</a></li>\n' +
137 137
                                     '       <li><a href="javascript:void(0);" class="job_registryinfo" >' + I18n.jobinfo_opt_registryinfo + '</a></li>\n' +
138
+                                    '       <li><a href="javascript:void(0);" class="job_next_time" >' + I18n.jobinfo_opt_next_time + '</a></li>\n' +
138 139
                                     '       <li class="divider"></li>\n' +
139 140
                                     codeBtn +
140 141
                                     start_stop_div +
@@ -311,7 +312,48 @@ $(function() {
311 312
             }
312 313
         });
313 314
 
315
+    });
316
+
317
+    // job_next_time
318
+    $("#job_list").on('click', '.job_next_time',function() {
319
+        var id = $(this).parents('ul').attr("_id");
320
+        var row = tableData['key'+id];
321
+
322
+        var jobCron = row.jobCron;
323
+
324
+        $.ajax({
325
+            type : 'POST',
326
+            url : base_url + "/jobinfo/nextTriggerTime",
327
+            data : {
328
+                "cron" : jobCron
329
+            },
330
+            dataType : "json",
331
+            success : function(data){
332
+            	
333
+            	if (data.code != 200) {
334
+                    layer.open({
335
+                        title: I18n.jobinfo_opt_next_time ,
336
+                        btn: [ I18n.system_ok ],
337
+                        content: data.msg
338
+                    });
339
+				} else {
340
+                    var html = '<center>';
341
+                    if (data.code == 200 && data.content) {
342
+                        for (var index in data.content) {
343
+                            html += '<span>' + data.content[index] + '</span><br>';
344
+                        }
345
+                    }
346
+                    html += '</center>';
314 347
 
348
+                    layer.open({
349
+                        title: I18n.jobinfo_opt_next_time ,
350
+                        btn: [ I18n.system_ok ],
351
+                        content: html
352
+                    });
353
+				}
354
+
355
+            }
356
+        });
315 357
 
316 358
     });
317 359