* Optimize batch actions on my bug and my requirement.
This commit is contained in:
@@ -7,6 +7,7 @@ $app->loadLang('story');
|
||||
$app->loadLang('doc');
|
||||
$app->loadLang('testtask');
|
||||
$app->loadLang('testcase');
|
||||
$app->loadLang('product');
|
||||
$app->loadModuleConfig('testtask');
|
||||
$app->loadModuleConfig('testcase');
|
||||
$app->loadModuleConfig('company');
|
||||
|
||||
@@ -45,26 +45,19 @@ $config->bug->dtable->fieldList['product']['link'] = 'RAWJS<function(info){ if(i
|
||||
|
||||
foreach($bugs as $bug) $bug->canBeChanged = common::canBeChanged('bug', $bug);
|
||||
|
||||
$footToolbar = $canBatchAction ? array('items' => array
|
||||
(
|
||||
array('text' => $lang->edit, 'className' => 'batch-btn ' . ($canBatchEdit ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchEdit')),
|
||||
array('text' => $lang->confirm, 'className' => 'batch-btn ajax-btn ' . ($canBatchConfirm ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchConfirm')),
|
||||
array('text' => $lang->close, 'className' => 'batch-btn ajax-btn ' . ($canBatchClose ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchClose')),
|
||||
array('text' => $lang->bug->assignedTo, 'className' => ($canBatchAssignTo ? '' : 'hidden'), 'caret' => 'up', 'url' => '#navAssignedTo','data-toggle' => 'dropdown', 'data-placement' => 'top-start'),
|
||||
), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')) : null;
|
||||
|
||||
$assignedToItems = array();
|
||||
foreach ($memberPairs as $key => $value)
|
||||
{
|
||||
$assignedToItems[] = array('text' => $value, 'class' => 'batch-btn ajax-btn not-open-url', 'data-url' => createLink('bug', 'batchAssignTo', "assignedTo=$key&productID=0&type=my"));
|
||||
}
|
||||
|
||||
menu
|
||||
$footToolbar = $canBatchAction ? array('items' => array
|
||||
(
|
||||
set::id('navAssignedTo'),
|
||||
set::class('dropdown-menu'),
|
||||
set::items($assignedToItems)
|
||||
);
|
||||
array('text' => $lang->edit, 'className' => 'batch-btn ' . ($canBatchEdit ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchEdit')),
|
||||
array('text' => $lang->confirm, 'className' => 'batch-btn ajax-btn ' . ($canBatchConfirm ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchConfirm')),
|
||||
array('text' => $lang->close, 'className' => 'batch-btn ajax-btn ' . ($canBatchClose ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchClose')),
|
||||
array('text' => $lang->bug->assignedTo, 'className' => ($canBatchAssignTo ? '' : 'hidden'), 'type' => 'dropdown', 'items' => $assignedToItems, 'caret' => 'up', 'data-placement' => 'top-start'),
|
||||
), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')) : null;
|
||||
|
||||
$cols = $this->loadModel('datatable')->getSetting('my');
|
||||
$cols['actions']['list']['edit']['data-toggle'] = 'modal';
|
||||
|
||||
@@ -22,24 +22,17 @@ $canBatchReview = common::hasPriv('story', 'batchReview');
|
||||
$canBatchAssignTo = common::hasPriv('story', 'batchAssignTo');
|
||||
$canBatchClose = common::hasPriv('story', 'batchClose');
|
||||
$canBatchAction = $canBatchEdit || $canBatchReview || $canBatchAssignTo || $canBatchClose;
|
||||
$footToolbar = array('items' => array
|
||||
(
|
||||
$canBatchEdit ? array('text' => $lang->edit, 'className' => 'batch-btn', 'data-url' => helper::createLink('story', 'batchEdit', "productID=0&executionID=0&branch=0&storyType=requirement&from={$app->rawMethod}")) : null,
|
||||
$canBatchReview ? array('caret' => 'up', 'text' => $lang->story->review, 'url' => '#navReview', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start') : null,
|
||||
$canBatchAssignTo ? array('caret' => 'up', 'text' => $lang->story->assignedTo, 'url' => '#navAssignedTo', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start') : null,
|
||||
$canBatchClose ? array('text' => $lang->story->close, 'className' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('story', 'batchClose', "productID=0&executionID=0&storyType=requirement&from={$app->rawMethod}")) : null,
|
||||
), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary'));
|
||||
|
||||
$reviewItems = array();
|
||||
if($canBatchReview)
|
||||
{
|
||||
$rejectItems = array();
|
||||
foreach($lang->story->reasonList as $key => $reason)
|
||||
{
|
||||
if(!$key || $key == 'subdivided' || $key == 'duplicate') continue;
|
||||
$rejectItems[] = array('text' => $reason, 'class' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('story', 'batchReview', "result=reject&reason={$key}&storyType=requirement"));
|
||||
$rejectItems[] = array('text' => $reason, 'class' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('story', 'batchReview', "result=reject&reason={$key}&storyType=requirement"));
|
||||
}
|
||||
|
||||
$reviewItems = array();
|
||||
foreach($lang->story->reviewResultList as $key => $result)
|
||||
{
|
||||
if(!$key || $key == 'revert') continue;
|
||||
@@ -49,35 +42,29 @@ if($canBatchReview)
|
||||
}
|
||||
else
|
||||
{
|
||||
$reviewItems[] = array('text' => $result, 'class' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('story', 'batchReview', "result={$key}&reason=&storyType=requirement"));
|
||||
$reviewItems[] = array('text' => $result, 'class' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('story', 'batchReview', "result={$key}&reason=&storyType=requirement"));
|
||||
}
|
||||
}
|
||||
|
||||
menu
|
||||
(
|
||||
set::id('navReview'),
|
||||
set::class('menu dropdown-menu'),
|
||||
set::items($reviewItems)
|
||||
);
|
||||
}
|
||||
|
||||
$assignedToItems = array();
|
||||
if($canBatchAssignTo)
|
||||
{
|
||||
$assignedToItems = array();
|
||||
foreach($users as $key => $value)
|
||||
{
|
||||
if(empty($key) || $key == 'closed') continue;
|
||||
$assignedToItems[] = array('text' => $value, 'class' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('story', 'batchAssignTo', "storyType=requirement&assignedTo={$key}"));
|
||||
$assignedToItems[] = array('text' => $value, 'class' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('story', 'batchAssignTo', "storyType=requirement&assignedTo={$key}"));
|
||||
}
|
||||
|
||||
menu
|
||||
(
|
||||
set::id('navAssignedTo'),
|
||||
set::class('dropdown-menu'),
|
||||
set::items($assignedToItems)
|
||||
);
|
||||
}
|
||||
|
||||
$footToolbar = array('items' => array
|
||||
(
|
||||
$canBatchEdit ? array('text' => $lang->edit, 'className' => 'batch-btn', 'data-url' => helper::createLink('story', 'batchEdit', "productID=0&executionID=0&branch=0&storyType=requirement&from={$app->rawMethod}")) : null,
|
||||
$canBatchReview ? array('caret' => 'up', 'text' => $lang->story->review, 'type' => 'dropdown', 'items' => $reviewItems, 'data-placement' => 'top-start') : null,
|
||||
$canBatchAssignTo ? array('caret' => 'up', 'text' => $lang->story->assignedTo, 'type' => 'dropdown', 'items' => $assignedToItems, 'data-placement' => 'top-start') : null,
|
||||
$canBatchClose ? array('text' => $lang->story->close, 'className' => 'batch-btn', 'data-url' => helper::createLink('story', 'batchClose', "productID=0&executionID=0&storyType=requirement&from={$app->rawMethod}")) : null,
|
||||
), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary'));
|
||||
|
||||
if($canBatchAction) $config->my->requirement->dtable->fieldList['id']['type'] = 'checkID';
|
||||
|
||||
$stories = initTableData($stories, $config->my->requirement->dtable->fieldList, $this->story);
|
||||
|
||||
@@ -110,14 +110,13 @@ class storyModel extends model
|
||||
*/
|
||||
public function getByList(array|string $storyIdList, string $type = 'story', string $mode = ''): array
|
||||
{
|
||||
if(empty($storyIdList)) return array();
|
||||
return $this->dao->select('t1.*, t2.spec, t2.verify, t3.name as productTitle, t3.deleted as productDeleted')
|
||||
->from(TABLE_STORY)->alias('t1')
|
||||
->leftJoin(TABLE_STORYSPEC)->alias('t2')->on('t1.id=t2.story')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product=t3.id')
|
||||
->where('t1.version=t2.version')
|
||||
->andWhere('t1.id')->in($storyIdList)
|
||||
->andWhere('t1.type')->eq($type)
|
||||
->beginIF($storyIdList)->andWhere('t1.id')->in($storyIdList)->fi()
|
||||
->beginIF(!$storyIdList)->andWhere('t1.type')->eq($type)->fi()
|
||||
->beginIF($mode != 'all')->andWhere('t1.deleted')->eq(0)->fi()
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user