* Adjust Gitlab list function.

This commit is contained in:
lichengjun
2021-08-18 08:49:02 +00:00
parent 6648beb067
commit 34391dbe4c
4 changed files with 22 additions and 33 deletions
+8 -1
View File
@@ -29,8 +29,15 @@ class gitlab extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$gitlabList = $this->gitlab->getList($orderBy, $pager);
foreach($gitlabList as $gitlab)
{
$token = $this->gitlab->apiGetCurrentUser($gitlab->url,$gitlab->token);
$gitlab->isAdminToken = $token->is_admin;
}
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->browse;
$this->view->gitlabList = $this->gitlab->getList($orderBy, $pager);
$this->view->gitlabList = $gitlabList;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
+2 -27
View File
@@ -34,34 +34,9 @@ class gitlabModel extends model
*/
public function getList($orderBy = 'id_desc', $pager = null)
{
$pipeline = $this->loadModel('pipeline')->getList('gitlab', $orderBy, $pager);
$gitlabList = $this->loadModel('pipeline')->getList('gitlab', $orderBy, $pager);
$lists = array();
foreach ($pipeline as $pipelineGitlab)
{
$token = $this->apiGetCurrentUser($pipelineGitlab->url,$pipelineGitlab->token);
$list = new stdclass;
$list->id = $pipelineGitlab->id;
$list->type = $pipelineGitlab->type;
$list->name = $pipelineGitlab->name;
$list->url = $pipelineGitlab->url;
$list->account = $pipelineGitlab->account;
$list->password = $pipelineGitlab->password;
$list->token = $pipelineGitlab->token;
$list->private = $pipelineGitlab->private;
$list->createdBy = $pipelineGitlab->createdBy;
$list->createdDate = $pipelineGitlab->createdDate;
$list->editedBy = $pipelineGitlab->editedBy;
$list->editedDate = $pipelineGitlab->editedDate;
$list->deleted = $pipelineGitlab->deleted;
$list->is_admin = $token->is_admin;
$lists[] = $list;
}
return $lists;
return $gitlabList;
}
/**
+4 -3
View File
@@ -46,9 +46,10 @@
<td class='text' title='<?php echo $gitlab->url;?>'><?php echo $gitlab->url;?></td>
<td class='c-actions text-left'>
<?php
common::printIcon('gitlab', 'edit', "gitlabID=$id", '', 'list', 'edit');
common::printIcon('gitlab', 'bindUser', "id=$id", '', 'list', 'group');
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'delete', "gitlabID=$id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->delete}' class='btn'");
$disabled = !empty($gitlab->isAdminToken) ? '' : 'disabled';
common::printLink('gitlab', 'edit', "gitlabID=$id", "<i class='icon icon-edit'></i> ", '',"title={$lang->gitlab->edit} class='btn btn-primary {$disabled}'");
common::printLink('gitlab', 'bindUser', "id=$id", "<i class='icon icon-group'></i> ", '', "title={$lang->gitlab->bindUser} class='btn btn-primary {$disabled}'");
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'delete', "gitlabID=$id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->delete}' class='btn {$disabled}'");
?>
</td>
</tr>
+8 -2
View File
@@ -63,6 +63,7 @@ $lang->moduleOrder[205] = 'cron';
$lang->moduleOrder[210] = 'dev';
$lang->moduleOrder[215] = 'message';
$lang->moduleOrder[220] = 'gitlab';
$lang->moduleOrder[225] = 'mr';
$lang->resource = new stdclass();
@@ -1132,13 +1133,13 @@ $lang->svn->methodOrder[15] = 'apiSync';
/* GitLab. */
$lang->resource->gitlab = new stdclass();
$lang->resource->gitlab->browse = 'browse';
$lang->resource->gitlab->create = 'create';
$lang->resource->gitlab->edit = 'edit';
$lang->resource->gitlab->importIssue = 'importIssue';
$lang->resource->gitlab->delete = 'delete';
$lang->resource->gitlab->bindUser = 'bindUser';
$lang->resource->gitlab->bindProduct = 'bindProduct';
//$lang->resource->gitlab->webhook = 'webhook';
$lang->gitlab->methodOrder[5] = 'browse';
@@ -1147,9 +1148,14 @@ $lang->gitlab->methodOrder[15] = 'edit';
$lang->gitlab->methodOrder[20] = 'importIssue';
$lang->gitlab->methodOrder[30] = 'delete';
$lang->gitlab->methodOrder[35] = 'bindUser';
$lang->gitlab->methodOrder[40] = 'bindProduct';
//$lang->gitlab->methodOrder[45] = 'webhook';
/* merge request. */
$lang->resource->mr = new stdclass();
$lang->resource->mr->common = "common";
$lang->mr->methodOrder[5] = 'common';
/* Git. */
$lang->resource->git = new stdclass();
$lang->resource->git->diff = 'diff';