Skip to content

Commit

Permalink
Merge pull request xuxueli#1687 from wjllp/cron_runtime
Browse files Browse the repository at this point in the history
cron编辑器修改cron时可实时查看最近运行时间
  • Loading branch information
xuxueli authored May 21, 2020
2 parents eba4695 + adad237 commit 6191225
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
options = $.extend({}, $.fn.cronGen.defaultOptions, options);
//create top menu
var cronContainer = $("<div/>", { id: "CronContainer", style: "display:none;width:300px;height:300px;" });
var mainDiv = $("<div/>", { id: "CronGenMainDiv", style: "width:410px;height:300px;" });
var mainDiv = $("<div/>", { id: "CronGenMainDiv", style: "width:410px;height:430px;" });
var topMenu = $("<ul/>", { "class": "nav nav-tabs", id: "CronGenTabs" });
$('<li/>', { 'class': 'active' }).html($('<a id="SecondlyTab" href="#Secondly">秒</a>')).appendTo(topMenu);
$('<li/>').html($('<a id="MinutesTab" href="#Minutes">分钟</a>')).appendTo(topMenu);
Expand Down Expand Up @@ -318,9 +318,12 @@
// resultsName = $(this).prop("id");
// $(this).prop("name", resultsName);

var runTime = '<br style="padding-top: 10px"><label>最近运行时间: </label></br><textarea id="runTime" rows="6" style="width: 90%;resize: none;background: none;border: none;outline: none;" readonly = readonly></textarea></div>';

$(span12).appendTo(row);
$(row).appendTo(container);
$(container).appendTo(mainDiv);
$(runTime).appendTo(mainDiv);
$(cronContainer).append(mainDiv);

var that = $(this);
Expand Down Expand Up @@ -354,6 +357,9 @@
placement: options.direction

}).on('click', function (e) {
if (inputElement.val().trim() !== '') {
refreshRunTime();
}
e.preventDefault();

//fillDataOfMinutesAndHoursSelectOptions();
Expand All @@ -374,6 +380,7 @@
});
$("#CronGenMainDiv select,input").change(function (e) {
generate();
refreshRunTime();
});
$("#CronGenMainDiv input").focus(function (e) {
generate();
Expand Down Expand Up @@ -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($) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
options = $.extend({}, $.fn.cronGen.defaultOptions, options);
//create top menu
var cronContainer = $("<div/>", { id: "CronContainer", style: "display:none;width:300px;height:300px;" });
var mainDiv = $("<div/>", { id: "CronGenMainDiv", style: "width:410px;height:300px;" });
var mainDiv = $("<div/>", { id: "CronGenMainDiv", style: "width:410px;height:430px;" });
var topMenu = $("<ul/>", { "class": "nav nav-tabs", id: "CronGenTabs" });
$('<li/>', { 'class': 'active' }).html($('<a id="SecondlyTab" href="#Secondly">秒</a>')).appendTo(topMenu);
$('<li/>').html($('<a id="MinutesTab" href="#Minutes">Minute</a>')).appendTo(topMenu);
Expand Down Expand Up @@ -318,9 +318,12 @@
// resultsName = $(this).prop("id");
// $(this).prop("name", resultsName);

var runTime = '<br style="padding-top: 10px"><label>Recent Run Time: </label></br><textarea id="runTime" rows="6" style="width: 90%;resize: none;background: none;border: none;outline: none;" readonly = readonly></textarea></div>';

$(span12).appendTo(row);
$(row).appendTo(container);
$(container).appendTo(mainDiv);
$(runTime).appendTo(mainDiv);
$(cronContainer).append(mainDiv);

var that = $(this);
Expand Down Expand Up @@ -354,6 +357,9 @@
placement: options.direction

}).on('click', function (e) {
if (inputElement.val().trim() !== '') {
refreshRunTime();
}
e.preventDefault();

//fillDataOfMinutesAndHoursSelectOptions();
Expand All @@ -374,6 +380,7 @@
});
$("#CronGenMainDiv select,input").change(function (e) {
generate();
refreshRunTime();
});
$("#CronGenMainDiv input").focus(function (e) {
generate();
Expand Down Expand Up @@ -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($) {
Expand Down

0 comments on commit 6191225

Please sign in to comment.