diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 213828f266..c39a7729ce 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -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(); } } diff --git a/module/gitlab/model.php b/module/gitlab/model.php index b2a9d0fe64..65601c5c08 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -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)); } diff --git a/module/gitlab/view/importissue.html.php b/module/gitlab/view/importissue.html.php index 16b8879841..e1a53be93c 100644 --- a/module/gitlab/view/importissue.html.php +++ b/module/gitlab/view/importissue.html.php @@ -20,22 +20,24 @@
| gitlab->gitlabIssue;?> | product->common;?> | execution->common;?> | -gitlab->gitlabIssue;?> | gitlab->objectType;?> | |
|---|---|---|---|---|---|
| title; ?> | - | - | + | ||