Merge branch 'master_xieqiyu_78667' into 'master'

* Code for task#78667.

See merge request easycorp/zentaopms!6479
This commit is contained in:
孙广明
2022-12-06 08:09:59 +00:00
3 changed files with 4 additions and 38 deletions
+2 -3
View File
@@ -804,13 +804,12 @@ class projectrelease extends control
*
* @param int $projectID
* @param int $productID
* @param int $branch
* @access public
* @return void
*/
public function ajaxLoadBuilds($projectID, $productID, $branch = 0)
public function ajaxLoadBuilds($projectID, $productID)
{
$builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'notrunk,withbranch,hasproject', $projectID, 'project', '', false);
$builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk,withbranch,hasproject', $projectID, 'project', '', false);
$releasedBuilds = $this->projectrelease->getReleasedBuilds($projectID);
foreach($releasedBuilds as $build) unset($builds[$build]);
+1 -29
View File
@@ -7,36 +7,8 @@
function loadBuilds()
{
var productID = $('#product').val();
var branch = $('#branch').length == 0 ? 0 : $('#branch').val();
$('#buildBox').load(createLink('projectrelease', 'ajaxLoadBuilds', "projectID=" + projectID + "&productID=" + productID + "&branch=" + branch), function()
$('#buildBox').load(createLink('projectrelease', 'ajaxLoadBuilds', "projectID=" + projectID + "&productID=" + productID), function()
{
$('#build').attr('data-placeholder', multipleSelect).chosen();
});
}
/**
* Flush the branch when switching products.
*
* @param int $productID
* @access public
* @return void
*/
function loadBranches(productID)
{
$('#branch').remove();
$('#branch_chosen').remove();
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + '&oldBranch=0&params=active&projectID=' + projectID), function(data)
{
var $product = $('#product');
var $inputGroup = $product.closest('.input-group');
$inputGroup.find('.input-group-addon').toggleClass('hidden', !data);
if(data)
{
$inputGroup.append(data);
$inputGroup.find('#branch').attr('onchange', 'loadBuilds()');
$('#branch').css('width', '120px').chosen();
}
loadBuilds();
$inputGroup.fixInputGroup();
})
}
+1 -6
View File
@@ -39,12 +39,7 @@
<?php else:?>
<tr>
<th><?php echo $lang->release->product;?></th>
<td>
<div class='input-group'>
<?php echo html::select('product', $products, $product->id, "onchange='loadBranches(this.value)' class='form-control chosen'");?>
<?php if($product->type != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBuilds()' class='form-control chosen control-branch'");?>
</div>
</td>
<td><?php echo html::select('product', $products, $product->id, "onchange='loadBuilds()' class='form-control chosen'");?></td>
<td></td>
</tr>
<?php endif;?>