* Finish task #78645.
This commit is contained in:
@@ -57,18 +57,21 @@ class hostHeartbeatEntry extends baseEntry
|
||||
->set('zap')->eq($zap)
|
||||
->where('id')->eq($id)->exec();
|
||||
|
||||
foreach($vms as $vm)
|
||||
if($vms)
|
||||
{
|
||||
if(!empty($vm->vncPortOnHost))
|
||||
foreach($vms as $vm)
|
||||
{
|
||||
$this->dao->update(TABLE_ZAHOST)
|
||||
->set('vnc')->eq($vm->vncPortOnHost)
|
||||
->set('zap')->eq($vm->agentPortOnHost)
|
||||
->set('ztf')->eq($vm->ztfPortOnHost)
|
||||
->set('zd')->eq($vm->zdPortOnHost)
|
||||
->set('ssh')->eq($vm->sshPortOnHost)
|
||||
->set('status')->eq($vm->status)
|
||||
->where('mac')->eq($vm->macAddress)->exec();
|
||||
if(!empty($vm->vncPortOnHost))
|
||||
{
|
||||
$this->dao->update(TABLE_ZAHOST)
|
||||
->set('vnc')->eq($vm->vncPortOnHost)
|
||||
->set('zap')->eq($vm->agentPortOnHost)
|
||||
->set('ztf')->eq($vm->ztfPortOnHost)
|
||||
->set('zd')->eq($vm->zdPortOnHost)
|
||||
->set('ssh')->eq($vm->sshPortOnHost)
|
||||
->set('status')->eq($vm->status)
|
||||
->where('mac')->eq($vm->macAddress)->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<style>
|
||||
#successModal #modalLink{color: #2e7fff;text-decoration: underline;}
|
||||
#successModal .modal-dialog .modal-content{border: 2px solid #75e5c4; background-color: #f1fcf9; border-radius: 4px;}
|
||||
#successModal .icon-check-circle{color: #17ce97; margin-right: 10px; font-size: 20px;}
|
||||
#successModal .modal-dialog{width: fit-content;}
|
||||
#successModal .modal-dialog{border-radius: 4px;}
|
||||
#successModal .modal-header{padding:9px 15px 0px; margin:0px; border-bottom:0;}
|
||||
#successModal .modal-dialog .modal-body{padding: 5px 15px 20px 15px;}
|
||||
</style>
|
||||
<div class="modal fade" id="successModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<?php echo html::a($closeLink, '×', '', 'class="close"');?>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
<i class="icon-check-circle icon"></i><?php echo $notice;?>
|
||||
<?php $modalLink = !empty($modalLink) ? $modalLink : '';?>
|
||||
<?php echo html::a($modalLink, $buttonName, '', 'id="modalLink"');?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function showModal(url = '')
|
||||
{
|
||||
if(url) $("#modalLink").attr('href', url);
|
||||
$('#successModal').modal('show', 'center');
|
||||
}
|
||||
</script>
|
||||
@@ -1204,11 +1204,13 @@ class testtask extends control
|
||||
* Run case.
|
||||
*
|
||||
* @param int $runID
|
||||
* @param String $extras others params, forexample, caseID=10, version=3
|
||||
* @param int $caseID
|
||||
* @param int $version
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function runCase($runID, $caseID = 0, $version = 0)
|
||||
public function runCase($runID, $caseID = 0, $version = 0, $confirm = '')
|
||||
{
|
||||
if($runID)
|
||||
{
|
||||
@@ -1222,6 +1224,12 @@ class testtask extends control
|
||||
|
||||
$caseID = $caseID ? $caseID : $run->case->id;
|
||||
$preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID);
|
||||
$automation = $this->loadModel('zanode')->getAutomationByProduct($run->case->product);
|
||||
$confirmURL = inlink('runCase', "runID=$runID&caseID=$caseID&version=$version&confirm=yes");
|
||||
$cancelURL = inlink('runCase', "runID=$runID&caseID=$caseID&version=$version&confirm=no");
|
||||
|
||||
if($automation and $confirm == '') return print(js::confirm($this->lang->zanode->runCaseConfirm, $confirmURL, $cancelURL));
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$caseResult = $this->testtask->createResult($runID);
|
||||
@@ -1284,6 +1292,7 @@ class testtask extends control
|
||||
$this->view->caseID = $caseID;
|
||||
$this->view->version = $version;
|
||||
$this->view->runID = $runID;
|
||||
$this->view->confirm = $confirm;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<?php include '../../common/view/form.html.php';?>
|
||||
<?php js::set('caseResultSave', $lang->save);?>
|
||||
<?php js::set('tab', $app->tab);?>
|
||||
<?php js::set('confirm', $confirm);?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='main-header'>
|
||||
<h2>
|
||||
@@ -27,6 +28,7 @@
|
||||
<tr>
|
||||
<td colspan='5' style='word-break: break-all;'><strong><?php echo $lang->testcase->precondition;?></strong><br/><?php echo nl2br($run->case->precondition);?></td>
|
||||
</tr>
|
||||
<?php if($confirm != 'yes'):?>
|
||||
<tr>
|
||||
<th class='w-50px'><?php echo $lang->testcase->stepID;?></th>
|
||||
<th class='w-p30'><?php echo $lang->testcase->stepDesc;?></th>
|
||||
@@ -34,7 +36,9 @@
|
||||
<th class='w-100px'><?php echo $lang->testcase->result;?></th>
|
||||
<th><?php echo $lang->testcase->real;?></th>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
</thead>
|
||||
<?php if($confirm != 'yes'):?>
|
||||
<?php
|
||||
if(empty($run->case->steps))
|
||||
{
|
||||
@@ -81,6 +85,7 @@
|
||||
</tr>
|
||||
<?php $childId ++;?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<tr class='text-center'>
|
||||
<td colspan='5' class='form-actions'>
|
||||
<?php
|
||||
|
||||
@@ -101,7 +101,8 @@ class zahost extends control
|
||||
|
||||
$this->view->title = $this->lang->zahost->create;
|
||||
$this->view->notice = $this->lang->zahost->initNotice;
|
||||
$this->view->buttonName = $this->lang->zahost->initTitle;
|
||||
$this->view->buttonName = $this->lang->zahost->init->title;
|
||||
$this->view->closeLink = $this->createLink('zahost', 'browse');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ class zahost extends control
|
||||
if($_POST)
|
||||
{
|
||||
$changes = $this->zahost->update($hostID);
|
||||
if(dao::isError())
|
||||
if(dao::isError())
|
||||
{
|
||||
return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
}
|
||||
@@ -329,13 +330,14 @@ class zahost extends control
|
||||
{
|
||||
$imageList = $this->zahost->getImagePairs($hostID);
|
||||
|
||||
$this->view->title = $this->lang->zahost->initTitle;
|
||||
$this->view->title = $this->lang->zahost->init->title;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted');
|
||||
$this->view->hostID = $hostID;
|
||||
$this->view->host = $this->zahost->getById($hostID);
|
||||
$this->view->notice = $imageList ? $this->lang->zahost->createZanodeNotice : $this->lang->zahost->downloadImageNotice;
|
||||
$this->view->buttonName = $imageList ? $this->lang->zahost->createZanode : $this->lang->zahost->image->downloadImage;
|
||||
$this->view->modalLink = $imageList ? $this->createLink('zanode', 'create', "hostID=$hostID") : $this->createLink('zahost', 'browseImage', "hostID=$hostID");
|
||||
$this->view->closeLink = $this->createLink('zahost', 'browse');
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#modalLink{color: #2e7fff;text-decoration: underline;}
|
||||
.modal-dialog .modal-content{border: 2px solid #75e5c4; background-color: #f1fcf9; border-radius: 4px;}
|
||||
.icon-check-circle{color: #17ce97; margin-right: 10px; font-size: 20px;}
|
||||
.modal-dialog{width: fit-content;}
|
||||
.modal-dialog{border-radius: 4px;}
|
||||
.modal-header{padding:9px 15px 0px; margin:0px; border-bottom:0;}
|
||||
.modal-dialog .modal-body{padding: 5px 15px 20px 15px;}
|
||||
@@ -32,9 +32,3 @@ $(function()
|
||||
|
||||
$('#osCategory').change();
|
||||
})
|
||||
|
||||
function showModal(url = '')
|
||||
{
|
||||
if(url) $("#modalLink").attr('href', url);
|
||||
$('#successModal').modal('show', 'center');
|
||||
}
|
||||
|
||||
@@ -37,11 +37,7 @@ $lang->zahost->os = '操作系统';
|
||||
$lang->zahost->imageName = '镜像文件';
|
||||
|
||||
$lang->zahost->createZanode = '创建执行节点';
|
||||
<<<<<<< HEAD
|
||||
$lang->zahost->initNotice = '保存成功,请您初始化宿主机或返回列表。';
|
||||
=======
|
||||
$lang->zahost->initNotice = '保存成功,请您初始化宿主机或返回列表。';
|
||||
>>>>>>> zenops_46_zhaoke_77683
|
||||
$lang->zahost->createZanodeNotice = '初始化成功,您现在可以创建执行节点了。';
|
||||
$lang->zahost->downloadImageNotice = '初始化成功,请下载镜像用于创建执行节点。';
|
||||
$lang->zahost->undeletedNotice = "宿主机下存在执行节点无法删除。";
|
||||
|
||||
@@ -78,5 +78,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'successmodal.html.php';?>
|
||||
<?php include $app->getModuleRoot() . 'common/view/successmodal.html.php';?>
|
||||
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>
|
||||
|
||||
@@ -39,5 +39,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'successmodal.html.php';?>
|
||||
<?php include $app->getModuleRoot() . 'common/view/successmodal.html.php';?>
|
||||
<?php include '../../common/view/footer.html.php'; ?>
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<div class="modal fade" id="successModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<?php echo html::a($this->createLink('zahost', 'browse'), '×', '', 'class="close"');?>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
<i class="icon-check-circle icon"></i><?php echo $notice;?>
|
||||
<?php $modalLink = !empty($modalLink) ? $modalLink : '';?>
|
||||
<?php echo html::a($modalLink, $buttonName, '', 'id="modalLink"');?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,14 +47,15 @@ $lang->zanode->shell = "Shell";
|
||||
$lang->zanode->automation = "Automation";
|
||||
|
||||
$lang->automation = new stdClass();
|
||||
$lang->automation->path = $lang->zanode->scriptPath;
|
||||
$lang->automation->node = $lang->zanode->common;
|
||||
$lang->automation->scriptPath = $lang->zanode->scriptPath;
|
||||
$lang->automation->node = $lang->zanode->common;
|
||||
|
||||
$lang->zanode->notFoundAgent = 'No Agent service is found';
|
||||
$lang->zanode->createVmFail = 'Failed to create a execution node';
|
||||
$lang->zanode->noVncPort = 'Failed to get vnc port';
|
||||
$lang->zanode->nameValid = "Name must be letters, numbers,'-','_','.', And cannot begin with a symbol";
|
||||
$lang->zanode->empty = 'Execution node not found.';
|
||||
$lang->zanode->notFoundAgent = 'No Agent service is found';
|
||||
$lang->zanode->createVmFail = 'Failed to create a execution node';
|
||||
$lang->zanode->noVncPort = 'Failed to get vnc port';
|
||||
$lang->zanode->nameValid = "Name must be letters, numbers,'-','_','.', And cannot begin with a symbol";
|
||||
$lang->zanode->empty = 'Execution node not found.';
|
||||
$lang->zanode->runCaseConfirm = 'The system detects the presence of an automation script. Whether to execute?';
|
||||
|
||||
$lang->zanode->empty = 'No Execution Node';
|
||||
$lang->zanode->createImaging = 'Creating';
|
||||
|
||||
@@ -47,14 +47,15 @@ $lang->zanode->shell = "Shell";
|
||||
$lang->zanode->automation = "Automation";
|
||||
|
||||
$lang->automation = new stdClass();
|
||||
$lang->automation->path = $lang->zanode->scriptPath;
|
||||
$lang->automation->node = $lang->zanode->common;
|
||||
$lang->automation->scriptPath = $lang->zanode->scriptPath;
|
||||
$lang->automation->node = $lang->zanode->common;
|
||||
|
||||
$lang->zanode->notFoundAgent = 'No Agent service is found';
|
||||
$lang->zanode->createVmFail = 'Failed to create a execution node';
|
||||
$lang->zanode->noVncPort = 'Failed to get vnc port';
|
||||
$lang->zanode->nameValid = "The name can only be letters, numbers, '-', '_', '.', and cannot start with a symbol";
|
||||
$lang->zanode->empty = 'No zanode is found';
|
||||
$lang->zanode->notFoundAgent = 'No Agent service is found';
|
||||
$lang->zanode->createVmFail = 'Failed to create a execution node';
|
||||
$lang->zanode->noVncPort = 'Failed to get vnc port';
|
||||
$lang->zanode->nameValid = "The name can only be letters, numbers, '-', '_', '.', and cannot start with a symbol";
|
||||
$lang->zanode->empty = 'No zanode is found';
|
||||
$lang->zanode->runCaseConfirm = 'The system detects the presence of an automation script. Whether to execute?';
|
||||
|
||||
$lang->zanode->empty = 'No ZenAgent Node';
|
||||
$lang->zanode->createImaging = 'Creating';
|
||||
|
||||
@@ -47,14 +47,15 @@ $lang->zanode->shell = "Shell";
|
||||
$lang->zanode->automation = "Automation";
|
||||
|
||||
$lang->automation = new stdClass();
|
||||
$lang->automation->path = $lang->zanode->scriptPath;
|
||||
$lang->automation->node = $lang->zanode->common;
|
||||
$lang->automation->scriptPath = $lang->zanode->scriptPath;
|
||||
$lang->automation->node = $lang->zanode->common;
|
||||
|
||||
$lang->zanode->notFoundAgent = 'No Agent service is found';
|
||||
$lang->zanode->createVmFail = 'Failed to create a execution node';
|
||||
$lang->zanode->noVncPort = 'Failed to get vnc port';
|
||||
$lang->zanode->nameValid = "The name can only be letters, numbers, '-', '_', '.', and cannot start with a symbol";
|
||||
$lang->zanode->empty = 'No zanode is found';
|
||||
$lang->zanode->notFoundAgent = 'No Agent service is found';
|
||||
$lang->zanode->createVmFail = 'Failed to create a execution node';
|
||||
$lang->zanode->noVncPort = 'Failed to get vnc port';
|
||||
$lang->zanode->nameValid = "The name can only be letters, numbers, '-', '_', '.', and cannot start with a symbol";
|
||||
$lang->zanode->empty = 'No zanode is found';
|
||||
$lang->zanode->runCaseConfirm = 'The system detects the presence of an automation script. Whether to execute?';
|
||||
|
||||
$lang->zanode->empty = 'No Execution Node';
|
||||
$lang->zanode->createImaging = 'Creating';
|
||||
|
||||
@@ -47,14 +47,15 @@ $lang->zanode->shell = "shell命令";
|
||||
$lang->zanode->automation = "自动化测试";
|
||||
|
||||
$lang->automation = new stdClass();
|
||||
$lang->automation->path = $lang->zanode->scriptPath;
|
||||
$lang->automation->node = $lang->zanode->common;
|
||||
$lang->automation->scriptPath = $lang->zanode->scriptPath;
|
||||
$lang->automation->node = $lang->zanode->common;
|
||||
|
||||
$lang->zanode->notFoundAgent = '没有发现Agent服务';
|
||||
$lang->zanode->createVmFail = '创建执行节点失败';
|
||||
$lang->zanode->noVncPort = '无法获取执行节点端口';
|
||||
$lang->zanode->nameValid = "名称只能是字母、数字,'-','_','.',且不能以符号开头";
|
||||
$lang->zanode->empty = '暂时没有执行节点';
|
||||
$lang->zanode->notFoundAgent = '没有发现Agent服务';
|
||||
$lang->zanode->createVmFail = '创建执行节点失败';
|
||||
$lang->zanode->noVncPort = '无法获取执行节点端口';
|
||||
$lang->zanode->nameValid = "名称只能是字母、数字,'-','_','.',且不能以符号开头";
|
||||
$lang->zanode->empty = '暂时没有执行节点';
|
||||
$lang->zanode->runCaseConfirm = '系统检测到选择的用例存在自动化测试脚本,是否自动执行用例?';
|
||||
|
||||
$lang->zanode->createImage = '创建镜像';
|
||||
$lang->zanode->createImaging = '正在创建镜像';
|
||||
|
||||
@@ -650,6 +650,20 @@ class zanodemodel extends model
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get automation by product id.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getAutomationByProduct($productID = 0)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_AUTOMATION)
|
||||
->where('product')->eq($productID)
|
||||
->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set automation setting.
|
||||
*
|
||||
|
||||
@@ -76,7 +76,7 @@ function getTaskProgress()
|
||||
|
||||
if(rate == 1 || status == 'completed') rate = 1;
|
||||
|
||||
$('.rate').css('width', rate*100 + '%');
|
||||
$('.rate').css('width', rate + '%');
|
||||
if(rate == 1 || (status != 'inprogress' && status != 'created'))
|
||||
{
|
||||
updateStatus(data);
|
||||
|
||||
Reference in New Issue
Block a user