From 4f0d5ac031bb78cadcec810d8cc50d3b3d53b445 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Thu, 18 Jan 2024 10:31:06 +0800 Subject: [PATCH] * Add create build btn and create release btn to bug create page. --- module/bug/js/common.ui.js | 4 ++-- module/bug/ui/common.field.php | 4 +--- module/bug/ui/create.field.php | 13 +++++++++++++ module/bug/ui/create.html.php | 4 ++-- module/bug/zen.php | 1 - module/build/control.php | 2 +- module/release/control.php | 2 +- module/testtask/js/common.ui.js | 5 +++++ 8 files changed, 25 insertions(+), 10 deletions(-) diff --git a/module/bug/js/common.ui.js b/module/bug/js/common.ui.js index 260071ef49..1a8fe0e784 100644 --- a/module/bug/js/common.ui.js +++ b/module/bug/js/common.ui.js @@ -120,13 +120,13 @@ function refreshModule(event) loadProductModules(productID); } -function refreshProductBuild(event) +window.refreshProductBuild = function(event) { const productID = $('[name="product"]').val(); loadProductBuilds(productID); } -function refreshExecutionBuild(event) +window.refreshExecutionBuild = function(event) { const executionID = $('[name="execution"]').val(); loadExecutionBuilds(executionID); diff --git a/module/bug/ui/common.field.php b/module/bug/ui/common.field.php index 2303a80881..5f2681eec7 100644 --- a/module/bug/ui/common.field.php +++ b/module/bug/ui/common.field.php @@ -29,9 +29,7 @@ $fields->field('module') $fields->field('openedBuild') ->checkbox(array('text' => $lang->bug->allBugs, 'name' => 'allBuilds')) ->control('inputGroup') - ->itemBegin('openedBuild[]')->control('picker')->items(data('builds'))->multiple()->itemEnd() - ->itemBegin()->control('addon')->id('buildBoxActions')->className('btn-group hidden')->itemEnd() - ->itemBegin()->control('btn')->icon('refresh text-primary')->hint($lang->bug->loadAll)->id('allBuilds')->itemEnd(); + ->itemBegin('openedBuild[]')->control('picker')->items(data('builds'))->multiple()->itemEnd(); $fields->field('assignedTo') ->control('inputGroup') diff --git a/module/bug/ui/create.field.php b/module/bug/ui/create.field.php index 984d79731d..bfeaa6ab54 100644 --- a/module/bug/ui/create.field.php +++ b/module/bug/ui/create.field.php @@ -19,6 +19,19 @@ $fields->field('execution') ->className('full:w-1/4') ->foldable(!$isShadowProduct); +$fields->field('openedBuild') + ->itemBegin()->control(array('control' => 'btn', 'data-toggle' => 'modal')) + ->icon('plus')->text($lang->build->create)->hint($lang->build->create) + ->url(createLink('build', 'create', 'executionID=' . data('executionID') . '&productID=' . data('bug.productID') . '&projectID=' . data('projectID'))) + ->className(count(data('builds')) > 1 || !data('executionID') ? 'hidden' : '') + ->itemEnd() + ->itemBegin()->control(array('control' => 'btn', 'data-toggle' => 'modal')) + ->icon('plus')->text($lang->release->create)->hint($lang->release->create) + ->url(createLink('release', 'create', 'productID=' . data('bug.productID') . '&branch=' . data('bug.branch'))) + ->className(count(data('builds')) > 1 || data('executionID') ? 'hidden' : '') + ->itemEnd() + ->itemBegin()->control('btn')->icon('refresh text-primary')->hint($lang->bug->loadAll)->id('allBuilds')->itemEnd(); + $fields->field('story')->foldable(); $fields->field('task')->foldable(); diff --git a/module/bug/ui/create.html.php b/module/bug/ui/create.html.php index 03729d6649..fcdc1bddf5 100644 --- a/module/bug/ui/create.html.php +++ b/module/bug/ui/create.html.php @@ -18,8 +18,8 @@ if(!empty($executionType) && $executionType == 'kanban') $fields->merge('bug.kan $fields->autoLoad('product', 'product,module,openedBuild,execution,project,story,task,assignedTo') ->autoLoad('branch', 'module,openedBuild,execution,project,story,task,assignedTo') ->autoLoad('module', 'assignedTo,story') - ->autoLoad('project', 'openedBuild,execution,story,task,assignedTo') - ->autoLoad('execution', 'openedBuild,story,task,assignedTo') + ->autoLoad('project', 'project,openedBuild,execution,story,task,assignedTo') + ->autoLoad('execution', 'execution,openedBuild,story,task,assignedTo') ->autoLoad('region', 'lane'); jsVar('bug', $bug); diff --git a/module/bug/zen.php b/module/bug/zen.php index c48bfc395e..03a91fcaaf 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -1127,7 +1127,6 @@ class bugZen extends bug protected function buildCreateForm(object $bug, array $param, string $from): void { extract($param); - if(!empty($executionID)) $projectID = $this->dao->select('project')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch('project'); $currentProduct = $this->product->getByID($bug->productID); diff --git a/module/build/control.php b/module/build/control.php index 5ea01eb1b0..165822d6fd 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -60,7 +60,7 @@ class build extends control $message = $this->executeHooks($buildID); if($message) $this->lang->saveSuccess = $message; - if(helper::isAjaxRequest('modal')) return $this->sendSuccess(array('closeModal' => true, 'callback' => 'loadExecutionBuilds()')); + if(helper::isAjaxRequest('modal')) return $this->sendSuccess(array('closeModal' => true, 'callback' => 'refreshExecutionBuild()')); return $this->sendSuccess(array('load' => $this->createLink($this->app->rawModule, 'view', "buildID=$buildID"), 'id' => $buildID)); } diff --git a/module/release/control.php b/module/release/control.php index c2b5c6c0d1..e43da1a8e4 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -116,7 +116,7 @@ class release extends control $message = $result ? $result : $this->lang->saveSuccess; if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $message, 'id' => $releaseID)); - if(isInModal()) return $this->send(array('result' => 'success', 'message' => $message, 'closeModal' => true, 'callback' => "parent.loadProductBuilds($productID)")); + if(isInModal()) return $this->send(array('result' => 'success', 'message' => $message, 'closeModal' => true, 'callback' => 'refreshProductBuild')); return $this->send(array('result' => 'success', 'message' => $message, 'load' => inlink('view', "releaseID={$releaseID}"))); } diff --git a/module/testtask/js/common.ui.js b/module/testtask/js/common.ui.js index 6ed19787c2..bde9c4c8fc 100644 --- a/module/testtask/js/common.ui.js +++ b/module/testtask/js/common.ui.js @@ -17,6 +17,11 @@ function loadExecutionRelated() loadExecutionBuilds(); } +window.refreshExecutionBuild = function() +{ + loadExecutionBuilds(); +} + /** * Load execution builds. *