Merge branch 'zenops_46_tanghucheng' into zenops_46

This commit is contained in:
tanghucheng
2022-12-29 10:28:59 +08:00
34 changed files with 543 additions and 102 deletions
+3
View File
@@ -395,6 +395,7 @@ class testcase extends control
$this->loadModel('story');
if(!empty($_POST))
{
if(!empty($_FILES['scriptFile'])) unset($_FILES['scriptFile']);
$response['result'] = 'success';
setcookie('lastCaseModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false);
@@ -875,6 +876,8 @@ class testcase extends control
if(!empty($_POST))
{
if(!empty($_FILES['scriptFile'])) unset($_FILES['scriptFile']);
$changes = array();
if($comment == false or $comment == 'false')
{
+2 -1
View File
@@ -14,6 +14,7 @@
#story_chosen .chosen-results > li.no-results {cursor: pointer;}
#story_chosen .chosen-results > li.no-results:hover {color: #1a4f85; background-color: #ddd;}
#story_chosen .chosen-results > li.no-results > span {font-weight: bold;}
#type_chosen {display: table-cell;}
.row .col-sm-10 {width: 89%;}
.row .col-sm-2 {padding-left: 0px; width: 11%;}
@@ -42,4 +43,4 @@
.pri-selector > .dropdown-menu {padding: 10px;}
.stageBox {padding-left: 15px !important;}
#refresh {margin-left: 7px;}
#refresh {margin-left: 7px;}
+1
View File
@@ -7,3 +7,4 @@
[lang^=en] .detail > table > tbody th, [lang^=fr] .detail > table > tbody th {width: 100px !important;}
[lang^=de] .detail > table > tbody th {width: 125px !important;}
.linkCaseTitle, .linkBugTitle {white-space: nowrap;}
#type_chosen{display: table-cell;}
+1
View File
@@ -152,6 +152,7 @@ $lang->testcase->stepChild = '子步骤';
$lang->testcase->viewAll = '查看所有';
$lang->testcase->importToLib = '导入用例库';
$lang->testcase->showScript = '查看自动化脚本';
$lang->testcase->autoScript = '自动化脚本';
$lang->testcase->new = '新增';
+25 -2
View File
@@ -50,6 +50,16 @@ class testcaseModel extends model
}
}
if(!empty($_POST['auto']))
{
$_POST['auto'] = 'auto';
if($_POST['script']) $_POST['script'] = htmlentities($_POST['script']);
}
else
{
unset($_POST['script']);
}
$now = helper::now();
$status = $this->getStatus('create');
$case = fixer::input('post')
@@ -61,7 +71,7 @@ class testcaseModel extends model
->setIF($this->app->tab == 'project', 'project', $this->session->project)
->setIF($this->app->tab == 'execution', 'execution', $this->session->execution)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion((int)$this->post->story))
->remove('steps,expects,files,labels,stepType,forceNotReview')
->remove('steps,expects,files,labels,stepType,forceNotReview,scriptFile,scriptName')
->setDefault('story', 0)
->cleanInt('story,product,branch,module')
->join('stage', ',')
@@ -81,6 +91,8 @@ class testcaseModel extends model
if(!$this->dao->isError())
{
$caseID = $this->dao->lastInsertID();
$this->config->dangers = '';
$this->loadModel('file')->saveUpload('testcase', $caseID, 'autoscript', 'script', 'scriptName');
$this->loadModel('file')->saveUpload('testcase', $caseID);
$parentStepID = 0;
$this->loadModel('score')->create('testcase', 'create', $caseID);
@@ -830,6 +842,17 @@ class testcaseModel extends model
$version = $stepChanged ? $oldCase->version + 1 : $oldCase->version;
if(!empty($_POST['auto']))
{
$_POST['auto'] = 'auto';
if($_POST['script']) $_POST['script'] = htmlentities($_POST['script']);
}
else
{
$_POST['auto'] = 'no';
$_POST['script'] = '';
}
$case = fixer::input('post')
->add('id', $caseID)
->add('version', $version)
@@ -845,7 +868,7 @@ class testcaseModel extends model
->setForce('status', $status)
->cleanInt('story,product,branch,module')
->stripTags($this->config->testcase->editor->edit['id'], $this->config->allowedTags)
->remove('comment,steps,expects,files,labels,linkBug,stepType')
->remove('comment,steps,expects,files,labels,linkBug,stepType,scriptFile,scriptName')
->get();
$requiredFields = $this->config->testcase->edit->requiredFields;
+1
View File
@@ -28,6 +28,7 @@
<th class='w-100px'><?php echo $lang->testcase->product;?></th>
<td class='required'><?php echo html::select('product', $products, '', "class='form-control picker-select' onchange='loadProduct(this.value)'");?></td>
<td></td>
<td></td>
</tr>
<?php endif;?>
<tr>
+124
View File
@@ -0,0 +1,124 @@
<?php
$this->loadModel('file');
$filesName = 'scriptFile';
$labelsName = 'scriptName';
$maxUploadSize = strtoupper(ini_get('upload_max_filesize'));
$dangerFiles = 'zip';
js::set('scriptDangerExtensions', ',' . $dangerFiles . ',');
js::set('maxUploadSize', $maxUploadSize);
?>
<div class="file-input-list" data-append-way="before" data-filedName="<?php echo $filesName;?>" data-provide="fileInputList" data-each-file-max-size="<?php echo $maxUploadSize; ?>" data-file-size-error="<?php echo sprintf($lang->file->errorFileSize, $maxUploadSize); ?>">
<div class="file-input">
<div class="file-input-edit input-group">
<div class="input-group-cell"><i class="icon icon-paper-clip text-muted"></i></div>
<input type="text" name="<?php echo $labelsName;?>[]" class="form-control file-editbox" placeholder="<?php echo $lang->file->title;?>">
<div class="input-group-btn">
<button type="button" class="btn btn-success file-name-confirm"><i class="icon icon-check"></i></button>
<button type="button" class="btn btn-gray file-name-cancel"><i class="icon icon-close"></i></button>
</div>
</div>
<div class="file-input-normal input-group">
<div class="input-group-cell"><i class="icon icon-paper-clip text-muted"></i></div>
<div class="input-group-cell">
<span class="file-title"></span>
<small class="file-size muted"></small>
</div>
<div class="input-group-btn">
<button type="button" class="fileAction btn btn-link file-input-rename" title="<?php echo $lang->file->edit;?>"><i class='icon icon-pencil-alt'></i></button>
<button type="button" class="fileAction btn btn-link file-input-delete" onclick="changeHidden()" title="<?php echo $lang->delete;?>"><i class='icon icon-trash'></i></button>
</div>
</div>
<input type="file" name="<?php echo $filesName;?>[]" onchange="checkDangerExtensions(this)" />
</div>
<button type="button" class="btn btn-link file-input-btn"><i class="icon icon-plus"></i> <?php echo $lang->file->addFile;?></button> <small class="muted"><?php echo sprintf($lang->file->maxUploadSize, $maxUploadSize);?></small>
<input type="file" id="file-input-multiple" />
<input type='hidden' name='script' id='scriptContent' value=''>
</div>
<script>
var totalSize = 0;
maxUploadSize = unitConversion(maxUploadSize);
/**
* Conversion unit to byte.
*
* @param string $maxUploadSize
* @access public
* @return int
*/
function unitConversion(maxUploadSize)
{
var sizeOfString = maxUploadSize;
if(sizeOfString.indexOf('K') != -1) maxUploadSize = parseFloat(maxUploadSize) * 1024;
if(sizeOfString.indexOf('M') != -1) maxUploadSize = parseFloat(maxUploadSize) * 1024 * 1024;
if(sizeOfString.indexOf('G') != -1) maxUploadSize = parseFloat(maxUploadSize) * 1024 * 1024 * 1024;
return parseFloat(maxUploadSize);
}
/**
* Check danger extension and file size.
*
* @param object $file
* @access public
* @return void
*/
function checkDangerExtensions(file)
{
var fileName = $(file).val();
var index = fileName.lastIndexOf(".");
var fileSize = $(file)[0].files[0].size;
totalSize += fileSize;
if(index >= 0)
{
extension = fileName.substr(index + 1);
if(scriptDangerExtensions.lastIndexOf(',' + extension + ',') >= 0)
{
alert(<?php echo json_encode($this->lang->file->dangerFile);?>);
$(file).val('');
return false;
}
if(fileSize == 0)
{
alert(<?php echo json_encode($this->lang->file->fileContentEmpty);?>);
$(file).val('');
return false;
}
if(totalSize >= maxUploadSize)
{
alert(<?php echo json_encode(sprintf($lang->file->errorFileSize, $maxUploadSize));?>);
totalSize -= fileSize;
$(file).val('');
return false;
}
}
$('.autoScript .file-input-btn').addClass('hidden');
$('.autoScript .muted').addClass('hide');
/* read file. */
var reader = new FileReader();
reader.readAsText($(file)[0].files[0], "UTF-8");
reader.onload = function(evt){
var fileString = evt.target.result;
$('#scriptContent').val(fileString);
}
}
function changeHidden(){
$('.autoScript .file-input-btn').removeClass('hidden');
$('.autoScript .muted').removeClass('hide');
}
</script>
<style>
#file-input-multiple {display: none;}
.file-input .file-editbox {max-width: 40%;}
.file-input-list .input-group-btn {float: left}
.fileAction {color: #0c64eb !important;}
.backgroundColor {background: #eff5ff;}
</style>
+1 -1
View File
@@ -194,7 +194,7 @@
<div class='btn-toolbar pull-right'>
<?php if(!empty($productID)): ?>
<div class='btn-group'>
<?php common::printLink('testcase', 'automation', "productID=$productID", "<i class='icon-wrench muted'> </i>" . $lang->testcase->automation, '', "class='btn btn-link iframe'", true, true)?>
<?php common::printLink('testcase', 'automation', "productID=$productID", "<i class='icon-wrench muted'> </i>" . $lang->testcase->automation, '', "class='btn btn-link iframe' data-width='50%'", true, true)?>
<icon class='icon icon-help' data-toggle='popover' data-trigger='focus hover' data-placement='bottom' data-tip-class='text-muted popover-sm' data-content="<?php echo $lang->zanode->automationTips;?>"></icon>
</div>
<div class='btn-group'>
+22 -1
View File
@@ -70,7 +70,12 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field)
<tr>
<th><?php echo $lang->testcase->type;?></th>
<?php unset($lang->testcase->typeList['unit']);?>
<td><?php echo html::select('type', $lang->testcase->typeList, $type, "class='form-control chosen'");?></td>
<td>
<?php echo html::select('type', $lang->testcase->typeList, $type, "class='form-control chosen'");?>
<div class="input-group-addon">
<?php echo html::checkbox('auto', array('auto' => $lang->testcase->showAutoCase), '', "id='autocase' title='{$lang->testcase->showAutoCase}'");?>
</div>
</td>
<?php if(strpos(",$showFields,", 'stage') !== false):?>
<?php $hiddenStage = strpos(",$showFields,", 'stage') !== false ? '' : 'hidden';?>
<td class="<?php echo $hiddenStage?> stageBox">
@@ -81,6 +86,10 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field)
</td>
<?php endif;?>
</tr>
<tr class='autoScript hide'>
<th><?php echo $lang->testcase->autoScript;?></th>
<td colspan='2'><?php include './buildscriptform.php';?></td>
</tr>
<?php $hiddenStory = strpos(",$showFields,", ',story,') !== false ? '' : 'hidden';?>
<tr class="<?php echo $hiddenStory?> storyBox">
<th><?php echo $lang->testcase->lblStory;?></th>
@@ -151,6 +160,7 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field)
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->testcase->precondition;?></th>
<td colspan='2'><?php echo html::textarea('precondition', $precondition, " rows='2' class='form-control'");?></td>
@@ -267,4 +277,15 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field)
</div>
</div>
<?php js::set('caseModule', $lang->testcase->module)?>
<script>
$(":checkbox[name^='auto']").on('click', function(){
if($(this).attr('checked'))
{
$('.autoScript').removeClass('hide')
}else
{
$('.autoScript').addClass('hide')
}
});
</script>
<?php include '../../common/view/footer.html.php';?>
+28 -1
View File
@@ -214,7 +214,16 @@
<tr>
<th><?php echo $lang->testcase->type;?></th>
<?php if($case->type != 'unit') unset($lang->testcase->typeList['unit']);?>
<td><?php echo html::select('type', (array)$lang->testcase->typeList, $case->type, "class='form-control chosen'");?></td>
<td>
<?php echo html::select('type', (array)$lang->testcase->typeList, $case->type, "class='form-control chosen'");?>
<div class="input-group-addon">
<?php echo html::checkbox('auto', array('auto' => $lang->testcase->showAutoCase), $case->auto, "id='autocase' title='{$lang->testcase->showAutoCase}'");?>
</div>
</td>
</tr>
<tr class='autoScript hide'>
<th><?php echo $lang->testcase->autoScript;?></th>
<td><?php include './buildscriptform.php';?></td>
</tr>
<tr>
<th><?php echo $lang->testcase->stage;?></th>
@@ -316,6 +325,24 @@ $(function()
{
$('#subNavbar [data-id=testcase]').addClass('active');
$('#navbar [data-id=testcase]').addClass('active');
checkScript();
})
function checkScript()
{
var autoScript = $(":checkbox[name^='auto']");
if(autoScript.attr('checked'))
{
$('.autoScript').removeClass('hide')
}else
{
$('.autoScript').addClass('hide')
}
}
$(":checkbox[name^='auto']").on('click', function(){
checkScript();
});
</script>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -24,7 +24,7 @@ js::import($jsRoot . 'misc/highlight/highlight.pack.js');
</div>
<div class="main-col repoCode main">
<div class="content panel">
<pre class="cpp"><?php echo trim(htmlSpecialString($case->script, defined('ENT_SUBSTITUTE') ? ENT_QUOTES | ENT_SUBSTITUTE : ENT_QUOTES));?></pre>
<pre class="cpp"><?php echo $case->script;?></pre>
</div>
</div>
</div>
+4 -1
View File
@@ -46,7 +46,7 @@
<td class='w-120px'> &nbsp; #<?php echo $result->id?></td>
<td class='w-180px'><?php echo $result->date;?></td>
<?php if($result->node > 0):?>
<td><?php echo sprintf($lang->testtask->runNode, zget($users, $result->lastRunner), $result->nodeName, !empty($result->ZTFResult) ? $lang->testtask->runCase : "<span class='span-warning'>{$lang->testtask->running}</span>") . "&nbsp;&nbsp;<span class=\"label label-badge\">{$lang->testtask->auto}</span>";?></td>
<td><?php echo sprintf($lang->testtask->runNode, zget($users, $result->lastRunner), $result->nodeName, $lang->testtask->runCase) . "&nbsp;&nbsp;<span class=\"label label-badge\">{$lang->testtask->auto}</span>";?></td>
<?php else:?>
<td><?php echo zget($users, $result->lastRunner) . ' ' . $lang->testtask->runCase;?></td>
<?php endif;?>
@@ -55,6 +55,9 @@
<?php if($result->node == 0 || !empty($result->ZTFResult)):?>
<strong class='result-testcase <?php echo $result->caseResult;?>'><?php echo $lang->testcase->resultList[$result->caseResult];?></strong>
<?php endif;?>
<?php if($result->node > 0 and empty($result->ZTFResult)):?>
<strong class='span-warning'><?php echo $lang->testtask->running;?></strong>
<?php endif;?>
</td>
<td class='w-60px'><?php if(!empty($result->files)) echo html::a("#caseResult{$result->id}", $lang->files . $fileCount, '', "data-toggle='modal' data-type='iframe'")?></td>
<td class='w-50px text-center'><i class='collapse-handle icon-angle-down text-muted'></i></td>
+1 -1
View File
@@ -12,7 +12,7 @@ $config->zahost->imageListUrl = 'https://pkg.qucheng.com/zenagent/list.json';
$config->zahost->cpuCoreList = [1 => 1, 2 => 2, 4 => 4, 6 => 6, 8 => 8, 10 => 10, 12 => 12, 16 => 16, 24 => 24, 32 => 32, 64 => 64];
$config->zahost->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -k%s -z%s';
$config->zahost->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -k %s -z %s';
global $lang;
$config->zahost->search['module'] = 'zahost';
+6 -6
View File
@@ -63,13 +63,16 @@ class zahost extends control
*/
public function view($id, $orderBy = 'id_desc')
{
$zahost = $this->zahost->getById($id);
$this->view->title = $this->lang->zahost->view;
$this->view->position[] = html::a($this->createLink('host', 'browse'), $this->lang->zahost->common);
$this->view->position[] = $this->lang->zahost->view;
$this->view->zahost = $this->zahost->getById($id);
$this->view->zahost = $zahost;
$this->view->orderBy = $orderBy;
$this->view->nodeList = $this->loadModel("zanode")->getListByHost($this->view->zahost->id, $orderBy);
$this->view->initBash = sprintf($this->config->zahost->initBash, $zahost->secret, getWebRoot(true));
$this->view->actions = $this->loadModel('action')->getList('zahost', $id);
$this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted');
$this->display();
@@ -95,14 +98,11 @@ class zahost extends control
return $this->send(array('result' => 'fail', 'message' => array("extranet" => array($this->lang->zahost->netError))));
}
$initLink = $this->createLink('zahost', 'init', "hostID=$hostID");
return print("<script>showModal('$initLink')</script>");
$viewLink = $this->createLink('zahost', 'view', "hostID=$hostID");
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $viewLink));
}
$this->view->title = $this->lang->zahost->create;
$this->view->notice = $this->lang->zahost->initNotice;
$this->view->buttonName = $this->lang->zahost->init->title;
$this->view->closeLink = $this->createLink('zahost', 'browse');
$this->display();
}
+6
View File
@@ -9,3 +9,9 @@
.status-wait {color: #f00;}
.c-actions {overflow: visible!important;}
.zanode-mt-8{margin-top: 8px;}
.zahost-init{padding:15px;background: #f4f5f7;margin:10px 0;}
.fail{color:red;}
.dot-symbol{padding-right:10px;}
#statusContainer{margin:0px 0px 10px 0px;}
#checkServiceStatus{background-color:unset;}
.service-check{margin-top: 0px;}
+62
View File
@@ -0,0 +1,62 @@
ajaxGetServiceStatus();
function ajaxGetServiceStatus()
{
$.get(createLink('zahost', 'ajaxGetServiceStatus', 'hostID=' + hostID), function(response)
{
var resultData = JSON.parse(response);
let html = "";
let isSuccess = true
var service = '';
for (let key in resultData.data) {
if(key == 'kvm') service = 'KVM';
if(key == 'nginx') service = 'Nginx';
if(key == 'novnc') service = 'noVNC';
if(key == 'websockify') service = 'Websockify';
if(resultData.data[key] == 'ready'){
html += "<div class='text-success'><span class='dot-symbol'>● </span><span>" + service + ' ' + zahostLang.init[resultData.data[key]] + "</span></div>"
}else{
isSuccess = false
html += "<div class='text-danger'><span class='dot-symbol'>● </span><span>" + service + ' ' + zahostLang.init[resultData.data[key]] + "</span></div>"
}
};
$('#statusContainer').html(html)
if(!isSuccess){
$('.result .init-fail').removeClass('hide')
$('.result .init-success').addClass('hide')
}
else
{
$('.result .init-fail').addClass('hide')
$('.result .init-success').removeClass('hide')
}
});
return
}
$('#checkServiceStatus').click(function(){
ajaxGetServiceStatus();
})
$('.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: 'bottom',
title: zahostLang.copied,
tipClass: 'tooltip-success'
});
$(this).tooltip('show');
var that = this;
setTimeout(function()
{
$(that).tooltip('hide')
}, 2000)
})
+5 -2
View File
@@ -47,14 +47,15 @@ $lang->zahost->uninitNotice = 'Please init the host first';
$lang->zahost->netError = 'Unable to connect to the host, please check the network and try again.';
$lang->zahost->init = new stdclass;
$lang->zahost->init->statusTitle = "Status";
$lang->zahost->init->checkStatus = "Check Service Status";
$lang->zahost->init->not_install = "Not installed";
$lang->zahost->init->not_available = "Installed, Not Started";
$lang->zahost->init->ready = "Ready";
$lang->zahost->init->next = "Next";
$lang->zahost->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:";
$lang->zahost->init->initFailNoticeDesc = "1. Re-execute the script <br/>2. Review the initialization FAQ";
$lang->zahost->init->initFailNotice = "Fail,Execute the installation service command on the host or <a href='https://github.com/easysoft/zenagent/' target='_blank'>See Help</a>.";
$lang->zahost->init->initSuccessNotice = "Succeed,%s and %s。";
$lang->zahost->init->serviceStatus = [
"kvm" => 'not_install',
@@ -111,6 +112,8 @@ $lang->zahost->softwareList['kvm'] = 'KVM';
$lang->zahost->unitList['GB'] = 'GB';
$lang->zahost->unitList['TB'] = 'TB';
$lang->zahost->cpuUnit = 'CORE';
$lang->zahost->zaHostType = 'Type';
$lang->zahost->zaHostTypeList['physical'] = 'Physical';
+5 -2
View File
@@ -47,14 +47,15 @@ $lang->zahost->uninitNotice = 'Please init the host first';
$lang->zahost->netError = 'Unable to connect to the host, please check the network and try again.';
$lang->zahost->init = new stdclass;
$lang->zahost->init->statusTitle = "Status";
$lang->zahost->init->checkStatus = "Check Service Status";
$lang->zahost->init->not_install = "Not installed";
$lang->zahost->init->not_available = "Installed, Not Started";
$lang->zahost->init->ready = "Ready";
$lang->zahost->init->next = "Next";
$lang->zahost->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:";
$lang->zahost->init->initFailNoticeDesc = "1. Re-execute the script <br/>2. Review the initialization FAQ";
$lang->zahost->init->initFailNotice = "Fail,Execute the installation service command on the host or <a href='https://github.com/easysoft/zenagent/' target='_blank'>See Help</a>.";
$lang->zahost->init->initSuccessNotice = "Succeed,%s and %s。";
$lang->zahost->init->serviceStatus = [
"kvm" => 'not_install',
@@ -111,6 +112,8 @@ $lang->zahost->softwareList['kvm'] = 'KVM';
$lang->zahost->unitList['GB'] = 'GB';
$lang->zahost->unitList['TB'] = 'TB';
$lang->zahost->cpuUnit = 'CORE';
$lang->zahost->zaHostType = 'Type';
$lang->zahost->zaHostTypeList['physical'] = 'Physical';
+5 -2
View File
@@ -48,13 +48,14 @@ $lang->zahost->netError = 'Unable to connect to the host, please chec
$lang->zahost->init = new stdclass;
$lang->zahost->init->checkStatus = "Check Service Status";
$lang->zahost->init->checkStatus = "Check Service Status";
$lang->zahost->init->not_install = "Not installed";
$lang->zahost->init->not_available = "Installed, Not Started";
$lang->zahost->init->ready = "Ready";
$lang->zahost->init->next = "Next";
$lang->zahost->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:";
$lang->zahost->init->initFailNoticeDesc = "1. Re-execute the script <br/>2. Review the initialization FAQ";
$lang->zahost->init->initFailNotice = "Fail,Execute the installation service command on the host or <a href='https://github.com/easysoft/zenagent/' target='_blank'>See Help</a>.";
$lang->zahost->init->initSuccessNotice = "Succeed,%s and %s。";
$lang->zahost->init->serviceStatus = [
"kvm" => 'not_install',
@@ -111,6 +112,8 @@ $lang->zahost->softwareList['kvm'] = 'KVM';
$lang->zahost->unitList['GB'] = 'GB';
$lang->zahost->unitList['TB'] = 'TB';
$lang->zahost->cpuUnit = 'CORE';
$lang->zahost->zaHostType = 'Type';
$lang->zahost->zaHostTypeList['physical'] = 'Physical';
+5 -2
View File
@@ -54,8 +54,9 @@ $lang->zahost->init->not_available = "已安装,未启动";
$lang->zahost->init->ready = "已就绪";
$lang->zahost->init->next = "下一步";
$lang->zahost->init->initFailNoticeTitle = "初始化失败,请查看初始化脚本执行日志并尝试以下两种解决方案:";
$lang->zahost->init->initFailNoticeDesc = "1. 重新执行脚本 <br/>2. 查看初始化常见问题";
$lang->zahost->init->initFailNotice = "服务未就绪,在宿主机上执行安装服务命令或<a href='https://github.com/easysoft/zenagent/' target='_blank'>查看帮助</a>.";
$lang->zahost->init->initSuccessNotice = "服务已就绪,您可以在%s后%s。";
$lang->zahost->init->serviceStatus = [
"kvm" => 'not_install',
"nginx" => 'not_install',
@@ -111,6 +112,8 @@ $lang->zahost->softwareList['kvm'] = 'KVM';
$lang->zahost->unitList['GB'] = 'GB';
$lang->zahost->unitList['TB'] = 'TB';
$lang->zahost->cpuUnit = '核';
$lang->zahost->zaHostType = '主机类型';
$lang->zahost->zaHostTypeList['physical'] = '实体主机';
+1 -2
View File
@@ -52,7 +52,7 @@
<th class='c-software'> <?php common::printOrderLink('vsoft', $orderBy, $vars, $lang->zahost->vsoft);?></th>
<th class='c-status'> <?php common::printOrderLink('t2.status', $orderBy, $vars, $lang->zahost->status);?></th>
<th class='c-datetime'> <?php common::printOrderLink('registerDate', $orderBy, $vars, $lang->zahost->registerDate);?></th>
<th class='c-actions-4 text-center'><?php echo $lang->actions;?></th>
<th class='c-actions-3 text-center'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
@@ -75,7 +75,6 @@
<?php $disabled = !empty($nodeList[$host->hostID]) ? 'disabled' : '';?>
<?php $title = !empty($nodeList[$host->hostID]) ? $lang->zahost->undeletedNotice : $lang->zahost->delete;?>
<?php common::printIcon('zahost', 'edit', "hostID={$host->hostID}", $host, 'list');?>
<?php common::printIcon('zahost', 'init', "hostID={$host->hostID}", $host, 'list', 'refresh', '', ' init', false, "data-placement='bottom'", $lang->zahost->init->title);?>
<?php echo html::a($this->createLink('zahost', 'delete', "hostID={$host->id}"), '<i class="icon-trash"></i>', 'hiddenwin', "title='$title' class='btn $disabled'");;?>
</td>
</tr>
-1
View File
@@ -79,5 +79,4 @@
</div>
</div>
</div>
<?php include $app->getModuleRoot() . 'common/view/successmodal.html.php';?>
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>
+56 -23
View File
@@ -12,6 +12,8 @@
?>
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
<?php include $app->getModuleRoot() . 'common/view/kindeditor.html.php'; ?>
<?php js::set('hostID', $zahost->id);?>
<?php js::set('zahostLang', $lang->zahost);?>
<?php $browseLink = $this->session->zahostList ? $this->session->zahostList : $this->createLink('zahost', 'browse', "");?>
<?php $vars = "id={$zahost->hostID}&orderBy=%s";?>
<div id='mainMenu' class='clearfix'>
@@ -34,42 +36,22 @@
<div class="detail-title"><?php echo $lang->zahost->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-4 text-right"><?php echo $lang->zahost->zaHostType;?>:</div>
<div class="col-7"><?php echo $lang->zahost->zaHostTypeList[$zahost->hostType];?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->extranet;?>:</div>
<div class="col-7"><?php echo $zahost->extranet;?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->memory;?>:</div>
<div class="col-7"><?php echo $zahost->memory;?></div>
</div>
</div>
</div>
<div class="main-row zanode-mt-8">
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->vsoft;?>:</div>
<div class="col-7"><?php echo zget($lang->zahost->softwareList, $zahost->vsoft);?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->cpuCores;?>:</div>
<div class="col-7"><?php echo $zahost->cpuCores;?></div>
<div class="col-7"><?php echo $zahost->cpuCores . $lang->zahost->cpuUnit;?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->diskSize;?>:</div>
<div class="col-7"><?php echo $zahost->diskSize;?></div>
<div class="col-4 text-right"><?php echo $lang->zahost->zaHostType;?>:</div>
<div class="col-7"><?php echo $lang->zahost->zaHostTypeList[$zahost->hostType];?></div>
</div>
</div>
</div>
@@ -80,12 +62,32 @@
<div class="col-7"><?php echo zget($lang->zahost->statusList, $zahost->status);?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->memory;?>:</div>
<div class="col-7"><?php echo $zahost->memory . $lang->zahost->unitList['GB'];;?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->vsoft;?>:</div>
<div class="col-7"><?php echo zget($lang->zahost->softwareList, $zahost->vsoft);?></div>
</div>
</div>
</div>
<div class="main-row zanode-mt-8">
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->registerDate;?>:</div>
<div class="col-7"><?php echo helper::isZeroDate($zahost->heartbeat) ? '' : $zahost->heartbeat;?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->diskSize;?>:</div>
<div class="col-7"><?php echo $zahost->diskSize . $lang->zahost->unitList['GB'];?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
</div>
@@ -93,6 +95,37 @@
</div>
</div>
</div>
</div>
<div class="cell">
<div class="detail zahost-detail">
<div class="detail-title">
<?php echo $lang->zahost->init->statusTitle;?>
<button type='button' id='checkServiceStatus' class='btn btn-info'><i class="icon icon-refresh"></i> <span><?php echo $lang->zahost->init->checkStatus;?></span></button>
</div>
<div class="detail-content article-content">
<div class="main-row">
<div id="statusContainer">
<div class="text-kvm"><span class="dot-symbol fail"> ●</span><span>KVM</span></div>
<div class="text-kvm"><span class="dot-symbol fail"> ●</span><span>Nginx</span></div>
<div class="text-kvm"><span class="dot-symbol fail"> ●</span><span>noVNC</span></div>
<div class="text-kvm"><span class="dot-symbol fail"> ●</span><span>Websockify</span></div>
</div>
<div class='result'>
<?php $imageLink = html::a($this->createLink('zahost', 'browseImage', "hostID=$zahost->id", '', true), $lang->zahost->image->downloadImage, '', "class='iframe'");?>
<?php $createNode = html::a($this->createLink('zanode', 'create'), $lang->zahost->createZanode);?>
<div class='hide init-success'><?php echo sprintf($lang->zahost->init->initSuccessNotice, $imageLink, $createNode);?></div>
<div class='hide init-fail'>
<?php echo $lang->zahost->init->initFailNotice;?>
<div class="zahost-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->zahost->copy . "'></i></button>"; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell">
<div class="detail zahost-detail">
<div class="detail-title"><?php echo $lang->zahost->desc;?></div>
<div class="detail-content article-content"><?php echo !empty($zahost->desc) ? htmlspecialchars_decode($zahost->desc) : $lang->noData;?></div>
+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';
+38 -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();
}
@@ -150,6 +158,30 @@ class zanode extends control
$this->display();
}
/**
* start Node.
*
* @param int $nodeID
* @access public
* @return void
*/
public function start($nodeID)
{
$this->handleNode($nodeID, 'boot');
}
/**
* shutdown Node.
*
* @param int $nodeID
* @access public
* @return void
*/
public function close($nodeID)
{
$this->handleNode($nodeID, 'destroy');
}
/**
* Suspend Node.
*
+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',
+1
View File
@@ -171,6 +171,7 @@ class zanodemodel extends model
$result = commonModel::http($agnetUrl . $path, $param, array(), array("Authorization:$node->tokenSN"));
$data = json_decode($result, true);
if(empty($data)) return $this->lang->zanode->notFoundAgent;
if($data['code'] != 'success') return zget($this->lang->zanode->apiError, $data['code'], $data['msg']);
+10 -1
View File
@@ -57,7 +57,7 @@
<th class='c-os'><?php common::printOrderLink('t1.osName', $orderBy, $vars, $lang->zanode->osName); ?></th>
<th class='c-status'><?php common::printOrderLink('t1.status', $orderBy, $vars, $lang->zanode->status); ?></th>
<th class='c-host'><?php common::printOrderLink('t2.name', $orderBy, $vars, $lang->zanode->hostName); ?>
<th class='c-actions-5 text-center'><?php echo $lang->actions ?></th>
<th class='c-actions-6 text-center'><?php echo $lang->actions ?></th>
</tr>
</thead>
<tbody>
@@ -93,6 +93,15 @@
common::printLink('zanode', 'suspend', "zanodeID={$node->id}", "<i class='icon icon-pause'></i> ", '', $suspendAttr);
}
if($node->status == "shutoff")
{
common::printLink('zanode', 'start', "zanodeID={$node->id}", "<i class='icon icon-magic'></i> ", '', "class='btn ' title='{$lang->zanode->boot}'");
}
else
{
common::printLink('zanode', 'close', "zanodeID={$node->id}", "<i class='icon icon-off'></i> ", '', "class='btn ' title='{$lang->zanode->shutdown}'");
}
common::printLink('zanode', 'reboot', "zanodeID={$node->id}", "<i class='icon icon-restart'></i> ", '', $rebootAttr);
common::printIcon('zanode', 'edit', "id={$node->id}", $node, 'list');
+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'; ?>