* [bug#62391,done,3h,0h] Optimize bug create autoload js.
This commit is contained in:
@@ -248,7 +248,8 @@ class bug extends control
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$formData = form::data($this->config->bug->form->create);
|
||||
if(!empty($params['productID'])) $product = $this->bug->fetchByID((int)$params['productID'], 'product');
|
||||
$formData = form::data($this->config->bug->form->create, 0, !empty($product->workflowGroup) ? $product->workflowGroup : 0);
|
||||
$bug = $this->bugZen->prepareCreateExtras($formData);
|
||||
|
||||
$bugID = $this->bug->create($bug, $from);
|
||||
@@ -268,8 +269,9 @@ class bug extends control
|
||||
|
||||
/* 初始化一个bug对象,尽可能把属性都绑定到bug对象上,extract() 出来的变量除外。 */
|
||||
/* Init bug, give bug as many variables as possible, except for extract variables. */
|
||||
$fields = array('productID' => $productID, 'branch' => $branch, 'title' => ($from == 'sonarqube' ? $_COOKIE['sonarqubeIssue'] : ''), 'assignedTo' => (isset($product->QD) ? $product->QD : ''));
|
||||
$fields = array('id' => 0, 'productID' => $productID, 'branch' => $branch, 'title' => ($from == 'sonarqube' ? $_COOKIE['sonarqubeIssue'] : ''), 'assignedTo' => (isset($product->QD) ? $product->QD : ''));
|
||||
$fields = array_merge($fields, $params);
|
||||
$fields['product'] = $fields['productID'];
|
||||
|
||||
$bug = $this->bugZen->initBug($fields);
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
window.reloadByProduct = function(e)
|
||||
{
|
||||
let extra = 'bugID=' + copyBugID + ',projectID=' + projectID + ',executionID=' + executionID;
|
||||
if(typeof fromID != 'undefined') extra += ',fromID=' + fromID;
|
||||
if(typeof fromType != 'undefined') extra += ',fromType=' + fromType;
|
||||
loadPage($.createLink('bug', 'create', 'productID=' + $(e.target).val() + '&branch=0&extra=' + extra));
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ include($this->app->getModuleRoot() . 'ai/ui/inputinject.html.php');
|
||||
$fields = useFields('bug.create');
|
||||
if(!empty($executionType) && $executionType == 'kanban') $fields->merge('bug.kanban');
|
||||
|
||||
$fields->autoLoad('branch', 'module,execution,project,story,task,assignedTo')
|
||||
|
||||
$fields->autoLoad('product', array('items' => 'product,module,execution,project,story,task,assignedTo,' . (!empty($lang->bug->flowExtraFields) ? implode(',', $lang->bug->flowExtraFields) : ''), 'updateOrders' => true))
|
||||
->autoLoad('branch', 'module,execution,project,story,task,assignedTo')
|
||||
->autoLoad('module', 'assignedTo,story')
|
||||
->autoLoad('project', 'project,execution,story,task,assignedTo,injection,identify,openedBuild')
|
||||
->autoLoad('execution', 'execution,story,task,assignedTo,openedBuild')
|
||||
@@ -40,8 +42,7 @@ jsVar('projectExecutionPairs', $projectExecutionPairs);
|
||||
|
||||
formGridPanel
|
||||
(
|
||||
on::change('[name="product"]', 'reloadByProduct'),
|
||||
on::change('[name="branch"], [name="project"], [name="execution"]', 'loadBuilds'),
|
||||
on::change('[name="product"], [name="branch"], [name="project"], [name="execution"]', 'loadBuilds'),
|
||||
set::title($lang->bug->create),
|
||||
set::fields($fields),
|
||||
set::loadUrl($loadUrl)
|
||||
|
||||
+11
-3
@@ -1303,9 +1303,17 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
const $item = $data.filter(`[data-name="${name}"]`);
|
||||
$oldItems.filter(`[data-name="${name}"]`).replaceWith($item);
|
||||
$item.zuiInit();
|
||||
const $items = $data.filter(`[data-name="${name}"]`);
|
||||
const $oldMatchItems = $oldItems.filter(`[data-name="${name}"]`);
|
||||
if($oldMatchItems.length)
|
||||
{
|
||||
$oldMatchItems.replaceWith($items);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oldItems.last().after($items);
|
||||
}
|
||||
$items.zuiInit();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user