* Change the smell code.

This commit is contained in:
tianshujie
2023-07-08 13:56:50 +08:00
parent f14fc34a3b
commit 72a0b0f6bb
10 changed files with 18 additions and 21 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ function loadExecutionBuilds(productID, executionID, index)
}
else
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + "&varName=openedBuilds&build=&branch=" + branch + "&index=" + index);
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + "&varName=openedBuilds&build=&branch=" + branch);
}
setOpenedBuilds(link, index);
+6 -6
View File
@@ -179,7 +179,7 @@ function loadAllBuilds()
if(page == 'resolve')
{
oldResolvedBuild = $('#resolvedBuild').val() ? $('#resolvedBuild').val() : 0;
link = $.createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=0&index=0&type=all');
link = $.createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=0&type=all');
$('#resolvedBuildBox').load(link);
}
else
@@ -231,7 +231,7 @@ function loadAllExecutionBuilds(executionID, productID, buildBox)
}
if(buildBox == 'resolvedBuildBox')
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch + '&index=0&type=all');
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch + '&type=all');
$('#resolvedBuildBox').load(link, function(){$(this).find('select').picker({optionRender: markReleasedBuilds, dropWidth: 'auto'})});
}
}
@@ -254,7 +254,7 @@ function loadAllProductBuilds(productID, buildBox)
if(page == 'create')
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&type=all');
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&type=all');
$.get(link, function(data)
{
if(!data) data = '<select id="openedBuild" name="openedBuild" class="form-control" multiple=multiple></select>';
@@ -269,12 +269,12 @@ function loadAllProductBuilds(productID, buildBox)
{
if(buildBox == 'openedBuildBox')
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&type=all');
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&type=all');
$('#openedBuildBox').load(link, function(){$(this).find('select').picker({optionRender: markReleasedBuilds})});
}
if(buildBox == 'resolvedBuildBox')
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch + '&index=0&type=all');
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch + '&type=all');
$('#resolvedBuildBox').load(link, function()
{
$(this).find('select').picker({optionRender: markReleasedBuilds, dropWidth: 'auto'})
@@ -959,7 +959,7 @@ function setBranchRelated(branchID, productID, num)
$("#executions" + num).chosen();
});
var buildLink = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + "&varName=openedBuilds&build=&branch=" + branchID + "&index=" + num);
var buildLink = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + "&varName=openedBuilds&build=&branch=" + branchID);
/* If the branch of the current row is inconsistent with the one below, clear the module and execution of the nex row. */
if(config.currentMethod == 'batchcreate')
+1 -2
View File
@@ -388,13 +388,12 @@ class build extends control
* @param string $varName the name of the select object to create
* @param string $build build to selected
* @param string|int $branch
* @param int $index the index of batch create bug.
* @param string $type get all builds or some builds belong to normal releases and executions are not done.
* @param string $extra
* @access public
* @return string
*/
public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 'all', $index = 0, $type = 'normal', $extra = '')
public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 'all', $type = 'normal', $extra = '')
{
$isJsonView = $this->app->getViewType() == 'json';
if($varName == 'openedBuild' )
+1 -2
View File
@@ -290,13 +290,12 @@ class design extends control
* @param int $repoID
* @param string $begin
* @param string $end
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function linkCommit(int $designID = 0, int $repoID = 0, string $begin = '', string $end = '', int $recTotal = 0, int $recPerPage = 50, int $pageID = 1)
public function linkCommit(int $designID = 0, int $repoID = 0, string $begin = '', string $end = '', int $recPerPage = 50, int $pageID = 1)
{
$design = $this->design->getById($designID);
$this->commonAction($design->project, (int)$design->product, $designID);
+1 -1
View File
@@ -97,7 +97,7 @@ else
set::footPager(
usePager
(
array('linkCreator' => helper::createLink('design', 'linkCommit', "designID={$designID}&repoID={$repoID}&begin={$begin}&end={$end}&recTotal={recTotal}&recPerPage={recPerPage}&pageID={page}")),
array('linkCreator' => helper::createLink('design', 'linkCommit', "designID={$designID}&repoID={$repoID}&begin={$begin}&end={$end}&recPerPage={recPerPage}&pageID={page}")),
),
),
);
+1 -1
View File
@@ -88,7 +88,7 @@ if(isset($project->hasProduct) && !empty($project->hasProduct) && $products)
{
$hasBranch = $product->type != 'normal' && isset($branchGroups[$product->id]);
$branches = isset($branchGroups[$product->id]) ? $branchGroups[$product->id] : array();
if(!isset($linkedBranches)) $branchIdList = isset($product->branches) ? join(',', $product->branches) : '';
if(!isset($linkedBranches)) $branchIdList = isset($product->branches) ? implode(',', $product->branches) : '';
if(isset($linkedBranches)) $branchIdList = !empty($linkedBranches[$product->id]) ? $linkedBranches[$product->id] : '';
if(empty($productID) || (!empty($productID) || $productID != $product->id))
{
+2 -2
View File
@@ -163,7 +163,7 @@ if($project->model != 'waterfall' && $project->model != 'waterfallplus')
set::value($product->id),
set::items($allProducts),
set::last($product->id),
$hasBranch ? set::lastBranch(join(',', $product->branches)) : null,
$hasBranch ? set::lastBranch(implode(',', $product->branches)) : null,
set::disabled($execution->type == 'stage' && $project->stageBy == 'project'),
set::required(true),
on::change('productChange'),
@@ -352,7 +352,7 @@ else
set::value($product->id),
set::items($allProducts),
set::last($product->id),
$hasBranch && $product->branches ? set::lastBranch(join(',', $product->branches)) : null,
$hasBranch && $product->branches ? set::lastBranch(implode(',', $product->branches)) : null,
set::disabled($project->model == 'waterfall' || $project->model == 'waterfallplus'),
set::required(true),
on::change('productChange'),
+2 -3
View File
@@ -492,13 +492,12 @@ class group extends control
* @param string $browseType
* @param string $view
* @param int $paramID
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function editManagePriv($browseType = '', $view = '', $paramID = 0, $recTotal = 0, $recPerPage = 100, $pageID = 1)
public function editManagePriv($browseType = '', $view = '', $paramID = 0, $recPerPage = 100, $pageID = 1)
{
if(empty($browseType) and $browseType != 'bysearch') $browseType = $this->cookie->managePrivEditType ? $this->cookie->managePrivEditType : 'bycard';
if($browseType == 'bysearch' and $this->cookie->managePrivEditType == 'bycard') $browseType = 'bycard';
@@ -536,7 +535,7 @@ class group extends control
/* Build the search form. */
$queryID = ($browseType == 'bysearch') ? (int)$paramID : 0;
$actionURL = $this->createLink('group', 'editManagePriv', "browseType=bysearch&view=&paramID=myQueryID&recTotal=$total&recPerPage=$recPerPage");
$actionURL = $this->createLink('group', 'editManagePriv', "browseType=bysearch&view=&paramID=myQueryID&recPerPage=$recPerPage");
$this->group->buildPrivSearchForm($queryID, $actionURL);
$privRelations = $this->group->getPrivRelationsByIdList(array_keys($privList));
+1 -1
View File
@@ -22,7 +22,7 @@ $getProjectGroup = function($project): string
{
global $app;
if($project->status != 'done' and $project->status != 'closed' and $project->PM == $app->user->account) return 'my';
if($project->status != 'done' and $project->status != 'closed' and !($project->PM == $app->user->account)) return 'other';
if($project->status != 'done' and $project->status != 'closed' and $project->PM != $app->user->account) return 'other';
return 'closed';
};
+2 -2
View File
@@ -74,7 +74,7 @@ if($linkedProducts)
set::value($product->id),
set::items($allProducts),
set::last($product->id),
$hasBranch ? set::lastBranch(join(',', $product->branches)) : null,
$hasBranch ? set::lastBranch(implode(',', $product->branches)) : null,
on::change('productChange')
)
),
@@ -91,7 +91,7 @@ if($linkedProducts)
(
set::name("branch[$i][]"),
set::items($branches),
set::value(join(',', $product->branches)),
set::value(implode(',', $product->branches)),
on::change('branchChange')
)
),