Merge branch 'devops_liyuchun_47233' into 'devops19'
lyc完成任务:在禅道SonarQube项目列表页面中添加执行SonarQube按钮 See merge request easycorp/zentaopms!1397
This commit is contained in:
@@ -593,4 +593,22 @@ class jobModel extends model
|
||||
->beginIF($jobID > 0)->andWhere('id')->ne($jobID)->fi()
|
||||
->fetchAll('repo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get job pairs by sonarqube projectkeys.
|
||||
*
|
||||
* @param int $sonarqubeID
|
||||
* @param array $projectKeys
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getJobBySonarqubeProject($sonarqubeID, $projectKeys = array())
|
||||
{
|
||||
return $this->dao->select('projectKey,id')->from(TABLE_JOB)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('frame')->eq('sonarqube')
|
||||
->andWhere('sonarqubeServer')->eq($sonarqubeID)
|
||||
->andWhere('projectKey')->in($projectKeys)
|
||||
->fetchPairs();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,12 @@ class sonarqube extends control
|
||||
$keyword = fixer::input('post')->setDefault('keyword', '')->get('keyword');
|
||||
|
||||
$sonarqubeProjectList = $this->sonarqube->apiGetProjects($sonarqubeID, $keyword);
|
||||
foreach($sonarqubeProjectList as $key => $sonarqubeProject) !isset($sonarqubeProject->lastAnalysisDate) ? $sonarqubeProject->lastAnalysisDate = '' : '';
|
||||
$projectKeyList = array();
|
||||
foreach($sonarqubeProjectList as $key => $sonarqubeProject)
|
||||
{
|
||||
if(!isset($sonarqubeProject->lastAnalysisDate)) $sonarqubeProject->lastAnalysisDate = '';
|
||||
$projectKeyList[] = $sonarqubeProject->key;
|
||||
}
|
||||
|
||||
/* Data sort. */
|
||||
list($order, $sort) = explode('_', $orderBy);
|
||||
@@ -221,6 +226,7 @@ class sonarqube extends control
|
||||
$this->view->title = $this->lang->sonarqube->common . $this->lang->colon . $this->lang->sonarqube->browseProject;
|
||||
$this->view->sonarqubeID = $sonarqubeID;
|
||||
$this->view->sonarqubeProjectList = empty($sonarqubeProjectList) ? $sonarqubeProjectList: $sonarqubeProjectList[$pageID - 1];
|
||||
$this->view->projectJobPairs = $this->loadModel('job')->getJobBySonarqubeProject($sonarqubeID, $projectKeyList);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -63,6 +63,11 @@
|
||||
/* Fix error when request type is PATH_INFO and the project key contains '-'.*/
|
||||
$projectKey = str_replace('-', '*', $sonarqubeProject->key);
|
||||
common::printLink('sonarqube', 'deleteProject', "sonarqubeID=$sonarqubeID&project=$projectKey", "<i class='icon icon-trash'></i> ", 'hiddenwin', "title='{$lang->sonarqube->deleteProject}' class='btn btn-primary'");
|
||||
if(isset($projectJobPairs[$sonarqubeProject->key]))
|
||||
{
|
||||
$jobID = $projectJobPairs[$sonarqubeProject->key];
|
||||
common::printIcon('sonarqube', 'execJob', "jobID=$jobID", '', 'list', 'sonarqube', 'hiddenwin');
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user