diff --git a/module/repo/config/dtable.php b/module/repo/config/dtable.php index 71a95670f0..18ef08ac6a 100644 --- a/module/repo/config/dtable.php +++ b/module/repo/config/dtable.php @@ -58,12 +58,12 @@ $config->repo->dtable->fieldList['actions']['list']['edit']['hint'] = $lang->rep $config->repo->dtable->fieldList['actions']['list']['execJob']['icon'] = 'sonarqube'; $config->repo->dtable->fieldList['actions']['list']['execJob']['hint'] = $lang->sonarqube->execJob; -$config->repo->dtable->fieldList['actions']['list']['execJob']['url'] = helper::createLink('sonarqube', 'execJob', "jobID={job}"); +$config->repo->dtable->fieldList['actions']['list']['execJob']['url'] = array('module' => 'sonarqube', 'method' => 'execJob', 'params' => "jobID={job}"); $config->repo->dtable->fieldList['actions']['list']['execJob']['className'] = 'ajax-submit'; $config->repo->dtable->fieldList['actions']['list']['reportView']['icon'] = 'audit'; $config->repo->dtable->fieldList['actions']['list']['reportView']['hint'] = $lang->sonarqube->reportView; -$config->repo->dtable->fieldList['actions']['list']['reportView']['url'] = helper::createLink('sonarqube', 'reportView', "jobID={job}"); +$config->repo->dtable->fieldList['actions']['list']['reportView']['url'] = array('module' => 'sonarqube', 'method' => 'reportView', 'params' => "jobID={job}"); $config->repo->dtable->fieldList['actions']['list']['delete']['icon'] = 'trash'; $config->repo->dtable->fieldList['actions']['list']['delete']['hint'] = $lang->repo->delete; diff --git a/module/sonarqube/model.php b/module/sonarqube/model.php index 498ddd691c..a320c80cb9 100644 --- a/module/sonarqube/model.php +++ b/module/sonarqube/model.php @@ -327,4 +327,24 @@ class sonarqubeModel extends model return $projectPairs; } + + /** + * 判断按钮是否可点击。 + * Judge an action is clickable or not. + * + * @param object $sonarqube + * @param string $action + * @access public + * @return bool + */ + public static function isClickable(object $sonarqube, string $action): bool + { + $action = strtolower($action); + + if($action == 'execjob') return $sonarqube->exec == ''; + if($action == 'reportview') return $sonarqube->report == ''; + + return true; + } + }