From 3075732c2bc17f42d552dd2f6daa2513ffe1942b Mon Sep 17 00:00:00 2001 From: wangyuting <851424971@qq.com> Date: Thu, 24 Nov 2022 05:01:52 +0000 Subject: [PATCH] * Fix bug #30033. --- module/build/control.php | 14 ++++++++++++++ module/build/js/create.js | 12 +++++++++++- module/build/view/create.html.php | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index 66f90a99b4..ec6d3e8bc3 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -531,6 +531,20 @@ class build extends control } } + /** + * Ajax get last build. + * + * @param int $projectID + * @param int $executionID + * @access public + * @return string + */ + public function ajaxGetLastBuild($projectID, $executionID) + { + $lastBuild = $this->build->getLast($executionID, $projectID); + echo "
  " . $this->lang->build->last . ": " . $lastBuild->name . "
"; + } + /** * Link stories. * diff --git a/module/build/js/create.js b/module/build/js/create.js index 217ea6e9a6..89ef6e4d2b 100644 --- a/module/build/js/create.js +++ b/module/build/js/create.js @@ -1,6 +1,6 @@ $().ready(function() { - $('#lastBuildBtn').click(function() + $(document).on('click', '#lastBuildBtn', function() { $('#name').val($(this).text()).focus(); }); @@ -66,4 +66,14 @@ function loadProducts(executionID) loadBranches($("#product").val()); } }); + loadLastBuild(); +} + +function loadLastBuild() +{ + var executionID = $('#execution').val(); + $.get(createLink('build', 'ajaxGetLastBuild', 'projectID=' + projectID + '&executionID=' + executionID), function(data) + { + if(data) $('#lastBuildBox').html(data); + }); } diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index 6458231bb3..1c772f2144 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -58,7 +58,7 @@ build->name;?> - +
  build->last . ': ' . $lastBuild->name . '';?>