diff --git "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" index e0acdb1..74ef1b8 100644 --- "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" +++ "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" @@ -1547,7 +1547,7 @@ - 9、任务触发组件加载顺序调整,避免小概率情况下组件随机加载顺序导致的I18N的NPE问题。 - 10、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等; - 11、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题; -- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式[ING,国际化待完善]; +- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式; - 13、Cron执行时间查询:支持通过界面在线查看后续连续5次执行时间[ING,交互待完善]; - 14、[ING]xxl-rpc服务端线程优化,降低线程内存开销; - 15、[ING]调度日志优化:支持设置日志保留天数,过期日志天维度记录报表,并清理;调度报表汇总实时数据和报表; diff --git "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" index e0acdb1..74ef1b8 100644 --- "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" +++ "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" @@ -1547,7 +1547,7 @@ - 9、任务触发组件加载顺序调整,避免小概率情况下组件随机加载顺序导致的I18N的NPE问题。 - 10、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等; - 11、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题; -- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式[ING,国际化待完善]; +- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式; - 13、Cron执行时间查询:支持通过界面在线查看后续连续5次执行时间[ING,交互待完善]; - 14、[ING]xxl-rpc服务端线程优化,降低线程内存开销; - 15、[ING]调度日志优化:支持设置日志保留天数,过期日志天维度记录报表,并清理;调度报表汇总实时数据和报表; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index c7b351e..38d954b 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -44,9 +44,9 @@ public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { // 枚举-字典 - model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 + model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 - model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 + model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 执行器列表 List jobGroupList_all = xxlJobGroupDao.findAll(); diff --git "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" index e0acdb1..74ef1b8 100644 --- "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" +++ "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" @@ -1547,7 +1547,7 @@ - 9、任务触发组件加载顺序调整,避免小概率情况下组件随机加载顺序导致的I18N的NPE问题。 - 10、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等; - 11、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题; -- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式[ING,国际化待完善]; +- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式; - 13、Cron执行时间查询:支持通过界面在线查看后续连续5次执行时间[ING,交互待完善]; - 14、[ING]xxl-rpc服务端线程优化,降低线程内存开销; - 15、[ING]调度日志优化:支持设置日志保留天数,过期日志天维度记录报表,并清理;调度报表汇总实时数据和报表; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index c7b351e..38d954b 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -44,9 +44,9 @@ public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { // 枚举-字典 - model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 + model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 - model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 + model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 执行器列表 List jobGroupList_all = xxlJobGroupDao.findAll(); diff --git a/xxl-job-admin/src/main/resources/i18n/message.properties b/xxl-job-admin/src/main/resources/i18n/message.properties index c7ab2fb..613fba3 100644 --- a/xxl-job-admin/src/main/resources/i18n/message.properties +++ b/xxl-job-admin/src/main/resources/i18n/message.properties @@ -1,6 +1,7 @@ admin_name=任务调度中心 admin_name_full=分布式任务调度平台XXL-JOB admin_version=2.1.1-SNAPSHOT +admin_i18n= ## system system_tips=系统提示 diff --git "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" index e0acdb1..74ef1b8 100644 --- "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" +++ "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" @@ -1547,7 +1547,7 @@ - 9、任务触发组件加载顺序调整,避免小概率情况下组件随机加载顺序导致的I18N的NPE问题。 - 10、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等; - 11、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题; -- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式[ING,国际化待完善]; +- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式; - 13、Cron执行时间查询:支持通过界面在线查看后续连续5次执行时间[ING,交互待完善]; - 14、[ING]xxl-rpc服务端线程优化,降低线程内存开销; - 15、[ING]调度日志优化:支持设置日志保留天数,过期日志天维度记录报表,并清理;调度报表汇总实时数据和报表; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index c7b351e..38d954b 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -44,9 +44,9 @@ public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { // 枚举-字典 - model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 + model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 - model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 + model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 执行器列表 List jobGroupList_all = xxlJobGroupDao.findAll(); diff --git a/xxl-job-admin/src/main/resources/i18n/message.properties b/xxl-job-admin/src/main/resources/i18n/message.properties index c7ab2fb..613fba3 100644 --- a/xxl-job-admin/src/main/resources/i18n/message.properties +++ b/xxl-job-admin/src/main/resources/i18n/message.properties @@ -1,6 +1,7 @@ admin_name=任务调度中心 admin_name_full=分布式任务调度平台XXL-JOB admin_version=2.1.1-SNAPSHOT +admin_i18n= ## system system_tips=系统提示 diff --git a/xxl-job-admin/src/main/resources/i18n/message_en.properties b/xxl-job-admin/src/main/resources/i18n/message_en.properties index d0f77df..d877a9d 100644 --- a/xxl-job-admin/src/main/resources/i18n/message_en.properties +++ b/xxl-job-admin/src/main/resources/i18n/message_en.properties @@ -1,6 +1,7 @@ admin_name=Scheduling Center admin_name_full=Distributed Task Scheduling Platform XXL-JOB admin_version=2.1.1-SNAPSHOT +admin_i18n=en ## system system_tips=System message diff --git "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" index e0acdb1..74ef1b8 100644 --- "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" +++ "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" @@ -1547,7 +1547,7 @@ - 9、任务触发组件加载顺序调整,避免小概率情况下组件随机加载顺序导致的I18N的NPE问题。 - 10、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等; - 11、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题; -- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式[ING,国际化待完善]; +- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式; - 13、Cron执行时间查询:支持通过界面在线查看后续连续5次执行时间[ING,交互待完善]; - 14、[ING]xxl-rpc服务端线程优化,降低线程内存开销; - 15、[ING]调度日志优化:支持设置日志保留天数,过期日志天维度记录报表,并清理;调度报表汇总实时数据和报表; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index c7b351e..38d954b 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -44,9 +44,9 @@ public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { // 枚举-字典 - model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 + model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 - model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 + model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 执行器列表 List jobGroupList_all = xxlJobGroupDao.findAll(); diff --git a/xxl-job-admin/src/main/resources/i18n/message.properties b/xxl-job-admin/src/main/resources/i18n/message.properties index c7ab2fb..613fba3 100644 --- a/xxl-job-admin/src/main/resources/i18n/message.properties +++ b/xxl-job-admin/src/main/resources/i18n/message.properties @@ -1,6 +1,7 @@ admin_name=任务调度中心 admin_name_full=分布式任务调度平台XXL-JOB admin_version=2.1.1-SNAPSHOT +admin_i18n= ## system system_tips=系统提示 diff --git a/xxl-job-admin/src/main/resources/i18n/message_en.properties b/xxl-job-admin/src/main/resources/i18n/message_en.properties index d0f77df..d877a9d 100644 --- a/xxl-job-admin/src/main/resources/i18n/message_en.properties +++ b/xxl-job-admin/src/main/resources/i18n/message_en.properties @@ -1,6 +1,7 @@ admin_name=Scheduling Center admin_name_full=Distributed Task Scheduling Platform XXL-JOB admin_version=2.1.1-SNAPSHOT +admin_i18n=en ## system system_tips=System message 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 new file mode 100755 index 0000000..5e14551 --- /dev/null +++ b/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js @@ -0,0 +1,1076 @@ +(function ($) { + // var resultsName = ""; + var inputElement; + var displayElement; + $.fn.extend({ + cronGen: function (options) { + if (options == null) { + options = {}; + } + 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 topMenu = $("
    ", { "class": "nav nav-tabs", id: "CronGenTabs" }); + $('
  • ', { 'class': 'active' }).html($('')).appendTo(topMenu); + $('
  • ').html($('Minute')).appendTo(topMenu); + $('
  • ').html($('Hour')).appendTo(topMenu); + $('
  • ').html($('Day')).appendTo(topMenu); + $('
  • ').html($('Month')).appendTo(topMenu); + $('
  • ').html($('Week')).appendTo(topMenu); + $('
  • ').html($('Year')).appendTo(topMenu); + $(topMenu).appendTo(mainDiv); + + //create what's inside the tabs + var container = $("
    ", { "class": "container-fluid", "style": "margin-top: 30px;margin-left: -14px;" }); + var row = $("
    ", { "class": "row-fluid" }); + var span12 = $("
    ", { "class": "span12" }); + var tabContent = $("
    ", { "class": "tab-content", "style": "border:0px; margin-top:-20px;" }); + + + //creating the secondsTab + var secondsTab = $("
    ", { "class": "tab-pane active", id: "Secondly" }); + var seconds1 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "second"}).appendTo(seconds1); + $(seconds1).append("Per second, allowed wildcard[, - * /]"); + $(seconds1).appendTo(secondsTab); + + var seconds2 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "second"}).appendTo(seconds2); + $(seconds2).append("Cycle, from"); + $("",{type : "text", id : "secondStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(seconds2); + $(seconds2).append("-"); + $("",{type : "text", id : "secondEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(seconds2); + $(seconds2).append("second"); + $(seconds2).appendTo(secondsTab); + + var seconds3 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "second"}).appendTo(seconds3); + $(seconds3).append("from"); + $("",{type : "text", id : "secondStart_1", value : "0", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(seconds3); + $(seconds3).append("seconds start, per"); + $("",{type : "text", id : "secondEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(seconds3); + $(seconds3).append("second execute once"); + $(seconds3).appendTo(secondsTab); + + var seconds4 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "second", id: "sencond_appoint"}).appendTo(seconds4); + $(seconds4).append("specify"); + $(seconds4).appendTo(secondsTab); + + $(secondsTab).append('
    00010203040506070809
    '); + $(secondsTab).append('
    10111213141516171819
    '); + $(secondsTab).append('
    20212223242526272829
    '); + $(secondsTab).append('
    30313233343536373839
    '); + $(secondsTab).append('
    40414243444546474849
    '); + $(secondsTab).append('
    50515253545556575859
    '); + $("",{type : "hidden", id : "secondHidden"}).appendTo(secondsTab); + $(secondsTab).appendTo(tabContent); + + //creating the minutesTab + var minutesTab = $("
    ", { "class": "tab-pane", id: "Minutes" }); + + var minutes1 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "min"}).appendTo(minutes1); + $(minutes1).append("Per minute, allowed wildcard[, - * /]"); + $(minutes1).appendTo(minutesTab); + + var minutes2 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "min"}).appendTo(minutes2); + $(minutes2).append("Cycle, from"); + $("",{type : "text", id : "minStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(minutes2); + $(minutes2).append("-"); + $("",{type : "text", id : "minEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(minutes2); + $(minutes2).append("minute"); + $(minutes2).appendTo(minutesTab); + + var minutes3 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "min"}).appendTo(minutes3); + $(minutes3).append("from"); + $("",{type : "text", id : "minStart_1", value : "0", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(minutes3); + $(minutes3).append("seconds start, per"); + $("",{type : "text", id : "minEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(minutes3); + $(minutes3).append("second execute once"); + $(minutes3).appendTo(minutesTab); + + var minutes4 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "min", id: "min_appoint"}).appendTo(minutes4); + $(minutes4).append("specify"); + $(minutes4).appendTo(minutesTab); + + $(minutesTab).append('
    00010203040506070809
    '); + $(minutesTab).append('
    10111213141516171819
    '); + $(minutesTab).append('
    20212223242526272829
    '); + $(minutesTab).append('
    30313233343536373839
    '); + $(minutesTab).append('
    40414243444546474849
    '); + $(minutesTab).append('
    50515253545556575859
    '); + $("",{type : "hidden", id : "minHidden"}).appendTo(minutesTab); + $(minutesTab).appendTo(tabContent); + + //creating the hourlyTab + var hourlyTab = $("
    ", { "class": "tab-pane", id: "Hourly" }); + + var hourly1 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "hour"}).appendTo(hourly1); + $(hourly1).append("Per hour, allowed wildcard[, - * /]"); + $(hourly1).appendTo(hourlyTab); + + var hourly2 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "hour"}).appendTo(hourly2); + $(hourly2).append("Cycle, from"); + $("",{type : "text", id : "hourStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(hourly2); + $(hourly2).append("-"); + $("",{type : "text", id : "hourEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(hourly2); + $(hourly2).append("hour"); + $(hourly2).appendTo(hourlyTab); + + var hourly3 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "hour"}).appendTo(hourly3); + $(hourly3).append("from"); + $("",{type : "text", id : "hourStart_1", value : "0", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(hourly3); + $(hourly3).append("hour start, per"); + $("",{type : "text", id : "hourEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(hourly3); + $(hourly3).append("hour execute once"); + $(hourly3).appendTo(hourlyTab); + + var hourly4 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "hour", id: "hour_appoint"}).appendTo(hourly4); + $(hourly4).append("specify"); + $(hourly4).appendTo(hourlyTab); + + $(hourlyTab).append('
    000102030405
    '); + $(hourlyTab).append('
    060708091011
    '); + $(hourlyTab).append('
    121314151617
    '); + $(hourlyTab).append('
    181920212223
    '); + $("",{type : "hidden", id : "hourHidden"}).appendTo(hourlyTab); + $(hourlyTab).appendTo(tabContent); + + + //creating the dailyTab + var dailyTab = $("
    ", { "class": "tab-pane", id: "Daily" }); + + var daily1 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "day"}).appendTo(daily1); + $(daily1).append("Per day, allowed wildcard[, - * / L W]"); + $(daily1).appendTo(dailyTab); + + var daily5 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "day"}).appendTo(daily5); + $(daily5).append("not specify"); + $(daily5).appendTo(dailyTab); + + var daily2 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "day"}).appendTo(daily2); + $(daily2).append("Cycle, from"); + $("",{type : "text", id : "dayStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily2); + $(daily2).append("-"); + $("",{type : "text", id : "dayEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily2); + $(daily2).append("day"); + $(daily2).appendTo(dailyTab); + + var daily3 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "day"}).appendTo(daily3); + $(daily3).append("from"); + $("",{type : "text", id : "dayStart_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily3); + $(daily3).append("day start, per"); + $("",{type : "text", id : "dayEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily3); + $(daily3).append("day execute once"); + $(daily3).appendTo(dailyTab); + + var daily6 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "5", name : "day"}).appendTo(daily6); + $(daily6).append("The most recent working day on the 1"); + $("",{type : "text", id : "dayStart_2", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily6); + $(daily6).append(" of each month"); + $(daily6).appendTo(dailyTab); + + var daily7 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "6", name : "day"}).appendTo(daily7); + $(daily7).append("The last day of the month"); + $(daily7).appendTo(dailyTab); + + var daily4 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "7", name : "day", id: "day_appoint"}).appendTo(daily4); + $(daily4).append("specify"); + $(daily4).appendTo(dailyTab); + + $(dailyTab).append('
    01020304050607080910
    '); + $(dailyTab).append('
    11121314151617181920
    '); + $(dailyTab).append('
    21222324252627282930
    '); + $(dailyTab).append('
    31
    '); + $("",{type : "hidden", id : "dayHidden"}).appendTo(dailyTab); + $(dailyTab).appendTo(tabContent); + + + //creating the monthlyTab + var monthlyTab = $("
    ", { "class": "tab-pane", id: "Monthly" }); + + var monthly1 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "month"}).appendTo(monthly1); + $(monthly1).append("Per month, allowed wildcard[, - * /]"); + $(monthly1).appendTo(monthlyTab); + + var monthly2 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "month"}).appendTo(monthly2); + $(monthly2).append("not specify"); + $(monthly2).appendTo(monthlyTab); + + var monthly3 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "month"}).appendTo(monthly3); + $(monthly3).append("Cycle, from"); + $("",{type : "text", id : "monthStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(monthly3); + $(monthly3).append("-"); + $("",{type : "text", id : "monthEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(monthly3); + $(monthly3).append("month"); + $(monthly3).appendTo(monthlyTab); + + var monthly4 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "month"}).appendTo(monthly4); + $(monthly4).append("Starting from "); + $("",{type : "text", id : "monthStart_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(monthly4); + $(monthly4).append("day, once every"); + $("",{type : "text", id : "monthEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(monthly4); + $(monthly4).append("month"); + $(monthly4).appendTo(monthlyTab); + + var monthly5 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "5", name : "month", id: "month_appoint"}).appendTo(monthly5); + $(monthly5).append("specify"); + $(monthly5).appendTo(monthlyTab); + + $(monthlyTab).append('
    010203040506
    '); + $(monthlyTab).append('
    070809101112
    '); + $("",{type : "hidden", id : "monthHidden"}).appendTo(monthlyTab); + $(monthlyTab).appendTo(tabContent); + + //creating the weeklyTab + var weeklyTab = $("
    ", { "class": "tab-pane", id: "Weekly" }); + + var weekly1 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "week"}).appendTo(weekly1); + $(weekly1).append("Per week, allowed wildcard[, - * / L #]"); + $(weekly1).appendTo(weeklyTab); + + var weekly2 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "week"}).appendTo(weekly2); + $(weekly2).append("not specify"); + $(weekly2).appendTo(weeklyTab); + + var weekly3 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "week"}).appendTo(weekly3); + $(weekly3).append("Cycle, from week"); + $("",{type : "text", id : "weekStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly3); + $(weekly3).append("-"); + $("",{type : "text", id : "weekEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly3); + $(weekly3).appendTo(weeklyTab); + + var weekly4 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "week"}).appendTo(weekly4); + $(weekly4).append("The"); + $("",{type : "text", id : "weekStart_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly4); + $(weekly4).append("th week, and day "); + $("",{type : "text", id : "weekEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly4); + $(weekly4).appendTo(weeklyTab); + + var weekly5 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "5", name : "week"}).appendTo(weekly5); + $(weekly5).append("Last week of the month"); + $("",{type : "text", id : "weekStart_2", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly5); + $(weekly5).appendTo(weeklyTab); + + var weekly6 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "6", name : "week", id: "week_appoint"}).appendTo(weekly6); + $(weekly6).append("specify"); + $(weekly6).appendTo(weeklyTab); + + $(weeklyTab).append('
    1234567
    '); + + $("",{type : "hidden", id : "weekHidden"}).appendTo(weeklyTab); + $(weeklyTab).appendTo(tabContent); + + //creating the yearlyTab + var yearlyTab = $("
    ", { "class": "tab-pane", id: "Yearly" }); + + var yearly1 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "year"}).appendTo(yearly1); + $(yearly1).append("not specify allowed wildcard[, - * /] not required"); + $(yearly1).appendTo(yearlyTab); + + var yearly3 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "year"}).appendTo(yearly3); + $(yearly3).append("Per year"); + $(yearly3).appendTo(yearlyTab); + + var yearly2 = $("
    ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "year"}).appendTo(yearly2); + $(yearly2).append("Cycle, from "); + $("",{type : "text", id : "yearStart_0", value : "2016", style:"width:45px; height:20px;"}).appendTo(yearly2); + $(yearly2).append("-"); + $("",{type : "text", id : "yearEnd_0", value : "2017", style:"width:45px; height:20px;"}).appendTo(yearly2); + $(yearly2).append("year"); + $(yearly2).appendTo(yearlyTab); + $("",{type : "hidden", id : "yearHidden"}).appendTo(yearlyTab); + $(yearlyTab).appendTo(tabContent); + + $(tabContent).appendTo(span12); + + //creating the button and results input + // resultsName = $(this).prop("id"); + // $(this).prop("name", resultsName); + + $(span12).appendTo(row); + $(row).appendTo(container); + $(container).appendTo(mainDiv); + $(cronContainer).append(mainDiv); + + var that = $(this); + + // Hide the original input + that.hide(); + + // Replace the input with an input group + var $g = $("
    ").addClass("input-group"); + // Add an input + var $i = $("", { type: 'text', placeholder: 'cron表达式...'}).addClass("form-control").val($(that).val()); + $i.appendTo($g); + // Add the button + var $b = $(""); + // Put button inside span + var $s = $("").addClass("input-group-btn"); + $b.appendTo($s); + $s.appendTo($g); + + $(this).before($g); + + inputElement = that; + displayElement = $i; + + $b.popover({ + html: true, + content: function () { + return $(cronContainer).html(); + }, + template: '

    ', + placement: options.direction + + }).on('click', function (e) { + e.preventDefault(); + + //fillDataOfMinutesAndHoursSelectOptions(); + //fillDayWeekInMonth(); + //fillInWeekDays(); + //fillInMonths(); + + $.fn.cronGen.tools.cronParse(inputElement.val()); + + //绑定指定事件 + $.fn.cronGen.tools.initChangeEvent(); + + + $('#CronGenTabs a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); + //generate(); + }); + $("#CronGenMainDiv select,input").change(function (e) { + generate(); + }); + $("#CronGenMainDiv input").focus(function (e) { + generate(); + }); + //generate(); + }); + return; + } + }); + + + var fillInMonths = function () { + var days = [ + { text: "January", val: "1" }, + { text: "February", val: "2" }, + { text: "March", val: "3" }, + { text: "April", val: "4" }, + { text: "May", val: "5" }, + { text: "June", val: "6" }, + { text: "July", val: "7" }, + { text: "August", val: "8" }, + { text: "September", val: "9" }, + { text: "October", val: "10" }, + { text: "November", val: "11" }, + { text: "December", val: "12" } + ]; + $(".months").each(function () { + fillOptions(this, days); + }); + }; + + var fillOptions = function (elements, options) { + for (var i = 0; i < options.length; i++) + $(elements).append(""); + }; + var fillDataOfMinutesAndHoursSelectOptions = function () { + for (var i = 0; i < 60; i++) { + if (i < 24) { + $(".hours").each(function () { $(this).append(timeSelectOption(i)); }); + } + $(".minutes").each(function () { $(this).append(timeSelectOption(i)); }); + } + }; + var fillInWeekDays = function () { + var days = [ + { text: "Tuesday", val: "2" }, + { text: "Wednesday", val: "3" }, + { text: "Thursday", val: "4" }, + { text: "Friday", val: "5" }, + { text: "Saturday", val: "6" }, + { text: "Sunday", val: "7" }, + { text: "Monday", val: "1" } + ]; + $(".week-days").each(function () { + fillOptions(this, days); + }); + + }; + var fillDayWeekInMonth = function () { + var days = [ + { text: "First", val: "1" }, + { text: "Second", val: "2" }, + { text: "Third", val: "3" }, + { text: "Fourth", val: "4" } + ]; + $(".day-order-in-month").each(function () { + fillOptions(this, days); + }); + }; + var displayTimeUnit = function (unit) { + if (unit.toString().length == 1) + return "0" + unit; + return unit; + }; + var timeSelectOption = function (i) { + return ""; + }; + + var generate = function () { + + var activeTab = $("ul#CronGenTabs li.active a").prop("id"); + var results = ""; + switch (activeTab) { + case "SecondlyTab": + switch ($("input:radio[name=second]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("second"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.cycle("second"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.startOn("second"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.initCheckBox("second"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "MinutesTab": + switch ($("input:radio[name=min]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("min"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.cycle("min"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.startOn("min"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.initCheckBox("min"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "HourlyTab": + switch ($("input:radio[name=hour]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("hour"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.cycle("hour"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.startOn("hour"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.initCheckBox("hour"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "DailyTab": + switch ($("input:radio[name=day]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.unAppoint("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.cycle("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.startOn("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "5": + $.fn.cronGen.tools.workDay("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "6": + $.fn.cronGen.tools.lastDay("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "7": + $.fn.cronGen.tools.initCheckBox("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "WeeklyTab": + switch ($("input:radio[name=week]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.unAppoint("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.cycle("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.startOn("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "5": + $.fn.cronGen.tools.lastWeek("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "6": + $.fn.cronGen.tools.initCheckBox("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "MonthlyTab": + switch ($("input:radio[name=month]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.unAppoint("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.cycle("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.startOn("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "5": + $.fn.cronGen.tools.initCheckBox("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "YearlyTab": + switch ($("input:radio[name=year]:checked").val()) { + case "1": + $.fn.cronGen.tools.unAppoint("year"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.everyTime("year"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.cycle("year"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + } + + // Update original control + inputElement.val(results); + // Update display + displayElement.val(results); + }; + +})(jQuery); + +(function($) { + $.fn.cronGen.defaultOptions = { + direction : 'bottom' + }; + $.fn.cronGen.tools = { + /** + * 每周期 + */ + everyTime : function(dom){ + $("#"+dom+"Hidden").val("*"); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 不指定 + */ + unAppoint : function(dom){ + var val = "?"; + if (dom == "year") + { + val = ""; + } + $("#"+dom+"Hidden").val(val); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 周期 + */ + cycle : function(dom){ + var start = $("#"+dom+"Start_0").val(); + var end = $("#"+dom+"End_0").val(); + $("#"+dom+"Hidden").val(start + "-" + end); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 从开始 + */ + startOn : function(dom) { + var start = $("#"+dom+"Start_1").val(); + var end = $("#"+dom+"End_1").val(); + $("#"+dom+"Hidden").val(start + "/" + end); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 最后一天 + */ + lastDay : function(dom){ + $("#"+dom+"Hidden").val("L"); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 每周的某一天 + */ + weekOfDay : function(dom){ + var start = $("#"+dom+"Start_0").val(); + var end = $("#"+dom+"End_0").val(); + $("#"+dom+"Hidden").val(start + "#" + end); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 最后一周 + */ + lastWeek : function(dom){ + var start = $("#"+dom+"Start_2").val(); + $("#"+dom+"Hidden").val(start+"L"); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 工作日 + */ + workDay : function(dom) { + var start = $("#"+dom+"Start_2").val(); + $("#"+dom+"Hidden").val(start + "W"); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + initChangeEvent : function(){ + var secondList = $(".secondList").children(); + $("#sencond_appoint").click(function(){ + if (this.checked) { + if ($(secondList).filter(":checked").length == 0) { + $(secondList.eq(0)).attr("checked", true); + } + secondList.eq(0).change(); + } + }); + + secondList.change(function() { + var sencond_appoint = $("#sencond_appoint").prop("checked"); + if (sencond_appoint) { + var vals = []; + secondList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 59) { + val = vals.join(","); + }else if(vals.length == 59){ + val = "*"; + } + $("#secondHidden").val(val); + } + }); + + var minList = $(".minList").children(); + $("#min_appoint").click(function(){ + if (this.checked) { + if ($(minList).filter(":checked").length == 0) { + $(minList.eq(0)).attr("checked", true); + } + minList.eq(0).change(); + } + }); + + minList.change(function() { + var min_appoint = $("#min_appoint").prop("checked"); + if (min_appoint) { + var vals = []; + minList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 59) { + val = vals.join(","); + }else if(vals.length == 59){ + val = "*"; + } + $("#minHidden").val(val); + } + }); + + var hourList = $(".hourList").children(); + $("#hour_appoint").click(function(){ + if (this.checked) { + if ($(hourList).filter(":checked").length == 0) { + $(hourList.eq(0)).attr("checked", true); + } + hourList.eq(0).change(); + } + }); + + hourList.change(function() { + var hour_appoint = $("#hour_appoint").prop("checked"); + if (hour_appoint) { + var vals = []; + hourList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 24) { + val = vals.join(","); + }else if(vals.length == 24){ + val = "*"; + } + $("#hourHidden").val(val); + } + }); + + var dayList = $(".dayList").children(); + $("#day_appoint").click(function(){ + if (this.checked) { + if ($(dayList).filter(":checked").length == 0) { + $(dayList.eq(0)).attr("checked", true); + } + dayList.eq(0).change(); + } + }); + + dayList.change(function() { + var day_appoint = $("#day_appoint").prop("checked"); + if (day_appoint) { + var vals = []; + dayList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 31) { + val = vals.join(","); + }else if(vals.length == 31){ + val = "*"; + } + $("#dayHidden").val(val); + } + }); + + var monthList = $(".monthList").children(); + $("#month_appoint").click(function(){ + if (this.checked) { + if ($(monthList).filter(":checked").length == 0) { + $(monthList.eq(0)).attr("checked", true); + } + monthList.eq(0).change(); + } + }); + + monthList.change(function() { + var month_appoint = $("#month_appoint").prop("checked"); + if (month_appoint) { + var vals = []; + monthList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 12) { + val = vals.join(","); + }else if(vals.length == 12){ + val = "*"; + } + $("#monthHidden").val(val); + } + }); + + var weekList = $(".weekList").children(); + $("#week_appoint").click(function(){ + if (this.checked) { + if ($(weekList).filter(":checked").length == 0) { + $(weekList.eq(0)).attr("checked", true); + } + weekList.eq(0).change(); + } + }); + + weekList.change(function() { + var week_appoint = $("#week_appoint").prop("checked"); + if (week_appoint) { + var vals = []; + weekList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 7) { + val = vals.join(","); + }else if(vals.length == 7){ + val = "*"; + } + $("#weekHidden").val(val); + } + }); + }, + initObj : function(strVal, strid){ + var ary = null; + var objRadio = $("input[name='" + strid + "'"); + if (strVal == "*") { + objRadio.eq(0).attr("checked", "checked"); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(1).attr("checked", "checked"); + $("#" + strid + "Start_0").val(ary[0]); + $("#" + strid + "End_0").val(ary[1]); + } else if (strVal.split('/').length > 1) { + ary = strVal.split('/'); + objRadio.eq(2).attr("checked", "checked"); + $("#" + strid + "Start_1").val(ary[0]); + $("#" + strid + "End_1").val(ary[1]); + } else { + objRadio.eq(3).attr("checked", "checked"); + if (strVal != "?") { + ary = strVal.split(","); + for (var i = 0; i < ary.length; i++) { + $("." + strid + "List input[value='" + ary[i] + "']").attr("checked", "checked"); + } + $.fn.cronGen.tools.initCheckBox(strid); + } + } + }, + initDay : function(strVal) { + var ary = null; + var objRadio = $("input[name='day'"); + if (strVal == "*") { + objRadio.eq(0).attr("checked", "checked"); + } else if (strVal == "?") { + objRadio.eq(1).attr("checked", "checked"); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(2).attr("checked", "checked"); + $("#dayStart_0").val(ary[0]); + $("#dayEnd_0").val(ary[1]); + } else if (strVal.split('/').length > 1) { + ary = strVal.split('/'); + objRadio.eq(3).attr("checked", "checked"); + $("#dayStart_1").val(ary[0]); + $("#dayEnd_1").val(ary[1]); + } else if (strVal.split('W').length > 1) { + ary = strVal.split('W'); + objRadio.eq(4).attr("checked", "checked"); + $("#dayStart_2").val(ary[0]); + } else if (strVal == "L") { + objRadio.eq(5).attr("checked", "checked"); + } else { + objRadio.eq(6).attr("checked", "checked"); + ary = strVal.split(","); + for (var i = 0; i < ary.length; i++) { + $(".dayList input[value='" + ary[i] + "']").attr("checked", "checked"); + } + $.fn.cronGen.tools.initCheckBox("day"); + } + }, + initMonth : function(strVal) { + var ary = null; + var objRadio = $("input[name='month'"); + if (strVal == "*") { + objRadio.eq(0).attr("checked", "checked"); + } else if (strVal == "?") { + objRadio.eq(1).attr("checked", "checked"); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(2).attr("checked", "checked"); + $("#monthStart_0").val(ary[0]); + $("#monthEnd_0").val(ary[1]); + } else if (strVal.split('/').length > 1) { + ary = strVal.split('/'); + objRadio.eq(3).attr("checked", "checked"); + $("#monthStart_1").val(ary[0]); + $("#monthEnd_1").val(ary[1]); + + } else { + objRadio.eq(4).attr("checked", "checked"); + + ary = strVal.split(","); + for (var i = 0; i < ary.length; i++) { + $(".monthList input[value='" + ary[i] + "']").attr("checked", "checked"); + } + $.fn.cronGen.tools.initCheckBox("month"); + } + }, + initWeek : function(strVal) { + var ary = null; + var objRadio = $("input[name='week'"); + if (strVal == "*") { + objRadio.eq(0).attr("checked", "checked"); + } else if (strVal == "?") { + objRadio.eq(1).attr("checked", "checked"); + } else if (strVal.split('/').length > 1) { + ary = strVal.split('/'); + objRadio.eq(2).attr("checked", "checked"); + $("#weekStart_0").val(ary[0]); + $("#weekEnd_0").val(ary[1]); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(3).attr("checked", "checked"); + $("#weekStart_1").val(ary[0]); + $("#weekEnd_1").val(ary[1]); + } else if (strVal.split('L').length > 1) { + ary = strVal.split('L'); + objRadio.eq(4).attr("checked", "checked"); + $("#weekStart_2").val(ary[0]); + } else { + objRadio.eq(5).attr("checked", "checked"); + ary = strVal.split(","); + for (var i = 0; i < ary.length; i++) { + $(".weekList input[value='" + ary[i] + "']").attr("checked", "checked"); + } + $.fn.cronGen.tools.initCheckBox("week"); + } + }, + initYear : function(strVal) { + var ary = null; + var objRadio = $("input[name='year'"); + if (strVal == "*") { + objRadio.eq(1).attr("checked", "checked"); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(2).attr("checked", "checked"); + $("#yearStart_0").val(ary[0]); + $("#yearEnd_0").val(ary[1]); + } + }, + cronParse : function(cronExpress) { + //获取参数中表达式的值 + if (cronExpress) { + var regs = cronExpress.split(' '); + $("input[name=secondHidden]").val(regs[0]); + $("input[name=minHidden]").val(regs[1]); + $("input[name=hourHidden]").val(regs[2]); + $("input[name=dayHidden]").val(regs[3]); + $("input[name=monthHidden]").val(regs[4]); + $("input[name=weekHidden]").val(regs[5]); + + $.fn.cronGen.tools.initObj(regs[0], "second"); + $.fn.cronGen.tools.initObj(regs[1], "min"); + $.fn.cronGen.tools.initObj(regs[2], "hour"); + $.fn.cronGen.tools.initDay(regs[3]); + $.fn.cronGen.tools.initMonth(regs[4]); + $.fn.cronGen.tools.initWeek(regs[5]); + + if (regs.length > 6) { + $("input[name=yearHidden]").val(regs[6]); + $.fn.cronGen.tools.initYear(regs[6]); + } + } + }, + cronResult : function() { + var result; + var second = $("#secondHidden").val(); + second = second== "" ? "*":second; + var minute = $("#minHidden").val(); + minute = minute== "" ? "*":minute; + var hour = $("#hourHidden").val(); + hour = hour== "" ? "*":hour; + var day = $("#dayHidden").val(); + day = day== "" ? "*":day; + var month = $("#monthHidden").val(); + month = month== "" ? "*":month; + var week = $("#weekHidden").val(); + week = week== "" ? "?":week; + var year = $("#yearHidden").val(); + if(year!="") + { + result = second+" "+minute+" "+hour+" "+day+" "+month+" "+week+" "+year; + }else + { + result = second+" "+minute+" "+hour+" "+day+" "+month+" "+week; + } + return result; + }, + clearCheckbox : function(dom){ + //清除选中的checkbox + var list = $("."+dom+"List").children().filter(":checked"); + if ($(list).length > 0) { + $.each(list, function(index){ + $(this).attr("checked", false); + $(this).attr("disabled", "disabled"); + $(this).change(); + }); + } + }, + initCheckBox : function(dom) { + //移除checkbox禁用 + var list = $("."+dom+"List").children(); + if ($(list).length > 0) { + $.each(list, function(index){ + $(this).removeAttr("disabled"); + }); + } + } + }; +})(jQuery); diff --git "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" index e0acdb1..74ef1b8 100644 --- "a/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" +++ "b/doc/XXL-JOB\345\256\230\346\226\271\346\226\207\346\241\243.md" @@ -1547,7 +1547,7 @@ - 9、任务触发组件加载顺序调整,避免小概率情况下组件随机加载顺序导致的I18N的NPE问题。 - 10、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等; - 11、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题; -- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式[ING,国际化待完善]; +- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式; - 13、Cron执行时间查询:支持通过界面在线查看后续连续5次执行时间[ING,交互待完善]; - 14、[ING]xxl-rpc服务端线程优化,降低线程内存开销; - 15、[ING]调度日志优化:支持设置日志保留天数,过期日志天维度记录报表,并清理;调度报表汇总实时数据和报表; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index c7b351e..38d954b 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -44,9 +44,9 @@ public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { // 枚举-字典 - model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 + model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 - model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 + model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 执行器列表 List jobGroupList_all = xxlJobGroupDao.findAll(); diff --git a/xxl-job-admin/src/main/resources/i18n/message.properties b/xxl-job-admin/src/main/resources/i18n/message.properties index c7ab2fb..613fba3 100644 --- a/xxl-job-admin/src/main/resources/i18n/message.properties +++ b/xxl-job-admin/src/main/resources/i18n/message.properties @@ -1,6 +1,7 @@ admin_name=任务调度中心 admin_name_full=分布式任务调度平台XXL-JOB admin_version=2.1.1-SNAPSHOT +admin_i18n= ## system system_tips=系统提示 diff --git a/xxl-job-admin/src/main/resources/i18n/message_en.properties b/xxl-job-admin/src/main/resources/i18n/message_en.properties index d0f77df..d877a9d 100644 --- a/xxl-job-admin/src/main/resources/i18n/message_en.properties +++ b/xxl-job-admin/src/main/resources/i18n/message_en.properties @@ -1,6 +1,7 @@ admin_name=Scheduling Center admin_name_full=Distributed Task Scheduling Platform XXL-JOB admin_version=2.1.1-SNAPSHOT +admin_i18n=en ## system system_tips=System message 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 new file mode 100755 index 0000000..5e14551 --- /dev/null +++ b/xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js @@ -0,0 +1,1076 @@ +(function ($) { + // var resultsName = ""; + var inputElement; + var displayElement; + $.fn.extend({ + cronGen: function (options) { + if (options == null) { + options = {}; + } + 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 topMenu = $("
      ", { "class": "nav nav-tabs", id: "CronGenTabs" }); + $('
    • ', { 'class': 'active' }).html($('')).appendTo(topMenu); + $('
    • ').html($('Minute')).appendTo(topMenu); + $('
    • ').html($('Hour')).appendTo(topMenu); + $('
    • ').html($('Day')).appendTo(topMenu); + $('
    • ').html($('Month')).appendTo(topMenu); + $('
    • ').html($('Week')).appendTo(topMenu); + $('
    • ').html($('Year')).appendTo(topMenu); + $(topMenu).appendTo(mainDiv); + + //create what's inside the tabs + var container = $("
      ", { "class": "container-fluid", "style": "margin-top: 30px;margin-left: -14px;" }); + var row = $("
      ", { "class": "row-fluid" }); + var span12 = $("
      ", { "class": "span12" }); + var tabContent = $("
      ", { "class": "tab-content", "style": "border:0px; margin-top:-20px;" }); + + + //creating the secondsTab + var secondsTab = $("
      ", { "class": "tab-pane active", id: "Secondly" }); + var seconds1 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "second"}).appendTo(seconds1); + $(seconds1).append("Per second, allowed wildcard[, - * /]"); + $(seconds1).appendTo(secondsTab); + + var seconds2 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "second"}).appendTo(seconds2); + $(seconds2).append("Cycle, from"); + $("",{type : "text", id : "secondStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(seconds2); + $(seconds2).append("-"); + $("",{type : "text", id : "secondEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(seconds2); + $(seconds2).append("second"); + $(seconds2).appendTo(secondsTab); + + var seconds3 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "second"}).appendTo(seconds3); + $(seconds3).append("from"); + $("",{type : "text", id : "secondStart_1", value : "0", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(seconds3); + $(seconds3).append("seconds start, per"); + $("",{type : "text", id : "secondEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(seconds3); + $(seconds3).append("second execute once"); + $(seconds3).appendTo(secondsTab); + + var seconds4 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "second", id: "sencond_appoint"}).appendTo(seconds4); + $(seconds4).append("specify"); + $(seconds4).appendTo(secondsTab); + + $(secondsTab).append('
      00010203040506070809
      '); + $(secondsTab).append('
      10111213141516171819
      '); + $(secondsTab).append('
      20212223242526272829
      '); + $(secondsTab).append('
      30313233343536373839
      '); + $(secondsTab).append('
      40414243444546474849
      '); + $(secondsTab).append('
      50515253545556575859
      '); + $("",{type : "hidden", id : "secondHidden"}).appendTo(secondsTab); + $(secondsTab).appendTo(tabContent); + + //creating the minutesTab + var minutesTab = $("
      ", { "class": "tab-pane", id: "Minutes" }); + + var minutes1 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "min"}).appendTo(minutes1); + $(minutes1).append("Per minute, allowed wildcard[, - * /]"); + $(minutes1).appendTo(minutesTab); + + var minutes2 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "min"}).appendTo(minutes2); + $(minutes2).append("Cycle, from"); + $("",{type : "text", id : "minStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(minutes2); + $(minutes2).append("-"); + $("",{type : "text", id : "minEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(minutes2); + $(minutes2).append("minute"); + $(minutes2).appendTo(minutesTab); + + var minutes3 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "min"}).appendTo(minutes3); + $(minutes3).append("from"); + $("",{type : "text", id : "minStart_1", value : "0", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(minutes3); + $(minutes3).append("seconds start, per"); + $("",{type : "text", id : "minEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(minutes3); + $(minutes3).append("second execute once"); + $(minutes3).appendTo(minutesTab); + + var minutes4 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "min", id: "min_appoint"}).appendTo(minutes4); + $(minutes4).append("specify"); + $(minutes4).appendTo(minutesTab); + + $(minutesTab).append('
      00010203040506070809
      '); + $(minutesTab).append('
      10111213141516171819
      '); + $(minutesTab).append('
      20212223242526272829
      '); + $(minutesTab).append('
      30313233343536373839
      '); + $(minutesTab).append('
      40414243444546474849
      '); + $(minutesTab).append('
      50515253545556575859
      '); + $("",{type : "hidden", id : "minHidden"}).appendTo(minutesTab); + $(minutesTab).appendTo(tabContent); + + //creating the hourlyTab + var hourlyTab = $("
      ", { "class": "tab-pane", id: "Hourly" }); + + var hourly1 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "hour"}).appendTo(hourly1); + $(hourly1).append("Per hour, allowed wildcard[, - * /]"); + $(hourly1).appendTo(hourlyTab); + + var hourly2 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "hour"}).appendTo(hourly2); + $(hourly2).append("Cycle, from"); + $("",{type : "text", id : "hourStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(hourly2); + $(hourly2).append("-"); + $("",{type : "text", id : "hourEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(hourly2); + $(hourly2).append("hour"); + $(hourly2).appendTo(hourlyTab); + + var hourly3 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "hour"}).appendTo(hourly3); + $(hourly3).append("from"); + $("",{type : "text", id : "hourStart_1", value : "0", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(hourly3); + $(hourly3).append("hour start, per"); + $("",{type : "text", id : "hourEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(hourly3); + $(hourly3).append("hour execute once"); + $(hourly3).appendTo(hourlyTab); + + var hourly4 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "hour", id: "hour_appoint"}).appendTo(hourly4); + $(hourly4).append("specify"); + $(hourly4).appendTo(hourlyTab); + + $(hourlyTab).append('
      000102030405
      '); + $(hourlyTab).append('
      060708091011
      '); + $(hourlyTab).append('
      121314151617
      '); + $(hourlyTab).append('
      181920212223
      '); + $("",{type : "hidden", id : "hourHidden"}).appendTo(hourlyTab); + $(hourlyTab).appendTo(tabContent); + + + //creating the dailyTab + var dailyTab = $("
      ", { "class": "tab-pane", id: "Daily" }); + + var daily1 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "day"}).appendTo(daily1); + $(daily1).append("Per day, allowed wildcard[, - * / L W]"); + $(daily1).appendTo(dailyTab); + + var daily5 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "day"}).appendTo(daily5); + $(daily5).append("not specify"); + $(daily5).appendTo(dailyTab); + + var daily2 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "day"}).appendTo(daily2); + $(daily2).append("Cycle, from"); + $("",{type : "text", id : "dayStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily2); + $(daily2).append("-"); + $("",{type : "text", id : "dayEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily2); + $(daily2).append("day"); + $(daily2).appendTo(dailyTab); + + var daily3 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "day"}).appendTo(daily3); + $(daily3).append("from"); + $("",{type : "text", id : "dayStart_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily3); + $(daily3).append("day start, per"); + $("",{type : "text", id : "dayEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily3); + $(daily3).append("day execute once"); + $(daily3).appendTo(dailyTab); + + var daily6 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "5", name : "day"}).appendTo(daily6); + $(daily6).append("The most recent working day on the 1"); + $("",{type : "text", id : "dayStart_2", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(daily6); + $(daily6).append(" of each month"); + $(daily6).appendTo(dailyTab); + + var daily7 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "6", name : "day"}).appendTo(daily7); + $(daily7).append("The last day of the month"); + $(daily7).appendTo(dailyTab); + + var daily4 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "7", name : "day", id: "day_appoint"}).appendTo(daily4); + $(daily4).append("specify"); + $(daily4).appendTo(dailyTab); + + $(dailyTab).append('
      01020304050607080910
      '); + $(dailyTab).append('
      11121314151617181920
      '); + $(dailyTab).append('
      21222324252627282930
      '); + $(dailyTab).append('
      31
      '); + $("",{type : "hidden", id : "dayHidden"}).appendTo(dailyTab); + $(dailyTab).appendTo(tabContent); + + + //creating the monthlyTab + var monthlyTab = $("
      ", { "class": "tab-pane", id: "Monthly" }); + + var monthly1 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "month"}).appendTo(monthly1); + $(monthly1).append("Per month, allowed wildcard[, - * /]"); + $(monthly1).appendTo(monthlyTab); + + var monthly2 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "month"}).appendTo(monthly2); + $(monthly2).append("not specify"); + $(monthly2).appendTo(monthlyTab); + + var monthly3 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "month"}).appendTo(monthly3); + $(monthly3).append("Cycle, from"); + $("",{type : "text", id : "monthStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(monthly3); + $(monthly3).append("-"); + $("",{type : "text", id : "monthEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(monthly3); + $(monthly3).append("month"); + $(monthly3).appendTo(monthlyTab); + + var monthly4 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "month"}).appendTo(monthly4); + $(monthly4).append("Starting from "); + $("",{type : "text", id : "monthStart_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(monthly4); + $(monthly4).append("day, once every"); + $("",{type : "text", id : "monthEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(monthly4); + $(monthly4).append("month"); + $(monthly4).appendTo(monthlyTab); + + var monthly5 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "5", name : "month", id: "month_appoint"}).appendTo(monthly5); + $(monthly5).append("specify"); + $(monthly5).appendTo(monthlyTab); + + $(monthlyTab).append('
      010203040506
      '); + $(monthlyTab).append('
      070809101112
      '); + $("",{type : "hidden", id : "monthHidden"}).appendTo(monthlyTab); + $(monthlyTab).appendTo(tabContent); + + //creating the weeklyTab + var weeklyTab = $("
      ", { "class": "tab-pane", id: "Weekly" }); + + var weekly1 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "week"}).appendTo(weekly1); + $(weekly1).append("Per week, allowed wildcard[, - * / L #]"); + $(weekly1).appendTo(weeklyTab); + + var weekly2 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "week"}).appendTo(weekly2); + $(weekly2).append("not specify"); + $(weekly2).appendTo(weeklyTab); + + var weekly3 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "week"}).appendTo(weekly3); + $(weekly3).append("Cycle, from week"); + $("",{type : "text", id : "weekStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly3); + $(weekly3).append("-"); + $("",{type : "text", id : "weekEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly3); + $(weekly3).appendTo(weeklyTab); + + var weekly4 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "4", name : "week"}).appendTo(weekly4); + $(weekly4).append("The"); + $("",{type : "text", id : "weekStart_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly4); + $(weekly4).append("th week, and day "); + $("",{type : "text", id : "weekEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly4); + $(weekly4).appendTo(weeklyTab); + + var weekly5 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "5", name : "week"}).appendTo(weekly5); + $(weekly5).append("Last week of the month"); + $("",{type : "text", id : "weekStart_2", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly5); + $(weekly5).appendTo(weeklyTab); + + var weekly6 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "6", name : "week", id: "week_appoint"}).appendTo(weekly6); + $(weekly6).append("specify"); + $(weekly6).appendTo(weeklyTab); + + $(weeklyTab).append('
      1234567
      '); + + $("",{type : "hidden", id : "weekHidden"}).appendTo(weeklyTab); + $(weeklyTab).appendTo(tabContent); + + //creating the yearlyTab + var yearlyTab = $("
      ", { "class": "tab-pane", id: "Yearly" }); + + var yearly1 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "1", name : "year"}).appendTo(yearly1); + $(yearly1).append("not specify allowed wildcard[, - * /] not required"); + $(yearly1).appendTo(yearlyTab); + + var yearly3 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "2", name : "year"}).appendTo(yearly3); + $(yearly3).append("Per year"); + $(yearly3).appendTo(yearlyTab); + + var yearly2 = $("
      ",{"class":"line"}); + $("",{type : "radio", value : "3", name : "year"}).appendTo(yearly2); + $(yearly2).append("Cycle, from "); + $("",{type : "text", id : "yearStart_0", value : "2016", style:"width:45px; height:20px;"}).appendTo(yearly2); + $(yearly2).append("-"); + $("",{type : "text", id : "yearEnd_0", value : "2017", style:"width:45px; height:20px;"}).appendTo(yearly2); + $(yearly2).append("year"); + $(yearly2).appendTo(yearlyTab); + $("",{type : "hidden", id : "yearHidden"}).appendTo(yearlyTab); + $(yearlyTab).appendTo(tabContent); + + $(tabContent).appendTo(span12); + + //creating the button and results input + // resultsName = $(this).prop("id"); + // $(this).prop("name", resultsName); + + $(span12).appendTo(row); + $(row).appendTo(container); + $(container).appendTo(mainDiv); + $(cronContainer).append(mainDiv); + + var that = $(this); + + // Hide the original input + that.hide(); + + // Replace the input with an input group + var $g = $("
      ").addClass("input-group"); + // Add an input + var $i = $("", { type: 'text', placeholder: 'cron表达式...'}).addClass("form-control").val($(that).val()); + $i.appendTo($g); + // Add the button + var $b = $(""); + // Put button inside span + var $s = $("").addClass("input-group-btn"); + $b.appendTo($s); + $s.appendTo($g); + + $(this).before($g); + + inputElement = that; + displayElement = $i; + + $b.popover({ + html: true, + content: function () { + return $(cronContainer).html(); + }, + template: '

      ', + placement: options.direction + + }).on('click', function (e) { + e.preventDefault(); + + //fillDataOfMinutesAndHoursSelectOptions(); + //fillDayWeekInMonth(); + //fillInWeekDays(); + //fillInMonths(); + + $.fn.cronGen.tools.cronParse(inputElement.val()); + + //绑定指定事件 + $.fn.cronGen.tools.initChangeEvent(); + + + $('#CronGenTabs a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); + //generate(); + }); + $("#CronGenMainDiv select,input").change(function (e) { + generate(); + }); + $("#CronGenMainDiv input").focus(function (e) { + generate(); + }); + //generate(); + }); + return; + } + }); + + + var fillInMonths = function () { + var days = [ + { text: "January", val: "1" }, + { text: "February", val: "2" }, + { text: "March", val: "3" }, + { text: "April", val: "4" }, + { text: "May", val: "5" }, + { text: "June", val: "6" }, + { text: "July", val: "7" }, + { text: "August", val: "8" }, + { text: "September", val: "9" }, + { text: "October", val: "10" }, + { text: "November", val: "11" }, + { text: "December", val: "12" } + ]; + $(".months").each(function () { + fillOptions(this, days); + }); + }; + + var fillOptions = function (elements, options) { + for (var i = 0; i < options.length; i++) + $(elements).append(""); + }; + var fillDataOfMinutesAndHoursSelectOptions = function () { + for (var i = 0; i < 60; i++) { + if (i < 24) { + $(".hours").each(function () { $(this).append(timeSelectOption(i)); }); + } + $(".minutes").each(function () { $(this).append(timeSelectOption(i)); }); + } + }; + var fillInWeekDays = function () { + var days = [ + { text: "Tuesday", val: "2" }, + { text: "Wednesday", val: "3" }, + { text: "Thursday", val: "4" }, + { text: "Friday", val: "5" }, + { text: "Saturday", val: "6" }, + { text: "Sunday", val: "7" }, + { text: "Monday", val: "1" } + ]; + $(".week-days").each(function () { + fillOptions(this, days); + }); + + }; + var fillDayWeekInMonth = function () { + var days = [ + { text: "First", val: "1" }, + { text: "Second", val: "2" }, + { text: "Third", val: "3" }, + { text: "Fourth", val: "4" } + ]; + $(".day-order-in-month").each(function () { + fillOptions(this, days); + }); + }; + var displayTimeUnit = function (unit) { + if (unit.toString().length == 1) + return "0" + unit; + return unit; + }; + var timeSelectOption = function (i) { + return ""; + }; + + var generate = function () { + + var activeTab = $("ul#CronGenTabs li.active a").prop("id"); + var results = ""; + switch (activeTab) { + case "SecondlyTab": + switch ($("input:radio[name=second]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("second"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.cycle("second"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.startOn("second"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.initCheckBox("second"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "MinutesTab": + switch ($("input:radio[name=min]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("min"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.cycle("min"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.startOn("min"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.initCheckBox("min"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "HourlyTab": + switch ($("input:radio[name=hour]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("hour"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.cycle("hour"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.startOn("hour"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.initCheckBox("hour"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "DailyTab": + switch ($("input:radio[name=day]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.unAppoint("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.cycle("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.startOn("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "5": + $.fn.cronGen.tools.workDay("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "6": + $.fn.cronGen.tools.lastDay("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "7": + $.fn.cronGen.tools.initCheckBox("day"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "WeeklyTab": + switch ($("input:radio[name=week]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.unAppoint("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.cycle("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.startOn("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "5": + $.fn.cronGen.tools.lastWeek("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "6": + $.fn.cronGen.tools.initCheckBox("week"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "MonthlyTab": + switch ($("input:radio[name=month]:checked").val()) { + case "1": + $.fn.cronGen.tools.everyTime("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.unAppoint("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.cycle("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "4": + $.fn.cronGen.tools.startOn("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "5": + $.fn.cronGen.tools.initCheckBox("month"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + case "YearlyTab": + switch ($("input:radio[name=year]:checked").val()) { + case "1": + $.fn.cronGen.tools.unAppoint("year"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "2": + $.fn.cronGen.tools.everyTime("year"); + results = $.fn.cronGen.tools.cronResult(); + break; + case "3": + $.fn.cronGen.tools.cycle("year"); + results = $.fn.cronGen.tools.cronResult(); + break; + } + break; + } + + // Update original control + inputElement.val(results); + // Update display + displayElement.val(results); + }; + +})(jQuery); + +(function($) { + $.fn.cronGen.defaultOptions = { + direction : 'bottom' + }; + $.fn.cronGen.tools = { + /** + * 每周期 + */ + everyTime : function(dom){ + $("#"+dom+"Hidden").val("*"); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 不指定 + */ + unAppoint : function(dom){ + var val = "?"; + if (dom == "year") + { + val = ""; + } + $("#"+dom+"Hidden").val(val); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 周期 + */ + cycle : function(dom){ + var start = $("#"+dom+"Start_0").val(); + var end = $("#"+dom+"End_0").val(); + $("#"+dom+"Hidden").val(start + "-" + end); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 从开始 + */ + startOn : function(dom) { + var start = $("#"+dom+"Start_1").val(); + var end = $("#"+dom+"End_1").val(); + $("#"+dom+"Hidden").val(start + "/" + end); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 最后一天 + */ + lastDay : function(dom){ + $("#"+dom+"Hidden").val("L"); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 每周的某一天 + */ + weekOfDay : function(dom){ + var start = $("#"+dom+"Start_0").val(); + var end = $("#"+dom+"End_0").val(); + $("#"+dom+"Hidden").val(start + "#" + end); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 最后一周 + */ + lastWeek : function(dom){ + var start = $("#"+dom+"Start_2").val(); + $("#"+dom+"Hidden").val(start+"L"); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + /** + * 工作日 + */ + workDay : function(dom) { + var start = $("#"+dom+"Start_2").val(); + $("#"+dom+"Hidden").val(start + "W"); + $.fn.cronGen.tools.clearCheckbox(dom); + }, + initChangeEvent : function(){ + var secondList = $(".secondList").children(); + $("#sencond_appoint").click(function(){ + if (this.checked) { + if ($(secondList).filter(":checked").length == 0) { + $(secondList.eq(0)).attr("checked", true); + } + secondList.eq(0).change(); + } + }); + + secondList.change(function() { + var sencond_appoint = $("#sencond_appoint").prop("checked"); + if (sencond_appoint) { + var vals = []; + secondList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 59) { + val = vals.join(","); + }else if(vals.length == 59){ + val = "*"; + } + $("#secondHidden").val(val); + } + }); + + var minList = $(".minList").children(); + $("#min_appoint").click(function(){ + if (this.checked) { + if ($(minList).filter(":checked").length == 0) { + $(minList.eq(0)).attr("checked", true); + } + minList.eq(0).change(); + } + }); + + minList.change(function() { + var min_appoint = $("#min_appoint").prop("checked"); + if (min_appoint) { + var vals = []; + minList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 59) { + val = vals.join(","); + }else if(vals.length == 59){ + val = "*"; + } + $("#minHidden").val(val); + } + }); + + var hourList = $(".hourList").children(); + $("#hour_appoint").click(function(){ + if (this.checked) { + if ($(hourList).filter(":checked").length == 0) { + $(hourList.eq(0)).attr("checked", true); + } + hourList.eq(0).change(); + } + }); + + hourList.change(function() { + var hour_appoint = $("#hour_appoint").prop("checked"); + if (hour_appoint) { + var vals = []; + hourList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 24) { + val = vals.join(","); + }else if(vals.length == 24){ + val = "*"; + } + $("#hourHidden").val(val); + } + }); + + var dayList = $(".dayList").children(); + $("#day_appoint").click(function(){ + if (this.checked) { + if ($(dayList).filter(":checked").length == 0) { + $(dayList.eq(0)).attr("checked", true); + } + dayList.eq(0).change(); + } + }); + + dayList.change(function() { + var day_appoint = $("#day_appoint").prop("checked"); + if (day_appoint) { + var vals = []; + dayList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 31) { + val = vals.join(","); + }else if(vals.length == 31){ + val = "*"; + } + $("#dayHidden").val(val); + } + }); + + var monthList = $(".monthList").children(); + $("#month_appoint").click(function(){ + if (this.checked) { + if ($(monthList).filter(":checked").length == 0) { + $(monthList.eq(0)).attr("checked", true); + } + monthList.eq(0).change(); + } + }); + + monthList.change(function() { + var month_appoint = $("#month_appoint").prop("checked"); + if (month_appoint) { + var vals = []; + monthList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 12) { + val = vals.join(","); + }else if(vals.length == 12){ + val = "*"; + } + $("#monthHidden").val(val); + } + }); + + var weekList = $(".weekList").children(); + $("#week_appoint").click(function(){ + if (this.checked) { + if ($(weekList).filter(":checked").length == 0) { + $(weekList.eq(0)).attr("checked", true); + } + weekList.eq(0).change(); + } + }); + + weekList.change(function() { + var week_appoint = $("#week_appoint").prop("checked"); + if (week_appoint) { + var vals = []; + weekList.each(function() { + if (this.checked) { + vals.push(this.value); + } + }); + var val = "?"; + if (vals.length > 0 && vals.length < 7) { + val = vals.join(","); + }else if(vals.length == 7){ + val = "*"; + } + $("#weekHidden").val(val); + } + }); + }, + initObj : function(strVal, strid){ + var ary = null; + var objRadio = $("input[name='" + strid + "'"); + if (strVal == "*") { + objRadio.eq(0).attr("checked", "checked"); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(1).attr("checked", "checked"); + $("#" + strid + "Start_0").val(ary[0]); + $("#" + strid + "End_0").val(ary[1]); + } else if (strVal.split('/').length > 1) { + ary = strVal.split('/'); + objRadio.eq(2).attr("checked", "checked"); + $("#" + strid + "Start_1").val(ary[0]); + $("#" + strid + "End_1").val(ary[1]); + } else { + objRadio.eq(3).attr("checked", "checked"); + if (strVal != "?") { + ary = strVal.split(","); + for (var i = 0; i < ary.length; i++) { + $("." + strid + "List input[value='" + ary[i] + "']").attr("checked", "checked"); + } + $.fn.cronGen.tools.initCheckBox(strid); + } + } + }, + initDay : function(strVal) { + var ary = null; + var objRadio = $("input[name='day'"); + if (strVal == "*") { + objRadio.eq(0).attr("checked", "checked"); + } else if (strVal == "?") { + objRadio.eq(1).attr("checked", "checked"); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(2).attr("checked", "checked"); + $("#dayStart_0").val(ary[0]); + $("#dayEnd_0").val(ary[1]); + } else if (strVal.split('/').length > 1) { + ary = strVal.split('/'); + objRadio.eq(3).attr("checked", "checked"); + $("#dayStart_1").val(ary[0]); + $("#dayEnd_1").val(ary[1]); + } else if (strVal.split('W').length > 1) { + ary = strVal.split('W'); + objRadio.eq(4).attr("checked", "checked"); + $("#dayStart_2").val(ary[0]); + } else if (strVal == "L") { + objRadio.eq(5).attr("checked", "checked"); + } else { + objRadio.eq(6).attr("checked", "checked"); + ary = strVal.split(","); + for (var i = 0; i < ary.length; i++) { + $(".dayList input[value='" + ary[i] + "']").attr("checked", "checked"); + } + $.fn.cronGen.tools.initCheckBox("day"); + } + }, + initMonth : function(strVal) { + var ary = null; + var objRadio = $("input[name='month'"); + if (strVal == "*") { + objRadio.eq(0).attr("checked", "checked"); + } else if (strVal == "?") { + objRadio.eq(1).attr("checked", "checked"); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(2).attr("checked", "checked"); + $("#monthStart_0").val(ary[0]); + $("#monthEnd_0").val(ary[1]); + } else if (strVal.split('/').length > 1) { + ary = strVal.split('/'); + objRadio.eq(3).attr("checked", "checked"); + $("#monthStart_1").val(ary[0]); + $("#monthEnd_1").val(ary[1]); + + } else { + objRadio.eq(4).attr("checked", "checked"); + + ary = strVal.split(","); + for (var i = 0; i < ary.length; i++) { + $(".monthList input[value='" + ary[i] + "']").attr("checked", "checked"); + } + $.fn.cronGen.tools.initCheckBox("month"); + } + }, + initWeek : function(strVal) { + var ary = null; + var objRadio = $("input[name='week'"); + if (strVal == "*") { + objRadio.eq(0).attr("checked", "checked"); + } else if (strVal == "?") { + objRadio.eq(1).attr("checked", "checked"); + } else if (strVal.split('/').length > 1) { + ary = strVal.split('/'); + objRadio.eq(2).attr("checked", "checked"); + $("#weekStart_0").val(ary[0]); + $("#weekEnd_0").val(ary[1]); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(3).attr("checked", "checked"); + $("#weekStart_1").val(ary[0]); + $("#weekEnd_1").val(ary[1]); + } else if (strVal.split('L').length > 1) { + ary = strVal.split('L'); + objRadio.eq(4).attr("checked", "checked"); + $("#weekStart_2").val(ary[0]); + } else { + objRadio.eq(5).attr("checked", "checked"); + ary = strVal.split(","); + for (var i = 0; i < ary.length; i++) { + $(".weekList input[value='" + ary[i] + "']").attr("checked", "checked"); + } + $.fn.cronGen.tools.initCheckBox("week"); + } + }, + initYear : function(strVal) { + var ary = null; + var objRadio = $("input[name='year'"); + if (strVal == "*") { + objRadio.eq(1).attr("checked", "checked"); + } else if (strVal.split('-').length > 1) { + ary = strVal.split('-'); + objRadio.eq(2).attr("checked", "checked"); + $("#yearStart_0").val(ary[0]); + $("#yearEnd_0").val(ary[1]); + } + }, + cronParse : function(cronExpress) { + //获取参数中表达式的值 + if (cronExpress) { + var regs = cronExpress.split(' '); + $("input[name=secondHidden]").val(regs[0]); + $("input[name=minHidden]").val(regs[1]); + $("input[name=hourHidden]").val(regs[2]); + $("input[name=dayHidden]").val(regs[3]); + $("input[name=monthHidden]").val(regs[4]); + $("input[name=weekHidden]").val(regs[5]); + + $.fn.cronGen.tools.initObj(regs[0], "second"); + $.fn.cronGen.tools.initObj(regs[1], "min"); + $.fn.cronGen.tools.initObj(regs[2], "hour"); + $.fn.cronGen.tools.initDay(regs[3]); + $.fn.cronGen.tools.initMonth(regs[4]); + $.fn.cronGen.tools.initWeek(regs[5]); + + if (regs.length > 6) { + $("input[name=yearHidden]").val(regs[6]); + $.fn.cronGen.tools.initYear(regs[6]); + } + } + }, + cronResult : function() { + var result; + var second = $("#secondHidden").val(); + second = second== "" ? "*":second; + var minute = $("#minHidden").val(); + minute = minute== "" ? "*":minute; + var hour = $("#hourHidden").val(); + hour = hour== "" ? "*":hour; + var day = $("#dayHidden").val(); + day = day== "" ? "*":day; + var month = $("#monthHidden").val(); + month = month== "" ? "*":month; + var week = $("#weekHidden").val(); + week = week== "" ? "?":week; + var year = $("#yearHidden").val(); + if(year!="") + { + result = second+" "+minute+" "+hour+" "+day+" "+month+" "+week+" "+year; + }else + { + result = second+" "+minute+" "+hour+" "+day+" "+month+" "+week; + } + return result; + }, + clearCheckbox : function(dom){ + //清除选中的checkbox + var list = $("."+dom+"List").children().filter(":checked"); + if ($(list).length > 0) { + $.each(list, function(index){ + $(this).attr("checked", false); + $(this).attr("disabled", "disabled"); + $(this).change(); + }); + } + }, + initCheckBox : function(dom) { + //移除checkbox禁用 + var list = $("."+dom+"List").children(); + if ($(list).length > 0) { + $.each(list, function(index){ + $(this).removeAttr("disabled"); + }); + } + } + }; +})(jQuery); diff --git a/xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl b/xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl index 6c1a7c9..be9dba5 100644 --- a/xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl +++ b/xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl @@ -428,7 +428,7 @@ <#-- cronGen --> - +