diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 0193f67792..d5d3e7ceef 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -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; diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 9cc0439aa1..4b91dbc2d4 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -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; } /** diff --git a/module/gitlab/view/browse.html.php b/module/gitlab/view/browse.html.php index 3ddbdcdf5a..c4a5663170 100644 --- a/module/gitlab/view/browse.html.php +++ b/module/gitlab/view/browse.html.php @@ -46,9 +46,10 @@