* Modify server delete tip.
This commit is contained in:
+3
-1
@@ -31,7 +31,9 @@ class ciModel extends model
|
||||
$repo = $this->loadModel('repo')->getRepoByID($this->session->repoID);
|
||||
if(!empty($repo) and !in_array(strtolower($repo->SCM), $this->config->repo->gitServiceList)) unset($this->lang->devops->menu->mr);
|
||||
|
||||
$this->lang->switcherMenu = $this->loadModel('repo')->getSwitcher($this->session->repoID);
|
||||
$tab = $this->app->tab;
|
||||
$repos = $this->repo->getRepoPairs($tab);
|
||||
if(count($repos) > 1) $this->lang->switcherMenu = $this->loadModel('repo')->getSwitcher($this->session->repoID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,9 +141,9 @@ class gitea extends control
|
||||
{
|
||||
if($confirm != 'yes') return print(js::confirm($this->lang->gitea->confirmDelete, inlink('delete', "id=$giteaID&confirm=yes")));
|
||||
|
||||
|
||||
$oldGitea = $this->loadModel('pipeline')->getByID($giteaID);
|
||||
$actionID = $this->pipeline->delete($giteaID, 'gitea');
|
||||
if(!$actionID) return print(js::error($this->lang->pipeline->delError));
|
||||
|
||||
$gitea = $this->pipeline->getByID($giteaID);
|
||||
$changes = common::createChanges($oldGitea, $gitea);
|
||||
|
||||
@@ -228,11 +228,10 @@ class gitlab extends control
|
||||
{
|
||||
if($confirm != 'yes') return print(js::confirm($this->lang->gitlab->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
|
||||
|
||||
$oldGitLab = $this->gitlab->getByID($id);
|
||||
$this->loadModel('action');
|
||||
$this->gitlab->delete(TABLE_PIPELINE, $id);
|
||||
$oldGitea = $this->loadModel('pipeline')->getByID($id);
|
||||
$actionID = $this->pipeline->delete($id, 'gitlab');
|
||||
if(!$actionID) return print(js::error($this->lang->pipeline->delError));
|
||||
|
||||
$actionID = $this->dao->lastInsertID();
|
||||
$gitLab = $this->gitlab->getByID($id);
|
||||
$changes = common::createChanges($oldGitLab, $gitLab);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
@@ -141,9 +141,9 @@ class gogs extends control
|
||||
{
|
||||
if($confirm != 'yes') return print(js::confirm($this->lang->gogs->confirmDelete, inlink('delete', "id=$gogsID&confirm=yes")));
|
||||
|
||||
|
||||
$oldGogs = $this->loadModel('pipeline')->getByID($gogsID);
|
||||
$actionID = $this->pipeline->delete($gogsID, 'gogs');
|
||||
if(!$actionID) return print(js::error($this->lang->pipeline->delError));
|
||||
|
||||
$gogs = $this->pipeline->getByID($gogsID);
|
||||
$changes = common::createChanges($oldGogs, $gogs);
|
||||
|
||||
@@ -5,3 +5,4 @@ $lang->pipeline->url = 'Server URL';
|
||||
$lang->pipeline->token = 'Token';
|
||||
$lang->pipeline->account = 'Username';
|
||||
$lang->pipeline->password = 'Password';
|
||||
$lang->pipeline->delError = 'The server has some repos, please delete them and operate';
|
||||
|
||||
@@ -5,3 +5,4 @@ $lang->pipeline->url = 'Server URL';
|
||||
$lang->pipeline->token = 'Token';
|
||||
$lang->pipeline->account = 'Username';
|
||||
$lang->pipeline->password = 'Password';
|
||||
$lang->pipeline->delError = 'The server has some repos, please delete them and operate';
|
||||
|
||||
@@ -5,3 +5,4 @@ $lang->pipeline->url = 'Server URL';
|
||||
$lang->pipeline->token = 'Token';
|
||||
$lang->pipeline->account = 'Username';
|
||||
$lang->pipeline->password = 'Password';
|
||||
$lang->pipeline->delError = 'The server has some repos, please delete them and operate';
|
||||
|
||||
@@ -5,3 +5,4 @@ $lang->pipeline->url = 'Server URL';
|
||||
$lang->pipeline->token = 'Token';
|
||||
$lang->pipeline->account = 'Username';
|
||||
$lang->pipeline->password = 'Password';
|
||||
$lang->pipeline->delError = 'The server has some repos, please delete them and operate';
|
||||
|
||||
@@ -5,3 +5,4 @@ $lang->pipeline->url = '服务器地址';
|
||||
$lang->pipeline->token = 'Token';
|
||||
$lang->pipeline->account = '用户名';
|
||||
$lang->pipeline->password = '密码';
|
||||
$lang->pipeline->delError = '当前服务器下有代码库,请删除代码库后操作';
|
||||
|
||||
@@ -131,10 +131,28 @@ class pipelineModel extends model
|
||||
* @param string $id the id to be deleted
|
||||
* @param string $object the action object
|
||||
* @access public
|
||||
* @return int
|
||||
* @return int|bool
|
||||
*/
|
||||
public function delete($id, $object = 'gitlab')
|
||||
{
|
||||
if(in_array($object, array('gitlab', 'gitea', 'gogs')))
|
||||
{
|
||||
$repo = $this->dao->select('*')->from(TABLE_REPO)
|
||||
->where('deleted')->eq('0')
|
||||
->andWhere('SCM')->eq(ucfirst($object))
|
||||
->andWhere('serviceHost')->eq($id)
|
||||
->fetch();
|
||||
if($repo) return false;
|
||||
}
|
||||
elseif($object == 'sonarqube')
|
||||
{
|
||||
$job = $this->dao->select('id,name,repo,deleted')->from(TABLE_JOB)
|
||||
->where('frame')->eq('sonarqube')
|
||||
->andWhere('server')->eq($id)
|
||||
->andWhere('deleted')->eq('0')
|
||||
->fetch();
|
||||
if($job) return false;
|
||||
}
|
||||
$this->dao->update(TABLE_PIPELINE)->set('deleted')->eq(1)->where('id')->eq($id)->exec();
|
||||
$this->loadModel('action')->create($object, $id, 'deleted', '', ACTIONMODEL::CAN_UNDELETED);
|
||||
|
||||
|
||||
@@ -57,14 +57,12 @@ function scmChanged(scm)
|
||||
if(scm == 'Git' || scm == 'Gitea' || scm == 'Gogs')
|
||||
{
|
||||
$('.account-fields').addClass('hidden');
|
||||
|
||||
$('.tips-git').removeClass('hidden');
|
||||
$('.tips-svn').addClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.account-fields').removeClass('hidden');
|
||||
|
||||
$('.tips-git').addClass('hidden');
|
||||
$('.tips-svn').removeClass('hidden');
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class repoModel extends model
|
||||
}
|
||||
|
||||
if(!in_array(strtolower($repo->SCM), $this->config->repo->gitServiceList)) unset($this->lang->devops->menu->mr);
|
||||
$this->lang->switcherMenu = $this->getSwitcher($repoID);
|
||||
if(count($repos) > 1) $this->lang->switcherMenu = $this->getSwitcher($repoID);
|
||||
}
|
||||
|
||||
common::setMenuVars('devops', $repoID);
|
||||
|
||||
@@ -215,6 +215,7 @@ class sonarqube extends control
|
||||
$oldSonarQube = $this->loadModel('pipeline')->getByID($sonarqubeID);
|
||||
$this->loadModel('action');
|
||||
$actionID = $this->pipeline->delete($sonarqubeID, 'sonarqube');
|
||||
if($actionID) return print(js::error($this->lang->sonarqube->delError));
|
||||
|
||||
$sonarQube = $this->pipeline->getByID($sonarqubeID);
|
||||
$changes = common::createChanges($oldSonarQube, $sonarQube);
|
||||
|
||||
@@ -16,6 +16,7 @@ $lang->sonarqube->desc = 'Description';
|
||||
$lang->sonarqube->reportView = "SonarQube Report";
|
||||
$lang->sonarqube->browseIssue = "SonarQube Issue List";
|
||||
$lang->sonarqube->createBug = "Create Bug";
|
||||
$lang->sonarqube->delError = "There are bound jobs under this server, please delete the association and then operate";
|
||||
|
||||
$lang->sonarqube->id = 'ID';
|
||||
$lang->sonarqube->name = "Server Name";
|
||||
|
||||
@@ -16,6 +16,7 @@ $lang->sonarqube->desc = 'Description';
|
||||
$lang->sonarqube->reportView = "SonarQube Report";
|
||||
$lang->sonarqube->browseIssue = "SonarQube Issue List";
|
||||
$lang->sonarqube->createBug = "Create Bug";
|
||||
$lang->sonarqube->delError = "There are bound jobs under this server, please delete the association and then operate";
|
||||
|
||||
$lang->sonarqube->id = 'ID';
|
||||
$lang->sonarqube->name = "Server Name";
|
||||
|
||||
@@ -16,6 +16,7 @@ $lang->sonarqube->desc = 'Description';
|
||||
$lang->sonarqube->reportView = "SonarQube Report";
|
||||
$lang->sonarqube->browseIssue = "SonarQube Issue List";
|
||||
$lang->sonarqube->createBug = "Create Bug";
|
||||
$lang->sonarqube->delError = "There are bound jobs under this server, please delete the association and then operate";
|
||||
|
||||
$lang->sonarqube->id = 'ID';
|
||||
$lang->sonarqube->name = "Server Name";
|
||||
|
||||
@@ -16,6 +16,7 @@ $lang->sonarqube->desc = 'Description';
|
||||
$lang->sonarqube->reportView = "SonarQube Report";
|
||||
$lang->sonarqube->browseIssue = "SonarQube Issue List";
|
||||
$lang->sonarqube->createBug = "Create Bug";
|
||||
$lang->sonarqube->delError = "There are bound jobs under this server, please delete the association and then operate";
|
||||
|
||||
$lang->sonarqube->id = 'ID';
|
||||
$lang->sonarqube->name = "Server Name";
|
||||
|
||||
@@ -16,6 +16,7 @@ $lang->sonarqube->desc = '描述';
|
||||
$lang->sonarqube->reportView = "SonarQube报告";
|
||||
$lang->sonarqube->browseIssue = "SonarQube问题列表";
|
||||
$lang->sonarqube->createBug = "转bug";
|
||||
$lang->sonarqube->delError = "该服务器下有绑定的构建,请删除关联之后操作";
|
||||
|
||||
$lang->sonarqube->id = 'ID';
|
||||
$lang->sonarqube->name = "服务器名称";
|
||||
|
||||
Reference in New Issue
Block a user