* Modify job exec check.
This commit is contained in:
+13
-1
@@ -49,12 +49,24 @@ class job extends control
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->app->loadLang('compile');
|
||||
$this->view->jobList = $this->job->getList($repoID, $orderBy, $pager);
|
||||
$jobList = $this->job->getList($repoID, $orderBy, $pager);
|
||||
$this->loadModel('gitlab');
|
||||
foreach($jobList as $job)
|
||||
{
|
||||
$job->canExec = true;
|
||||
if($job->engine == 'gitlab')
|
||||
{
|
||||
$pipeline = json_decode($job->pipeline);
|
||||
$branch = $this->gitlab->apiGetSingleBranch($job->server, $pipeline->project, $pipeline->reference);
|
||||
if($branch and isset($branch->can_push) and !$branch->can_push) $job->canExec = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->job->browse;
|
||||
$this->view->position[] = $this->lang->ci->job;
|
||||
$this->view->position[] = $this->lang->job->browse;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->jobList = $jobList;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<?php
|
||||
common::printIcon('compile', 'browse', "repoID={$job->repo}&jobID=$id", '', 'list', 'history');
|
||||
common::printIcon('job', 'edit', "jobID=$id", '', 'list', 'edit');
|
||||
common::printIcon('job', 'exec', "jobID=$id", '', 'list', 'play');
|
||||
common::printIcon('job', 'exec', "jobID=$id", '', 'list', 'play', '', $job->canExec ? '' : 'disabled');
|
||||
if(common::hasPriv('job', 'delete')) echo html::a($this->createLink('job', 'delete', "jobID=$id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->job->delete}' class='btn'");
|
||||
?>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user