Merge branch 'feature/42422' into zenops_66

This commit is contained in:
zhaoke
2023-03-16 09:39:13 +08:00
15 changed files with 135 additions and 70 deletions
+13 -5
View File
@@ -28,8 +28,8 @@ class hostHeartbeatEntry extends baseEntry
/* Check param. */
$status = $this->requestBody->status;
$vms = $this->requestBody->Vms;
$zap = $this->requestBody->port;
$vms = !empty($this->requestBody->Vms) ? $this->requestBody->Vms : array();
$zap = !empty($this->requestBody->port) ? $this->requestBody->port : 0;
$now = helper::now();
if(!$status) return $this->sendError(400, 'Params error.');
@@ -37,7 +37,7 @@ class hostHeartbeatEntry extends baseEntry
$conditionValue = $secret ? $secret : $token;
$this->dao = $this->loadModel('common')->dao;
$hostInfo = $this->dao->select('id,tokenSN')->from(TABLE_ZAHOST)
$hostInfo = $this->dao->select('id,tokenSN,hostType')->from(TABLE_ZAHOST)
->beginIF($secret)->where('secret')->eq($secret)->fi()
->beginIF(!$secret)->where('tokenSN')->eq($token)
->andWhere('tokenTime')->gt($now)->fi()
@@ -88,9 +88,17 @@ class hostHeartbeatEntry extends baseEntry
if($heartbeat > 0) $vmData['heartbeat'] = date("Y-m-d H:i:s", $heartbeat);
$this->dao->update(TABLE_ZAHOST)->data($vmData)->where('mac')->eq($vm->macAddress)->exec();
if($hostInfo->hostType == 'physics')
{
unset($vmData['extranet']);
$this->dao->update(TABLE_ZAHOST)->data($vmData)->where('id')->eq($hostInfo->id)->exec();
}
else
{
$this->dao->update(TABLE_ZAHOST)->data($vmData)->where('mac')->eq($vm->macAddress)->exec();
}
if($vm->status == 'running')
if($vm->status == 'running' && $hostInfo->hostType != 'physics')
{
if(!empty($node))
{
+1 -1
View File
@@ -12,7 +12,7 @@ $config->zanode->defaultAccount = 'z';
$config->zanode->defaultWinAccount = 'admin';
$config->zanode->defaultPwd = 'CQdliYQn6tKkoFhP';
$config->zanode->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -szvm -z%s';
$config->zanode->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -s zvm -k %s -z %s';
$config->zanode->os = new stdClass();
+9 -10
View File
@@ -161,17 +161,16 @@ class zanode extends control
$node = $this->zanode->getNodeByID($id);
$vnc = $this->zanode->getVncUrl($node);
/* Add action log. */
// if(!empty($vnc->token)) $this->loadModel('action')->create('zanode', $id, 'getVNC');
$this->view->url = $node->ip . ":" . $node->hzap;
$this->view->host = !empty($vnc->hostIP) ? $vnc->hostIP:'';
$this->view->token = !empty($vnc->token) ? $vnc->token:'';
$this->view->title = $this->lang->zanode->view;
$this->view->zanode = $node;
$this->view->url = $node->ip . ":" . $node->hzap;
$this->view->host = !empty($vnc->hostIP) ? $vnc->hostIP:'';
$this->view->token = !empty($vnc->token) ? $vnc->token:'';
$this->view->title = $this->lang->zanode->view;
$this->view->zanode = $node;
$this->view->snapshotList = $this->zanode->getSnapshotList($id);
$this->view->actions = $this->loadModel('action')->getList('zanode', $id);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->initBash = sprintf($this->config->zanode->initBash, $node->secret, getWebRoot(true));
$this->view->actions = $this->loadModel('action')->getList('zanode', $id);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
+4 -3
View File
@@ -7,10 +7,10 @@
.zanode-mt-8{margin-top: 8px;}
.zanode-status-text{margin-left: 10px;font:small-caption;color:#838a9d;}
.zanode-status-text i{color:#18a6fd}
.status-notice{margin-top: 8px;margin-left: 18px;line-height: 28px;}
.status-notice{margin-top: 16px;line-height: 28px;}
.status-notice a{color: #2463c7;}
.service-status a{color: #2463c7;}
.service-status{margin-top: 10px;}
.service-status{margin-top: 5px;}
.vnc-detail{height: 60vh;min-height: 550px;}
.vnc-mask{width: 100%;height:100%;background-color: rgba(0,0,0,0);position: absolute;z-index: 1;}
.checkStatus{color: #313c52;}
@@ -19,4 +19,5 @@
.btn.disabled i {color: #fff;}
.btn-toolbar a img{margin-bottom: 1px;}
#serviceContent{min-height: 120px;}
.btn-snap-create{width: 100px;height: 30px;}
.btn-snap-create{width: 100px;height: 30px;}
.zanode-init{padding:15px;background: #f4f5f7;margin:10px 0;}
+1 -1
View File
@@ -6,7 +6,7 @@
*/
function zanodeType()
{
if($('#type').val() == 'physics')
if($('#hostType').val() == 'physics')
{
$('#parent').closest('tr').hide();
$('#image').closest('tr').hide();
+24 -2
View File
@@ -88,14 +88,14 @@ function checkServiceStatus(){
if(!isSuccess)
{
// $('.init-fail').show();
$('.init-fail').show();
$('.init-success').hide();
}
else
{
clearInterval(checkInterval)
$('.init-success').show();
// $('.init-fail').hide();
$('.init-fail').hide();
}
setTimeout(function() {
$('#serviceContent').removeClass('loading');
@@ -161,6 +161,28 @@ $('.btn-pwd-copy').live('click', function()
}, 2000)
})
$('.btn-init-copy').live('click', function()
{
var copyText = $('#initBash');
copyText.show();
copyText .select();
document.execCommand("Copy");
copyText.hide();
$('.btn-init-copy').tooltip({
trigger: 'click',
placement: 'top',
title: zanodeLang.copied,
tipClass: 'tooltip-success'
});
$(this).tooltip('show');
var that = this;
setTimeout(function()
{
$(that).tooltip('hide')
}, 2000)
})
$('.btn-pwd-show').live('click', function()
{
var pwd = $('#pwd-copy').text();
+4 -2
View File
@@ -63,6 +63,9 @@ $lang->zanode->manual = 'Manual';
$lang->zanode->initializing = 'Initializing';
$lang->zanode->showPwd = 'Show Password';
$lang->zanode->hidePwd = 'Hide Password';
$lang->zanode->baseInfo = 'Basic information';
$lang->zanode->cpuUnit = 'CORE';
$lang->zanode->IP = 'Extranet Address';
$lang->zanode->typeList['node'] = 'Virtual machine';
$lang->zanode->typeList['physics'] = 'Physical machine';
@@ -152,8 +155,7 @@ $lang->zanode->init->next = "Next";
$lang->zanode->init->button = "Go To Settings";
$lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node: <br/>1. Configure the automated test running environment according to the %s<br/>2. Go to %s";
$lang->zanode->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:";
$lang->zanode->init->initFailNoticeDesc = "1. Re-execute the script <br/>2. Review the initialization FAQ";
$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or <a href='https://github.com/easysoft/zenagent/' target='_blank'>See Help</a>.";
$lang->zanode->init->serviceStatus = array(
"ZenAgent" => 'not_install',
+4 -2
View File
@@ -63,6 +63,9 @@ $lang->zanode->manual = 'Manual';
$lang->zanode->initializing = 'Initializing';
$lang->zanode->showPwd = 'Show Password';
$lang->zanode->hidePwd = 'Hide Password';
$lang->zanode->baseInfo = 'Basic information';
$lang->zanode->cpuUnit = 'CORE';
$lang->zanode->IP = 'Extranet Address';
$lang->zanode->typeList['node'] = 'Virtual machine';
$lang->zanode->typeList['physics'] = 'Physical machine';
@@ -152,8 +155,7 @@ $lang->zanode->init->next = "Next";
$lang->zanode->init->button = "Go To Settings";
$lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node: <br/>1. Configure the automated test running environment according to the %s<br/>2. Go to %s";
$lang->zanode->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:";
$lang->zanode->init->initFailNoticeDesc = "1. Re-execute the script <br/>2. Review the initialization FAQ";
$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or <a href='https://github.com/easysoft/zenagent/' target='_blank'>See Help</a>.";
$lang->zanode->init->serviceStatus = array(
"ZenAgent" => 'not_install',
+3
View File
@@ -63,6 +63,9 @@ $lang->zanode->manual = 'Manual';
$lang->zanode->initializing = 'Initializing';
$lang->zanode->showPwd = 'Show Password';
$lang->zanode->hidePwd = 'Hide Password';
$lang->zanode->baseInfo = 'Basic information';
$lang->zanode->cpuUnit = 'CORE';
$lang->zanode->IP = 'Extranet Address';
$lang->zanode->typeList['node'] = 'Virtual machine';
$lang->zanode->typeList['physics'] = 'Physical machine';
+4 -2
View File
@@ -63,6 +63,9 @@ $lang->zanode->manual = '手册';
$lang->zanode->initializing = '初始化中';
$lang->zanode->showPwd = '显示密码';
$lang->zanode->hidePwd = '隐藏密码';
$lang->zanode->baseInfo = '基础信息';
$lang->zanode->cpuUnit = '核';
$lang->zanode->IP = 'IP/域名';
$lang->zanode->typeList['node'] = '虚拟机';
$lang->zanode->typeList['physics'] = '物理机';
@@ -152,8 +155,7 @@ $lang->zanode->init->next = "下一步";
$lang->zanode->init->button = "去设置";
$lang->zanode->init->initSuccessNoticeTitle = "服务已就绪,还需两步即可在执行节点上执行自动化测试:<br/>1、根据%s配置自动化测试运行环境。<br/>2、进行%s";
$lang->zanode->init->initFailNoticeTitle = "初始化失败,请查看初始化脚本执行日志并尝试以下两种解决方案:";
$lang->zanode->init->initFailNoticeDesc = "1、 重新执行脚本 <br/>2、 查看初始化常见问题";
$lang->zanode->init->initFailNotice = "服务未就绪,在执行节点上执行安装服务命令或<a href='https://github.com/easysoft/zenagent/' target='_blank'>查看帮助</a>.";
$lang->zanode->init->serviceStatus = array(
"ZenAgent" => 'not_install',
+34 -14
View File
@@ -57,14 +57,26 @@ class zanodemodel extends model
public function create()
{
$data = fixer::input('post')
->setIF($this->post->type == 'physics', 'parent', 0)
->setIF($this->post->type == 'physics', 'osName', $this->post->osNamePhysics)
->setIF($this->post->hostType == 'physics', 'parent', 0)
->setIF($this->post->hostType == 'physics', 'osName', $this->post->osNamePhysics)
->remove('osNamePhysics')
->get();
$data->type = "node";
if($data->hostType == 'physics')
{
$data->secret = md5($data->name . time());
$data->status = "offline";
}
else
{
$data->hostType = '';
}
/* Batch check fields. */
$this->dao->update(TABLE_ZAHOST)->data($data)
->batchCheck($data->type == 'node' ? $this->config->zanode->create->requiredFields : $this->config->zanode->create->physicsRequiredFields, 'notempty');
->batchCheck($data->hostType != 'physics' ? $this->config->zanode->create->requiredFields : $this->config->zanode->create->physicsRequiredFields, 'notempty');
if(dao::isError()) return false;
@@ -75,10 +87,10 @@ class zanodemodel extends model
}
/* If name already exists return error. */
$node = $this->dao->select('*')->from(TABLE_ZAHOST)->where('name')->eq($data->name)->andWhere('type')->in('node,physics')->fetch();
$node = $this->dao->select('*')->from(TABLE_ZAHOST)->where('name')->eq($data->name)->andWhere('type')->eq('node')->fetch();
if($node) return dao::$errors[] = $this->lang->zanode->nameUnique;
if($data->type == 'physics')
if($data->hostType == 'physics')
{
$ping = $this->loadModel('zahost')->checkAddress($data->extranet);
if(!$ping)
@@ -469,7 +481,7 @@ class zanodemodel extends model
{
$node = $this->getNodeByID($id);
if($node)
if($node && $node->hostType != 'physics')
{
$req = array( 'name' => $node->name );
$agnetUrl = 'http://' . $node->ip . ':' . $node->hzap;
@@ -589,11 +601,11 @@ class zanodemodel extends model
$query = str_replace('`hostID`', 't2.`id`', $query);
}
$list = $this->dao->select("t1.*, t2.name as hostName, if(t1.type='node', t2.extranet, t1.extranet) extranet,if(t1.type='node', t3.osName, t1.osName) osName")->from(TABLE_ZAHOST)->alias('t1')
$list = $this->dao->select("t1.*, t2.name as hostName, if(t1.hostType='', t2.extranet, t1.extranet) extranet,if(t1.hostType='', t3.osName, t1.osName) osName")->from(TABLE_ZAHOST)->alias('t1')
->leftJoin(TABLE_ZAHOST)->alias('t2')->on('t1.parent = t2.id')
->leftJoin(TABLE_IMAGE)->alias('t3')->on('t3.id = t1.image')
->where('t1.deleted')->eq(0)
->andWhere("((t1.type = 'node' and t2.type = 'zahost') or t1.type = 'physics')")
->andWhere("t1.type = 'node'")
->beginIF($query)->andWhere($query)->fi()
->orderBy($orderBy)
->page($pager)
@@ -606,7 +618,9 @@ class zanodemodel extends model
foreach($list as $l)
{
$host = zget($hosts, $l->parent);
$host = $l->hostType == '' ? zget($hosts, $l->parent) : clone $l;
$host->status = in_array($host->status, array('running', 'ready')) ? "online" : $host->status;
if($l->status == 'running' || $l->status == 'ready')
{
if(empty($host))
@@ -623,7 +637,7 @@ class zanodemodel extends model
if(time() - strtotime($l->heartbeat) > 60)
{
$l->status = 'wait';
$l->status = $l->hostType == '' ? 'wait' : 'offline';
}
}
}
@@ -673,6 +687,8 @@ class zanodemodel extends model
*/
public function getListByHost($hostID, $orderBy = 'id_desc')
{
if(!$hostID) return array();
$list = $this->dao->select('id, name, vnc, cpuCores, memory, diskSize, osName, status, heartbeat')->from(TABLE_ZAHOST)
->where('deleted')->eq(0)
->andWhere("parent")->eq($hostID)
@@ -805,14 +821,16 @@ class zanodemodel extends model
*/
public function getNodeByID($id)
{
$node = $this->dao->select("t1.*, t2.name as hostName, t2.extranet as ip,t2.zap as hzap,if(t1.type='node', t3.osName, t1.osName) osName, t2.tokenSN as tokenSN, t2.secret as secret")->from(TABLE_ZAHOST)
$node = $this->dao->select("t1.*, t2.name as hostName, if(t1.hostType='', t2.extranet, t1.extranet) ip,t2.zap as hzap,if(t1.hostType='', t3.osName, t1.osName) osName, if(t1.hostType='', t2.tokenSN, t1.tokenSN) tokenSN, if(t1.hostType='', t2.secret, t1.secret) secret")->from(TABLE_ZAHOST)
->alias('t1')
->leftJoin(TABLE_ZAHOST)->alias('t2')->on('t1.parent = t2.id')
->leftJoin(TABLE_IMAGE)->alias('t3')->on('t3.id = t1.image')
->where('t1.id')->eq($id)
->fetch();
$host = $this->loadModel("zahost")->getByID($node->type == 'node' ? $node->parent : $node->id);
$host = $node->hostType == '' ? $this->loadModel("zahost")->getByID($node->parent) : clone $node;
$host->status = in_array($host->status, array('running', 'ready')) ? "online" : $host->status;
if($node->status == 'running' || $node->status == 'ready')
{
if(empty($host) || $host->status != 'online')
@@ -821,7 +839,7 @@ class zanodemodel extends model
}
elseif(time() - strtotime($node->heartbeat) > 60)
{
$node->status = 'wait';
$node->status = $node->hostType == '' ? 'wait' : 'offline';
}
}
@@ -842,7 +860,9 @@ class zanodemodel extends model
if(empty($node)) return $node;
$host = $this->loadModel("zahost")->getByID($node->parent);
$host = $node->hostType == '' ? $this->loadModel("zahost")->getByID($node->parent) : $node;
$host->status = in_array($host->status, array('running', 'ready')) ? "online" : $host->status;
if($node->status == 'running' || $node->status == 'ready')
{
if(empty($host) || $host->status != 'online')
+8 -8
View File
@@ -80,26 +80,26 @@
<td class='c-actions'>
<?php
$suspendAttr = "title='{$lang->zanode->suspend}' target='hiddenwin'";
$suspendAttr .= $node->type == 'physics' || $node->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
$suspendAttr .= $node->hostType == 'physics' || $node->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
$resumeAttr = "title='{$lang->zanode->resume}' target='hiddenwin'";
$resumeAttr .= $node->type == 'physics' || $node->status == 'running' || $node->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'";
$resumeAttr .= $node->hostType == 'physics' || $node->status == 'running' || $node->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'";
$rebootAttr = "title='{$lang->zanode->reboot}' target='hiddenwin'";
$rebootAttr .= $node->type == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring', 'shutoff')) ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'";
$rebootAttr .= $node->hostType == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring', 'shutoff')) ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'";
$closeAttr = "title='{$lang->zanode->shutdown}'";
$closeAttr .= $node->type == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"';
$closeAttr .= $node->hostType == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"';
$startAttr = "title='{$lang->zanode->boot}'";
$startAttr .= $node->type == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"';
$startAttr .= $node->hostType == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"';
$snapshotAttr = "title='{$lang->zanode->createSnapshot}'";
$snapshotAttr .= $node->type == 'physics' || $node->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"';
$snapshotAttr .= $node->hostType == 'physics' || $node->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"';
$imageAttr = $node->status != 'running' && $node->status != 'creating_img' ? ' class="btn btn-action iframe createImage disabled"' : ' class="btn btn-action iframe createImage"';
$imageAttr = $node->hostType == 'physics' || $node->status != 'running' && $node->status != 'creating_img' ? ' class="btn btn-action iframe createImage disabled"' : ' class="btn btn-action iframe createImage"';
common::printLink('zanode', 'getVNC', "id={$node->id}", "<i class='icon icon-remote'></i> ", (in_array($node->status ,array('running', 'launch', 'wait')) ? '_blank' : ''), "title='{$lang->zanode->getVNC}' class='btn desktop " . (in_array($node->status ,array('running', 'launch', 'wait')) ? '':'disabled') . "'", '');
common::printLink('zanode', 'getVNC', "id={$node->id}", "<i class='icon icon-remote'></i> ", (in_array($node->status ,array('running', 'launch', 'wait')) ? '_blank' : ''), "title='{$lang->zanode->getVNC}' class='btn desktop " . ($node->hostType == '' && in_array($node->status ,array('running', 'launch', 'wait')) ? '':'disabled') . "'", '');
if($node->status == "suspend")
{
common::printLink('zanode', 'resume', "zanodeID={$node->id}", "<i class='icon icon-resume'></i> ", '', $resumeAttr);
+1 -1
View File
@@ -24,7 +24,7 @@
<table class='table table-form'>
<tr>
<th><?php echo $lang->zahost->type;?></th>
<td><?php echo html::select('type', $lang->zanode->typeList, 'virtual', "class='form-control chosen' onchange='zanodeType()'")?></td>
<td><?php echo html::select('hostType', $lang->zanode->typeList, 'virtual', "class='form-control chosen' onchange='zanodeType()'")?></td>
<td></td>
</tr>
<tr>
+5 -5
View File
@@ -21,7 +21,7 @@
</div>
<form method='post' target='hiddenwin' id='ajaxForm' class="load-indicator main-form form-ajax">
<table class='table table-form'>
<?php if($zanode->type == 'node'):?>
<?php if($zanode->hostType != 'physics'):?>
<tr>
<th><?php echo $lang->zanode->hostName;?></th>
<td class='p-25f'><?php echo html::input('', $host->name, "class='form-control' readonly='readonly'");?></td>
@@ -29,17 +29,17 @@
<?php endif;?>
<tr>
<th class='w-120px'><?php echo $lang->zanode->name;?></th>
<td class='p-25f'><?php echo html::input('name', $zanode->name, "class='form-control' placeholder=\"{$lang->zanode->nameValid}\" readonly='readonly'");?></td>
<td class='p-25f'><?php echo html::input('name', $zanode->name, "class='form-control' placeholder=\"{$lang->zanode->nameValid}\" " . ($zanode->hostType != 'physics' ? "readonly='readonly'" : ''));?></td>
<td></td>
</tr>
<?php if($zanode->type == 'node'):?>
<?php if($zanode->hostType != 'physics'):?>
<tr>
<th><?php echo $lang->zanode->image;?></th>
<td class='p-25f'><?php echo html::input('', $image->name, "class='form-control' readonly='readonly'");?></td>
</tr>
<?php else:?>
<tr>
<th class='w-120px'><?php echo $lang->zahost->IP;?></th>
<th class='w-120px'><?php echo $lang->zanode->IP;?></th>
<td class='p-25f'><?php echo html::input('extranet', $zanode->extranet, "class='form-control' readonly='readonly'");?></td>
</tr>
<?php endif;?>
@@ -69,7 +69,7 @@
</tr>
<tr>
<th><?php echo $lang->zanode->osName;?></th>
<td><?php echo html::input('osName', $zanode->osName, "class='form-control' readonly='readonly'")?></td>
<td><?php echo html::input('osName', $zanode->osName, "class='form-control' " . ($zanode->hostType != 'physics' ? "readonly='readonly'" : ''))?></td>
</tr>
<tr>
<th><?php echo $lang->zanode->desc ?></th>
+20 -14
View File
@@ -44,7 +44,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
<div class="col-8 main-col">
<div class="cell">
<div class="detail zanode-detail">
<div class="detail-title"><?php echo $lang->zahost->baseInfo; ?></div>
<div class="detail-title"><?php echo $lang->zanode->baseInfo; ?></div>
<div class="detail-content article-content">
<div class="main-row zanode-mt-8">
<div class="col-4">
@@ -63,7 +63,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
<div class="col-4">
<div class="main-row">
<div class="col-3 text-right"><?php echo $lang->zanode->cpuCores; ?>:</div>
<div class="col-8"><?php echo $zanode->cpuCores . ' ' . $lang->zahost->cpuUnit; ?></div>
<div class="col-8"><?php echo $zanode->cpuCores . ' ' . $lang->zanode->cpuUnit; ?></div>
</div>
</div>
</div>
@@ -132,28 +132,34 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
<?php echo $lang->zanode->init->statusTitle; ?>
<button type='button' id='checkServiceStatus' class='btn btn-info'><i class="icon icon-refresh"></i> <span class='checkStatus'><?php echo $lang->zanode->init->checkStatus;?></span></button>
</div>
<div class="detail-content statusContainer load-indicator" id='serviceContent'>
<div class="detail-content article-content statusContainer load-indicator" id='serviceContent'>
<div class="service-status hide">
<span class='dot-symbol dot-zenagent text-danger'>●</span>
<span>&nbsp;&nbsp;ZenAgent &nbsp;
<span>&nbsp;ZenAgent &nbsp;
<span class="zenagent-status"><?php echo $lang->zanode->initializing; ?></span>
</span>
</div>
<div class="service-status hide">
<span class='dot-symbol dot-ztf text-danger'>●</span>
<span>&nbsp;&nbsp;ZTF &nbsp;
<span>&nbsp;ZTF &nbsp;
<span class="ztf-status"><?php echo $lang->zanode->initializing; ?></span>&nbsp;
<a class='node-init-install hide' target='hiddenwin' href='javascript:;' data-href='<?php echo $this->createLink('zanode', 'ajaxInstallService', 'nodeID=' . $zanode->id . '&service=ztf');?>'><i class="icon icon-download icon-sm ztf-install-icon"></i><span class="ztf-install"><?php echo $lang->zanode->install ?></span></a>
</span>
</div>
<div class="status-notice hide">
<span class='init-success hide'><?php echo sprintf($lang->zanode->init->initSuccessNoticeTitle, "<a id='jumpManual' href='javascript:;'>{$lang->zanode->manual}</a>", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?></span>
<span class='init-fail hide'><?php echo $lang->zanode->init->initFailNoticeTitle . '<br/>' . $lang->zanode->init->initFailNoticeDesc;?></span>
<div class='hide init-fail'>
<?php echo $lang->zanode->init->initFailNotice;?>
<textarea style="display:none;" id="initBash"><?php echo $initBash; ?></textarea>
<div class="zanode-init">
<?php echo "$initBash <button type='button' class='btn btn-info btn-mini btn-init-copy'><i class='icon-common-copy icon-copy' title='" . $lang->zanode->copy . "'></i></button>"; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if(common::hasPriv('zanode', 'browseSnapshot')):?>
<?php if(common::hasPriv('zanode', 'browseSnapshot') && $zanode->hostType == ''):?>
<div class="cell">
<div class="detail zanode-detail">
<div class="detail-title">
@@ -186,23 +192,23 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
<?php
if (empty($zanode->deleted)) {
$suspendAttr = "title='{$lang->zanode->suspend}' target='hiddenwin'";
$suspendAttr .= $zanode->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
$suspendAttr .= $zanode->hostType == 'physics' || $zanode->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
$resumeAttr = "title='{$lang->zanode->resume}' target='hiddenwin'";
$resumeAttr .= $zanode->status == 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'";
$resumeAttr .= $zanode->hostType == 'physics' || $zanode->status == 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'";
$rebootAttr = "title='{$lang->zanode->reboot}' target='hiddenwin'";
$rebootAttr .= in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring', 'shutoff')) ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'";
$rebootAttr .= $zanode->hostType == 'physics' || in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring', 'shutoff')) ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'";
$closeAttr = "title='{$lang->zanode->shutdown}'";
$closeAttr .= in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"';
$closeAttr .= $zanode->hostType == 'physics' || in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"';
$startAttr = "title='{$lang->zanode->boot}'";
$startAttr .= in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"';
$startAttr .= $zanode->hostType == 'physics' || in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"';
$snapshotAttr = "title='{$lang->zanode->createSnapshot}'";
$snapshotAttr .= $zanode->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"';
common::printLink('zanode', 'getVNC', "id={$zanode->id}", "<i class='icon icon-remote'></i> " . $lang->zanode->getVNC, in_array($zanode->status ,array('running', 'launch', 'wait')) ? '_blank' : '', "title='{$lang->zanode->getVNC}' class='btn desktop " . (in_array($zanode->status ,array('running', 'launch', 'wait')) ? '':'disabled') . "'", '');
$snapshotAttr .= $zanode->hostType == 'physics' || $zanode->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"';
common::printLink('zanode', 'getVNC', "id={$zanode->id}", "<i class='icon icon-remote'></i> " . $lang->zanode->getVNC, in_array($zanode->status ,array('running', 'launch', 'wait')) ? '_blank' : '', "title='{$lang->zanode->getVNC}' class='btn desktop " . ($zanode->hostType == '' && in_array($zanode->status ,array('running', 'launch', 'wait')) ? '':'disabled') . "'", '');
if($zanode->status == "suspend")
{