From 77c96eec2492ff062962e3ba0059c29e856d2244 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Mon, 18 Dec 2023 21:40:56 -0500 Subject: [PATCH] Revert "* Finish task #107892." This reverts commit 8415e68eaa65d0ab3e98d4a96e65cf74276fa943. --- module/testtask/control.php | 58 +++++----------------------- module/testtask/css/cases.css | 60 ----------------------------- module/testtask/view/cases.html.php | 17 +++++--- 3 files changed, 21 insertions(+), 114 deletions(-) diff --git a/module/testtask/control.php b/module/testtask/control.php index 9c15d86b6b..7884d714e2 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -561,52 +561,8 @@ class testtask extends control $sort = common::appendOrder($orderBy, 't2.id'); /* Get test cases. */ - $runs = array(); - $pager->pageID = $pageID; // 场景和用例混排,$pageID 可能大于场景分页后的总页数。在 pager 构造函数中会被设为 1,这里要重新赋值。 - - $scenes = $this->testcase->getSceneGroups($productID, $task->branch, $moduleID, '', $orderBy, $pager); // 获取包含子场景和用例的顶级场景树。 - $recPerPage = $pager->recPerPage; - $sceneTotal = $pager->recTotal; - $sceneCount = count($scenes); - - /* 场景条数小于每页记录数,继续获取用例。 */ - if($sceneCount < $recPerPage) - { - /* 重置 $pager 属性,只获取需要的用例条数。*/ - $pager->recTotal = 0; - $pager->pageID = 1; // 查询用例时的分页起始偏移量单独计算,每次查询的页码都设为 1 即可,后面会重新设置页码。 - $pager->recPerPage = $recPerPage - $sceneCount; // 可能存在场景没排满一页,需要用例补全的情况。这里只查询需要补全的记录数。 - - if($sceneCount == 0) $pager->offset = $recPerPage * ($pageID - 1) - $sceneTotal; // 场景数为 0 表示本页查询只显示用例,需要计算用例分页的起始 - - $runs = $this->testtask->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task); - - /* Process case for check story changed. */ - $runs = $this->loadModel('story')->checkNeedConfirm($runs); - $runs = $this->testcase->appendData($runs, 'run'); - foreach($runs as $runID => $run) - { - unset($runs[$runID]); - if($run->task != $taskID and $run->scene) continue; - - $run->id = 'case_' . $run->case; // Add a prefix to avoid duplication with the scene ID. - $run->parent = 0; - $run->grade = 1; - $run->path = ',' . $run->case . ','; - $run->isScene = false; - $runs[$run->id] = $run; - } - - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); - } - - /* 合并场景和用例的总记录数,并重新计算总页数和当前页码。*/ - $pager->recTotal = $sceneTotal + count($runs); - $pager->recPerPage = $recPerPage; - $pager->pageTotal = ceil($pager->recTotal / $recPerPage); - $pager->pageID = $pageID; - - $sceneRuns = $this->testcase->processSearchedData($scenes, $runs); + $runs = $this->testtask->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task); + $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); /* Build the search form. */ $this->loadModel('testcase'); @@ -628,16 +584,22 @@ class testtask extends control $this->loadModel('search')->setSearchParams($this->config->testcase->search); /* Append bugs and results. */ + $runs = $this->testcase->appendData($runs, 'run'); + $case2RunMap = array(); foreach($runs as $run) $case2RunMap[$run->case] = $run->id; $showModule = $this->loadModel('setting')->getItem("owner={$this->app->user->account}&module=datatable§ion=testtaskCases&key=showModule"); - $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; - $this->view->runs = $sceneRuns; + $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; + $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->position[] = $this->lang->testtask->common; + $this->view->position[] = $this->lang->testtask->cases; + $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; $this->view->task = $task; + $this->view->runs = $runs; $this->view->case2RunMap = $case2RunMap; $this->view->users = $this->loadModel('user')->getPairs('noclosed|qafirst|noletter'); $this->view->assignedToList = $assignedToList; diff --git a/module/testtask/css/cases.css b/module/testtask/css/cases.css index 8c106240e3..07ce91ae3e 100644 --- a/module/testtask/css/cases.css +++ b/module/testtask/css/cases.css @@ -14,63 +14,3 @@ td .warning {color: red;} #modules .active {font-weight: bolder;} .tree li > a.active {color: #0c64eb;} - -body {margin-bottom: 25px;} -.w-220px {width: 220px;} -.w-170px {width: 170px;} - -#createActionMenu .dropdown-menu {width: 100%;} -#caseForm table tbody tr td {overflow: hidden; white-space: nowrap;} -#caseForm .setting {height: 25px;} -#caseForm table tbody .c-name {overflow: hidden; padding-right: 65px;} -#caseForm table tbody .c-name a:first-child {overflow: hidden; display: inline-block; max-width: 100%;} - -.dropdown-menu.with-search {padding: 0; min-width: 150px; overflow: hidden; max-height: 302px;} -.dropdown-menu > .menu-search .input-group {width: 100%;} -.dropdown-menu > .menu-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666;} -.dropdown-menu > .menu-search .form-control {border: none !important; box-shadow: none !important; border-top: 1px solid #ddd !important;} -.dropdown-list {display: block; padding: 0; max-height: 270px; overflow-y: auto;} -.dropdown-list > li > a {display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.53846154; color: #141414; white-space: nowrap;} -.dropdown-list > li > a:hover, -.dropdown-list > li > a:focus {color: #1a4f85; text-decoration: none; background-color: #ddd;} - -.pl-5px {padding-left: 5px;} - -tbody > tr > td > .btn-icon {margin-right: 3px;} -tbody > tr > td .icon-share {font-size: 9px;} - -.table td.c-title > a:first-child {display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} - -#importToLib .select-lib {width: 100px; text-align: right;} -#subHeader #currentBranch + #dropMenu .col-left {padding-bottom: 30px;} -.status-blocked {left: -5px;} - -#mainMenu .pull-left .dividing-line {margin: 7px 5px 0 0;} -.btn-toolbar>.btn, .btn-toolbar>.btn-group, .btn-toolbar>.dropdown {margin-right: 5px;} - -#mainMenu > .btn-toolbar > .checkbox-primary{float: left;} - -.table-nest-icon { cursor: pointer; } - -.tr-moving { opacity: 0.3; } -.tr-acceptable { border: 2px solid rgba(255,0,0,0.5); } -.none-select { -webkit-user-select: none; -moz-user-select: none; -moz-user-select: none; user-select: none; } - -.table-nest-toggle { vertical-align: middle; } -.table-nest-title .icon-test { pointer-events: none; } - -.icon-test:after,.icon-ztf:after { border: 0px solid!important; } - -#caseTableList.sortable-sorting > tr {opacity: 0.7} -#caseTableList.sortable-sorting > tr.drag-row {opacity: 1;} -#caseTableList > tr.drop-not-allowed {opacity: 0.1!important} -#caseList .c-actions {overflow: visible;} -#caseList > thead > tr > th .table-nest-toggle-global {top: 6px} -#caseList > thead > tr > th .table-nest-toggle-global:before {color: #a6aab8;} -#caseTableList > tr:last-child .c-actions .dropdown-menu {top: auto; bottom: 100%; margin-bottom: -5px;} -#caseTableList .icon-common:before {width: 22px; height: 22px; background: none; color: rgb(166, 170, 184); top: 0; line-height: 22px; margin-right: 2px; font-size: 14px} -#caseTableList .icon-project:before {content: '\e99c';} -#caseTableList .icon-test:before {content: '\e956';} -#caseTableList .icon-ztf:before {content: '\e9dd';} -#caseTableList .icon-waterfall:before {content: '\e9a4';} -#caseTableList .icon-kanban:before {content: '\e983';} diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index b4ceb4ea77..e40e9450c7 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -11,7 +11,7 @@ */ ?> - + testtask->confirmUnlinkCase)?> session->taskCaseBrowseType == 'bysearch') ? 'all' : $this->session->taskCaseBrowseType);?> @@ -45,8 +45,7 @@ $datatableId = $this->moduleName . ucfirst($this->methodName); $useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable'); ?> -
> + >
@@ -63,13 +62,15 @@ if($useDatatable) include '../../common/view/datatable.html.php'; if(!$useDatatable) include '../../common/view/tablesorter.html.php'; + $config->testcase->datatable->defaultField = $config->testtask->datatable->defaultField; + $config->testcase->datatable->fieldList['actions']['width'] = '120'; $setting = $this->datatable->getSetting('testtask'); $widths = $this->datatable->setFixedFieldWidth($setting); $columns = 0; ?> ';?> - ' id='caseList' data-fixed-left-width='' data-fixed-right-width='' data-checkbox-name='caseIDList[]'> +
' id='caseList' data-fixed-left-width='' data-fixed-right-width='' data-checkbox-name='caseIDList[]'> - - testcase->printRow($runs, $setting, $users, array(), $modulePairs, $browseType, $useDatatable ? 'datatable' : 'table');?> + + + + $value) $this->testtask->printCell($value, $run, $users, $task, $branches, $modulePairs, $useDatatable ? 'datatable' : 'table');?> + +
';?>