diff --git a/module/gitlab/control.php b/module/gitlab/control.php
index 7e5cb0c642..11b0853457 100644
--- a/module/gitlab/control.php
+++ b/module/gitlab/control.php
@@ -1039,7 +1039,7 @@ class gitlab extends control
$failedIssues = array();
foreach($executionList as $issueID => $executionID)
{
- if(empty($executionID) and $productList[$issueID] != 0) return $this->send(array('result' => 'fail', 'message' => $this->lang->gitlab->importIssueError, 'locate' => $this->server->http_referer));
+ if(empty($executionID) and $productList[$issueID]) return $this->send(array('result' => 'fail', 'message' => $this->lang->gitlab->importIssueError));
}
foreach($executionList as $issueID => $executionID)
@@ -1076,8 +1076,8 @@ class gitlab extends control
}
}
- if($failedIssues) return $this->send(array('result' => 'success', 'message' => $this->lang->gitlab->importIssueWarn, 'locate' => $this->server->http_referer));
- return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer));
+ if($failedIssues) return $this->send(array('result' => 'success', 'message' => $this->lang->gitlab->importIssueWarn));
+ return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'reload' => true));
}
$savedIssueIDList = $this->dao->select('BID as issueID')->from(TABLE_RELATION)
@@ -1110,7 +1110,7 @@ class gitlab extends control
$this->view->gitlabID = $gitlabID;
$this->view->gitlabProjectID = $projectID;
$this->view->objectTypes = $this->config->gitlab->objectTypes;
- $this->view->gitlabIssues = $gitlabIssues;
+ $this->view->gitlabIssues = array_values($gitlabIssues);
$this->display();
}
@@ -1305,12 +1305,14 @@ class gitlab extends control
if(!$productID) return $this->send(array('message' => array()));
$executions = $this->loadModel('product')->getExecutionPairsByProduct($productID);
- $options = "";
- foreach($executions as $index =>$execution)
+
+ $options = array();
+ $options[] = array('text' => '', 'value' => '');;
+ foreach($executions as $index => $execution)
{
- $options .= "";
+ $options[] = array('text' => $execution, 'value' => $index);
}
- return $this->send($options);
+ return print(json_encode($options));
}
/**
diff --git a/module/gitlab/js/importissue.ui.js b/module/gitlab/js/importissue.ui.js
new file mode 100644
index 0000000000..d504432768
--- /dev/null
+++ b/module/gitlab/js/importissue.ui.js
@@ -0,0 +1,23 @@
+window.renderRowCol = function(result, col, row)
+{
+ if(col.name == 'title_static')
+ {
+ $(result[0]).html('' + row.title + '');
+ }
+
+ return result;
+}
+
+function loadProductExecutions(event)
+{
+ const $target = $(event.target);
+ const $currentRow = $target.closest('tr');
+ const host = $target.val();
+ const projects = $currentRow.find('div.picker-box[data-name="executionList"]');
+
+ $.get($.createLink('gitlab', 'ajaxGetExecutionsByProduct', 'host=' + host), function(response)
+ {
+ var items = JSON.parse(response);
+ $(projects).zui('picker').render({items: items});
+ });
+}
diff --git a/module/gitlab/ui/importissue.html.php b/module/gitlab/ui/importissue.html.php
new file mode 100644
index 0000000000..7a59510d6d
--- /dev/null
+++ b/module/gitlab/ui/importissue.html.php
@@ -0,0 +1,47 @@
+
+ * @package gitlab
+ * @link https://www.zentao.net
+ */
+namespace zin;
+
+$items = array();
+$items[] = array('name' => 'title', 'label' => $lang->gitlab->gitlabIssue, 'control' => 'static');
+$items[] = array('name' => 'objectTypeList', 'label' => $lang->gitlab->objectType, 'control' => 'picker', 'items' => $objectTypes);
+$items[] = array('name' => 'productList', 'label' => $lang->productCommon, 'control' => 'picker', 'items' => $products, '' => 'loadProductExecutions' );
+$items[] = array('name' => 'executionList', 'label' => $lang->execution->common, 'control' => 'picker', 'items' => array());
+
+foreach($gitlabIssues as $issue)
+{
+ $issue->id = $issue->iid;
+}
+
+formBatchPanel
+(
+ h::input
+ (
+ set::type('hidden'),
+ set::name('gitlabID'),
+ set::value($gitlabID)
+ ),
+ h::input
+ (
+ set::type('hidden'),
+ set::name('gitlabProjectID'),
+ set::value($gitlabProjectID)
+ ),
+ set::title($lang->gitlab->importIssue),
+ set::mode('edit'),
+ set::items($items),
+ set::data($gitlabIssues),
+ set::onRenderRowCol(jsRaw('window.renderRowCol')),
+ on::change('[data-name="productList"]', 'loadProductExecutions')
+);
+
+render();
+