* Modify build list switch the product logic.

This commit is contained in:
tianshujie
2023-06-08 13:14:01 +08:00
parent 828f6e21b2
commit cb14f1cdfa
4 changed files with 13 additions and 15 deletions
+3 -6
View File
@@ -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;
+1 -1
View File
@@ -55,6 +55,6 @@ window.confirmDelete = function(buildID)
*/
window.changeProduct = function()
{
const link = $.createLink('execution', 'build', 'executionID=' + executionID + '&type=product&param=' + $(this).val());
const link = changeProductLink.replace('{productID}', $(this).val());
loadPage(link);
}
+6 -5
View File
@@ -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}&param={$param}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"),
set::linkParams("executionID={$execution->id}&type={key}&param={$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}&param={$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}&param={$param}&orderBy={orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"));
jsVar('changeProductLink', helper::createLink('execution', 'build', "executionID={$execution->id}&type=product&param={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}&param={$param}&orderBy={$orderBy}&recTotal={recTotal}&recPerPage={page}")),
set::linkCreator(helper::createLink('execution', 'build', "executionID={$execution->id}&type={$type}&param={$param}&orderBy={$orderBy}&recTotal={recTotal}&recPerPage={page}")),
),
);
+3 -3
View File
@@ -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);
}