Merge branch 'devops17_46142' into 'devops17'

* Finish task#46142

See merge request easycorp/zentaopms!970
This commit is contained in:
李玉春
2021-12-16 06:47:10 +00:00
6 changed files with 39 additions and 12 deletions
+2
View File
@@ -7,3 +7,5 @@ ALTER TABLE `zt_task` ADD `mr` mediumint(8) unsigned NOT NULL AFTER `repo`;
ALTER TABLE `zt_bug` ADD `mr` mediumint(8) unsigned NOT NULL AFTER `repo`;
UPDATE `zt_grouppriv` SET `method`='addReview' where `module`='mr' and `method`='addBug';
ALTER TABLE `zt_mr` ADD `removeSourceBranch` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `compileStatus`;
+3 -2
View File
@@ -56,8 +56,9 @@ $lang->mr->approvalResultList = array();
$lang->mr->approvalResultList['approve'] = 'Approve';
$lang->mr->approvalResultList['reject'] = 'Reject';
$lang->mr->needApproved = 'This MR should be approved before merge';
$lang->mr->needCI = 'This MR should be passed CI before merge';
$lang->mr->needApproved = 'This MR should be approved before merge';
$lang->mr->needCI = 'This MR should be passed CI before merge';
$lang->mr->removeSourceBranch = 'Delete source branch after merge';
$lang->mr->repeatedOperation = 'Do not repeat operations';
+3 -2
View File
@@ -56,8 +56,9 @@ $lang->mr->approvalResultList = array();
$lang->mr->approvalResultList['approve'] = '通过';
$lang->mr->approvalResultList['reject'] = '拒绝';
$lang->mr->needApproved = '需要通过评审才能合并';
$lang->mr->needCI = '需要通过构建才能合并';
$lang->mr->needApproved = '需要通过评审才能合并';
$lang->mr->needCI = '需要通过构建才能合并';
$lang->mr->removeSourceBranch = '合并后删除源分支';
$lang->mr->repeatedOperation = '请勿重复操作';
+12 -8
View File
@@ -87,6 +87,7 @@ class mrModel extends model
$MR = fixer::input('post')
->setDefault('jobID', 0)
->setDefault('repoID', 0)
->setDefault('removeSourceBranch','0')
->setDefault('needCI', 0)
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::now())
@@ -114,11 +115,12 @@ class mrModel extends model
$MRID = $this->dao->lastInsertId();
$MRObject = new stdclass;
$MRObject->target_project_id = $MR->targetProject;
$MRObject->source_branch = $MR->sourceBranch;
$MRObject->target_branch = $MR->targetBranch;
$MRObject->title = $MR->title;
$MRObject->description = $MR->description;
$MRObject->target_project_id = $MR->targetProject;
$MRObject->source_branch = $MR->sourceBranch;
$MRObject->target_branch = $MR->targetBranch;
$MRObject->title = $MR->title;
$MRObject->description = $MR->description;
$MRObject->remove_source_branch = $MR->removeSourceBranch == '1' ? true : false;
if($MR->assignee)
{
$gitlabAssignee = $this->gitlab->getUserIDByZentaoAccount($this->post->gitlabID, $MR->assignee);
@@ -187,6 +189,7 @@ class mrModel extends model
$MR = fixer::input('post')
->setDefault('jobID', 0)
->setDefault('repoID', 0)
->setDefault('removeSourceBranch','0')
->setDefault('needCI', 0)
->setDefault('editedBy', $this->app->user->account)
->setDefault('editedDate', helper::now())
@@ -212,9 +215,10 @@ class mrModel extends model
/* Update MR in GitLab. */
$newMR = new stdclass;
$newMR->title = $MR->title;
$newMR->description = $MR->description;
$newMR->target_branch = $MR->targetBranch;
$newMR->title = $MR->title;
$newMR->description = $MR->description;
$newMR->target_branch = $MR->targetBranch;
$newMR->remove_source_branch = $MR->removeSourceBranch == '1' ? true : false;
if($MR->assignee)
{
$gitlabAssignee = $this->gitlab->getUserIDByZentaoAccount($oldMR->gitlabID, $MR->assignee);
+9
View File
@@ -55,6 +55,15 @@
<th><?php echo $lang->devops->repo;?></th>
<td colspan='1' class='required'><?php echo html::select('repoID', array(''), '', "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->mr->removeSourceBranch;?></th>
<td colspan='1'>
<div class="checkbox-primary">
<input type="checkbox" name="removeSourceBranch" value="1" id="removeSourceBranch">
<label for="removeSourceBranch"></label>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->mr->needCI;?></th>
<td colspan='1'>
+10
View File
@@ -69,6 +69,16 @@
<th><?php echo $lang->devops->repo;?></th>
<td colspan='1' class='required'><?php echo html::select('repoID', $repoList, $MR->repoID, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->mr->removeSourceBranch;?></th>
<td colspan='1'>
<div class="checkbox-primary">
<?php $checked = $MR->removeSourceBranch== '1' ? 'checked' : '' ?>
<input type="checkbox" <?php echo $checked;?> name="removeSourceBranch" value="1" id="removeSourceBranch">
<label for="removeSourceBranch"></label>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->mr->needCI;?></th>
<td colspan='1'>