* Refactor the browse units view.

This commit is contained in:
daitingting
2023-06-26 11:45:00 +00:00
parent 2d54d0fb7e
commit 40222cf216
9 changed files with 106 additions and 16 deletions
+17 -15
View File
@@ -40,7 +40,8 @@ $canCreate = $canCreateCase || $canBatchCreateCase || $canCreateScene;
$lang->testcase->typeList[''] = $lang->testcase->allType;
if(!isset($param)) $param = 0;
if($rawMethod == 'zerocase') $caseType = '';
if($rawMethod == 'zerocase') $caseType = '';
if($rawMethod == 'browseunits') $caseType = 'unit';
if($canSwitchCaseType)
{
@@ -90,10 +91,11 @@ if($canDisplaySuite)
$linkParams = $projectParam . "productID=$productID&branch=$branch&browseType={key}&param=0&caseType={$caseType}";
$browseLink = createLink('testcase', 'browse', $linkParams);
if($rawMethod == 'browseunits') $browseLink = createLink('testtask', 'browse', "productID=$productID&browseType={key}");
featureBar
(
set::linkParams($rawMethod == 'zerocase' ? null : $linkParams),
set::link($rawMethod == 'zerocase' ? $browseLink : null),
set::linkParams($rawMethod == 'zerocase' || $rawMethod == 'browseunits' ? null : $linkParams),
set::link($rawMethod == 'zerocase' || $rawMethod == 'browseunits' ? $browseLink : null),
$canSwitchCaseType ? to::before
(
productMenu
@@ -102,7 +104,7 @@ featureBar
set::items($caseTypeItems)
)
) : null,
$canBrowseZeroCase ? li
$canBrowseZeroCase && $rawMethod != 'browseunits' ? li
(
set::class('nav-item'),
a
@@ -114,7 +116,7 @@ featureBar
$lang->testcase->zeroCase
)
) : null,
$canDisplaySuite ? dropdown
$canDisplaySuite && $rawMethod != 'browseunits' ? dropdown
(
btn
(
@@ -123,18 +125,18 @@ featureBar
),
set::items($suiteItems)
) : null,
li
$rawMethod != 'browseunits' ? li
(
set::class('nav-item'),
a($lang->testcase->onlyAutomated)
),
li
) : null,
$rawMethod != 'browseunits' ? li
(
set::class('nav-item'),
a($lang->testcase->onlyScene)
),
li(searchToggle(set::open($browseType == 'bysearch'))),
li(btn(setClass('ghost'), set::icon('unfold-all'), $lang->sort))
) : null,
$rawMethod != 'browseunits' ? (searchToggle(set::open($browseType == 'bysearch'))) : null,
$rawMethod != 'browseunits' ? li(btn(setClass('ghost'), set::icon('unfold-all'), $lang->sort)) : null
);
$viewItems = array(array('text' => $lang->testcase->listView, 'active' => true));
@@ -220,7 +222,7 @@ toolbar
set::items($viewItems),
set::placement('bottom-end'),
) : null,
$canAutomation ? btn
$canAutomation && $rawMethod != 'browseunits' ? btn
(
set
(
@@ -237,7 +239,7 @@ toolbar
set::items($exportItems),
set::placement('bottom-end'),
) : null,
$importItems ? dropdown
$importItems && $rawMethod != 'browseunits'? dropdown
(
btn
(
@@ -247,7 +249,7 @@ toolbar
set::items($importItems),
set::placement('bottom-end'),
) : null,
$canCreate ? btngroup
$canCreate && $rawMethod != 'browseunits' ? btngroup
(
btn
(
@@ -265,7 +267,7 @@ toolbar
) : null,
);
if($rawMethod != 'zerocase')
if($rawMethod != 'zerocase' && $rawMethod != 'browseunits')
{
$settingLink = $canManageModule ? createLink('tree', 'browse', "productID=$productID&view=case&currentModuleID=0&branch=0&from={$app->tab}") : '';
$closeLink = $browseType == 'bymodule' ? createLink($currentModule, $currentMethod, $projectParam . "productID=$productID&branch=$branch&browseType=$browseType&param=0&caseType=&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("caseModule")';
+5
View File
@@ -49,6 +49,11 @@ $config->testtask->actionList['view']['url'] = array('module' => 'testta
$config->testtask->actionList['view']['data-toggle'] = 'modal';
$config->testtask->actionList['view']['data-size'] = 'lg';
$config->testtask->actionList['unitCases']['icon'] = 'list-alt';
$config->testtask->actionList['unitCases']['text'] = $lang->testtask->unitCases;
$config->testtask->actionList['unitCases']['hint'] = $lang->testtask->unitCases;
$config->testtask->actionList['unitCases']['url'] = array('module' => 'testtask', 'method' => 'unitcases', 'params' => 'taskID={id}');
$config->testtask->actionList['edit']['icon'] = 'edit';
$config->testtask->actionList['edit']['text'] = $lang->testtask->edit;
$config->testtask->actionList['edit']['hint'] = $lang->testtask->edit;
+38
View File
@@ -101,3 +101,41 @@ $config->testtask->linkcase->dtable->fieldList['lastRunner'] = $config->testc
$config->testtask->linkcase->dtable->fieldList['lastRunDate'] = $config->testcase->dtable->fieldList['lastRunDate'];
$config->testtask->linkcase->dtable->fieldList['lastRunResult'] = $config->testcase->dtable->fieldList['lastRunResult'];
unset($config->testtask->linkcase->dtable->fieldList['title']['nestedToggle']);
$config->testtask->browseUnits = new stdclass();
$config->testtask->browseUnits->dtable = new stdclass();
$config->testtask->browseUnits->dtable->fieldList['id'] = $config->testtask->dtable->fieldList['id'];
$config->testtask->browseUnits->dtable->fieldList['title'] = $config->testtask->dtable->fieldList['title'];
$config->testtask->browseUnits->dtable->fieldList['title']['title'] = $lang->testtask->unitName;
$config->testtask->browseUnits->dtable->fieldList['execution'] = $config->testtask->dtable->fieldList['execution'];
$config->testtask->browseUnits->dtable->fieldList['build'] = $config->testtask->dtable->fieldList['build'];
$config->testtask->browseUnits->dtable->fieldList['owner'] = $config->testtask->dtable->fieldList['owner'];
$config->testtask->browseUnits->dtable->fieldList['execTime']['name'] = 'execTime';
$config->testtask->browseUnits->dtable->fieldList['execTime']['title'] = $lang->testtask->execTime;
$config->testtask->browseUnits->dtable->fieldList['execTime']['type'] = 'datetime';
$config->testtask->browseUnits->dtable->fieldList['execTime']['group'] = 'user';
$config->testtask->browseUnits->dtable->fieldList['caseCount']['name'] = 'caseCount';
$config->testtask->browseUnits->dtable->fieldList['caseCount']['title'] = $lang->testtask->caseCount;
$config->testtask->browseUnits->dtable->fieldList['caseCount']['type'] = 'number';
$config->testtask->browseUnits->dtable->fieldList['caseCount']['group'] = 'number';
$config->testtask->browseUnits->dtable->fieldList['passCount']['name'] = 'passCount';
$config->testtask->browseUnits->dtable->fieldList['passCount']['title'] = $lang->testtask->passCount;
$config->testtask->browseUnits->dtable->fieldList['passCount']['type'] = 'number';
$config->testtask->browseUnits->dtable->fieldList['passCount']['group'] = 'number';
$config->testtask->browseUnits->dtable->fieldList['failCount']['name'] = 'failCount';
$config->testtask->browseUnits->dtable->fieldList['failCount']['title'] = $lang->testtask->failCount;
$config->testtask->browseUnits->dtable->fieldList['failCount']['type'] = 'number';
$config->testtask->browseUnits->dtable->fieldList['failCount']['group'] = 'number';
$config->testtask->browseUnits->dtable->fieldList['actions']['name'] = 'actions';
$config->testtask->browseUnits->dtable->fieldList['actions']['title'] = $lang->actions;
$config->testtask->browseUnits->dtable->fieldList['actions']['type'] = 'actions';
$config->testtask->browseUnits->dtable->fieldList['actions']['sortType'] = false;
$config->testtask->browseUnits->dtable->fieldList['actions']['list'] = $config->testtask->actionList;
$config->testtask->browseUnits->dtable->fieldList['actions']['menu'] = array('unitCases', 'edit', 'delete');
+2
View File
@@ -201,6 +201,8 @@ class testtask extends control
/* Append id for secend sort. */
$sort = common::appendOrder($orderBy);
$this->lang->testcase->featureBar['browseunits'] = $this->lang->testtask->unitTag;
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->common;
$this->view->projectID = $projectID;
$this->view->productID = $productID;
+1
View File
@@ -154,6 +154,7 @@ $lang->testtask->titleOfAuto = "%s automated testing";
$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.';
$lang->testtask->finishedDateLess = 'Actual Finished Date cannot be <= Begin Date %s';
$lang->testtask->finishedDateMore = 'Actual Finished Date cannot be > Today';
$lang->testtask->emptyUnitTip = 'No unit test results.';
$lang->testtask->assignedToMe = 'Meine';
$lang->testtask->allCases = 'Alle Fälle';
+1
View File
@@ -154,6 +154,7 @@ $lang->testtask->titleOfAuto = "%s automated testing";
$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.';
$lang->testtask->finishedDateLess = 'Actual Finished Date cannot be <= Begin Date %s';
$lang->testtask->finishedDateMore = 'Actual Finished Date cannot be > Today';
$lang->testtask->emptyUnitTip = 'No unit test results.';
$lang->testtask->assignedToMe = 'AssignedToMe';
$lang->testtask->allCases = 'All Cases';
+1
View File
@@ -154,6 +154,7 @@ $lang->testtask->titleOfAuto = "%s tests automatisés";
$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.';
$lang->testtask->finishedDateLess = 'Actual Finished Date cannot be <= Begin Date %s';
$lang->testtask->finishedDateMore = 'Actual Finished Date cannot be > Today';
$lang->testtask->emptyUnitTip = 'No unit test results.';
$lang->testtask->assignedToMe = 'Affecté à Moi';
$lang->testtask->allCases = 'Tous les CasTests';
+4 -1
View File
@@ -78,6 +78,7 @@ $lang->testtask->executor = '执行人';
$lang->testtask->execTime = '执行时间';
$lang->testtask->pri = '优先级';
$lang->testtask->name = '测试单名称';
$lang->testtask->unitName = '单侧名称';
$lang->testtask->begin = '开始日期';
$lang->testtask->end = '结束日期';
$lang->testtask->realFinishedDate = '实际完成日期';
@@ -107,6 +108,7 @@ $lang->testtask->passCount = '成功';
$lang->testtask->failCount = '失败';
$lang->testtask->summary = '有%s个用例,失败%s个,耗时%s。';
$lang->testtask->stepSummary = '共有%s个步骤,%s个通过,%s个失败。';
$lang->testtask->unitSummary = '本页共 <strong>%s</strong> 个单元测试结果。';
$lang->testtask->pageSummary = '本页共 <strong>%s</strong> 个测试单。';
$lang->testtask->mySummary = '本页共 <strong>%s</strong> 个测试单,待测试 <strong>%s</strong>,测试中 <strong>%s</strong>,被阻塞 <strong>%s</strong>。';
$lang->testtask->allSummary = '本页共 <strong>%s</strong> 个测试单,待测试 <strong>%s</strong>,测试中 <strong>%s</strong>,被阻塞 <strong>%s</strong>,已测试 <strong>%s</strong>。';
@@ -152,6 +154,7 @@ $lang->testtask->titleOfAuto = "%s 自动化测试";
$lang->testtask->cannotBeParsed = '导入的XML文件内容格式错误,无法解析。';
$lang->testtask->finishedDateLess = '实际完成日期不能小于开始日期%s';
$lang->testtask->finishedDateMore = '实际完成日期不能大于今天';
$lang->testtask->emptyUnitTip = '暂时没有单元测试结果。';
$lang->testtask->assignedToMe = '指派给我';
$lang->testtask->allCases = '全部用例';
@@ -214,7 +217,7 @@ $lang->testtask->featureBar['linkcase']['bysuite'] = $lang->testtask->linkBySuit
$lang->testtask->featureBar['linkcase']['bybuild'] = $lang->testtask->linkByBuild;
$lang->testtask->featureBar['linkcase']['bybug'] = $lang->testtask->linkByBug;
$lang->testtask->unitTag['all'] = '所有';
$lang->testtask->unitTag['all'] = '全部';
$lang->testtask->unitTag['newest'] = '最近';
$lang->testtask->unitTag['thisWeek'] = '本周';
$lang->testtask->unitTag['lastWeek'] = '上周';
+37
View File
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
/**
* The browse units view file of testtask module of ZenTaoPMS.
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Tingting Dai <daitingting@easycorp.ltd>
* @package testtask
* @link https://www.zentao.net
*/
namespace zin;
include '../../testcase/ui/header.html.php';
$cols = $this->config->testtask->browseUnits->dtable->fieldList;
$tasks = initTableData($tasks, $cols, $this->testtask);
$summary = sprintf($lang->testtask->unitSummary, $pager->recTotal);
dtable
(
set::cols($cols),
set::data(array_values($tasks)),
set::emptyTip($lang->testtask->emptyUnitTip),
set::userMap($users),
set::footer(array(array('html' => $summary), 'flex', 'pager')),
set::footPager
(
usePager(),
set::page($pager->pageID),
set::recPerPage($pager->recPerPage),
set::recTotal($pager->recTotal),
set::linkCreator(helper::createLink('testtask', 'browseunits', "productID={$product->id}&browseType={$browseType}&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={recPerPage}&page={page}"))
),
);
render();