From cb6d24b7ff1f0c8720765a6a9cf39c6d82da2c3d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 20 Feb 2020 15:34:00 +0800 Subject: [PATCH] * code for task #6888. --- module/integration/css/create.css | 9 +--- module/integration/css/edit.css | 9 +--- module/integration/js/create.js | 17 ++++--- module/integration/js/edit.js | 67 ++++++++++++++----------- module/integration/lang/zh-cn.php | 1 + module/integration/view/create.html.php | 2 +- module/integration/view/edit.html.php | 5 +- 7 files changed, 56 insertions(+), 54 deletions(-) diff --git a/module/integration/css/create.css b/module/integration/css/create.css index acd32fac18..3f41118252 100644 --- a/module/integration/css/create.css +++ b/module/integration/css/create.css @@ -1,7 +1,2 @@ -.row.text-with-input .col { - line-height: 32px; -} - -.only-pick-time thead th, .only-pick-time tfoot th { - color: transparent !important; -} +.row.text-with-input .col{line-height: 32px;} +.only-pick-time thead th, .only-pick-time tfoot th {color: transparent !important;} diff --git a/module/integration/css/edit.css b/module/integration/css/edit.css index acd32fac18..88df220e48 100644 --- a/module/integration/css/edit.css +++ b/module/integration/css/edit.css @@ -1,7 +1,2 @@ -.row.text-with-input .col { - line-height: 32px; -} - -.only-pick-time thead th, .only-pick-time tfoot th { - color: transparent !important; -} +.row.text-with-input .col {line-height: 32px;} +.only-pick-time thead th, .only-pick-time tfoot th {color: transparent !important;} diff --git a/module/integration/js/create.js b/module/integration/js/create.js index 23d8f2b937..81467fb498 100644 --- a/module/integration/js/create.js +++ b/module/integration/js/create.js @@ -61,14 +61,9 @@ $(document).on('change', '#svnFolder', function() }) }) -$(function() -{ - $('#repo').change(); - triggerTypeChanged(triggerType); -}); - -function triggerTypeChanged(type) +$('#triggerType').change(function() { + var type = $(this).val(); if(type == 'tag') { $('.tag-fields').removeClass('hidden'); @@ -92,7 +87,13 @@ function triggerTypeChanged(type) var val = $("input[name='scheduleType']:checked").val(); scheduleTypeChanged(val ? val : 'custom'); } -} +}); + +$(function() +{ + $('#repo').change(); + $('#triggerType').change(); +}); function scheduleTypeChanged(type) { diff --git a/module/integration/js/edit.js b/module/integration/js/edit.js index 8794917787..4508e54151 100644 --- a/module/integration/js/edit.js +++ b/module/integration/js/edit.js @@ -63,56 +63,65 @@ $(document).on('change', '#svnFolder', function() }) }) -$(function() +$('#triggerType').change(function() { - $('#repo').change(); - triggerTypeChanged(triggerType); -}); - -function execJob(id) { - var link = createLink('integration', 'exec', 'id=' + id); - $.ajax({ - type:"POST", - url: link, - data: {}, - datatype: "json", - success:function(str) - { - $('.exe-job-button').tooltip('show', '发送执行请求成功!'); - } - }); -} - -function triggerTypeChanged(type) { - if(type == 'tag') { + var type = $(this).val(); + if(type == 'tag') + { $('.tag-fields').removeClass('hidden'); $('.comment-fields').addClass('hidden'); scheduleTypeChanged(); - } else if(type == 'commit') { + } + else if(type == 'commit') + { $('.tag-fields').addClass('hidden'); $('.comment-fields').removeClass('hidden'); - $('.custom-fields').addClass('hidden'); scheduleTypeChanged(); - } else if(type == 'schedule') { + } + else if(type == 'schedule') + { $('.tag-fields').addClass('hidden'); $('.comment-fields').addClass('hidden'); var val = $("input[name='scheduleType']:checked").val(); scheduleTypeChanged(val? val: 'custom'); } +}); + +$(function() +{ + $('#repo').change(); + $('#triggerType').change(); +}); + +function execJob(id) +{ + $.ajax( + { + type:"POST", + url: createLink('integration', 'exec', 'id=' + id), + data: {}, + datatype: "json", + success:function(data) + { + $('.exe-job-button').tooltip('show', sendExec); + } + }); } -function scheduleTypeChanged(type) { - if(type == 'custom') { +function scheduleTypeChanged(type) +{ + if(type == 'custom') + { $('.schedule-fields').removeClass('hidden'); - $('.custom-fields').removeClass('hidden'); - } else { + } + else + { $('.schedule-fields').addClass('hidden'); - $('.custom-fields').addClass('hidden'); } } diff --git a/module/integration/lang/zh-cn.php b/module/integration/lang/zh-cn.php index 8195a9d6e0..8ad5e03d2e 100644 --- a/module/integration/lang/zh-cn.php +++ b/module/integration/lang/zh-cn.php @@ -30,6 +30,7 @@ $lang->integration->example = '举例'; $lang->integration->tagEx = 'build_#15,其中15为Jenkins任务编号'; $lang->integration->commitEx = 'start build #15,其中15为Jenkins任务编号'; $lang->integration->cronSample = '如 0 0 2 * * 2-6/1 表示每个工作日凌晨2点'; +$lang->integration->sendExec = '发送执行请求成功!'; $lang->integration->dayTypeList['workDay'] = '工作日'; $lang->integration->dayTypeList['everyDay'] = '每天'; diff --git a/module/integration/view/create.html.php b/module/integration/view/create.html.php index 8df29c404d..d0b5179ae1 100644 --- a/module/integration/view/create.html.php +++ b/module/integration/view/create.html.php @@ -42,7 +42,7 @@ integration->triggerType; ?> - integration->triggerTypeList, '', "onchange='triggerTypeChanged(this.value)' class='form-control chosen'"); ?> + integration->triggerTypeList, '', "class='form-control chosen'");?> diff --git a/module/integration/view/edit.html.php b/module/integration/view/edit.html.php index a7f8335169..f2205570bc 100644 --- a/module/integration/view/edit.html.php +++ b/module/integration/view/edit.html.php @@ -45,7 +45,7 @@ integration->triggerType; ?> - integration->triggerTypeList, $job->triggerType, "onchange='triggerTypeChanged(this.value)' class='form-control chosen'"); ?> + integration->triggerTypeList, $job->triggerType, "class='form-control chosen'"); ?> @@ -77,7 +77,7 @@ repo, 'Git'));?>   - integration->execNow, "onclick=execJob($job->id) data-tip-class='tooltip-success'", "btn btn-info exe-job-button");?> + integration->execNow, "onclick=execJob($job->id) data-tip-class='tooltip-success'", "btn btn-info exe-job-button");?> @@ -85,4 +85,5 @@ +integration->sendExec);?>