diff --git a/module/jenkins/control.php b/module/jenkins/control.php index d6e0a4d275..3bb59632bb 100644 --- a/module/jenkins/control.php +++ b/module/jenkins/control.php @@ -125,9 +125,9 @@ class jenkins extends control */ public function ajaxGetJenkinsTasks($id) { - if(empty($id)) return print(''); + if(empty($id)) return print(json_encode(array('' => ''))); - $this->view->tasks = $this->jenkins->getTasks($id, 3); - $this->display(); + $tasks = $this->jenkins->getTasks($id); + echo json_encode($tasks); } } diff --git a/module/job/js/create.js b/module/job/js/create.js index 395f47d0cb..cd188907e9 100644 --- a/module/job/js/create.js +++ b/module/job/js/create.js @@ -18,7 +18,7 @@ $(document).ready(function() $('#frameBox .loading').remove(); $('#frameBox .input-group').append(html); $('#frameBox #frame').chosen(); - + $('#frame').change(); } getFrameSelect(''); @@ -171,16 +171,23 @@ $(document).ready(function() $('#jkServer').change(function() { var jenkinsID = $(this).val(); - $('#jenkinsServerTR .dropdown,.input-group-addon').hide(); + $('#jenkinsServerTR #jkTask').remove(); + $('#jenkinsServerTR #jkTask_chosen').remove(); $('#jenkinsServerTR .input-group').append("
"); - setJenkinsJob('', ''); - - $.get(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks) + $.getJSON(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks) { + html = "'; $('#jenkinsServerTR .loading').remove(); - $('#dropMenuTasks').html(tasks); - $('#jenkinsServerTR .dropdown,.input-group-addon').show(); - }); + $('#jenkinsServerTR .input-group').append(html); + + $('#jenkinsServerTR #jkTask').chosen({drop_direction: 'auto'}); + }) /* There has been a problem with handling the prompt label. */ $('#jkTaskLabel').remove(); @@ -246,18 +253,3 @@ $(document).ready(function() $('#engine').change(); $('#triggerType').change(); }); - -/** - * Set jenkins job. - * - * @param string $name - * @param string $task - * @access public - * @return void - */ -function setJenkinsJob(name, task) -{ - if(name) $('.jktask-label').removeClass('text-right'); - $('#jkTask').val(task); - $('.jktask-label .text').html(name); -} diff --git a/module/job/view/create.html.php b/module/job/view/create.html.php index ccdb62f149..13b7ee4f2b 100644 --- a/module/job/view/create.html.php +++ b/module/job/view/create.html.php @@ -106,17 +106,13 @@