* Update detail .

This commit is contained in:
zhaoke
2022-12-28 11:07:34 +00:00
parent 6582359c3f
commit 720d1d2799
9 changed files with 143 additions and 52 deletions
+4 -1
View File
@@ -6,7 +6,10 @@ $config->zanode->create->requiredFields = 'name,host,image,cpu,memory,disk,osNam
$config->zanode->edit->requiredFields = '';
$config->zanode->createimage->requiredFields = 'name';
$config->zanode->defaultPort = '55001';
$config->zanode->defaultPort = '55001';
$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';
+14 -6
View File
@@ -68,8 +68,7 @@ class zanode extends control
{
$nodeID = $this->zanode->create();
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$initLink = $this->createLink('zanode', 'init', "nodeID=$nodeID");
return print("<script>showModal('$initLink')</script>");
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "id=$nodeID")));
}
$this->view->title = $this->lang->zanode->create;
@@ -121,10 +120,19 @@ class zanode extends control
*/
public function view($id)
{
$this->view->title = $this->lang->zanode->view;
$this->view->zanode = $this->zanode->getNodeByID($id);
$this->view->actions = $this->loadModel('action')->getList('zanode', $id);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$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->actions = $this->loadModel('action')->getList('zanode', $id);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
+8 -1
View File
@@ -3,4 +3,11 @@
.table.has-sort-head thead tr th a:after{line-height: 22px;}
.table.has-sort-head thead tr th a:before{line-height: 22px;}
.main-row-last{table-layout: auto;}
.zanode-mt-8{margin-top: 8px;}
.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 a{color: #2463c7;}
.service-status{margin-top: 10px;}
.vnc-detail{min-height: 60vh;}
.vnc-mask{width: 100%;height:100%;background-color: rgba(0,0,0,0);position: absolute;}
+7
View File
@@ -0,0 +1,7 @@
var ifm = document.getElementById("vncIframe");
ifm.height=$('.vnc-detail').css('height')
$('.vnc-mask').click(function(){
window.open(vncLink)
})
$('.vnc-mask').css('width', $('.vnc-detail').css('width'));
$('.vnc-mask').css('height', $('.vnc-detail').css('height'));
+9 -3
View File
@@ -22,8 +22,11 @@ $lang->zanode->start = 'Start After Created';
$lang->zanode->hostName = 'Host Name';
$lang->zanode->host = $lang->zanode->hostName;
$lang->zanode->extranet = 'IP/Domain';
$lang->zanode->sshAddress = 'SSH Address';
$lang->zanode->osArch = 'Arch';
$lang->zanode->cpuCores = 'CPU';
$lang->zanode->defaultUser = 'Default Account Name';
$lang->zanode->defaultPwd = 'Default Password';
$lang->zanode->memory = 'Memory Size';
$lang->zanode->desc = 'Description';
$lang->zanode->diskSize = 'Disk Size';
@@ -47,6 +50,7 @@ $lang->zanode->automation = "Automation";
$lang->zanode->install = "Install";
$lang->zanode->copy = 'Click to copy';
$lang->zanode->copied = 'Copy successful';
$lang->zanode->manual = 'Manual';
$lang->automation = new stdClass();
$lang->automation->scriptPath = $lang->zanode->scriptPath;
@@ -100,13 +104,15 @@ $lang->zanode->init->ready = "Ready";
$lang->zanode->init->next = "Next";
$lang->zanode->init->button = "Go To Settings";
$lang->zanode->init->initSuccessNoticeTitle = "The initialization is successful, you can perform automated test settings or go to node browse.";
$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->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->serviceStatus = [
"ZenAgent" => 'not_install',
"ZTF" => 'not_install',
];
$lang->zanode->init->title = "Initialize Node";
$lang->zanode->init->descTitle = "Follow these steps to complete the initialization on the node:";
$lang->zanode->init->initDesc = "Execute the init script on the node: %s %s <br>- Click check service status button.";
+9 -3
View File
@@ -22,8 +22,11 @@ $lang->zanode->start = 'Start After Created';
$lang->zanode->hostName = 'Host Name';
$lang->zanode->host = $lang->zanode->hostName;
$lang->zanode->extranet = 'IP/Domain';
$lang->zanode->sshAddress = 'SSH Address';
$lang->zanode->osArch = 'Arch';
$lang->zanode->cpuCores = 'CPU';
$lang->zanode->defaultUser = 'Default Account Name';
$lang->zanode->defaultPwd = 'Default Password';
$lang->zanode->memory = 'Memory Size';
$lang->zanode->desc = 'Description';
$lang->zanode->diskSize = 'Disk Size';
@@ -47,6 +50,7 @@ $lang->zanode->automation = "Automation";
$lang->zanode->install = "Install";
$lang->zanode->copy = 'Click to copy';
$lang->zanode->copied = 'Copy successful';
$lang->zanode->manual = 'Manual';
$lang->automation = new stdClass();
$lang->automation->scriptPath = $lang->zanode->scriptPath;
@@ -100,13 +104,15 @@ $lang->zanode->init->ready = "Ready";
$lang->zanode->init->next = "Next";
$lang->zanode->init->button = "Go To Settings";
$lang->zanode->init->initSuccessNoticeTitle = "The initialization is successful, you can perform automated test settings or go to node browse.";
$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->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->serviceStatus = [
"ZenAgent" => 'not_install',
"ZTF" => 'not_install',
];
$lang->zanode->init->title = "Initialize Node";
$lang->zanode->init->descTitle = "Follow these steps to complete the initialization on the node:";
$lang->zanode->init->initDesc = "Execute the init script on the node: %s %s <br>- Click check service status button.";
+9 -3
View File
@@ -22,8 +22,11 @@ $lang->zanode->start = 'Start After Created';
$lang->zanode->hostName = 'Host Name';
$lang->zanode->host = $lang->zanode->hostName;
$lang->zanode->extranet = 'IP/Domain';
$lang->zanode->sshAddress = 'SSH Address';
$lang->zanode->osArch = 'Arch';
$lang->zanode->cpuCores = 'CPU';
$lang->zanode->defaultUser = 'Default Account Name';
$lang->zanode->defaultPwd = 'Default Password';
$lang->zanode->memory = 'Memory Size';
$lang->zanode->desc = 'Description';
$lang->zanode->diskSize = 'Disk Size';
@@ -47,6 +50,7 @@ $lang->zanode->automation = "Automation";
$lang->zanode->install = "Install";
$lang->zanode->copy = 'Click to copy';
$lang->zanode->copied = 'Copy successful';
$lang->zanode->manual = 'Manual';
$lang->automation = new stdClass();
$lang->automation->scriptPath = $lang->zanode->scriptPath;
@@ -100,13 +104,15 @@ $lang->zanode->init->ready = "Ready";
$lang->zanode->init->next = "Next";
$lang->zanode->init->button = "Go To Settings";
$lang->zanode->init->initSuccessNoticeTitle = "The initialization is successful, you can perform automated test settings or go to node browse.";
$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->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->serviceStatus = [
"ZenAgent" => 'not_install',
"ZTF" => 'not_install',
];
$lang->zanode->init->title = "Initialize Node";
$lang->zanode->init->descTitle = "Follow these steps to complete the initialization on the node:";
$lang->zanode->init->initDesc = "Execute the init script on the node: %s %s <br>- Click check service status button.";
+8 -3
View File
@@ -22,8 +22,11 @@ $lang->zanode->start = '创建后自动开启';
$lang->zanode->hostName = '所属宿主机';
$lang->zanode->host = $lang->zanode->hostName;
$lang->zanode->extranet = 'IP/域名';
$lang->zanode->sshAddress = 'SSH地址';
$lang->zanode->osArch = '架构';
$lang->zanode->cpuCores = 'CPU';
$lang->zanode->defaultUser = '默认用户';
$lang->zanode->defaultPwd = '默认密码';
$lang->zanode->memory = '内存';
$lang->zanode->diskSize = '硬盘';
$lang->zanode->desc = '描述';
@@ -47,6 +50,7 @@ $lang->zanode->automation = "自动化设置";
$lang->zanode->install = "安装";
$lang->zanode->copy = '复制';
$lang->zanode->copied = '复制成功';
$lang->zanode->manual = '手册';
$lang->automation = new stdClass();
$lang->automation->scriptPath = $lang->zanode->scriptPath;
@@ -100,9 +104,10 @@ $lang->zanode->init->ready = "已就绪";
$lang->zanode->init->next = "下一步";
$lang->zanode->init->button = "去设置";
$lang->zanode->init->initSuccessNoticeTitle = "初始化成功,您可以进行自动化测试设置或返回列表。";
$lang->zanode->init->initFailNoticeTitle = "初始化失败,请查看初始化脚本执行日志并尝试以下两种解决方案:";
$lang->zanode->init->initFailNoticeDesc = "1. 重新执行脚本 <br/>2. 查看初始化常见问题";
$lang->zanode->init->initSuccessNoticeTitle = "服务已就绪,还需两步即可在执行节点上执行自动化测试:1、根据%s配置自动化测试运行环境。<br/>2、进行%s";
$lang->zanode->init->initFailNoticeTitle = "初始化失败,请查看初始化脚本执行日志并尝试以下两种解决方案:";
$lang->zanode->init->initFailNoticeDesc = "1. 重新执行脚本 <br/>2. 查看初始化常见问题";
$lang->zanode->init->serviceStatus = [
"ZenAgent" => 'not_install',
"ZTF" => 'not_install',
+75 -32
View File
@@ -18,8 +18,12 @@
<?php js::set('confirmReboot', $lang->zanode->confirmReboot) ?>
<?php js::set('confirmShutdown', $lang->zanode->confirmShutdown) ?>
<?php js::set('actionSuccess', $lang->zanode->actionSuccess) ?>
<?php js::set('vncLink', "http://$url/novnc?port=6080&path=websockify/?token=$token&password=pass") ?>
<?php $browseLink = $this->session->zanodeList ? $this->session->zanodeList : $this->createLink('zanode', 'browse', ""); ?>
<?php $vars = "id={$zanode->id}&orderBy=%s"; ?>
<?php
$vars = "id={$zanode->id}&orderBy=%s";
$account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccount : $config->zanode->defaultAccount;
?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php echo html::backButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, "data-app='{$app->tab}'", 'btn btn-secondary'); ?>
@@ -40,12 +44,6 @@
<div class="detail-title"><?php echo $lang->zanode->view; ?></div>
<div class="detail-content article-content">
<div class="main-row zanode-mt-8">
<div class="col-4">
<div class="main-row">
<div class="col-3 text-right">IP:</div>
<div class="col-8"><?php echo $zanode->ip; ?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-3 text-right"><?php echo $lang->zanode->osName; ?>:</div>
@@ -54,8 +52,14 @@
</div>
<div class="col-4">
<div class="main-row">
<div class="col-3 text-right"><?php echo $lang->zanode->memory; ?>:</div>
<div class="col-8"><?php echo $zanode->memory; ?></div>
<div class="col-3 text-right"><?php echo $lang->zanode->sshAddress; ?>:</div>
<div class="col-8"><?php echo $account . '@' . $zanode->ip; ?></div>
</div>
</div>
<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; ?></div>
</div>
</div>
</div>
@@ -68,14 +72,14 @@
</div>
<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; ?></div>
<div class="col-3 text-right"><?php echo $lang->zanode->defaultUser; ?>:</div>
<div class="col-8"><?php echo $account; ?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-3 text-right"><?php echo $lang->zanode->diskSize; ?>:</div>
<div class="col-8"><?php echo $zanode->diskSize; ?></div>
<div class="col-3 text-right"><?php echo $lang->zanode->memory; ?>:</div>
<div class="col-8"><?php echo $zanode->memory; ?></div>
</div>
</div>
</div>
@@ -86,37 +90,47 @@
<div class="col-8"><?php echo $zanode->hostName; ?></div>
</div>
</div>
<div class="col-4"></div>
<div class="col-4"></div>
<div class="col-4">
<div class="main-row">
<div class="col-3 text-right"><?php echo $lang->zanode->defaultPwd; ?>:</div>
<div class="col-8"><?php echo $config->zanode->defaultPwd; ?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-3 text-right"><?php echo $lang->zanode->diskSize; ?>:</div>
<div class="col-8"><?php echo $zanode->diskSize; ?></div>
</div>
</div>
<div class="col-4"></div>
</div>
</div>
</div>
<div class="detail zanode-detail">
<div class="detail-title"><?php echo $lang->zanode->desc; ?></div>
<div class="detail-content article-content"><?php echo !empty($zanode->desc) ? htmlspecialchars_decode($zanode->desc) : $lang->noData; ?></div>
</div>
<?php
$canBeChanged = common::canBeChanged('zanode', $zanode);
if ($canBeChanged) $actionFormLink = $this->createLink('action', 'comment', "objectType=zanode&objectID=$zanode->id");
?>
</div>
<div class="cell">
<div class="detail vnc-detail">
<div class='vnc-mask'></div>
<?php echo "<iframe width='100%' id='vncIframe' src='http://$url/novnc?port=6080&path=websockify/?token=$token&password=pass'></iframe>";?>
</div>
</div>
<?php $this->printExtendFields($zanode, 'div', "position=left&inForm=0&inCell=1"); ?>
<div class='main-actions'>
<div class="btn-toolbar">
<?php echo html::backButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, '', 'btn btn-secondary'); ?>
<div class='divider'></div>
<?php
if (empty($zanode->deleted))
{
if($zanode->status == "running"){
if (empty($zanode->deleted)) {
if ($zanode->status == "running") {
common::printLink('zanode', 'suspend', "id={$zanode->id}", "<i class='icon icon-pause'></i> " . $lang->zanode->suspend, '', "title='{$lang->zanode->suspend}' class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'");
}
elseif($zanode->status == "suspend")
{
} elseif ($zanode->status == "suspend") {
common::printLink('zanode', 'resume', "id={$zanode->id}", "<i class='icon icon-restart'></i> " . $lang->zanode->resume, '', "title='{$lang->zanode->resume}' class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'");
}
common::printLink('zanode', 'getVNC', "id={$zanode->id}", "<i class='icon icon-desktop'></i> " . $lang->zanode->getVNC, '_blank', "title='{$lang->zanode->getVNC}' class='btn " . (common::hasPriv('zanode', 'getVNC') && in_array($zanode->status ,array('running', 'launch')) ? '':'disabled') . "'");
common::printLink('zanode', 'getVNC', "id={$zanode->id}", "<i class='icon icon-desktop'></i> " . $lang->zanode->getVNC, '_blank', "title='{$lang->zanode->getVNC}' class='btn " . (common::hasPriv('zanode', 'getVNC') && in_array($zanode->status, array('running', 'launch')) ? '' : 'disabled') . "'");
}
?>
<div class='divider'></div>
@@ -126,10 +140,39 @@
</div>
<div class="col-4 side-col">
<div class='cell'><?php include '../../common/view/action.html.php'; ?></div>
</div>
</div>
<div class="cell">
<div class="detail zanode-detail">
<div class="detail-title">
<?php echo $lang->zanode->init->statusTitle; ?>
<span class="zanode-status-text"><i class="icon icon-restart"></i><?php echo $lang->zanode->init->checkStatus; ?></span>
</div>
<div class="detail-content">
<div class="service-status">
<span class='dot-symbol text-success'>●</span>
<span>&nbsp;&nbsp;ZenAgent: &nbsp;
<span class="zenagent-staus">已就绪</span>
</span>
</div>
<div class="service-status">
<span class='dot-symbol text-success'>●</span>
<span>&nbsp;&nbsp;ZTF: &nbsp;
<span class="zenagent-staus">已就绪</span>
</span>
</div>
<div class="status-notice">
<?php echo sprintf($lang->zanode->init->initSuccessNoticeTitle, "<a href=''>{$lang->zanode->manual}</a>", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?>
</div>
</div>
</div>
</div>
<div class="cell">
<div class="detail zanode-detail">
<div class="detail-title"><?php echo $lang->zanode->desc; ?></div>
<div class="detail-content article-content"><?php echo !empty($zanode->desc) ? htmlspecialchars_decode($zanode->desc) : $lang->noData; ?></div>
</div>
</div>
<div id='mainActions' class='main-actions'>
<?php common::printPreAndNext($browseLink); ?>
</div>
<?php include '../../common/view/footer.html.php'; ?>
<div id='mainActions' class='main-actions'>
<?php common::printPreAndNext($browseLink); ?>
</div>
<?php include '../../common/view/footer.html.php'; ?>