From 720d1d2799804a3ce05f22c5cb8ec52b113cf76f Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 28 Dec 2022 11:07:34 +0000 Subject: [PATCH] * Update detail . --- module/zanode/config.php | 5 +- module/zanode/control.php | 20 ++++-- module/zanode/css/view.css | 9 ++- module/zanode/js/view.js | 7 ++ module/zanode/lang/de.php | 12 +++- module/zanode/lang/en.php | 12 +++- module/zanode/lang/fr.php | 12 +++- module/zanode/lang/zh-cn.php | 11 +++- module/zanode/view/view.html.php | 107 ++++++++++++++++++++++--------- 9 files changed, 143 insertions(+), 52 deletions(-) create mode 100644 module/zanode/js/view.js diff --git a/module/zanode/config.php b/module/zanode/config.php index 92a58a2147..25512d7701 100644 --- a/module/zanode/config.php +++ b/module/zanode/config.php @@ -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'; diff --git a/module/zanode/control.php b/module/zanode/control.php index 5825d472c4..58bf60e9f1 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -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(""); + 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(); } diff --git a/module/zanode/css/view.css b/module/zanode/css/view.css index 525953f674..6dc94b4809 100644 --- a/module/zanode/css/view.css +++ b/module/zanode/css/view.css @@ -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;} \ No newline at end of file +.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;} \ No newline at end of file diff --git a/module/zanode/js/view.js b/module/zanode/js/view.js new file mode 100644 index 0000000000..d6a3bb6119 --- /dev/null +++ b/module/zanode/js/view.js @@ -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')); \ No newline at end of file diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 54b522642c..dc7ddccf41 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -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
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:
1. Configure the automated test running environment according to the %s
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
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
- Click check service status button."; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 0244b4e243..e545d773ee 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -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
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:
1. Configure the automated test running environment according to the %s
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
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
- Click check service status button."; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 0bf60d004c..3473f470c4 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -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
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:
1. Configure the automated test running environment according to the %s
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
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
- Click check service status button."; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index 472a24766d..2209e840e2 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -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. 重新执行脚本
2. 查看初始化常见问题"; +$lang->zanode->init->initSuccessNoticeTitle = "服务已就绪,还需两步即可在执行节点上执行自动化测试:1、根据%s配置自动化测试运行环境。
2、进行%s"; +$lang->zanode->init->initFailNoticeTitle = "初始化失败,请查看初始化脚本执行日志并尝试以下两种解决方案:"; +$lang->zanode->init->initFailNoticeDesc = "1. 重新执行脚本
2. 查看初始化常见问题"; + $lang->zanode->init->serviceStatus = [ "ZenAgent" => 'not_install', "ZTF" => 'not_install', diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index 2016e6ba81..9c5694d600 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -18,8 +18,12 @@ zanode->confirmReboot) ?> zanode->confirmShutdown) ?> zanode->actionSuccess) ?> + session->zanodeList ? $this->session->zanodeList : $this->createLink('zanode', 'browse', ""); ?> -id}&orderBy=%s"; ?> +id}&orderBy=%s"; +$account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccount : $config->zanode->defaultAccount; +?> -
-
+
+
+
zanode->defaultPwd; ?>:
+
zanode->defaultPwd; ?>
+
+
+
+
+
zanode->diskSize; ?>:
+
diskSize; ?>
+
+
-
-
zanode->desc; ?>
-
desc) ? htmlspecialchars_decode($zanode->desc) : $lang->noData; ?>
-
+ createLink('action', 'comment', "objectType=zanode&objectID=$zanode->id"); ?> +
+
+
+ ";?> +
+
printExtendFields($zanode, 'div', "position=left&inForm=0&inCell=1"); ?>
' . $lang->goback, '', 'btn btn-secondary'); ?>
deleted)) - { - if($zanode->status == "running"){ + if (empty($zanode->deleted)) { + if ($zanode->status == "running") { common::printLink('zanode', 'suspend', "id={$zanode->id}", " " . $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}", " " . $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}", " " . $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}", " " . $lang->zanode->getVNC, '_blank', "title='{$lang->zanode->getVNC}' class='btn " . (common::hasPriv('zanode', 'getVNC') && in_array($zanode->status, array('running', 'launch')) ? '' : 'disabled') . "'"); } ?>
@@ -126,10 +140,39 @@
-
-
+
+
+
+ zanode->init->statusTitle; ?> + zanode->init->checkStatus; ?> +
+
+
+ ● +   ZenAgent:   + 已就绪 + +
+
+ ● +   ZTF:   + 已就绪 + +
+
+ zanode->init->initSuccessNoticeTitle, "{$lang->zanode->manual}", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?> +
+
+
+
+
+
+
zanode->desc; ?>
+
desc) ? htmlspecialchars_decode($zanode->desc) : $lang->noData; ?>
+
+
-
- -
- +
+ +
+ \ No newline at end of file