* Finish task #47232.
This commit is contained in:
@@ -135,6 +135,7 @@ $lang->action->objectTypes['kanbanlane'] = 'Kanban Lane';
|
||||
$lang->action->objectTypes['kanbancolumn'] = 'Kanban Column';
|
||||
$lang->action->objectTypes['kanbancard'] = 'Kanban Card';
|
||||
$lang->action->objectTypes['sonarqube'] = 'SonarQube Server';
|
||||
$lang->action->objectTypes['sonarqubeproject'] = 'SonarQube Project';
|
||||
|
||||
/* Used to describe operation history. */
|
||||
$lang->action->desc = new stdclass();
|
||||
|
||||
@@ -135,6 +135,7 @@ $lang->action->objectTypes['kanbanlane'] = '看板泳道';
|
||||
$lang->action->objectTypes['kanbancolumn'] = '看板列';
|
||||
$lang->action->objectTypes['kanbancard'] = '看板卡片';
|
||||
$lang->action->objectTypes['sonarqube'] = 'SonarQube服务器';
|
||||
$lang->action->objectTypes['sonarqubeproject'] = 'SonarQube项目';
|
||||
|
||||
/* 用来描述操作历史记录。*/
|
||||
$lang->action->desc = new stdclass();
|
||||
|
||||
@@ -66,10 +66,14 @@
|
||||
<?php $tab = '';?>
|
||||
<?php if($action->objectType == 'meeting') $tab = $action->project ? "data-app='project'" : "data-app='my'";?>
|
||||
<?php
|
||||
if(empty($action->objectName))
|
||||
if(empty($action->objectName) and $action->objectID)
|
||||
{
|
||||
echo '#' . $action->objectID;
|
||||
}
|
||||
elseif(empty($action->objectID) and $action->extra)
|
||||
{
|
||||
echo $action->extra;
|
||||
}
|
||||
elseif(empty($action->objectLink))
|
||||
{
|
||||
echo $action->objectName;
|
||||
@@ -79,8 +83,10 @@
|
||||
echo html::a($action->objectLink, $action->objectName, '', $tab);
|
||||
}
|
||||
?>
|
||||
<?php if($action->objectID):?>
|
||||
<span class="label label-id"><?php echo $action->objectID;?></span>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -183,13 +183,13 @@ class jobModel extends model
|
||||
unset($job->gitlabRepo);
|
||||
|
||||
/* SonarQube tool is only used if the engine is JenKins. */
|
||||
if($job->engine != 'jenkins' and $job->frame == 'sonarqube')
|
||||
if($job->engine != 'jenkins' and $job->frame == 'sonarqube')
|
||||
{
|
||||
dao::$errors[]['frame'] = $this->lang->job->mustUseJenkins;
|
||||
return false;
|
||||
}
|
||||
|
||||
if($job->repo > 0 and $job->frame == 'sonarqube')
|
||||
if($job->repo > 0 and $job->frame == 'sonarqube')
|
||||
{
|
||||
$sonarqubeJob = $this->getSonarqubeByRepo(array($job->repo));
|
||||
if(!empty($sonarqubeJob))
|
||||
@@ -289,13 +289,13 @@ class jobModel extends model
|
||||
unset($job->gitlabRepo);
|
||||
|
||||
/* SonarQube tool is only used if the engine is JenKins. */
|
||||
if($job->engine != 'jenkins' and $job->frame == 'sonarqube')
|
||||
if($job->engine != 'jenkins' and $job->frame == 'sonarqube')
|
||||
{
|
||||
dao::$errors[] = $this->lang->job->mustUseJenkins;
|
||||
return false;
|
||||
}
|
||||
|
||||
if($job->repo > 0 and $job->frame == 'sonarqube')
|
||||
if($job->repo > 0 and $job->frame == 'sonarqube')
|
||||
{
|
||||
$sonarqubeJob = $this->getSonarqubeByRepo(array($job->repo), $id);
|
||||
if(!empty($sonarqubeJob))
|
||||
|
||||
@@ -175,4 +175,25 @@ class sonarqube extends control
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete project.
|
||||
*
|
||||
* @param int $sonarqubeID
|
||||
* @param string $projectKey
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteProject($sonarqubeID, $projectKey, $confirm = 'no')
|
||||
{
|
||||
if($confirm != 'yes') die(js::confirm($this->lang->sonarqube->confirmDeleteProject, inlink('deleteProject', "sonarqubeID=$sonarqubeID&projectKey=$projectKey&confirm=yes")));
|
||||
|
||||
$reponse = $this->sonarqube->apiDeleteProject($sonarqubeID, $projectKey);
|
||||
|
||||
if(isset($reponse->errors)) return print(js::alert($reponse->errors[0]->msg));
|
||||
|
||||
$this->loadModel('action')->create('sonarqubeproject', 0, 'deleted', '', $projectKey);
|
||||
return print(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ $lang->sonarqube->search = 'Search';
|
||||
$lang->sonarqube->create = 'Create SonarQube';
|
||||
$lang->sonarqube->edit = 'Edit SonarQube';
|
||||
$lang->sonarqube->delete = 'Delete SonarQube';
|
||||
$lang->sonarqube->confirmDelete = 'Do you want to delete this SonarQube server?';
|
||||
$lang->sonarqube->serverFail = 'Connect to SonarQube server failed, please check the SonarQube server.';
|
||||
$lang->sonarqube->browseProject = "SonarQube Project List";
|
||||
$lang->sonarqube->createProject = "Create SonarQube Project";
|
||||
$lang->sonarqube->deleteProject = "Delete SonarQube Project";
|
||||
$lang->sonarqube->placeholderSearch = 'Project name';
|
||||
$lang->sonarqube->execJob = "Exec SonarQube Job";
|
||||
$lang->sonarqube->desc = 'Description';
|
||||
|
||||
$lang->sonarqube->id = 'ID';
|
||||
$lang->sonarqube->name = "{$lang->sonarqube->common} Name";
|
||||
@@ -23,17 +23,18 @@ $lang->sonarqube->token = 'Token';
|
||||
$lang->sonarqube->defaultProject = 'Default Project';
|
||||
$lang->sonarqube->private = 'MD5 Verify';
|
||||
|
||||
$lang->sonarqube->createServer = 'Create SonarQube Server';
|
||||
$lang->sonarqube->desc = 'Description';
|
||||
$lang->sonarqube->createSuccess = 'Create success';
|
||||
$lang->sonarqube->createServer = 'Create SonarQube Server';
|
||||
$lang->sonarqube->createSuccess = 'Create success';
|
||||
|
||||
$lang->sonarqube->placeholder = new stdclass;
|
||||
$lang->sonarqube->placeholder->name = '';
|
||||
$lang->sonarqube->placeholder->url = "Please fill in the access address of the SonarQube Server homepage, as: https://sonarqube.zentao.net.";
|
||||
|
||||
$lang->sonarqube->repeatError = 'Server name or server address already exists!';
|
||||
$lang->sonarqube->validError = 'Sonarqube user authority authentication failed!';
|
||||
$lang->sonarqube->hostError = "Invalid SonarQube service address.";
|
||||
$lang->sonarqube->repeatError = 'Server name or server address already exists!';
|
||||
$lang->sonarqube->validError = 'Sonarqube user authority authentication failed!';
|
||||
$lang->sonarqube->hostError = "Invalid SonarQube service address.";
|
||||
$lang->sonarqube->confirmDelete = 'Do you want to delete this SonarQube server?';
|
||||
$lang->sonarqube->confirmDeleteProject = 'Do you want to delete this SonarQube project?';
|
||||
|
||||
$lang->sonarqube->projectName = 'Project Name';
|
||||
$lang->sonarqube->projectlastAnalysis = 'Last analysis time';
|
||||
|
||||
@@ -6,7 +6,6 @@ $lang->sonarqube->search = '搜索';
|
||||
$lang->sonarqube->create = '添加SonarQube';
|
||||
$lang->sonarqube->edit = '编辑SonarQube';
|
||||
$lang->sonarqube->delete = '删除SonarQube';
|
||||
$lang->sonarqube->confirmDelete = '确认删除该SonarQube吗?';
|
||||
$lang->sonarqube->serverFail = '连接SonarQube服务器异常,请检查SonarQube服务器。';
|
||||
$lang->sonarqube->browseProject = "SonarQube项目列表";
|
||||
$lang->sonarqube->createProject = "创建SonarQube项目";
|
||||
@@ -31,9 +30,11 @@ $lang->sonarqube->placeholder = new stdclass;
|
||||
$lang->sonarqube->placeholder->name = '';
|
||||
$lang->sonarqube->placeholder->url = "请填写SonarQube Server首页的访问地址,如:https://sonarqube.zentao.net。";
|
||||
|
||||
$lang->sonarqube->repeatError = "服务器名称或服务器地址已存在!";
|
||||
$lang->sonarqube->validError = "SonarQube 用户权限认证失败!";
|
||||
$lang->sonarqube->hostError = "无效的SonarQube服务地址。";
|
||||
$lang->sonarqube->repeatError = "服务器名称或服务器地址已存在!";
|
||||
$lang->sonarqube->validError = "SonarQube 用户权限认证失败!";
|
||||
$lang->sonarqube->hostError = "无效的SonarQube服务地址。";
|
||||
$lang->sonarqube->confirmDelete = '确认删除该SonarQube吗?';
|
||||
$lang->sonarqube->confirmDeleteProject = '确认删除该SonarQube项目吗?';
|
||||
|
||||
$lang->sonarqube->projectName = '项目名称';
|
||||
$lang->sonarqube->projectlastAnalysis = '最后执行时间';
|
||||
|
||||
@@ -109,4 +109,22 @@ class sonarqubeModel extends model
|
||||
|
||||
return $allResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete sonarqube project by api.
|
||||
*
|
||||
* @param int $sonarqubeID
|
||||
* @param int $projectKey
|
||||
* @access public
|
||||
* @return bool|object
|
||||
*/
|
||||
public function apiDeleteProject($sonarqubeID, $projectKey)
|
||||
{
|
||||
list($apiRoot, $header) = $this->getApiBase($sonarqubeID);
|
||||
if(!$apiRoot) return false;
|
||||
|
||||
$url = sprintf($apiRoot, "projects/delete?project=$projectKey");
|
||||
$result = json_decode(commonModel::http($url, null, array(CURLOPT_CUSTOMREQUEST => 'POST'), $header));
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user