* Add table sort to testcase::browse.

This commit is contained in:
liumengyi
2023-10-18 13:51:26 +08:00
parent 3e3842e80c
commit 234bf79172
3 changed files with 65 additions and 47 deletions
+62 -47
View File
@@ -12,6 +12,7 @@ $config->testcase->dtable->fieldList['id']['group'] = 1;
$config->testcase->dtable->fieldList['title']['title'] = $lang->testcase->title;
$config->testcase->dtable->fieldList['title']['type'] = 'title';
$config->testcase->dtable->fieldList['title']['fixed'] = 'left';
$config->testcase->dtable->fieldList['title']['sortType'] = true;
$config->testcase->dtable->fieldList['title']['nestedToggle'] = true;
$config->testcase->dtable->fieldList['title']['link'] = array('module' => 'testcase', 'method' => 'view', 'params' => "caseID={caseID}");
$config->testcase->dtable->fieldList['title']['required'] = true;
@@ -27,54 +28,64 @@ $config->testcase->dtable->fieldList['pri']['sortType'] = true;
$config->testcase->dtable->fieldList['pri']['show'] = true;
$config->testcase->dtable->fieldList['pri']['group'] = 2;
$config->testcase->dtable->fieldList['type']['title'] = $lang->testcase->type;
$config->testcase->dtable->fieldList['type']['type'] = 'category';
$config->testcase->dtable->fieldList['type']['map'] = $lang->testcase->typeList;
$config->testcase->dtable->fieldList['type']['group'] = 2;
$config->testcase->dtable->fieldList['type']['title'] = $lang->testcase->type;
$config->testcase->dtable->fieldList['type']['type'] = 'category';
$config->testcase->dtable->fieldList['type']['map'] = $lang->testcase->typeList;
$config->testcase->dtable->fieldList['type']['group'] = 2;
$config->testcase->dtable->fieldList['type']['sortType'] = true;
$config->testcase->dtable->fieldList['status']['title'] = $lang->testcase->status;
$config->testcase->dtable->fieldList['status']['type'] = 'status';
$config->testcase->dtable->fieldList['status']['statusMap'] = $lang->testcase->statusList;
$config->testcase->dtable->fieldList['status']['group'] = 2;
$config->testcase->dtable->fieldList['status']['sortType'] = true;
$config->testcase->dtable->fieldList['stage']['title'] = $lang->testcase->stage;
$config->testcase->dtable->fieldList['stage']['type'] = 'text';
$config->testcase->dtable->fieldList['stage']['group'] = 2;
$config->testcase->dtable->fieldList['stage']['title'] = $lang->testcase->stage;
$config->testcase->dtable->fieldList['stage']['type'] = 'text';
$config->testcase->dtable->fieldList['stage']['group'] = 2;
$config->testcase->dtable->fieldList['stage']['sortType'] = true;
$config->testcase->dtable->fieldList['precondition']['title'] = $lang->testcase->precondition;
$config->testcase->dtable->fieldList['precondition']['type'] = 'desc';
$config->testcase->dtable->fieldList['precondition']['group'] = 3;
$config->testcase->dtable->fieldList['precondition']['title'] = $lang->testcase->precondition;
$config->testcase->dtable->fieldList['precondition']['type'] = 'desc';
$config->testcase->dtable->fieldList['precondition']['group'] = 3;
$config->testcase->dtable->fieldList['precondition']['sortType'] = true;
$config->testcase->dtable->fieldList['story']['title'] = $lang->testcase->story;
$config->testcase->dtable->fieldList['story']['type'] = 'desc';
$config->testcase->dtable->fieldList['story']['link'] = array('module' => 'story', 'method' => 'view', 'params' => "storyID={story}");
$config->testcase->dtable->fieldList['story']['group'] = 3;
$config->testcase->dtable->fieldList['keywords']['title'] = $lang->testcase->keywords;
$config->testcase->dtable->fieldList['keywords']['type'] = 'text';
$config->testcase->dtable->fieldList['keywords']['group'] = 3;
$config->testcase->dtable->fieldList['keywords']['title'] = $lang->testcase->keywords;
$config->testcase->dtable->fieldList['keywords']['type'] = 'text';
$config->testcase->dtable->fieldList['keywords']['group'] = 3;
$config->testcase->dtable->fieldList['keywords']['sortType'] = true;
$config->testcase->dtable->fieldList['openedBy']['title'] = $lang->testcase->openedByAB;
$config->testcase->dtable->fieldList['openedBy']['type'] = 'user';
$config->testcase->dtable->fieldList['openedBy']['show'] = true;
$config->testcase->dtable->fieldList['openedBy']['group'] = 4;
$config->testcase->dtable->fieldList['openedBy']['title'] = $lang->testcase->openedByAB;
$config->testcase->dtable->fieldList['openedBy']['type'] = 'user';
$config->testcase->dtable->fieldList['openedBy']['show'] = true;
$config->testcase->dtable->fieldList['openedBy']['group'] = 4;
$config->testcase->dtable->fieldList['openedBy']['sortType'] = true;
$config->testcase->dtable->fieldList['openedDate']['title'] = $lang->testcase->openedDate;
$config->testcase->dtable->fieldList['openedDate']['type'] = 'date';
$config->testcase->dtable->fieldList['openedDate']['group'] = 4;
$config->testcase->dtable->fieldList['openedDate']['title'] = $lang->testcase->openedDate;
$config->testcase->dtable->fieldList['openedDate']['type'] = 'date';
$config->testcase->dtable->fieldList['openedDate']['group'] = 4;
$config->testcase->dtable->fieldList['openedDate']['sortType'] = true;
$config->testcase->dtable->fieldList['reviewedBy']['title'] = $lang->testcase->reviewedByAB;
$config->testcase->dtable->fieldList['reviewedBy']['type'] = 'user';
$config->testcase->dtable->fieldList['reviewedBy']['group'] = 4;
$config->testcase->dtable->fieldList['reviewedBy']['title'] = $lang->testcase->reviewedByAB;
$config->testcase->dtable->fieldList['reviewedBy']['type'] = 'user';
$config->testcase->dtable->fieldList['reviewedBy']['group'] = 4;
$config->testcase->dtable->fieldList['reviewedBy']['sortType'] = true;
$config->testcase->dtable->fieldList['reviewedDate']['title'] = $lang->testcase->reviewedDate;
$config->testcase->dtable->fieldList['reviewedDate']['type'] = 'datetime';
$config->testcase->dtable->fieldList['reviewedDate']['group'] = 4;
$config->testcase->dtable->fieldList['reviewedDate']['title'] = $lang->testcase->reviewedDate;
$config->testcase->dtable->fieldList['reviewedDate']['type'] = 'datetime';
$config->testcase->dtable->fieldList['reviewedDate']['group'] = 4;
$config->testcase->dtable->fieldList['reviewedDate']['sortType'] = true;
$config->testcase->dtable->fieldList['lastRunner']['title'] = $lang->testcase->lastRunner;
$config->testcase->dtable->fieldList['lastRunner']['type'] = 'user';
$config->testcase->dtable->fieldList['lastRunner']['show'] = true;
$config->testcase->dtable->fieldList['lastRunner']['group'] = 4;
$config->testcase->dtable->fieldList['lastRunner']['title'] = $lang->testcase->lastRunner;
$config->testcase->dtable->fieldList['lastRunner']['type'] = 'user';
$config->testcase->dtable->fieldList['lastRunner']['show'] = true;
$config->testcase->dtable->fieldList['lastRunner']['group'] = 4;
$config->testcase->dtable->fieldList['lastRunner']['sortType'] = true;
$config->testcase->dtable->fieldList['lastRunDate']['title'] = $lang->testcase->lastRunDate;
$config->testcase->dtable->fieldList['lastRunDate']['type'] = 'datetime';
@@ -87,6 +98,7 @@ $config->testcase->dtable->fieldList['lastRunResult']['type'] = 'status';
$config->testcase->dtable->fieldList['lastRunResult']['statusMap'] = $lang->testcase->resultList;
$config->testcase->dtable->fieldList['lastRunResult']['show'] = true;
$config->testcase->dtable->fieldList['lastRunResult']['group'] = 4;
$config->testcase->dtable->fieldList['lastRunResult']['sortType'] = true;
$config->testcase->dtable->fieldList['bugs']['title'] = $lang->testcase->bugsAB;
$config->testcase->dtable->fieldList['bugs']['link'] = array('module' => 'testcase', 'method' => 'bugs', 'params' => "runID=0&caseID={caseID}");
@@ -95,27 +107,30 @@ $config->testcase->dtable->fieldList['bugs']['data-toggle'] = 'modal';
$config->testcase->dtable->fieldList['bugs']['data-size'] = 'lg';
$config->testcase->dtable->fieldList['bugs']['group'] = 5;
$config->testcase->dtable->fieldList['results']['title'] = $lang->testcase->results;
$config->testcase->dtable->fieldList['results']['title'] = $lang->testcase->resultsAB;
$config->testcase->dtable->fieldList['results']['type'] = 'number';
$config->testcase->dtable->fieldList['results']['group'] = 5;
$config->testcase->dtable->fieldList['results']['title'] = $lang->testcase->resultsAB;
$config->testcase->dtable->fieldList['results']['type'] = 'number';
$config->testcase->dtable->fieldList['results']['group'] = 5;
$config->testcase->dtable->fieldList['results']['sortType'] = true;
$config->testcase->dtable->fieldList['stepNumber']['title'] = $lang->testcase->stepNumber;
$config->testcase->dtable->fieldList['stepNumber']['title'] = $lang->testcase->stepNumberAB;
$config->testcase->dtable->fieldList['stepNumber']['type'] = 'number';
$config->testcase->dtable->fieldList['stepNumber']['group'] = 5;
$config->testcase->dtable->fieldList['stepNumber']['title'] = $lang->testcase->stepNumberAB;
$config->testcase->dtable->fieldList['stepNumber']['type'] = 'number';
$config->testcase->dtable->fieldList['stepNumber']['group'] = 5;
$config->testcase->dtable->fieldList['stepNumber']['sortType'] = true;
$config->testcase->dtable->fieldList['version']['title'] = $lang->testcase->version;
$config->testcase->dtable->fieldList['version']['type'] = 'text';
$config->testcase->dtable->fieldList['version']['group'] = 5;
$config->testcase->dtable->fieldList['version']['title'] = $lang->testcase->version;
$config->testcase->dtable->fieldList['version']['type'] = 'text';
$config->testcase->dtable->fieldList['version']['group'] = 5;
$config->testcase->dtable->fieldList['version']['sortType'] = true;
$config->testcase->dtable->fieldList['lastEditedBy']['title'] = $lang->testcase->lastEditedBy;
$config->testcase->dtable->fieldList['lastEditedBy']['type'] = 'user';
$config->testcase->dtable->fieldList['lastEditedBy']['group'] = 6;
$config->testcase->dtable->fieldList['lastEditedBy']['title'] = $lang->testcase->lastEditedBy;
$config->testcase->dtable->fieldList['lastEditedBy']['type'] = 'user';
$config->testcase->dtable->fieldList['lastEditedBy']['group'] = 6;
$config->testcase->dtable->fieldList['lastEditedBy']['sortType'] = true;
$config->testcase->dtable->fieldList['lastEditedDate']['title'] = $lang->testcase->lastEditedDate;
$config->testcase->dtable->fieldList['lastEditedDate']['type'] = 'date';
$config->testcase->dtable->fieldList['lastEditedDate']['group'] = 6;
$config->testcase->dtable->fieldList['lastEditedDate']['title'] = $lang->testcase->lastEditedDate;
$config->testcase->dtable->fieldList['lastEditedDate']['type'] = 'date';
$config->testcase->dtable->fieldList['lastEditedDate']['group'] = 6;
$config->testcase->dtable->fieldList['lastEditedDate']['sortType'] = true;
$config->testcase->dtable->fieldList['actions']['title'] = $lang->actions;
$config->testcase->dtable->fieldList['actions']['type'] = 'actions';
+2
View File
@@ -131,6 +131,8 @@ dtable
set::onRenderCell(jsRaw('window.onRenderCell')),
set::checkable($canBatchAction),
set::checkInfo(jsRaw('function(checks){return window.setStatistics(this, checks);}')),
set::orderBy($orderBy),
set::sortLink(createLink('testcase', 'browse', "productID={$productID}&branch={$branch}&browseType={$browseType}&param={$param}&caseType={$caseType}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}&projectID={$projectID}")),
set::footToolbar($footToolbar),
set::footPager(usePager()),
set::customData(array('isOnlyScene' => $isOnlyScene, 'pageSummary' => $summary, 'modules' => $modulePairs))
+1
View File
@@ -415,6 +415,7 @@ class testcaseZen extends testcase
$cases = array();
$scenes = array();
$sort = common::appendOrder($orderBy);
if(strpos($sort, 'caseID') !== false) $sort = str_replace('caseID', 'id', $sort);
if($browseType == 'all' || $browseType == 'onlyscene')
{
$pager->pageID = $pageID; // 场景和用例混排,$pageID 可能大于场景分页后的总页数。在 pager 构造函数中会被设为 1,这里要重新赋值。