* Finish task #78647.
This commit is contained in:
@@ -23,6 +23,9 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
|
||||
js::set('productID', $productID);
|
||||
js::set('branch', $branch);
|
||||
js::set('suiteID', $suiteID);
|
||||
js::set('runCaseConfirm', $lang->zanode->runCaseConfirm);
|
||||
js::set('confirmURL', $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=$orderBy&from=testcase&taskID=0&confirm=yes"));
|
||||
js::set('cancelURL', $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=$orderBy&from=testcase&taskID=0&confirm=no"));
|
||||
?>
|
||||
<?php if($this->app->tab == 'project'):?>
|
||||
<style>
|
||||
@@ -127,7 +130,7 @@ js::set('suiteID', $suiteID);
|
||||
<div class='btn-group dropup'>
|
||||
<?php
|
||||
$actionLink = $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=$orderBy");
|
||||
$misc = $canBatchRun ? "onclick=\"setFormAction('$actionLink', '', '#caseList')\"" : "disabled='disabled'";
|
||||
$misc = $canBatchRun ? "onclick=\"confirmAction('$actionLink', '', '#caseList')\"" : "disabled='disabled'";
|
||||
echo html::commonButton($lang->testtask->runCase, $misc);
|
||||
|
||||
$caseProductID = count($caseProductIds) > 1 ? 0 : $productID;
|
||||
@@ -282,6 +285,19 @@ js::set('suiteID', $suiteID);
|
||||
<script>
|
||||
$('#module' + moduleID).closest('li').addClass('active');
|
||||
$('#' + caseBrowseType + 'Tab').addClass('btn-active-text').find('.text').after(" <span class='label label-light label-badge'><?php echo $pager->recTotal;?></span>");
|
||||
function confirmAction(obj)
|
||||
{
|
||||
if(confirm(runCaseConfirm))
|
||||
{
|
||||
setFormAction(confirmURL, '', '#caseList');
|
||||
}
|
||||
else
|
||||
{
|
||||
setFormAction(cancelURL, '', '#caseList');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
<?php if($useDatatable):?>
|
||||
$(function(){$('#caseForm').table();})
|
||||
<?php endif;?>
|
||||
|
||||
@@ -12,8 +12,12 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/tablesorter.html.php';?>
|
||||
<?php $this->app->loadLang('zanode');?>
|
||||
<?php js::set('confirmUnlink', $lang->testsuite->confirmUnlinkCase)?>
|
||||
<?php js::set('flow', $config->global->flow);?>
|
||||
<?php js::set('runCaseConfirm', $lang->zanode->runCaseConfirm);?>
|
||||
<?php js::set('confirmURL', $this->createLink('testtask', 'batchRun', "productID=$suite->product&orderBy=id_desc&from=testcase&taskID=0&confirm=yes"));?>
|
||||
<?php js::set('cancelURL', $this->createLink('testtask', 'batchRun', "productID=$suite->product&orderBy=id_desc&from=testcase&taskID=0&confirm=no"));?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<?php $browseLink = $this->session->testsuiteList ? $this->session->testsuiteList : $this->createLink('testsuite', 'browse', "productID=$suite->product");?>
|
||||
@@ -130,7 +134,7 @@
|
||||
echo "<li>" . html::a('javascript:;', $lang->testsuite->unlinkCase, '', $misc) . "</li>";
|
||||
|
||||
$actionLink = $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=$orderBy");
|
||||
$misc = common::hasPriv('testtask', 'batchRun') ? "onclick=\"setFormAction('$actionLink')\"" : $class;
|
||||
$misc = common::hasPriv('testtask', 'batchRun') ? "onclick=\"confirmAction()\"" : $class;
|
||||
echo "<li>" . html::a('#', $lang->testtask->runCase, '', $misc) . "</li>";
|
||||
?>
|
||||
</ul>
|
||||
@@ -160,4 +164,19 @@
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<script>
|
||||
function confirmAction()
|
||||
{
|
||||
if(confirm(runCaseConfirm))
|
||||
{
|
||||
setFormAction(confirmURL, '', '#caseList');
|
||||
}
|
||||
else
|
||||
{
|
||||
setFormAction(cancelURL, '', '#caseList');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -1313,15 +1313,20 @@ class testtask extends control
|
||||
* @param int $productID
|
||||
* @param string $orderBy
|
||||
* @param string $from
|
||||
* @param int $taskID
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchRun($productID, $orderBy = 'id_desc', $from = 'testcase', $taskID = 0)
|
||||
public function batchRun($productID, $orderBy = 'id_desc', $from = 'testcase', $taskID = 0, $confirm = '')
|
||||
{
|
||||
$this->loadModel('tree');
|
||||
$url = $this->session->caseList ? $this->session->caseList : $this->createLink('testcase', 'browse', "productID=$productID");
|
||||
$automation = $this->loadModel('zanode')->getAutomationByProduct($productID);
|
||||
|
||||
if($this->post->results)
|
||||
{
|
||||
if($confirm == 'yes') $this->post->set('node', $automation->node);
|
||||
$this->testtask->batchRun($from, $taskID);
|
||||
$this->loadModel('action');
|
||||
foreach(array_keys($this->post->results) as $caseID) $this->action->create('case', $caseID, 'run', '', $taskID);
|
||||
@@ -1406,6 +1411,7 @@ class testtask extends control
|
||||
$this->view->position[] = $this->lang->testtask->common;
|
||||
$this->view->position[] = $this->lang->testtask->batchRun;
|
||||
$this->view->from = $from;
|
||||
$this->view->confirm = $confirm;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -1320,6 +1320,7 @@ class testtaskModel extends model
|
||||
$postReals = $postData->reals[$caseID];
|
||||
|
||||
$caseResult = $result ? $result : 'pass';
|
||||
if($postData->node) $caseResult = '';
|
||||
$stepResults = array();
|
||||
if($dbSteps)
|
||||
{
|
||||
@@ -1350,6 +1351,7 @@ class testtaskModel extends model
|
||||
$result->stepResults = serialize($stepResults);
|
||||
$result->lastRunner = $this->app->user->account;
|
||||
$result->date = $now;
|
||||
if(isset($postData->node)) $result->node = $postData->node;
|
||||
$this->dao->insert(TABLE_TESTRESULT)->data($result)->autoCheck()->exec();
|
||||
$this->dao->update(TABLE_CASE)->set('lastRunner')->eq($this->app->user->account)->set('lastRunDate')->eq($now)->set('lastRunResult')->eq($caseResult)->where('id')->eq($caseID)->exec();
|
||||
|
||||
|
||||
@@ -37,7 +37,13 @@
|
||||
<td class='text-left'><?php echo "<span title='" . $moduleOptionMenu[$case->module] . "'>" . $moduleOptionMenu[$case->module] . "</span>"?></td>
|
||||
<td class='text-left wordwrap'><?php echo "<span title='{$case->title}'>{$case->title}</span>"?></td>
|
||||
<td class='text-left precondition wordwrap'><?php echo "<span title='{$case->precondition}'>{$case->precondition}</span>"?></td>
|
||||
<td class='text-left'><?php echo html::radio("results[$caseID]", $this->lang->testcase->resultList, 'pass', "onclick='showAction(this.value,\".action$caseID\")'", 'block')?></td>
|
||||
<td class='text-left'>
|
||||
<?php if($confirm == 'yes'):?>
|
||||
<?php echo html::hidden("results[$caseID]", '');?>
|
||||
<?php else:?>
|
||||
<?php echo html::radio("results[$caseID]", $this->lang->testcase->resultList, 'pass', "onclick='showAction(this.value,\".action$caseID\")'", 'block')?>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if(!empty($steps[$caseID])):?>
|
||||
<table class='table table-fixed'>
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
<?php js::set('taskCaseBrowseType', ($browseType == 'bymodule' and $this->session->taskCaseBrowseType == 'bysearch') ? 'all' : $this->session->taskCaseBrowseType);?>
|
||||
<?php js::set('browseType', $browseType);?>
|
||||
<?php js::set('moduleID', $moduleID);?>
|
||||
<?php $this->app->loadLang('zanode');?>
|
||||
<?php js::set('runCaseConfirm', $lang->zanode->runCaseConfirm);?>
|
||||
<?php js::set('confirmURL', $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=id_desc&from=testcase&taskID=$taskID&confirm=yes"));?>
|
||||
<?php js::set('cancelURL', $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=id_desc&from=testcase&taskID=$taskID&confirm=no"));?>
|
||||
<div id='mainContent' class='main-row fade'>
|
||||
<div class='side-col' id='sidebar'>
|
||||
<div class="sidebar-toggle"><i class="icon icon-angle-left"></i></div>
|
||||
@@ -131,8 +135,7 @@
|
||||
<?php
|
||||
if($canBatchRun)
|
||||
{
|
||||
$actionLink = inLink('batchRun', "productID=$productID&orderBy=id_desc&from=testtask&taskID=$taskID");
|
||||
echo html::commonButton($lang->testtask->runCase, "onclick=\"setFormAction('$actionLink')\"");
|
||||
echo html::commonButton($lang->testtask->runCase, "onclick=\"confirmAction()\"");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -163,5 +166,19 @@ if($shortcut.size() > 0)
|
||||
$(function(){$('#casesForm').table();})
|
||||
<?php endif;?>
|
||||
$("thead").find('.c-assignedTo').attr('class', '');
|
||||
function confirmAction()
|
||||
{
|
||||
if(confirm(runCaseConfirm))
|
||||
{
|
||||
setFormAction(confirmURL, '', '#caseList');
|
||||
}
|
||||
else
|
||||
{
|
||||
setFormAction(cancelURL, '', '#caseList');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -6,14 +6,14 @@ $(function () {
|
||||
|
||||
function updateProgressInterval() {
|
||||
updateProgress();
|
||||
interval = setInterval(function ()
|
||||
interval = setInterval(function ()
|
||||
{
|
||||
updateProgress();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function updateProgress() {
|
||||
$.get(createLink('zahost', 'ajaxImageDownloadProgress', 'hostID=' + hostID)).done(function (response)
|
||||
$.get(createLink('zahost', 'ajaxImageDownloadProgress', 'hostID=' + hostID)).done(function (response)
|
||||
{
|
||||
var result = JSON.parse(response);
|
||||
var statusList = result.data;
|
||||
@@ -21,19 +21,19 @@ function updateProgress() {
|
||||
var hasInprogress = false;
|
||||
for (var imageID in statusList) {
|
||||
if (statusList[imageID].statusCode) {
|
||||
if (statusList[imageID].statusCode == 'inprogress' || statusList[imageID].statusCode == 'created')
|
||||
if (statusList[imageID].statusCode == 'inprogress' || statusList[imageID].statusCode == 'created')
|
||||
{
|
||||
hasInprogress = true;
|
||||
$('.image-download-' + imageID).addClass('disabled');
|
||||
$('.image-cancel-' + imageID).removeClass('disabled');
|
||||
}
|
||||
else if (statusList[imageID].statusCode == 'completed')
|
||||
else if (statusList[imageID].statusCode == 'completed')
|
||||
{
|
||||
$('.image-download-' + imageID).addClass('disabled');
|
||||
$('.image-cancel-' + imageID).addClass('disabled');
|
||||
$('.image-cancel-' + imageID).attr('href', '#');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.image-download-' + imageID).removeClass('disabled');
|
||||
$('.image-cancel-' + imageID).addClass('disabled');
|
||||
@@ -47,9 +47,9 @@ function updateProgress() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasInprogress)
|
||||
if (!hasInprogress)
|
||||
{
|
||||
clearInterval(interval)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,14 +234,6 @@ class zahostModel extends model
|
||||
$image->host = $hostID;
|
||||
}
|
||||
|
||||
if($refreshPageData)
|
||||
{
|
||||
$downloadedImageList = $this->dao->select('*')->from(TABLE_IMAGE)
|
||||
->where('host')->eq($hostID)
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('name');
|
||||
}
|
||||
return $imageList;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
|
||||
<?php js::set('hostID', $hostID);?>
|
||||
<?php js::set('downloadLink', $hostID);?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
|
||||
Reference in New Issue
Block a user