* Adjust job browse page loading speed.

This commit is contained in:
caoyanyi
2024-04-26 16:43:34 +08:00
parent a42e330916
commit 087cdb60aa
2 changed files with 2 additions and 32 deletions
-19
View File
@@ -549,25 +549,6 @@ class jobModel extends model
->fetchPairs();
}
/**
* 判断按钮是否可点击。
* Adjust the action is clickable.
*
* @param object $object
* @param string $action
* @param string $module
* @access public
* @return bool
*/
public static function isClickable(object $object, string $action, string $module = 'job'): bool
{
$action = strtolower($action);
if($module == 'job' && $action == 'exec') return $object->canExec;
return true;
}
/**
* 检查jenkins是否启用参数构建。
* Check if jenkins has enabled parameterized build.
+2 -13
View File
@@ -42,22 +42,11 @@ class jobZen extends job
$jobList = $this->job->getList($repoID, $orderBy, $pager);
foreach($jobList as $job)
{
$job->canExec = true;
if($job->engine == 'gitlab')
{
$pipeline = json_decode($job->pipeline);
$branch = $this->gitlab->apiGetSingleBranch($job->server, (int)$pipeline->project, $pipeline->reference);
if($branch and isset($branch->can_push) and !$branch->can_push) $job->canExec = false;
/* query buildSpec */
if(is_numeric($job->pipeline)) $job->pipeline = $this->gitlab->getProjectName($job->server, $job->pipeline);
if(isset($pipeline->reference)) $job->pipeline = $this->gitlab->getProjectName($job->server, (int)$pipeline->project);
}
elseif($job->engine == 'jenkins')
if($job->engine == 'jenkins')
{
if(strpos($job->pipeline, '/job/') !== false) $job->pipeline = trim(str_replace('/job/', '/', $job->pipeline), '/');
}
elseif($job->engine == 'gitfox')
else
{
$job->pipeline = $job->repoName;
}