* Finish testsuite link case page. the task #95479.
This commit is contained in:
@@ -325,6 +325,7 @@ foreach(explode(',', $case->reviewedBy) as $account)
|
||||
}
|
||||
$reviewedBy = trim($reviewedBy);
|
||||
|
||||
$isInModal = isAjaxRequest('modal');
|
||||
detailHeader
|
||||
(
|
||||
to::title
|
||||
@@ -336,7 +337,7 @@ detailHeader
|
||||
set::text($case->title)
|
||||
)
|
||||
),
|
||||
to::suffix
|
||||
!$isInModal ? to::suffix
|
||||
(
|
||||
btn
|
||||
(
|
||||
@@ -345,7 +346,7 @@ detailHeader
|
||||
set::text($lang->case->create),
|
||||
$canCreateCase ? set::url($this->createLink('testcase', 'create', "productID={$case->product}&branch={$case->branch}&moduleID={$case->module}")) : null
|
||||
)
|
||||
)
|
||||
) : null
|
||||
);
|
||||
|
||||
detailBody
|
||||
@@ -512,5 +513,4 @@ detailBody
|
||||
),
|
||||
);
|
||||
|
||||
render();
|
||||
|
||||
render($isInModal ? 'modalDialog' : 'page');
|
||||
|
||||
@@ -64,6 +64,7 @@ $config->testsuite->dtable->fieldList['actions']['menu'] = array('linkCase
|
||||
global $app;
|
||||
$app->loadLang('testcase');
|
||||
$app->loadLang('testtask');
|
||||
$app->loadModuleConfig('testcase');
|
||||
|
||||
$config->testsuite->testcase = new stdclass();
|
||||
|
||||
@@ -136,3 +137,19 @@ $config->testsuite->testcase->dtable->fieldList['actions']['title'] = $lang->
|
||||
$config->testsuite->testcase->dtable->fieldList['actions']['sortType'] = false;
|
||||
$config->testsuite->testcase->dtable->fieldList['actions']['list'] = $config->testsuite->testcase->actionList;
|
||||
$config->testsuite->testcase->dtable->fieldList['actions']['menu'] = array();
|
||||
|
||||
$config->testsuite->linkcase = new stdclass();
|
||||
$config->testsuite->linkcase->dtable = new stdclass();
|
||||
$config->testsuite->linkcase->dtable->fieldList['id'] = $config->testcase->dtable->fieldList['id'];
|
||||
$config->testsuite->linkcase->dtable->fieldList['title'] = $config->testcase->dtable->fieldList['title'];
|
||||
$config->testsuite->linkcase->dtable->fieldList['pri'] = $config->testcase->dtable->fieldList['pri'];
|
||||
$config->testsuite->linkcase->dtable->fieldList['type'] = $config->testcase->dtable->fieldList['type'];
|
||||
$config->testsuite->linkcase->dtable->fieldList['status'] = $config->testcase->dtable->fieldList['status'];
|
||||
|
||||
$config->testsuite->linkcase->dtable->fieldList['status']['name'] = 'version';
|
||||
$config->testsuite->linkcase->dtable->fieldList['status']['title'] = $lang->testsuite->linkVersion;
|
||||
$config->testsuite->linkcase->dtable->fieldList['status']['type'] = 'text';
|
||||
$config->testsuite->linkcase->dtable->fieldList['status']['group'] = 'version';
|
||||
|
||||
$config->testsuite->linkcase->dtable->fieldList['openedBy'] = $config->testcase->dtable->fieldList['openedBy'];
|
||||
unset($config->testsuite->linkcase->dtable->fieldList['title']['nestedToggle']);
|
||||
|
||||
@@ -317,7 +317,7 @@ class testsuite extends control
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->testsuite->linkCase($suiteID);
|
||||
$this->locate(inlink('view', "suiteID=$suiteID"));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => inlink('view', "suiteID=$suiteID")));
|
||||
}
|
||||
|
||||
$suite = $this->testsuite->getById($suiteID);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
$(document).off('click', '.batch-btn').on('click', '.batch-btn', function()
|
||||
{
|
||||
const dtable = zui.DTable.query($(this).target);
|
||||
const checkedList = dtable.$.getChecks();
|
||||
if(!checkedList.length) return;
|
||||
|
||||
const url = $(this).data('url');
|
||||
const form = new FormData();
|
||||
checkedList.forEach((id) =>
|
||||
{
|
||||
form.append('cases[]', id);
|
||||
form.append('versions[' + id + ']', $('#versions' + id).val());
|
||||
});
|
||||
|
||||
if($(this).hasClass('ajax-btn'))
|
||||
{
|
||||
$.ajaxSubmit({url, data: form});
|
||||
}
|
||||
else
|
||||
{
|
||||
postAndLoadPage(url, form);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 对列进行重定义。
|
||||
* Redefine the column.
|
||||
*
|
||||
* @param array result
|
||||
* @param array info
|
||||
* @access public
|
||||
* @return string|array
|
||||
*/
|
||||
window.renderCell = function(result, info)
|
||||
{
|
||||
if(info.col.name == 'title' && result[0])
|
||||
{
|
||||
const testcase = info.row.data;
|
||||
|
||||
let html = '(';
|
||||
for(i = 1; i <= testcase.version; i++)
|
||||
{
|
||||
html += "<a href='" + $.createLink('testcase', 'view', "caseID=" + testcase.id + "&version=" + i) + "' data-toggle='modal' data-size='lg'>#" + i + "</a>";
|
||||
}
|
||||
html += ')';
|
||||
result.push({html});
|
||||
}
|
||||
if(info.col.name == 'version' && result[0])
|
||||
{
|
||||
const testcase = info.row.data;
|
||||
let html = "<select name='versions[" + testcase.id + "]' id='versions" + testcase.id + "' class='form-control' style='width:60px'>";
|
||||
for(i = 1; i <= testcase.version; i++)
|
||||
{
|
||||
html += "<option value='" + i + "'>" + i + "</option>";
|
||||
}
|
||||
html += "</select>";
|
||||
result[0] = {html};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The browse view file of testsuite 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 Mengyi Liu <liumengyi@easycorp.ltd>
|
||||
* @package testsuite
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
detailHeader
|
||||
(
|
||||
to::title
|
||||
(
|
||||
entityLabel(set(array('entityID' => $suite->id, 'level' => 3, 'text' => $suite->name))),
|
||||
icon('angle-right'),
|
||||
$lang->testsuite->linkCase,
|
||||
div(searchToggle(set::open(true)))
|
||||
)
|
||||
);
|
||||
|
||||
$footToolbar = array('items' => array
|
||||
(
|
||||
array('text' => $lang->save, 'className' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('testsuite', 'linkCase', "suiteID=$suiteID¶m=$param"))
|
||||
), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary'));
|
||||
|
||||
div
|
||||
(
|
||||
set('class', 'mb-2'),
|
||||
icon('unlink'),
|
||||
span
|
||||
(
|
||||
set('class', 'font-semibold ml-2'),
|
||||
$lang->testsuite->unlinkedCases . "({$pager->recTotal})"
|
||||
)
|
||||
);
|
||||
$cases = initTableData($cases, $config->testcase->dtable->fieldList, $this->testcase);
|
||||
$data = array_values($cases);
|
||||
dtable
|
||||
(
|
||||
set::userMap($users),
|
||||
set::data($data),
|
||||
set::cols($config->testsuite->linkcase->dtable->fieldList),
|
||||
set::fixedLeftWidth('33%'),
|
||||
set::checkable(true),
|
||||
set::footToolbar($footToolbar),
|
||||
set::onRenderCell(jsRaw('window.renderCell')),
|
||||
set::footPager(usePager()),
|
||||
);
|
||||
|
||||
render();
|
||||
|
||||
Reference in New Issue
Block a user