From cb14f1cdfaaa4ece62bd92ee963e1b2a3ff3ad31 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 8 Jun 2023 11:28:32 +0800 Subject: [PATCH] * Modify build list switch the product logic. --- module/execution/control.php | 9 +++------ module/execution/js/build.ui.js | 2 +- module/execution/ui/build.html.php | 11 ++++++----- module/execution/zen.php | 6 +++--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index dd31dee6fa..cd565c52f6 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -490,8 +490,7 @@ class execution extends control /* Pager. */ $this->app->loadClass('pager', $static = true); - $recTotal = count($tasks2Imported); - $pager = new pager($recTotal, $recPerPage, $pageID); + $pager = new pager(count($tasks2Imported), $recPerPage, $pageID); $tasks2ImportedList = array_chunk($tasks2Imported, $pager->recPerPage, true); $tasks2ImportedList = empty($tasks2ImportedList) ? $tasks2ImportedList : $tasks2ImportedList[$pageID - 1]; @@ -1279,8 +1278,7 @@ class execution extends control /* Header and position. */ $this->view->title = $execution->name . $this->lang->colon . $this->lang->execution->build; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->builds = $this->executionZen->processBuildListData($builds, $executionID, $this->app->rawModule); - $this->view->executionID = $executionID; + $this->view->builds = $this->executionZen->processBuildListData($builds, $executionID); $this->view->product = $type == 'product' ? $param : 'all'; $this->view->products = $products; $this->view->type = $type; @@ -3449,8 +3447,7 @@ class execution extends control /* Pager. */ $this->app->loadClass('pager', $static = true); - $recTotal = count($allStories); - $pager = new pager($recTotal, $recPerPage, $pageID); + $pager = new pager(count($allStories), $recPerPage, $pageID); $allStories = array_chunk($allStories, $pager->recPerPage); $project = $object; diff --git a/module/execution/js/build.ui.js b/module/execution/js/build.ui.js index 69e48289c9..d04cbb5ca9 100644 --- a/module/execution/js/build.ui.js +++ b/module/execution/js/build.ui.js @@ -55,6 +55,6 @@ window.confirmDelete = function(buildID) */ window.changeProduct = function() { - const link = $.createLink('execution', 'build', 'executionID=' + executionID + '&type=product¶m=' + $(this).val()); + const link = changeProductLink.replace('{productID}', $(this).val()); loadPage(link); } diff --git a/module/execution/ui/build.html.php b/module/execution/ui/build.html.php index 9ea2e2343d..ca9245914c 100644 --- a/module/execution/ui/build.html.php +++ b/module/execution/ui/build.html.php @@ -10,11 +10,11 @@ declare(strict_types=1); */ namespace zin; -/* zin: Define the set::module('execution') feature bar on main menu. */ +/* zin: Define the set::module('executionBuild') feature bar on main menu. */ featureBar ( set::current($type), - set::linkParams("executionID={$executionID}&type={key}¶m={$param}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"), + set::linkParams("executionID={$execution->id}&type={key}¶m={$param}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"), div ( set::class('select-product-box'), @@ -38,8 +38,9 @@ toolbar ); jsVar('orderBy', $orderBy); -jsVar('executionID', $executionID); -jsVar('sortLink', helper::createLink('execution', 'build', "executionID={$executionID}&type={$type}¶m={$param}&orderBy={orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")); +jsVar('executionID', $execution->id); +jsVar('sortLink', helper::createLink('execution', 'build', "executionID={$execution->id}&type={$type}¶m={$param}&orderBy={orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")); +jsVar('changeProductLink', helper::createLink('execution', 'build', "executionID={$execution->id}&type=product¶m={productID}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")); jsVar('scmPathTip', $lang->build->scmPath); jsVar('filePathTip', $lang->build->filePath); jsVar('confirmDelete', $lang->build->confirmDelete); @@ -54,7 +55,7 @@ dtable usePager(), set::recPerPage($pager->recPerPage), set::recTotal($pager->recTotal), - set::linkCreator(helper::createLink('execution', 'build', "executionID={$executionID}&type={$type}¶m={$param}&orderBy={$orderBy}&recTotal={recTotal}&recPerPage={page}")), + set::linkCreator(helper::createLink('execution', 'build', "executionID={$execution->id}&type={$type}¶m={$param}&orderBy={$orderBy}&recTotal={recTotal}&recPerPage={page}")), ), ); diff --git a/module/execution/zen.php b/module/execution/zen.php index d0f9df240e..40e1f915e8 100644 --- a/module/execution/zen.php +++ b/module/execution/zen.php @@ -17,11 +17,10 @@ class executionZen extends execution * * @param array $buildList * @param string $executionID - * @param string $from execution|projectbuild * @access protected * @return object[] */ - protected function processBuildListData(array $buildList, int $executionID = 0, $from = 'execution'): array + protected function processBuildListData(array $buildList, int $executionID = 0): array { $this->loadModel('build'); @@ -44,10 +43,11 @@ class executionZen extends execution } $build->branchName = trim($build->branchName, ','); } - $build->actions = $this->build->buildActionList($build, $executionID, $from); + $build->actions = $this->build->buildActionList($build, $executionID, 'execution'); } if(!$showBranch) unset($this->config->build->dtable->fieldList['branch']); + unset($this->config->build->dtable->fieldList['execution']); return array_values($buildList); }