* bug: refactor bug-create UI with loadForm helper.

This commit is contained in:
sunhao
2024-01-08 18:12:31 +08:00
parent 99db67ac25
commit 529e071e94
3 changed files with 10 additions and 31 deletions
+3 -1
View File
@@ -208,7 +208,8 @@ class bug extends control
*/
public function create(int $productID, string $branch = '', string $extras = '')
{
$extras = str_replace(array(',', ' ', '*'), array('&', '', '-'), $extras);
$originExtras = $extras;
$extras = str_replace(array(',', ' ', '*'), array('&', '', '-'), $extras);
parse_str($extras, $params);
$from = isset($params['from']) ? $params['from'] : '';
@@ -248,6 +249,7 @@ class bug extends control
/* 获取分支、版本、需求、项目、执行、产品、项目的模式,构造$this->view。*/
/* Get branches, builds, stories, project, projects, executions, products, project model and build create form. */
$this->bugZen->buildCreateForm($bug, $params, $from);
$this->view->loadUrl = $this->createLink('bug', 'create', "productID={productID}&branch={branch}&extras=$originExtras" . (empty($from) ? '' : "&from=$from"));
$this->display();
}
-23
View File
@@ -1,23 +0,0 @@
$(function()
{
changeProductConfirmed = true;
if(parseInt(bug.execution.id))
{
changeExecution();
}
else if(parseInt(bug.project))
{
const projectID = bug.projectID;
loadProjectBuilds(projectID);
loadAssignedToByProject(projectID);
}
else
{
const productID = bug.productID;
const moduleID = bug.moduleID;
const assignedTo = bug.assignedTo;
if(!assignedTo) setTimeout(function(){loadAssignedToByModule(moduleID, productID)}, 500);
}
$('#buildBoxActions').closest('.input-group').find('.picker-box').on('inited', function(_, info){loadBuildActions()});
});
+7 -7
View File
@@ -22,15 +22,15 @@ jsVar('projectExecutionPairs', $projectExecutionPairs);
formGridPanel
(
on::change('[name="product"]', 'changeProduct'),
on::change('[name="branch"]', 'changeBranch'),
on::change('[name="project"]', 'changeProject'),
on::change('[name="execution"]', 'changeExecution'),
on::change('[name="module"]', 'changeModule'),
on::change('[name="region"]', 'changeRegion'),
set::loadUrl($loadUrl),
on::change('[name="product"]', 'loadForm({target: target, items: "product,module,openedBuild,execution,project,story,task,assignedTo"})'),
on::change('[name="branch"]', 'loadForm({target: target, items: "module,openedBuild,execution,project,story,task,assignedTo"})'),
on::change('[name="module"]', 'loadForm({target: target, items: "assignedTo,story"})'),
on::change('[name="project"]', 'loadForm({target: target, items: "openedBuild,execution,story,task,assignedTo"})'),
on::change('[name="execution"]', 'loadForm({target: target, items: "openedBuild,story,task,assignedTo"})'),
on::change('[name="region"]', 'loadForm({target: target, items: "lane"})'),
on::click('#allBuilds', 'loadAllBuilds'),
on::click('#allUsers', 'loadAllUsers'),
on::click('#refreshModule', 'refreshModule'),
on::click('#refreshExecutionBuild', 'refreshExecutionBuild'),
on::click('#refreshProductBuild', 'refreshProductBuild'),
set::title($lang->bug->create),