* Adjust mr create logic

This commit is contained in:
zenggang
2021-11-26 08:12:46 +00:00
parent f451a1c23e
commit 6bfdcd4e40
5 changed files with 18 additions and 6 deletions

View File

@@ -83,4 +83,10 @@ $(function()
});
});
$("#needCI").change(function()
{
if(this.checked == false) $("#jobID").parent().parent().addClass('hidden');
if(this.checked == true) $("#jobID").parent().parent().removeClass('hidden');
});
});

View File

@@ -34,6 +34,7 @@ $lang->mr->commits = 'commits';
$lang->mr->changes = 'changes';
$lang->mr->gitlabID = 'GitLab';
$lang->mr->repoID = 'Repo';
$lang->mr->jobID = 'Compile job';
$lang->mr->approval = 'Approval';
$lang->mr->approve = 'Approve';

View File

@@ -34,6 +34,7 @@ $lang->mr->commits = '提交数';
$lang->mr->changes = '更改数';
$lang->mr->gitlabID = 'GitLab';
$lang->mr->repoID = '版本库';
$lang->mr->jobID = '构建任务';
$lang->mr->canMerge = "可合并";
$lang->mr->cantMerge = "不可合并";

View File

@@ -85,6 +85,9 @@ class mrModel extends model
public function create()
{
$MR = fixer::input('post')
->setDefault('jobID', 0)
->setDefault('repoID', 0)
->setDefault('needCI', 0)
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::now())
->get();
@@ -103,6 +106,7 @@ class mrModel extends model
$this->dao->insert(TABLE_MR)->data($MR, $this->config->mr->create->skippedFields)
->batchCheck($this->config->mr->create->requiredFields, 'notempty')
->checkIF($MR->needCI, 'jobID', 'notempty')
->autoCheck()
->exec();
if(dao::isError()) return array('result' => 'fail', 'message' => dao::getError());

View File

@@ -51,6 +51,10 @@
<th><?php echo $lang->mr->description;?></th>
<td colspan='1'><?php echo html::textarea('description', '', "rows='3' class='form-control'");?></td>
</tr>
<tr>
<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->needCI;?></th>
<td colspan='1'>
@@ -60,13 +64,9 @@
</div>
</td>
</tr>
<tr>
<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>
<tr class='hidden'>
<th><?php echo $lang->job->common;?></th>
<td colspan='1'><?php echo html::select('jobID', array(''), '', "class='form-control chosen'");?></td>
<td colspan='1' class='required'><?php echo html::select('jobID', array(''), '', "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->mr->assignee;?></th>