diff --git a/xxl-job-admin/src/main/webapp/static/js/index.js b/xxl-job-admin/src/main/webapp/static/js/index.js
index 0e2cac1c..30def218 100644
--- a/xxl-job-admin/src/main/webapp/static/js/index.js
+++ b/xxl-job-admin/src/main/webapp/static/js/index.js
@@ -4,8 +4,17 @@
$(function () {
// filter Time
- var _startDate = moment().subtract(1, 'months'); // 默认,最近一月
+ var _startDate = moment().subtract(1, 'months'); // default,recent_month
var _endDate = moment();
+
+ var rangesConf = {};
+ rangesConf[I18n.daterangepicker_ranges_today] = [moment().startOf('day'), moment().endOf('day')];
+ rangesConf[I18n.daterangepicker_ranges_yesterday] = [moment().subtract(1, 'days').startOf('day'), moment().subtract(1, 'days').endOf('day')];
+ rangesConf[I18n.daterangepicker_ranges_this_month] = [moment().startOf('month'), moment().endOf('month')];
+ rangesConf[I18n.daterangepicker_ranges_last_month] = [moment().subtract(1, 'months').startOf('month'), moment().subtract(1, 'months').endOf('month')];
+ rangesConf[I18n.daterangepicker_ranges_recent_week] = [moment().subtract(1, 'weeks'), moment()];
+ rangesConf[I18n.daterangepicker_ranges_recent_month] = [_startDate, _endDate];
+
$('#filterTime').daterangepicker({
autoApply:false,
singleDatePicker:false,
@@ -14,25 +23,17 @@ $(function () {
timePickerIncrement: 10, // 时间的增量,单位为分钟
timePicker24Hour : true,
opens : 'left', //日期选择框的弹出位置
- ranges: {
- //'最近1小时': [moment().subtract(1, 'hours'), moment()],
- '今日': [moment().startOf('day'), moment().endOf('day')],
- '昨日': [moment().subtract(1, 'days').startOf('day'), moment().subtract(1, 'days').endOf('day')],
- '本月': [moment().startOf('month'), moment().endOf('month')],
- '上个月': [moment().subtract(1, 'months').startOf('month'), moment().subtract(1, 'months').endOf('month')],
- '最近1周': [moment().subtract(1, 'weeks'), moment()],
- '最近1月': [_startDate, _endDate]
- },
+ ranges: rangesConf,
locale : {
format: 'YYYY-MM-DD HH:mm:ss',
separator : ' - ',
- customRangeLabel : '自定义',
- applyLabel : '确定',
- cancelLabel : '取消',
- fromLabel : '起始时间',
- toLabel : '结束时间',
- daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
- monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月' ],
+ customRangeLabel : I18n.daterangepicker_custom_name ,
+ applyLabel : I18n.system_ok ,
+ cancelLabel : I18n.system_cancel ,
+ fromLabel : I18n.daterangepicker_custom_starttime ,
+ toLabel : I18n.daterangepicker_custom_endtime ,
+ daysOfWeek : I18n.daterangepicker_custom_daysofweek.split(',') , // '日', '一', '二', '三', '四', '五', '六'
+ monthNames : I18n.daterangepicker_custom_monthnames.split(',') , // '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'
firstDay : 1
},
startDate:_startDate,
@@ -64,7 +65,7 @@ $(function () {
} else {
layer.open({
title: I18n.system_tips ,
- content: (data.msg || '调度报表数据加载异常'),
+ content: (data.msg || I18n.job_dashboard_report_loaddata_fail ),
icon: '2'
});
}
@@ -78,7 +79,7 @@ $(function () {
function lineChartInit(data) {
var option = {
title: {
- text: '日期分布图'
+ text: I18n.job_dashboard_date_report
},
tooltip : {
trigger: 'axis',
@@ -90,7 +91,7 @@ $(function () {
}
},
legend: {
- data:['成功调度次数','失败调度次数']
+ data:[I18n.job_dashboard_date_report_suc_count, I18n.job_dashboard_date_report_fail_count]
},
toolbox: {
feature: {
@@ -117,16 +118,16 @@ $(function () {
],
series : [
{
- name:'成功调度次数',
+ name:I18n.job_dashboard_date_report_suc_count,
type:'line',
- stack: '总量',
+ stack: 'Total',
areaStyle: {normal: {}},
data: data.content.triggerDayCountSucList
},
{
- name:'失败调度次数',
+ name:I18n.job_dashboard_date_report_fail_count,
type:'line',
- stack: '总量',
+ stack: 'Total',
label: {
normal: {
show: true,
@@ -150,7 +151,7 @@ $(function () {
function pieChartInit(data) {
var option = {
title : {
- text: '成功比例图',
+ text: I18n.job_dashboard_rate_report ,
/*subtext: 'subtext',*/
x:'center'
},
@@ -161,7 +162,7 @@ $(function () {
legend: {
orient: 'vertical',
left: 'left',
- data: ['成功调度次数','失败调度次数']
+ data: [I18n.job_dashboard_rate_report_suc_count, I18n.job_dashboard_rate_report_fail_count ]
},
series : [
{
@@ -172,11 +173,11 @@ $(function () {
data:[
{
value:data.content.triggerCountSucTotal,
- name:'成功调度次数'
+ name:I18n.job_dashboard_rate_report_suc_count
},
{
value:data.content.triggerCountFailTotal,
- name:'失败调度次数'
+ name:I18n.job_dashboard_rate_report_fail_count
}
],
itemStyle: {
diff --git a/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js b/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
index e199cea2..6d153730 100644
--- a/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
+++ b/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
@@ -52,18 +52,12 @@ $(function() {
"width":'20%',
"visible" : true,
"render": function ( data, type, row ) {
- if ('GLUE_GROOVY'==row.glueType) {
- return "GLUE模式(Java)";
- } else if ('GLUE_SHELL'==row.glueType) {
- return "GLUE模式(Shell)";
- } else if ('GLUE_PYTHON'==row.glueType) {
- return "GLUE模式(Python)";
- }else if ('GLUE_NODEJS'==row.glueType){
- return "GLUE模式(Nodejs)";
- } else if ('BEAN'==row.glueType) {
- return "BEAN模式:" + row.executorHandler;
- }
- return row.executorHandler;
+ var glueTypeTitle = findGlueTypeTitle(row.glueType);
+ if (row.executorHandler) {
+ return glueTypeTitle +":" + row.executorHandler;
+ } else {
+ return glueTypeTitle;
+ }
}
},
{ "data": 'executorParam', "visible" : false},
@@ -88,7 +82,6 @@ $(function() {
},
{ "data": 'author', "visible" : true, "width":'10%'},
{ "data": 'alarmEmail', "visible" : false},
- { "data": 'glueType', "visible" : false},
{
"data": 'jobStatus',
"width":'10%',
@@ -97,24 +90,24 @@ $(function() {
if ('NORMAL' == data) {
return '
'+ data +'';
} else if ('PAUSED' == data){
- return '
'+ data +'';
+ return '
'+ data +'';
} else if ('BLOCKED' == data){
- return '
'+ data +'';
+ return '
'+ data +'';
}
return data;
}
},
{
- "data": '操作' ,
+ "data": I18n.system_opt ,
"width":'15%',
"render": function ( data, type, row ) {
return function(){
// status
var pause_resume = "";
if ('NORMAL' == row.jobStatus) {
- pause_resume = '
';
+ pause_resume = '
';
} else if ('PAUSED' == row.jobStatus){
- pause_resume = '
';
+ pause_resume = '
';
}
// log url
var logUrl = base_url +'/joblog?jobId='+ row.id;
@@ -129,12 +122,12 @@ $(function() {
// html
tableData['key'+row.id] = row;
var html = '
'+
- ' '+
+ ' '+
pause_resume +
- '
'+
- ' '+
+ '
'+
+ ' '+
codeBtn +
- ' '+
+ ' '+
'
';
return html;
@@ -143,27 +136,27 @@ $(function() {
}
],
"language" : {
- "sProcessing" : "处理中...",
- "sLengthMenu" : "每页 _MENU_ 条记录",
- "sZeroRecords" : "没有匹配结果",
- "sInfo" : "第 _PAGE_ 页 ( 总共 _PAGES_ 页,_TOTAL_ 条记录 )",
- "sInfoEmpty" : "无记录",
- "sInfoFiltered" : "(由 _MAX_ 项结果过滤)",
+ "sProcessing" : I18n.dataTable_sProcessing ,
+ "sLengthMenu" : I18n.dataTable_sLengthMenu ,
+ "sZeroRecords" : I18n.dataTable_sZeroRecords ,
+ "sInfo" : I18n.dataTable_sInfo ,
+ "sInfoEmpty" : I18n.dataTable_sInfoEmpty ,
+ "sInfoFiltered" : I18n.dataTable_sInfoFiltered ,
"sInfoPostFix" : "",
- "sSearch" : "搜索:",
+ "sSearch" : I18n.dataTable_sSearch ,
"sUrl" : "",
- "sEmptyTable" : "表中数据为空",
- "sLoadingRecords" : "载入中...",
+ "sEmptyTable" : I18n.dataTable_sEmptyTable ,
+ "sLoadingRecords" : I18n.dataTable_sLoadingRecords ,
"sInfoThousands" : ",",
"oPaginate" : {
- "sFirst" : "首页",
- "sPrevious" : "上页",
- "sNext" : "下页",
- "sLast" : "末页"
+ "sFirst" : I18n.dataTable_sFirst ,
+ "sPrevious" : I18n.dataTable_sPrevious ,
+ "sNext" : I18n.dataTable_sNext ,
+ "sLast" : I18n.dataTable_sLast
},
"oAria" : {
- "sSortAscending" : ": 以升序排列此列",
- "sSortDescending" : ": 以降序排列此列"
+ "sSortAscending" : I18n.dataTable_sSortAscending ,
+ "sSortDescending" : I18n.dataTable_sSortDescending
}
}
});
@@ -191,19 +184,19 @@ $(function() {
var type = $(this).attr("_type");
if ("job_pause" == type) {
- typeName = "暂停";
+ typeName = I18n.jobinfo_opt_pause ;
url = base_url + "/jobinfo/pause";
needFresh = true;
} else if ("job_resume" == type) {
- typeName = "恢复";
+ typeName = I18n.jobinfo_opt_resume ;
url = base_url + "/jobinfo/resume";
needFresh = true;
} else if ("job_del" == type) {
- typeName = "删除";
+ typeName = I18n.jobinfo_opt_del ;
url = base_url + "/jobinfo/remove";
needFresh = true;
} else if ("job_trigger" == type) {
- typeName = "执行";
+ typeName = I18n.jobinfo_opt_run ;
url = base_url + "/jobinfo/trigger";
} else {
return;
@@ -211,7 +204,7 @@ $(function() {
var id = $(this).parent('p').attr("id");
- layer.confirm('确认' + typeName + '?', {icon: 3, title:'系统提示'}, function(index){
+ layer.confirm( I18n.system_ok + typeName + '?', {icon: 3, title: I18n.system_tips }, function(index){
layer.close(index);
$.ajax({
@@ -225,8 +218,9 @@ $(function() {
if (data.code == 200) {
layer.open({
- title: '系统提示',
- content: typeName + "成功",
+ title: I18n.system_tips,
+ btn: [ I18n.system_ok , I18n.system_close ],
+ content: typeName + I18n.system_success ,
icon: '1',
end: function(layero, index){
if (needFresh) {
@@ -237,8 +231,9 @@ $(function() {
});
} else {
layer.open({
- title: '系统提示',
- content: (data.msg || typeName + "失败"),
+ title: I18n.system_tips,
+ btn: [ I18n.system_ok , I18n.system_close ],
+ content: (data.msg || typeName + I18n.system_fail ),
icon: '2'
});
}
@@ -269,13 +264,13 @@ $(function() {
},
messages : {
jobDesc : {
- required :"请输入“描述”."
+ required : I18n.system_please_input + I18n.jobinfo_field_jobdesc
},
jobCron : {
- required :"请输入“Cron”."
+ required : I18n.system_please_input + "Cron"
},
author : {
- required : "请输入“负责人”."
+ required : I18n.system_please_input + I18n.jobinfo_field_author
}
},
highlight : function(element) {
@@ -293,8 +288,8 @@ $(function() {
if (data.code == "200") {
$('#addModal').modal('hide');
layer.open({
- title: '系统提示',
- content: '新增任务成功',
+ title: I18n.system_tips ,
+ content: I18n.system_add_suc ,
icon: '1',
end: function(layero, index){
jobTable.fnDraw();
@@ -303,8 +298,8 @@ $(function() {
});
} else {
layer.open({
- title: '系统提示',
- content: (data.msg || "新增失败"),
+ title: I18n.system_tips ,
+ content: (data.msg || I18n.system_add_fail),
icon: '2'
});
}
@@ -353,14 +348,14 @@ $(function() {
var id = $(this).parent('p').attr("id");
var row = tableData['key'+id];
- if (!row) {
+ /*if (!row) {
layer.open({
- title: '系统提示',
- content: ("任务信息加载失败,请刷新页面"),
+ title: I18n.system_tips ,
+ content: ("数据加载失败,请刷新页面"),
icon: '2'
});
return;
- }
+ }*/
// base data
$("#updateModal .form input[name='id']").val( row.id );
@@ -401,13 +396,13 @@ $(function() {
},
messages : {
jobDesc : {
- required :"请输入“描述”."
+ required : I18n.system_please_input + I18n.jobinfo_field_jobdesc
},
jobCron : {
- required :"请输入“Cron”."
+ required : I18n.system_please_input + "Cron"
},
author : {
- required : "请输入“负责人”."
+ required : I18n.system_please_input + I18n.jobinfo_field_author
}
},
highlight : function(element) {
@@ -426,8 +421,8 @@ $(function() {
if (data.code == "200") {
$('#updateModal').modal('hide');
layer.open({
- title: '系统提示',
- content: '更新成功',
+ title: I18n.system_tips ,
+ content: I18n.system_update_suc ,
icon: '1',
end: function(layero, index){
//window.location.reload();
@@ -436,8 +431,8 @@ $(function() {
});
} else {
layer.open({
- title: '系统提示',
- content: (data.msg || "更新失败"),
+ title: I18n.system_tips ,
+ content: (data.msg || I18n.system_update_fail ),
icon: '2'
});
}
@@ -448,4 +443,20 @@ $(function() {
$("#updateModal .form")[0].reset()
});
+ /**
+ * find title by name, GlueType
+ */
+ function findGlueTypeTitle(glueType) {
+ var glueTypeTitle;
+ $("#addModal .form select[name=glueType] option").each(function () {
+ var name = $(this).val();
+ var title = $(this).text();
+ if (glueType == name) {
+ glueTypeTitle = title;
+ return false
+ }
+ });
+ return glueTypeTitle;
+ }
+
});