From adad237dbb323b2458f7f6ef66822fa0f05312b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E4=BF=8A?= Date: Fri, 15 May 2020 17:05:19 +0800 Subject: [PATCH] =?UTF-8?q?cron=E7=BC=96=E8=BE=91=E5=99=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9cron=E6=97=B6=E5=8F=AF=E5=AE=9E=E6=97=B6=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E6=9C=80=E8=BF=91=E8=BF=90=E8=A1=8C=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/plugins/cronGen/cronGen.js | 27 ++++++++++++++++++- .../static/plugins/cronGen/cronGen_en.js | 27 ++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen.js b/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen.js index a1e39383..4c066600 100755 --- a/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen.js +++ b/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen.js @@ -10,7 +10,7 @@ options = $.extend({}, $.fn.cronGen.defaultOptions, options); //create top menu var cronContainer = $("
", { id: "CronContainer", style: "display:none;width:300px;height:300px;" }); - var mainDiv = $("
", { id: "CronGenMainDiv", style: "width:410px;height:300px;" }); + var mainDiv = $("
", { id: "CronGenMainDiv", style: "width:410px;height:430px;" }); var topMenu = $("
    ", { "class": "nav nav-tabs", id: "CronGenTabs" }); $('
  • ', { 'class': 'active' }).html($('')).appendTo(topMenu); $('
  • ').html($('分钟')).appendTo(topMenu); @@ -318,9 +318,12 @@ // resultsName = $(this).prop("id"); // $(this).prop("name", resultsName); + var runTime = '

'; + $(span12).appendTo(row); $(row).appendTo(container); $(container).appendTo(mainDiv); + $(runTime).appendTo(mainDiv); $(cronContainer).append(mainDiv); var that = $(this); @@ -354,6 +357,9 @@ placement: options.direction }).on('click', function (e) { + if (inputElement.val().trim() !== '') { + refreshRunTime(); + } e.preventDefault(); //fillDataOfMinutesAndHoursSelectOptions(); @@ -374,6 +380,7 @@ }); $("#CronGenMainDiv select,input").change(function (e) { generate(); + refreshRunTime(); }); $("#CronGenMainDiv input").focus(function (e) { generate(); @@ -628,6 +635,24 @@ displayElement.val(results); }; + var refreshRunTime = function () { + $.ajax({ + type : 'GET', + url : base_url + "/jobinfo/nextTriggerTime", + data : { + "cron" : inputElement.val(), + }, + dataType : "json", + success : function(data){ + if (data.code === 200) { + $('#runTime').val(data.content.join("\n")); + } else { + $('#runTime').val(data.msg); + } + } + }); + }; + })(jQuery); (function($) { diff --git a/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js b/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js index 72018339..803384f7 100755 --- a/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js +++ b/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js @@ -10,7 +10,7 @@ options = $.extend({}, $.fn.cronGen.defaultOptions, options); //create top menu var cronContainer = $("
", { id: "CronContainer", style: "display:none;width:300px;height:300px;" }); - var mainDiv = $("
", { id: "CronGenMainDiv", style: "width:410px;height:300px;" }); + var mainDiv = $("
", { id: "CronGenMainDiv", style: "width:410px;height:430px;" }); var topMenu = $("
    ", { "class": "nav nav-tabs", id: "CronGenTabs" }); $('
  • ', { 'class': 'active' }).html($('')).appendTo(topMenu); $('
  • ').html($('Minute')).appendTo(topMenu); @@ -318,9 +318,12 @@ // resultsName = $(this).prop("id"); // $(this).prop("name", resultsName); + var runTime = '

'; + $(span12).appendTo(row); $(row).appendTo(container); $(container).appendTo(mainDiv); + $(runTime).appendTo(mainDiv); $(cronContainer).append(mainDiv); var that = $(this); @@ -354,6 +357,9 @@ placement: options.direction }).on('click', function (e) { + if (inputElement.val().trim() !== '') { + refreshRunTime(); + } e.preventDefault(); //fillDataOfMinutesAndHoursSelectOptions(); @@ -374,6 +380,7 @@ }); $("#CronGenMainDiv select,input").change(function (e) { generate(); + refreshRunTime(); }); $("#CronGenMainDiv input").focus(function (e) { generate(); @@ -628,6 +635,24 @@ displayElement.val(results); }; + var refreshRunTime = function () { + $.ajax({ + type : 'GET', + url : base_url + "/jobinfo/nextTriggerTime", + data : { + "cron" : inputElement.val(), + }, + dataType : "json", + success : function(data){ + if (data.code === 200) { + $('#runTime').val(data.content.join("\n")); + } else { + $('#runTime').val(data.msg); + } + } + }); + }; + })(jQuery); (function($) {