* Add selected lane when batch create bug in kanban.

This commit is contained in:
xieqiyu
2022-03-08 10:44:38 +08:00
parent e02951635c
commit 25ad53744a
5 changed files with 75 additions and 21 deletions
+17 -3
View File
@@ -684,6 +684,9 @@ class bug extends control
*/
public function batchCreate($productID, $branch = '', $executionID = 0, $moduleID = 0, $extra = '')
{
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
if(!empty($_POST))
{
$actions = $this->bug->batchCreate($productID, $branch, $extra);
@@ -697,9 +700,6 @@ class bug extends control
setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
/* If link from no head then reload. */
if(isonlybody() and $executionID)
{
@@ -731,6 +731,20 @@ class bug extends control
$builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'noempty', $executionID, 'execution');
$stories = $this->story->getExecutionStoryPairs($executionID);
$execution = $this->loadModel('execution')->getById($executionID);
if($execution->type == 'kanban')
{
$this->loadModel('kanban');
$regionPairs = $this->kanban->getRegionPairs($executionID, 0, 'execution');
$regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs);
$lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'bug');
$laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs);
$this->view->executionType = $execution->type;
$this->view->regionID = $regionID;
$this->view->laneID = $laneID;
$this->view->regionPairs = $regionPairs;
$this->view->lanePairs = $lanePairs;
}
}
else
{
+21
View File
@@ -38,6 +38,27 @@ function setOpenedBuilds(link, index)
});
}
/**
* Set lane.
*
* @param int $regionID
* @param int $num
* @access public
* @return void
*/
function setLane(regionID, num)
{
laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=bug&field=lanes&i=' + num);
$.get(laneLink, function(lanes)
{
if(!lanes) lanes = '<select id="lanes' + num + '" name="lanes[' + num + ']" class="form-control"></select>';
$('#lanes' + num).replaceWith(lanes);
$("#lanes" + num + "_chosen").remove();
$("#lanes" + num).next('.picker').remove();
$("#lanes" + num).chosen();
});
}
/**
* Load execution builds
*
+9 -3
View File
@@ -200,6 +200,7 @@ class bugModel extends model
$bug->os = $data->oses[$i];
$bug->browser = $data->browsers[$i];
$bug->keywords = $data->keywords[$i];
$bug->laneID = $data->lanes[$i];
if($bug->execution != 0) $bug->project = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('parent');
@@ -236,6 +237,9 @@ class bugModel extends model
/* When the bug is created by uploading an image, add the image to the step of the bug. */
foreach($bugs as $i => $bug)
{
$laneID = isset($bug->laneID) ? $bug->laneID : $output['laneID'];
unset($bug->laneID);
if(!empty($data->uploadImage[$i]))
{
$fileName = $data->uploadImage[$i];
@@ -274,8 +278,10 @@ class bugModel extends model
if($bug->execution)
{
if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($bug->execution, $output['laneID'], $output['columnID'], 'bug', $bugID);
if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($bug->execution, 'bug');
$columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed');
$columnID = empty($columnIDByLaneID) ? $output['columnID'] : $columnIDByLaneID;
if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID);
if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug');
}
/* When the bug is created by uploading the image, add the image to the file of the bug. */
@@ -290,7 +296,7 @@ class bugModel extends model
unset($file);
}
if(dao::isError()) return print(js::error('bug#' . ($i+1) . dao::getError(true)));
if(dao::isError()) return print(js::error('bug#' . ($i) . dao::getError(true)));
$actions[$bugID] = $this->action->create('bug', $bugID, 'Opened');
}
+22 -10
View File
@@ -51,6 +51,10 @@
<th class='c-execution<?php echo zget($visibleFields, 'execution', ' hidden') . zget($requiredFields, 'execution', '', ' required');?>'><?php echo (isset($project->model) and $project->model == 'kanban') ? $lang->bug->kanban : $lang->bug->execution;?></th>
<th class='c-build required'><?php echo $lang->bug->openedBuild;?></th>
<th class='c-title required'><?php echo $lang->bug->title;?></th>
<?php if(isset($executionType) and $executionType == 'kanban'):?>
<th class='c-execution'><?php echo $lang->kanbancard->region;?></th>
<th class='c-execution'><?php echo $lang->kanbancard->lane;?></th>
<?php endif;?>
<th class='c-date<?php echo zget($visibleFields, 'deadline', ' hidden') . zget($requiredFields, 'deadline', '', ' required');?>'><?php echo $lang->bug->deadline;?></th>
<th class='c-steps<?php echo zget($visibleFields, 'steps', ' hidden') . zget($requiredFields, 'steps', '', ' required');?>'><?php echo $lang->bug->steps;?></th>
<th class='c-type<?php echo zget($visibleFields, 'type', ' hidden') . zget($requiredFields, 'type', '', ' required');?>'><?php echo $lang->typeAB;?></th>
@@ -74,19 +78,19 @@
$lang->bug->osList += array('ditto' => $lang->bug->ditto);
$lang->bug->browserList += array('ditto' => $lang->bug->ditto);
?>
<?php $i = 0; ?>
<?php $i = 1; ?>
<?php if(!empty($titles)):?>
<?php foreach($titles as $bugTitle => $fileName):?>
<?php
$moduleID = $i == 0 ? $moduleID : 'ditto';
$executionID = $i == 0 ? $executionID : 'ditto';
$type = $i == 0 ? '' : 'ditto';
$pri = $i == 0 ? 0 : 'ditto';
$os = $i == 0 ? '' : 'ditto';
$browser = $i == 0 ? '' : 'ditto';
$moduleID = $i == 1 ? $moduleID : 'ditto';
$executionID = $i == 1 ? $executionID : 'ditto';
$type = $i == 1 ? '' : 'ditto';
$pri = $i == 1 ? 0 : 'ditto';
$os = $i == 1 ? '' : 'ditto';
$browser = $i == 1 ? '' : 'ditto';
?>
<tr>
<td class='text-center'><?php echo $i+1;?></td>
<td class='text-center'><?php echo $i;?></td>
<td class='<?php echo zget($visibleFields, $product->type, ' hidden')?>' style='overflow:visible'><?php echo html::select("branches[$i]", $branches, $branch, "class='form-control chosen' onchange='setBranchRelated(this.value, $productID, $i)'");?></td>
<td><?php echo html::select("modules[$i]", $moduleOptionMenu, $moduleID, "class='form-control chosen'");?></td>
<td class='<?php echo zget($visibleFields, 'execution', ' hidden')?>' style='overflow:visible'><?php echo html::select("executions[$i]", $executions, $executionID, "class='form-control chosen' onchange='loadExecutionBuilds($productID, this.value, $i)'");?></td>
@@ -105,6 +109,10 @@
</div>
</div>
</td>
<?php if(isset($executionType) and $executionType == 'kanban'):?>
<td><?php echo html::select("regions[$i]", $regionPairs, $regionID, "class='form-control chosen'");?></td>
<td><?php echo html::select("lanes[$i]", $lanePairs, $laneID, "class='form-control chosen'");?></td>
<?php endif;?>
<td class='<?php echo zget($visibleFields, 'deadline', 'hidden')?>'><?php echo html::input("deadlines[$i]", '', "class='form-control form-date'");?></td>
<td class='<?php echo zget($visibleFields, 'steps', 'hidden')?>'><?php echo html::textarea("stepses[$i]", '', "rows='1' class='form-control autosize'");?></td>
<td class='<?php echo zget($visibleFields, 'type', 'hidden')?>' style='overflow:visible'> <?php echo html::select("types[$i]", $lang->bug->typeList, $type, "class='form-control chosen'");?></td>
@@ -119,7 +127,7 @@
<?php endforeach;?>
<?php endif;?>
<?php $nextStart = $i;?>
<?php for($i = $nextStart; $i < $config->bug->batchCreate; $i++):?>
<?php for($i = $nextStart; $i <= $config->bug->batchCreate; $i++):?>
<?php
$moduleID = $i - $nextStart == 0 ? $moduleID : 'ditto';
$executionID = $i - $nextStart == 0 ? $executionID : 'ditto';
@@ -129,7 +137,7 @@
$browser = $i - $nextStart == 0 ? '' : 'ditto';
?>
<tr>
<td><?php echo $i+1;?></td>
<td><?php echo $i;?></td>
<td class='<?php echo zget($visibleFields, $product->type, ' hidden')?>' style='overflow:visible'><?php echo html::select("branches[$i]", $branches, $branch, "class='form-control chosen' onchange='setBranchRelated(this.value, $productID, $i)'");?></td>
<td><?php echo html::select("modules[$i]", $moduleOptionMenu, $moduleID, "class='form-control chosen'");?></td>
<td class='<?php echo zget($visibleFields, 'execution', ' hidden')?>' style='overflow:visible'><?php echo html::select("executions[$i]", $executions, $executionID, "class='form-control chosen' onchange='loadExecutionBuilds($productID, this.value, $i)'");?></td>
@@ -148,6 +156,10 @@
</div>
</div>
</td>
<?php if(isset($executionType) and $executionType == 'kanban'):?>
<td><?php echo html::select("regions[$i]", $regionPairs, $regionID, "class='form-control chosen' onchange='setLane(this.value, $i)'");?></td>
<td><?php echo html::select("lanes[$i]", $lanePairs, $laneID, "class='form-control chosen'");?></td>
<?php endif;?>
<td class='<?php echo zget($visibleFields, 'deadline', 'hidden')?>'><?php echo html::input("deadlines[$i]", '', "class='form-control form-date'");?></td>
<td class='<?php echo zget($visibleFields, 'steps', 'hidden')?>'><?php echo html::textarea("stepses[$i]", '', "rows='1' class='form-control autosize'");?></td>
<td class='<?php echo zget($visibleFields, 'type', 'hidden')?>' style='overflow:visible'> <?php echo html::select("types[$i]", $lang->bug->typeList, $type, "class='form-control chosen'");?></td>
+6 -5
View File
@@ -265,10 +265,11 @@ function createColumnMenu(options)
*/
function createColumnCreateMenu(options)
{
var $col = options.$trigger.closest('.kanban-col');
var col = $col.data('col');
var items = [];
var laneID = col.$kanbanData.lanes[0].id ? col.$kanbanData.lanes[0].id : 0;
var $col = options.$trigger.closest('.kanban-col');
var col = $col.data('col');
var items = [];
var laneID = col.$kanbanData.lanes[0].id ? col.$kanbanData.lanes[0].id : 0;
var regionID = col.$kanbanData.region;
if(col.type == 'backlog')
{
@@ -283,7 +284,7 @@ function createColumnCreateMenu(options)
if(priv.canBatchCreateBug)
{
if(productNum > 1) items.push({label: bugLang.batchCreate, url: '#batchCreateBug', 'attrs' : {'data-toggle': 'modal'}});
else items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&branch=&executionID=' + executionID + '&module=0&extra=&laneID=' + laneID + '&columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}});
else items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&branch=&executionID=' + executionID + '&module=0&extra=regionID=' + regionID + ',laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}});
}
}
else if(col.type == 'wait')