Merge branch 'devops24_cyy' into 'devops24'

Fix bug #20626.

See merge request easycorp/zentaopms!2302
This commit is contained in:
李玉春
2022-03-16 07:51:47 +00:00
3 changed files with 33 additions and 1 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ js::set('revision', '');
<td>
<div class='input-group'>
<?php echo $productSelect?>
<?php if($branches) echo html::select('branch', $branches, '', "class='form-control' style='width:95px'");?>
<?php if($branches) echo html::select('branch', $branches, '', "class='form-control' style='width:95px' onchange='loadBranch(this)'");?>
</div>
</td>
<th><?php echo $lang->repo->module?></th>
+14
View File
@@ -1266,4 +1266,18 @@ class repo extends control
{
return $this->send(array('status' => 'success', 'rules' => $this->config->repo->rules));
}
/**
* Ajax get executions.
*
* @param int $productID
* @param int $branch
* @access public
* @return void
*/
public function ajaxGetExecutions($productID, $branch = 0)
{
$executions = $this->repo->getExecutionPairs($productID, $branch);
echo html::select('execution', array('' => '') + $executions, '', 'class="form-control chosen"');
}
}
+18
View File
@@ -206,6 +206,8 @@ class repoModel extends model
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->gitlabProject)
->setIf($this->post->SCM == 'Gitlab', 'prefix', '')
->setIf($this->post->SCM == 'Git', 'account', '')
->setIf($this->post->SCM == 'Git', 'password', '')
->skipSpecial('path,client,account,password')
->setDefault('product', '')
->join('product', ',')
@@ -1968,4 +1970,20 @@ class repoModel extends model
$this->fixCommit($repoID);
}
/**
* Get execution pairs.
*
* @param int $product
* @param int $branch
* @access public
* @return array
*/
public function getExecutionPairs($product, $branch = 0)
{
$pairs = array();
$executions = $this->loadModel('execution')->getList(0, 'all', 'undone', 0, $product, $branch);
foreach($executions as $execution) $pairs[$execution->id] = $execution->name;
return $pairs;
}
}