Merge branch 'cyy_optimize' into 'zenops_41'

* Modify server delete tip.

See merge request easycorp/zentaopms!4827
This commit is contained in:
李玉春
2022-08-08 09:23:07 +00:00
24 changed files with 63 additions and 18 deletions
+1
View File
@@ -57,6 +57,7 @@ $lang->action->historyEdit = 'Der Verlauf darf nicht leer sein.';
$lang->action->noDynamic = 'Kein Verlauf. ';
$lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.';
$lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first';
$lang->action->repoNoServer = 'The repo does not belong to a server,please restore the server first';
$lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".';
$lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".';
+1
View File
@@ -57,6 +57,7 @@ $lang->action->historyEdit = 'The history EditBy cannot be empty.';
$lang->action->noDynamic = 'No dynamics. ';
$lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.';
$lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first';
$lang->action->repoNoServer = 'The repo does not belong to a server,please restore the server first';
$lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".';
$lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".';
+1
View File
@@ -57,6 +57,7 @@ $lang->action->historyEdit = "l'historique Edité Par ne peut pas être v
$lang->action->noDynamic = "Pas d'historique.";
$lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.';
$lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first';
$lang->action->repoNoServer = 'The repo does not belong to a server,please restore the server first';
$lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".';
$lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".';
+10 -7
View File
@@ -30,13 +30,16 @@ $lang->action->editComment = 'Sửa nhận xét';
$lang->action->create = 'Thêm nhận xét';
$lang->action->comment = 'Nhận xét';
$lang->action->trashTips = 'Ghi chú: Xóa trong ZenTao là hợp lệ.';
$lang->action->textDiff = 'Định dạng văn bản';
$lang->action->original = 'Định dạng gốc';
$lang->action->confirmHideAll = 'Bạn có muốn ẩn tất cả ghi nhận này?';
$lang->action->needEdit = '%s mà bạn muốn khôi phục. Vui lòng edit it.';
$lang->action->historyEdit = 'Lịch sử người cập nhật không thể trống.';
$lang->action->noDynamic = 'Không có lịch sử. ';
$lang->action->trashTips = 'Ghi chú: Xóa trong ZenTao là hợp lệ.';
$lang->action->textDiff = 'Định dạng văn bản';
$lang->action->original = 'Định dạng gốc';
$lang->action->confirmHideAll = 'Bạn có muốn ẩn tất cả ghi nhận này?';
$lang->action->needEdit = '%s mà bạn muốn khôi phục. Vui lòng edit it.';
$lang->action->historyEdit = 'Lịch sử người cập nhật không thể trống.';
$lang->action->noDynamic = 'Không có lịch sử. ';
$lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.';
$lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first';
$lang->action->repoNoServer = 'The repo does not belong to a server,please restore the server first';
$lang->action->history = new stdclass();
$lang->action->history->action = 'Liên kết';
+1
View File
@@ -57,6 +57,7 @@ $lang->action->historyEdit = '历史记录编辑不能为空。';
$lang->action->noDynamic = '暂时没有动态。';
$lang->action->undeletedTips = '该数据在版本升级过程中未参与数据归并流程,不支持还原。';
$lang->action->executionNoProject = '该执行没有所属的项目,请先还原项目再还原执行';
$lang->action->repoNoServer = '该代码库没有所属的服务器,请先还原服务器再还原代码库';
$lang->action->repeatChange = '系统内已有同名、同代号的%s,恢复后名称为\"%s\"、代号为\"%s\"。';
$lang->action->nameRepeatChange = '系统内已有同名的%s,恢复后名称为\"%s\"。';
+10
View File
@@ -1727,6 +1727,16 @@ class actionModel extends model
if((int)$projectCount == 0) return print(js::error($this->lang->action->executionNoProject));
}
if($action->objectType == 'repo')
{
$repo = $this->dao->select('*')->from(TABLE_REPO)->where('id')->eq($action->objectID)->fetch();
if($repo and in_array($repo->SCM, array('Gitlab', 'Gitea', 'Gogs')))
{
$server = $this->dao->select('*')->from(TABLE_PIPELINE)->where('id')->eq($repo->serviceHost)->andWhere('deleted')->eq('0')->fetch();
if(empty($server)) return print(js::error($this->lang->action->repoNoServer));
}
}
if($action->objectType == 'product')
{
$product = $this->dao->select('id,name,code,acl')->from(TABLE_PRODUCT)->where('id')->eq($action->objectID)->fetch();
+3 -1
View File
@@ -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);
}
}
+1 -1
View File
@@ -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);
+3 -4
View File
@@ -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);
$oldGitLab = $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);
+1 -1
View File
@@ -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);
+1
View File
@@ -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';
+1
View File
@@ -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';
+1
View File
@@ -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';
+1
View File
@@ -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';
+1
View File
@@ -5,3 +5,4 @@ $lang->pipeline->url = '服务器地址';
$lang->pipeline->token = 'Token';
$lang->pipeline->account = '用户名';
$lang->pipeline->password = '密码';
$lang->pipeline->delError = '当前服务器下有代码库,请删除代码库后操作';
+19 -1
View File
@@ -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);
-2
View File
@@ -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');
}
+1 -1
View File
@@ -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);
+1
View File
@@ -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);
+1
View File
@@ -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";
+1
View File
@@ -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";
+1
View File
@@ -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";
+1
View File
@@ -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";
+1
View File
@@ -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 = "服务器名称";