From 4c0d583520dc8371c1ce7af0d78df2c5d5513ac6 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 16 Mar 2022 14:15:34 +0800 Subject: [PATCH] * Fix bug #20626. --- module/mr/view/header.review.html.php | 2 +- module/repo/control.php | 14 ++++++++++++++ module/repo/model.php | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/module/mr/view/header.review.html.php b/module/mr/view/header.review.html.php index 15e52c7e2a..1b6201d186 100644 --- a/module/mr/view/header.review.html.php +++ b/module/mr/view/header.review.html.php @@ -106,7 +106,7 @@ js::set('revision', '');
- +
repo->module?> diff --git a/module/repo/control.php b/module/repo/control.php index 646e7c9fdc..0717ccdbd0 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -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"'); + } } diff --git a/module/repo/model.php b/module/repo/model.php index 7e3deb9a21..e375a8db50 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -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; + } }