Merge branch 'jihu' of https://gitlab.zcorp.cc/easycorp/zentaopms into jihu
This commit is contained in:
@@ -253,22 +253,19 @@ class gitlab extends control
|
||||
|
||||
public function importIssue()
|
||||
{
|
||||
$productID = $this->get->product;
|
||||
$gitlabID = $this->get->gitlab;
|
||||
$projectID = $this->get->project;
|
||||
|
||||
$executions = $this->loadModel('product')->getAllExecutionPairsByProduct($productID);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$this->post->a();
|
||||
}
|
||||
|
||||
$productID = $this->get->product;
|
||||
$gitlabID = $this->get->gitlab;
|
||||
$projectID = $this->get->project;
|
||||
// todo next: get execution from product and execution module.
|
||||
|
||||
$executions = array();
|
||||
foreach($relations as $relation)
|
||||
{
|
||||
if($relation->execution) $executions[] = $this->loadModel("execution")->getByID($relation->execution)->name;
|
||||
}
|
||||
|
||||
$gitlabIssues = $this->gitlab->apiGetIssues($gitlabID, $projectID);
|
||||
|
||||
$this->view->productName = $this->loadModel("product")->getByID($productID)->name;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->gitlabID = $gitlabID;
|
||||
@@ -276,7 +273,7 @@ class gitlab extends control
|
||||
$this->view->executions = $executions;
|
||||
$this->view->objectTypes = $this->config->gitlab->objectTypes;
|
||||
|
||||
$this->view->gitlabIssues = $this->gitlab->apiGetIssues($gitlabID, $projectID);
|
||||
$this->view->gitlabIssues = $gitlabIssues;
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
|
||||
+23
-1
@@ -276,6 +276,28 @@ class gitlabModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
* Send an api post request.
|
||||
*
|
||||
* @param int|string $host gitlab server ID | gitlab host url.
|
||||
* @param int $api
|
||||
* @param int $data
|
||||
* @param int $options
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function apiPost($host, $api, $data = array(), $options = array())
|
||||
{
|
||||
if(is_numeric($host)) $host = $this->getApiRoot($host);
|
||||
if(strpos($host, 'http://') !== 0 and strpos($host, 'https://') !== 0) return false;
|
||||
|
||||
$url = sprintf($apiRoot, $api);
|
||||
return json_decode(commonModel::http($url, $data, $options));
|
||||
}
|
||||
|
||||
/**
|
||||
>>>>>>> 388f6365c925b48fc5fe9db65977f00ad4bda236
|
||||
* Get current user.
|
||||
*
|
||||
* @param string $host
|
||||
@@ -530,7 +552,7 @@ class gitlabModel extends model
|
||||
public function apiGetIssues($gitlabID, $projectID)
|
||||
{
|
||||
// TODO(dingguodong) not pagination yet.
|
||||
$url = sprintf($this->getApiRoot($gitlabID), "/projects/{$projectID}/issues/{$issueID}");
|
||||
$url = sprintf($this->getApiRoot($gitlabID), "/projects/{$projectID}/issues");
|
||||
return json_decode(commonModel::http($url));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,22 +20,24 @@
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width='60px'><?php echo $lang->gitlab->gitlabIssue;?></th>
|
||||
<th width='30px'><?php echo $lang->product->common;?></th>
|
||||
<th width='30px'><?php echo $lang->execution->common;?></th>
|
||||
<th width='60px'><?php echo $lang->gitlab->gitlabIssue;?></th>
|
||||
<th width='30px'><?php echo $lang->gitlab->objectType;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($gitlabIssues as $issue):?>
|
||||
<tr>
|
||||
<td><?php echo $issue->title; ?></td>
|
||||
<td><?php echo $productName; ?></td>
|
||||
<input type='hidden' name='productID' value='<?php echo $productID;?>' />
|
||||
<input type='hidden' name='gitlabID' value='<?php echo $gitlabID;?>' />
|
||||
<input type='hidden' name='gitlabProjectID' value='<?php echo $gitlabProjectID;?>' />
|
||||
<td><?php echo html::select("executionName", $executions, '', "class='form-control select chosen'" );?></td>
|
||||
<td><?php echo html::select("gitlabIssueID", $gitlabIssues, '', "class='form-control select chosen'" );?></td>
|
||||
<td><?php echo html::select("mappedIssues", $executions, '', "class='form-control select chosen'" );?></td>
|
||||
<td><?php echo html::select("objectType", $objectTypes, '', "class='form-control select chosen'" );?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user