+ Add funcs of sync story to gitlab issue.

This commit is contained in:
dingguodong
2021-06-24 16:47:17 +08:00
parent 04d32851c3
commit b16d5bab3e
5 changed files with 41 additions and 1 deletions
+7
View File
@@ -295,6 +295,13 @@ class story extends control
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->story->custom->createFields;
$allGitlabs = $this->loadModel('gitlab')->getPairs();
$executionID = $objectID;
$gitlabProjects = $this->loadModel('gitlab')->getProjectsByExecution($executionID);
foreach($allGitlabs as $id => $name) if($id and !isset($gitlabProjects[$id])) unset($allGitlabs[$id]);
$this->view->gitlabList = $allGitlabs;
$this->view->gitlabProjects = $gitlabProjects;
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->create;
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID&branch=$branch"), $product->name);
$this->view->position[] = $this->lang->story->common;
+19
View File
@@ -34,3 +34,22 @@ function refreshPlan()
$(window).unload(function(){
if(blockID) window.parent.refreshBlock($('#block' + blockID));
});
$(document).ready(function()
{
$('#gitlab').change(function()
{
host = $('#gitlab').val();
if(host == '') return false;
projects = '';
$.each(gitlabProjects[host], function(id, obj){projects = projects + ',' + obj.gitlabProject});
url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host + "&projects=" + projects);
$.get(url, function(response)
{
$('#gitlabProject').html('').append(response);
$('#gitlabProject').chosen().trigger("chosen:updated");;
});
});
});
+2
View File
@@ -405,3 +405,5 @@ $lang->story->categoryList['safe'] = '安全';
$lang->story->categoryList['experience'] = '体验';
$lang->story->categoryList['improve'] = '改进';
$lang->story->categoryList['other'] = '其他';
$lang->story->sync2Gitlab = '同步到Gitlab';
+4 -1
View File
@@ -233,7 +233,7 @@ class storyModel extends model
$requiredFields = trim($requiredFields, ',');
$this->dao->insert(TABLE_STORY)->data($story, 'spec,verify')->autoCheck()->batchCheck($requiredFields, 'notempty')->exec();
$this->dao->insert(TABLE_STORY)->data($story, 'spec,verify,gitlab,gitlabProject')->autoCheck()->batchCheck($requiredFields, 'notempty')->exec();
if(!dao::isError())
{
$storyID = $this->dao->lastInsertID();
@@ -339,6 +339,9 @@ class storyModel extends model
/* Callback the callable method to process the related data for object that is transfered to story. */
if($from && is_callable(array($this, $this->config->story->fromObjects[$from]['callback']))) call_user_func(array($this, $this->config->story->fromObjects[$from]['callback']), $storyID);
/* sync this story to gitlab issue */
$this->loadModel('gitlab')->syncStory($storyID, $this->post->gitlab, $this->post->gitlabProject);
return array('status' => 'created', 'id' => $storyID);
}
return false;
+9
View File
@@ -17,6 +17,7 @@
</style>
<?php js::set('holders', $lang->story->placeholder); ?>
<?php js::set('blockID', $blockID); ?>
<?php js::set('gitlabProjects', $gitlabProjects);?>
<?php if(common::checkNotCN()):?>
<style> .sourceTd > .input-group > .input-group > .input-group-addon:first-child{padding: 5px 18px} </style>
<?php endif;?>
@@ -251,6 +252,14 @@
</td>
</tr>
<?php endif;?>
<?php if(!empty($gitlabProjects)):?>
<tr>
<th><?php echo $lang->story->sync2Gitlab;?></th>
<td><?php echo html::select('gitlab', $gitlabList, '', "class='form-control chosen'");?></td>
<td><?php echo html::select('gitlabProject', '', '', "class='form-control chosen'");?></td>
</tr>
<?php endif;?>
</tbody>
<tfoot>
<tr>