Merge branch 'cyy_mr' into 'zenops_36'

* Modify repo id save.

See merge request easycorp/zentaopms!4058
This commit is contained in:
李玉春
2022-06-22 05:03:50 +00:00
3 changed files with 27 additions and 5 deletions
+8 -1
View File
@@ -12,11 +12,18 @@ class ciModel extends model
/**
* Set menu.
*
* @param int $repoID
* @access public
* @return void
*/
public function setMenu()
public function setMenu($repoID = 0)
{
if($repoID)
{
if(!session_id()) session_start();
$this->session->set('repoID', $repoID);
session_write_close();
}
common::setMenuVars('devops', $this->session->repoID);
}
+18 -3
View File
@@ -1,6 +1,20 @@
<?php
class mr extends control
{
/**
* The gitlab 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); */
if($this->app->getMethodName() != 'browse') $this->loadModel('ci')->setMenu();
}
/**
* Browse mr.
*
@@ -23,9 +37,10 @@ class mr extends control
$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();
$repoID = $this->repo->saveState($repoID, $objectID);
$repo = $this->repo->getRepoByID($repoID);
if($repo->SCM != 'Gitlba') $repo = $repos[0];
$this->loadModel('ci')->setMenu($repo->id);
$projects = $this->mr->getAllGitlabProjects($repoID);
$MRList = $this->mr->getList($mode, $param, $orderBy, $pager, empty($projects) ? false : $projects, $repoID);
+1 -1
View File
@@ -11,7 +11,7 @@
<?php include '../../common/view/header.html.php';?>
<div id="mainMenu" class="clearfix">
<div class='btn-toolbar pull-left'>
<div class='btn-group'>
<div class='btn-group' id="swapper">
<a href='javascript:;' class='btn btn-link btn-limit text-ellipsis' data-toggle='dropdown' style="max-width: 120px;">
<span class='text' title='<?php echo $repo->name;?>'><?php echo $repo->name;?></span> <span class='caret'></span>
</a>