* Adjust buildOperateMenu to initTableData.

This commit is contained in:
wangyuting
2023-06-08 10:32:59 +08:00
parent a6b82ab88f
commit c22b94ac98
4 changed files with 33 additions and 25 deletions
+1 -1
View File
@@ -1116,7 +1116,7 @@ class project extends control
if($task->status == 'doing') $testingCount ++;
if($task->status == 'blocked') $blockedCount ++;
if($task->status == 'done') $doneCount ++;
if($task->build == 'trunk' || empty($task->buildName)) $task->buildName = $this->lang->trunk;
}
$this->view->title = $project->name . $this->lang->colon . $this->lang->project->common;
+11 -22
View File
@@ -9,17 +9,6 @@ declare(strict_types=1);
* @link https://www.zentao.net
*/
namespace zin;
$this->testtask->buildOperateMenu(null, 'browse');
foreach($tasks as $task)
{
$actions = array();
foreach($this->config->testtask->dtable->fieldList['actions']['actionsMap'] as $actionCode => $actionMap)
{
$isClickable = $this->testtask->isClickable($task, $actionCode);
$actions[] = $isClickable ? $actionCode : array('name' => $actionCode, 'disabled' => true);
}
$task->actions = $actions;
}
featureBar
(
@@ -27,22 +16,22 @@ featureBar
set::linkParams("projectID={$projectID}")
);
$cols = array_values($config->testtask->dtable->fieldList);
$data = array_values($tasks);
toolbar
(
btngroup
common::canModify('project', $project) && common::hasPriv('testtask', 'create') ? btn
(
btn
(
setClass('btn primary'),
set::icon('plus'),
set::url(helper::createLink('testtask', 'create', "product=$productID")),
$lang->testtask->create
)
)
setClass('btn primary'),
set::icon('plus'),
set::url(helper::createLink('testtask', 'create', "product=0&executionID=0&build=0&projectID={$projectID}")),
$lang->testtask->create
) : null
);
if(!$project->hasProduct) unset($config->testtask->dtable->fieldList['product']);
$tasks = initTableData($tasks, $config->testtask->dtable->fieldList, $this->testtask);
$cols = array_values($config->testtask->dtable->fieldList);
$data = array_values($tasks);
$footerHTML = sprintf($lang->testtask->allSummary, count($tasks), $waitCount, $testingCount, $blockedCount, $doneCount);
dtable
(
+20 -1
View File
@@ -189,15 +189,34 @@ class testtaskModel extends model
*/
public function getProjectTasks($projectID, $orderBy = 'id_desc', $pager = null)
{
return $this->dao->select('t1.*, t2.name AS buildName')
$tasks = $this->dao->select('t1.*, t2.name AS buildName, t3.name as executionName, t4.name AS productName')
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = t2.id')
->leftJoin(TABLE_EXECUTION)->alias('t3')->on('t1.execution = t3.id')
->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t1.product = t4.id')
->where('t1.project')->eq((int)$projectID)
->andWhere('t1.auto')->ne('unit')
->andWhere('t1.deleted')->eq(0)
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
foreach($tasks as $taskID => $task)
{
if($task->multiple)
{
if($task->projectName and $task->executionName)
{
$tasks[$taskID]->executionName = $task->projectName . '/' . $task->executionName;
}
elseif(!$task->executionName)
{
$tasks[$taskID]->executionName = $task->projectName;
}
}
}
return $tasks;
}
/**
+1 -1
View File
@@ -48,7 +48,7 @@ featureBar
)
);
if(!$product->shadow) unset($config->testtask->dtable->fieldList['product']);
if($product->shadow) unset($config->testtask->dtable->fieldList['product']);
$tasks = initTableData($tasks, $config->testtask->dtable->fieldList, $this->testtask);
$cols = array_values($config->testtask->dtable->fieldList);