This commit is contained in:
hufangzhou
2022-02-14 13:57:52 +08:00
parent e6db39683a
commit 64f8980289
7 changed files with 32 additions and 15 deletions
+1 -1
View File
@@ -466,7 +466,7 @@ class build extends control
$html .= html::a("javascript:loadExecutionBuilds($executionID)", $this->lang->refresh);
die($html);
}
die(html::select('build', array('') + $builds, $build, "class='form-control' onchange='loadTestReports(this.value)'"));
die(html::select('build', array('') + $builds, $build, "class='form-control'"));
}
if($varName == 'dropdownList')
{
+15
View File
@@ -573,4 +573,19 @@ class testreportModel extends model
->andWhere('id')->in(trim($storyIdList, ','))
->fetchAll('id');
}
/**
* Get pairs.
*
* @param int $productID
* @access public
* @return array
*/
public function getPairs($productID = 0)
{
return $this->dao->select('id,title')->from(TABLE_TESTREPORT)
->beginIF($productID)->where('product')->eq($productID)->fi()
->orderBy('id_desc')
->fetchPairs();
}
}
+6 -6
View File
@@ -756,7 +756,7 @@ class testtask extends control
$executions = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID);
$executionID = $task->execution;
$builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk', $executionID, 'execution');
$testreports = $this->testtask->getTestReportPairsByBuild($task->build);
$testreports = $this->loadModel('testreport')->getPairs($task->product);
$this->view->task = $task;
$this->view->executions = $executions;
@@ -1453,16 +1453,16 @@ class testtask extends control
}
/**
* Ajax get test report.
* Ajax: Get test report by productID.
*
* @param int $buildID
* @param int $productID
* @access public
* @return void
*/
public function ajaxGetTestReports($buildID)
public function ajaxGetTestReports($productID)
{
/* Testreport list. */
$pairs = $this->testtask->getTestReportPairsByBuild($buildID);
return print(html::select('testreport', $pairs, '', "class='form-control chosen'"));
$pairs = $this->loadModel('testreport')->getPairs($productID);
return print(html::select('testreport', array('') + $pairs, '', "class='form-control chosen'"));
}
}
+3 -3
View File
@@ -106,13 +106,13 @@ function loadExecutionBuilds(executionID, selected)
/**
* Load test report.
*
* @param int buildID
* @param int productID
* @access public
* @return void
*/
function loadTestReports(buildID)
function loadTestReports(productID)
{
link = createLink('testtask', 'ajaxGetTestReports', 'buildID=' + buildID);
link = createLink('testtask', 'ajaxGetTestReports', 'productID=' + productID);
$.get(link, function(data)
{
if(!data) data = '<select id="testreport" name="testreport" class="form-control"></select>';
+3 -1
View File
@@ -7,7 +7,8 @@
function loadProductRelated()
{
loadExecutions($('#product').val());
buildData = '<select id="build" name="build" class="form-control" onchange="loadTestReports(this.value)"></select>';
loadTestReports($('#product').val());
buildData = '<select id="build" name="build" class="form-control"></select>';
$('#build').replaceWith(buildData);
$('#build_chosen').remove();
$("#build").chosen();
@@ -37,5 +38,6 @@ function loadExecutions(productID)
$(function()
{
adjustPriBoxWidth();
loadTestReports($('#product').val());
if($('#execution').val() != 0) loadExecutionBuilds($('#execution').val());
});
+2 -2
View File
@@ -30,7 +30,7 @@
<?php else:?>
<tr class='hide'>
<th class='w-80px'><?php echo $lang->testtask->product;?></th>
<td class='w-p35-f'><?php echo html::input('product', $productID, "class='form-control'");?></td><td></td>
<td class='w-p35-f'><?php echo html::input('product', $productID, "class='form-control' onchange='loadTestReports(this.value)'");?></td><td></td>
</tr>
<?php endif;?>
<tr>
@@ -41,7 +41,7 @@
<th class='w-80px'><?php echo $lang->testtask->build;?></th>
<td class='w-p35-f'>
<div class='input-group' id='buildBox'>
<?php echo html::select('build', empty($builds) ? '' : $builds, $build, "class='form-control chosen' onchange='loadTestReports(this.value)'");?>
<?php echo html::select('build', empty($builds) ? '' : $builds, $build, "class='form-control chosen'");?>
<?php if(isset($executionID) and $executionID and empty($builds)):?>
<span class='input-group-addon'><?php echo html::a(helper::createLink('build', 'create', "executionID=$executionID&productID=$productID&projectID=$projectID", '', true), $lang->build->create, '', "data-toggle='modal' data-type='iframe' data-width='95%'")?> </span>
</div>
+2 -2
View File
@@ -36,7 +36,7 @@
</tr>
<tr>
<th><?php echo $lang->testtask->build;?></th>
<td class='w-p35-f'><span id='buildBox'><?php echo html::select('build', $builds, $task->build, "class='form-control chosen' onchange='loadTestReports(this.value)'");?></span></td>
<td class='w-p35-f'><span id='buildBox'><?php echo html::select('build', $builds, $task->build, "class='form-control chosen'");?></span></td>
<td></td>
</tr>
<tr>
@@ -69,7 +69,7 @@
</tr>
<tr>
<th><?php echo $lang->testtask->testreport;?></th>
<td><?php echo html::select('testreport', $testreports, $task->testreport, "class='form-control chosen'");?></td>
<td><?php echo html::select('testreport', array('') + $testreports, $task->testreport, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->testtask->name;?></th>