* Modify job exec check.

This commit is contained in:
caoyanyi
2022-08-09 14:19:32 +08:00
parent 4948370489
commit af0c0d4eae
2 changed files with 14 additions and 2 deletions
+13 -1
View File
@@ -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;
+1 -1
View File
@@ -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>