+ Add reportview page for sonarqube.
This commit is contained in:
@@ -51,4 +51,5 @@ $config->sonarqube->actionList['reportView']['icon'] = 'audit';
|
||||
$config->sonarqube->actionList['reportView']['text'] = $lang->sonarqube->reportView;
|
||||
$config->sonarqube->actionList['reportView']['hint'] = $lang->sonarqube->reportView;
|
||||
$config->sonarqube->actionList['reportView']['data-toggle'] = 'modal';
|
||||
$config->sonarqube->actionList['reportView']['data-size'] = 'lg';
|
||||
$config->sonarqube->actionList['reportView']['url'] = helper::createLink('sonarqube', 'reportView',"jobID={jobID}");
|
||||
|
||||
@@ -57,3 +57,25 @@ $config->sonarqube->dtable->project->fieldList['actions']['title'] = $lang->acti
|
||||
$config->sonarqube->dtable->project->fieldList['actions']['type'] = 'actions';
|
||||
$config->sonarqube->dtable->project->fieldList['actions']['menu'] = array('deleteProject', 'execJob', 'reportView');
|
||||
$config->sonarqube->dtable->project->fieldList['actions']['list'] = $config->sonarqube->actionList;
|
||||
|
||||
$config->sonarqube->dtable->report = new stdclass();
|
||||
$config->sonarqube->dtable->report->fieldList['bugs']['title'] = array('html' => '<i class="icon icon-bug"></i>' . $lang->sonarqube->report->bugs);
|
||||
$config->sonarqube->dtable->report->fieldList['bugs']['type'] = 'text';
|
||||
|
||||
$config->sonarqube->dtable->report->fieldList['vulnerabilities']['title'] = array('html' => '<i class="icon icon-unlock"></i>' . $lang->sonarqube->report->vulnerabilities);
|
||||
$config->sonarqube->dtable->report->fieldList['vulnerabilities']['type'] = 'text';
|
||||
|
||||
$config->sonarqube->dtable->report->fieldList['security_hotspots_reviewed']['title'] = array('html' => '<i class="icon icon-shield"></i>' . $lang->sonarqube->report->security_hotspots_reviewed);
|
||||
$config->sonarqube->dtable->report->fieldList['security_hotspots_reviewed']['type'] = 'text';
|
||||
|
||||
$config->sonarqube->dtable->report->fieldList['code_smells']['title'] = array('html' => '<i class="icon icon-frown"></i>' . $lang->sonarqube->report->code_smells);
|
||||
$config->sonarqube->dtable->report->fieldList['code_smells']['type'] = 'text';
|
||||
|
||||
$config->sonarqube->dtable->report->fieldList['coverage']['title'] = $lang->sonarqube->report->coverage;
|
||||
$config->sonarqube->dtable->report->fieldList['coverage']['type'] = 'text';
|
||||
|
||||
$config->sonarqube->dtable->report->fieldList['duplicated_lines_density']['title'] = $lang->sonarqube->report->duplicated_lines_density;
|
||||
$config->sonarqube->dtable->report->fieldList['duplicated_lines_density']['type'] = 'text';
|
||||
|
||||
$config->sonarqube->dtable->report->fieldList['ncloc']['title'] = $lang->sonarqube->report->ncloc;
|
||||
$config->sonarqube->dtable->report->fieldList['ncloc']['type'] = 'text';
|
||||
|
||||
@@ -67,7 +67,7 @@ class sonarqube extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function reportView($jobID)
|
||||
public function reportView(int $jobID)
|
||||
{
|
||||
$job = $this->loadModel('job')->getByID($jobID);
|
||||
$qualitygate = $this->sonarqube->apiGetQualitygate($job->sonarqubeServer, $job->projectKey);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The yyy view file of xxx module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Yanyi Cao <caoyanyi@easycorp.ltd>
|
||||
* @package xxx
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
$report = new stdclass();
|
||||
$report->bugs = zget($measures, 'bugs', 0);
|
||||
$report->vulnerabilities = zget($measures, 'vulnerabilities', 0);
|
||||
$report->security_hotspots_reviewed = zget($measures, 'security_hotspots_reviewed', '0.0%');
|
||||
$report->code_smells = zget($measures, 'code_smells', 0);
|
||||
$report->coverage = zget($measures, 'coverage', '0.0%');
|
||||
$report->duplicated_lines_density = zget($measures, 'duplicated_lines_density', 0);
|
||||
$report->ncloc = zget($measures, 'ncloc', 0);
|
||||
|
||||
$status = zget($lang->sonarqube->qualitygateList, $qualitygate->projectStatus->status);
|
||||
$statusClass = zget($config->sonarqube->projectStatusClass, $qualitygate->projectStatus->status);
|
||||
|
||||
div
|
||||
(
|
||||
setClass('flex items-center pb-2'),
|
||||
a
|
||||
(
|
||||
setClass('article-h2'),
|
||||
$projectName,
|
||||
hasPriv('instance', 'manage') ? set::href(createLink('sonarqube', 'browseIssue', "sonarqubeID={$sonarqubeID}&project=" . str_replace('-', '*', $projectKey))) : null
|
||||
),
|
||||
label
|
||||
(
|
||||
setClass("ml-2 rounded-full {$statusClass}"),
|
||||
set::text($status)
|
||||
|
||||
),
|
||||
);
|
||||
dtable
|
||||
(
|
||||
set::className('mt-4'),
|
||||
set::cols($config->sonarqube->dtable->report->fieldList),
|
||||
set::data(array($report))
|
||||
);
|
||||
Reference in New Issue
Block a user