Merge branch 'zenops_46_zhaoke_77683' into zenops_46_tanghucheng

This commit is contained in:
zhaoke
2022-12-07 06:54:21 +00:00
10 changed files with 55 additions and 17 deletions
+3 -1
View File
@@ -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();
}
+7
View File
@@ -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;}
+6
View File
@@ -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');
}
+3 -1
View File
@@ -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 <br/>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";
+3 -1
View File
@@ -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 <br/>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";
+3 -1
View File
@@ -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 <br/>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";
+8 -6
View File
@@ -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. 重新执行脚本 <br/>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";
+3 -6
View File
@@ -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;
+3 -1
View File
@@ -35,9 +35,11 @@
<div class="text-center host-action">
<button type='button' id='checkServiceStatus' class='btn btn-info margin-top-18'><?php echo $lang->zanode->init->checkStatus; ?></button>
<?php echo html::backButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, "data-app='{$app->tab}'", 'btn'); ?>
<!-- <button type='button' class='btn margin-top-18'><?php echo $lang->goback; ?></button> -->
</div>
</div>
</div>
</div>
<?php // include 'successmodal.html.php';?>
<?php include 'successmodal.html.php';?>
<?php include '../../common/view/footer.html.php'; ?>
+16
View File
@@ -0,0 +1,16 @@
<div class="modal fade" id="successModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<?php echo html::a($this->createLink('zanode', '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>