* Finish task #57664.

This commit is contained in:
caoyanyi
2022-06-21 10:33:12 +08:00
parent e138da8508
commit dfbf69a211
4 changed files with 57 additions and 28 deletions
+14 -17
View File
@@ -1,23 +1,10 @@
<?php
class mr extends control
{
/**
* The mr constructor.
* @param string $moduleName
* @param string $methodName
*/
public function __construct($moduleName = '', $methodName = '')
{
parent::__construct($moduleName, $methodName);
/* This is essential when changing tab(menu) from gitlab to repo. */
/* Optional: common::setMenuVars('devops', $this->session->repoID); */
$this->loadModel('ci')->setMenu();
}
/**
* Browse mr.
*
* @param int $repoID
* @param string $mode
* @param string $param
* @param int $objectID
@@ -28,13 +15,20 @@ class mr extends control
* @access public
* @return void
*/
public function browse($mode = 'status', $param = 'opened', $objectID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function browse($repoID = 0, $mode = 'status', $param = 'opened', $objectID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$projects = $this->mr->getAllGitlabProjects();
$MRList = $this->mr->getList($mode, $param, $orderBy, $pager, empty($projects) ? false : $projects);
$repos = $this->loadModel('repo')->getListBySCM('Gitlab');
if(empty($repos)) $this->locate($this->repo->createLink('create'));
if($repoID == 0) $repoID = $this->repo->saveState($repoID, $objectID);
$repo = $this->repo->getRepoByID($repoID);
$this->loadModel('ci')->setMenu();
$projects = $this->mr->getAllGitlabProjects($repoID);
$MRList = $this->mr->getList($mode, $param, $orderBy, $pager, empty($projects) ? false : $projects, $repoID);
/* Save current URI to session. */
$this->session->set('mrList', $this->app->getURI(true), 'repo');
@@ -62,7 +56,10 @@ class mr extends control
$this->view->pager = $pager;
$this->view->mode = $mode;
$this->view->param = $param;
$this->view->repoID = $repoID;
$this->view->objectID = $objectID;
$this->view->repos = $repos;
$this->view->repo = $repo;
$this->view->orderBy = $orderBy;
$this->view->openIDList = $openIDList;
$this->view->users = $this->loadModel('user')->getPairs('noletter');