diff --git a/module/zanode/control.php b/module/zanode/control.php index cdb5d2cad5..adad9480c5 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -135,7 +135,9 @@ class zanode extends control $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted'); $this->view->nodeID = $nodeID; $this->view->node = $this->zanode->getNodeById($nodeID); - // $this->view->modalLink = $imageList ? $this->createLink('zanode', 'create', "nodeID=$nodeID") : $this->createLink('zanode', 'browseImage', "nodeID=$nodeID"); + $this->view->notice = $this->lang->zanode->init->initSuccessNoticeTitle; + $this->view->buttonName = $this->lang->zanode->init->button; + $this->view->modalLink = $this->createLink('zanode', 'browse'); $this->display(); } diff --git a/module/zanode/css/common.css b/module/zanode/css/common.css new file mode 100644 index 0000000000..6f18896c39 --- /dev/null +++ b/module/zanode/css/common.css @@ -0,0 +1,7 @@ +#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;} diff --git a/module/zanode/js/common.js b/module/zanode/js/common.js index af78b5fd6f..07673afe7e 100644 --- a/module/zanode/js/common.js +++ b/module/zanode/js/common.js @@ -36,3 +36,9 @@ $(function() if(typeof image == 'undefined' || !image) $('#os').change(); }) + +function showModal(url = '') +{ + if(url) $("#modalLink").attr('href', url); + $('#successModal').modal('show', 'center'); +} diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 7fcaf6008d..545b096ab3 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -86,7 +86,9 @@ $lang->zanode->init->not_install = "Not installed"; $lang->zanode->init->not_available = "Installed, Not Started"; $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"; @@ -96,5 +98,5 @@ $lang->zanode->init->serviceStatus = [ ]; $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: bash <(curl -s -S -L https://pkg.qucheng.com/zenagent/zagent.sh) -s vm "; +$lang->zanode->init->initDesc = "Execute the init script on the node: bash <(curl -s -S -L https://pkg.qucheng.com/zenagent/zagent.sh) -s vm -k "; $lang->zanode->init->statusTitle = "Service Status"; \ No newline at end of file diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index de8de68d2a..36524ed948 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -86,7 +86,9 @@ $lang->zanode->init->not_install = "Not installed"; $lang->zanode->init->not_available = "Installed, Not Started"; $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"; @@ -96,5 +98,5 @@ $lang->zanode->init->serviceStatus = [ ]; $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: bash <(curl -s -S -L https://pkg.qucheng.com/zenagent/zagent.sh) -s vm "; +$lang->zanode->init->initDesc = "Execute the init script on the node: bash <(curl -s -S -L https://pkg.qucheng.com/zenagent/zagent.sh) -s vm -k "; $lang->zanode->init->statusTitle = "Service Status"; \ No newline at end of file diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index c06676d639..ddb6a5e76b 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -86,7 +86,9 @@ $lang->zanode->init->not_install = "Not installed"; $lang->zanode->init->not_available = "Installed, Not Started"; $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"; @@ -96,5 +98,5 @@ $lang->zanode->init->serviceStatus = [ ]; $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: bash <(curl -s -S -L https://pkg.qucheng.com/zenagent/zagent.sh) -s vm "; +$lang->zanode->init->initDesc = "Execute the init script on the node: bash <(curl -s -S -L https://pkg.qucheng.com/zenagent/zagent.sh) -s vm -k "; $lang->zanode->init->statusTitle = "Service Status"; \ No newline at end of file diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index 6654c5be94..ededdb960a 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -81,13 +81,15 @@ $lang->zanode->statusList['destroy'] = '已销毁'; $lang->zanode->statusList['destroy_fail'] = '销毁失败'; $lang->zanode->init = new stdclass; -$lang->zanode->init->statusTitle = "服务状态"; -$lang->zanode->init->checkStatus = "检测服务状态"; -$lang->zanode->init->not_install = "未安装"; +$lang->zanode->init->statusTitle = "服务状态"; +$lang->zanode->init->checkStatus = "检测服务状态"; +$lang->zanode->init->not_install = "未安装"; $lang->zanode->init->not_available = "已安装,未启动"; -$lang->zanode->init->ready = "已就绪"; -$lang->zanode->init->next = "下一步"; +$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->serviceStatus = [ @@ -96,5 +98,5 @@ $lang->zanode->init->serviceStatus = [ ]; $lang->zanode->init->title = "初始化执行节点"; $lang->zanode->init->descTitle = "请根据引导完成执行节点上的初始化: "; -$lang->zanode->init->initDesc = "1. 在执行节点上执行:bash <(curl -s -S -L https://pkg.qucheng.com/zenagent/zagent.sh) -s vm "; +$lang->zanode->init->initDesc = "1. 在执行节点上执行:bash <(curl -s -S -L https://pkg.qucheng.com/zenagent/zagent.sh) -s vm -k "; $lang->zanode->init->statusTitle = "Service Status"; \ No newline at end of file diff --git a/module/zanode/model.php b/module/zanode/model.php index e2a3cdc0f3..d7b22cd0d8 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -60,9 +60,6 @@ class zanodemodel extends model /* Get host info. */ $host = $this->getHostByID($data->parent); - /* Gen mac address */ - $mac = $this->genmac(); - /* Prepare create params. */ $agnetUrl = 'http://' . $host->extranet . ':' . $host->zap; $param = array( @@ -90,7 +87,7 @@ class zanodemodel extends model /* Prepare create execution node data. */ $data->image = $data->image; $data->parent = $host->id; - $data->mac = $mac; + $data->mac = $result->data->mac; $data->status = static::STATUS_RUNNING; $data->createdBy = $this->app->user->account; $data->createdDate = helper::now(); @@ -122,7 +119,6 @@ class zanodemodel extends model if(dao::isError()) return false; $node = $this->getNodeByID($zanodeID); - $image = $this->getImageByID($node->image); $newImage = new stdClass(); $newImage->host = $node->parent; @@ -472,7 +468,7 @@ class zanodemodel extends model */ public function getNodeByID($id) { - return $this->dao->select('t1.*, t1.name as hostName, t2.extranet as ip,t2.zap as hzap,t3.osName, t2.tokenSN as hTokenSN')->from(TABLE_ZAHOST)->alias('t1') + return $this->dao->select('t1.*, t1.name as hostName, t2.extranet as ip,t2.zap as hzap,t3.osName, t2.tokenSN as hTokenSN, t2.secret as 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) @@ -638,6 +634,7 @@ class zanodemodel extends model "server" => getWebRoot(true), ); $result = json_decode(commonModel::http("http://{$node->extranet}:{$node->zap}/api/v1/service/setup", json_encode($param), array(), array("Authorization:$node->tokenSN"))); + if(empty($result->data) || $result->code != 'success') { $result = new stdclass; diff --git a/module/zanode/view/init.html.php b/module/zanode/view/init.html.php index d1ed31ab37..d46257298a 100644 --- a/module/zanode/view/init.html.php +++ b/module/zanode/view/init.html.php @@ -35,9 +35,11 @@
+ ' . $lang->goback, "data-app='{$app->tab}'", 'btn'); ?> +
- + diff --git a/module/zanode/view/successmodal.html.php b/module/zanode/view/successmodal.html.php new file mode 100644 index 0000000000..819a0197ce --- /dev/null +++ b/module/zanode/view/successmodal.html.php @@ -0,0 +1,16 @@ +