* Finish task #57655.

This commit is contained in:
zhouxin
2022-06-22 01:23:19 +00:00
parent cbed1964c2
commit a29205235b
4 changed files with 100 additions and 26 deletions
+17 -15
View File
@@ -46,7 +46,8 @@ class repo extends control
public function commonAction($repoID = 0, $objectID = 0)
{
$tab = $this->app->tab;
$this->repos = $this->repo->getRepoPairs($tab, $objectID);
$this->repos = $this->repo->getRepoPairs($tab, $objectID);
$this->reposGroup = $this->repo->getReposGroup($tab, $objectID);
if($tab == 'project')
{
@@ -477,20 +478,21 @@ class repo extends control
/* Synchronous commit only in root path. */
if(strpos($repo->SCM, 'Git') !== false and empty($path) and $infos and empty($revisions)) $this->locate($this->repo->createLink('showSyncCommit', "repoID=$repoID&objectID=$objectID&branch=" . base64_encode($this->cookie->repoBranch)));
$this->view->title = $this->lang->repo->common;
$this->view->repo = $repo;
$this->view->repos = $this->repos;
$this->view->revisions = $revisions;
$this->view->revision = $revision;
$this->view->infos = $infos;
$this->view->repoID = $repoID;
$this->view->branches = $branches;
$this->view->branchID = $branchID;
$this->view->objectID = $objectID;
$this->view->pager = $pager;
$this->view->path = urldecode($path);
$this->view->logType = $logType;
$this->view->cacheTime = date('m-d H:i', filemtime($cacheFile));
$this->view->title = $this->lang->repo->common;
$this->view->repo = $repo;
$this->view->reposGroup = $this->reposGroup;
$this->view->repos = $this->repos;
$this->view->revisions = $revisions;
$this->view->revision = $revision;
$this->view->infos = $infos;
$this->view->repoID = $repoID;
$this->view->branches = $branches;
$this->view->branchID = $branchID;
$this->view->objectID = $objectID;
$this->view->pager = $pager;
$this->view->path = urldecode($path);
$this->view->logType = $logType;
$this->view->cacheTime = date('m-d H:i', filemtime($cacheFile));
$this->display();
}
+9
View File
@@ -4,6 +4,15 @@
.main-row {width: 99%;}
.btn-toolbar > .last-sync-time {display: inline-block; float: left; margin-right: 10px;}
.dropdown-menu > li.selected > a:after {content: '';}
.pull-left li > a.selected {color: #e9f2fb; background-color: #16a8f8;}
.pull-left li > a {line-height: 20px; border-radius: 5px;}
.tree li.has-list.open:before {border-left: 0px;}
#mainMenu > div.btn-toolbar.pull-left > div.btn-group.open {line-height: 20px;}
#dropMenuRepo > div.table-row > div > div > ul > li {padding: 0}
#dropMenuRepo > div.table-row > div > div > ul > li > div {padding-left: 20px;}
#dropMenuRepo > div.table-row > div > div > ul > li > ul {padding-left: 10px;}
#repoList .hide-in-search .hidden {display: block !important; visibility: inherit !important;}
#repoList > ul > li > ul > li > a:hover {color: white; background-color: #0c64eb; text-decoration: none;}
.c-name {min-width: 150px;}
.c-checkbox {width: 40px;}
+38
View File
@@ -397,6 +397,44 @@ class repoModel extends model
return $repoPairs;
}
/**
* Get repos group by repo type.
*
* @param string type
* @param int $projectID
* @access public
* @return array
*/
public function getReposGroup($type, $projectID = 0)
{
$repoPairs = $this->getRepoPairs($type, $projectID);
$repos = array();
$repos['gitlab'] = array();
$repos['svn'] = array();
$repos['git'] = array();
foreach($repoPairs as $id => $repo)
{
if(strpos($repo, '[gitlab]') !== false)
{
$repo = str_replace('[gitlab]', '', $repo);
$repos['gitlab'][$id] = $repo;
}
if(strpos($repo, '[svn]') !== false)
{
$repo = str_replace('[svn]', '', $repo);
$repos['svn'][$id] = $repo;
}
if(strpos($repo, '[git]') !== false)
{
$repo = str_replace('[git]', '', $repo);
$repos['git'][$id] = $repo;
}
}
return $repos;
}
/**
* Get repo by id.
*
+36 -11
View File
@@ -11,17 +11,42 @@
<?php include '../../common/view/header.html.php';?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<div class='btn-group'>
<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>
<ul class='dropdown-menu' style='max-height:240px; max-width: 300px; overflow-y:auto'>
<?php
foreach($repos as $id => $repoName)
{
$isSelected = $id == $repoID ? 'class="selected"' : '';
echo "<li $isSelected>" . html::a($this->createLink('repo', 'browse', "repoID=$id&branchID=&objectID=$objectID"), $repoName, '', "title='{$repoName}' class='text-ellipsis' data-app='{$app->tab}'") . "</li>";
}
?>
</ul>
<div class='btn-group group'>
<button data-toggle='dropdown' type='button' class='btn btn-link btn-limit repo-select text-ellipsis' title='<?php $repos[$repoID];?>'>
<span class='text'><?php echo $repos[$repoID];?></span>
<span class='caret' style='margin-bottom: -1px'></span>
</button>
<div id='dropMenuRepo' class='dropdown-menu search-list' data-ride='searchList' data-url=''>
<div class="input-control search-box has-icon-left has-icon-right search-example">
<input type="search" class="form-control search-input" id="searchSource"/>
<label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>
<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>
</div>
<div class="table-row">
<div class="table-col col-left">
<div class="list-group" id="repoList">
<ul class='tree tree-angles' data-ride='tree'>
<?php foreach($reposGroup as $groupName => $group):?>
<?php if(empty($group)) continue;?>
<li data-idx='<?php echo $groupName;?>' data-id='<?php echo $groupName;?>' class='has-list open in' style='cursor: pointer;'><i class='list-toggle icon'></i>
<div class='hide-in-search'><a class='text-muted'><?php echo $groupName;?></a></div>
<ul data-idx='<?php echo $groupName;?>'>
<?php
foreach($group as $id => $repoName)
{
$isSelected = $id == $repoID ? 'selected' : '';
$link = $this->createLink('repo', 'browse', "repoID=$id&branchID=&objectID=$objectID");
echo "<li data-idx='$repoName' data-id='$groupName-$repoName'><a href='{$link}' id='$groupName-$repoName' class='$isSelected text-ellipsis' title='$repoName' data-key='$repoName' data-app='{$app->tab}'>$repoName</a></li>";
}
?>
</ul>
</li>
<?php endforeach;?>
</ul>
</div>
</div>
</div>
</div>
</div>
<?php if(!empty($branches)):?>
<div class='btn-group'>