Merge branch 'zenops_62' into 'master'
Zenops 62 See merge request easycorp/zentaopms!7087
This commit is contained in:
@@ -84,6 +84,19 @@ class hostHeartbeatEntry extends baseEntry
|
||||
if($heartbeat > 0) $vmData['heartbeat'] = date("Y-m-d H:i:s", $heartbeat);
|
||||
|
||||
$this->dao->update(TABLE_ZAHOST)->data($vmData)->where('mac')->eq($vm->macAddress)->exec();
|
||||
|
||||
if($vm->status == 'running')
|
||||
{
|
||||
$node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress);
|
||||
if(!empty($node))
|
||||
{
|
||||
$snaps = $this->loadModel('zanode')->getSnapshotList($node->id);
|
||||
if(empty($snaps))
|
||||
{
|
||||
if($vm->status == 'running') $this->loadModel('zanode')->createDefaultSnapshot($node->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,13 +40,21 @@ class hostSubmitEntry extends baseEntry
|
||||
|
||||
if(!$id) return $this->sendError(400, 'Secret error.');
|
||||
|
||||
$imageInfo = $this->dao->select('`status`,`from`')->from(TABLE_IMAGE)
|
||||
$imageInfo = $this->dao->select('`status`,`from`', 'name')->from(TABLE_IMAGE)
|
||||
->where('id')->eq($task)
|
||||
->fetch();
|
||||
if(empty($imageInfo)) return $this->sendSuccess(200, 'success');
|
||||
if($imageInfo->from == 'snapshot' && $imageInfo->status == 'restoring')
|
||||
{
|
||||
$image->status = $image->status == 'completed' ? 'restore_completed' : 'restore_failed';
|
||||
if(in_array($image->status, array('failed', 'completed'))) $image->status = $image->status == 'completed' ? 'restore_completed' : 'restore_failed';
|
||||
}
|
||||
else if($imageInfo->from == 'snapshot' && $imageInfo->status == 'creating')
|
||||
{
|
||||
if($image->status == 'failed')
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_IMAGE)->where("id")->eq($task)->exec();
|
||||
return $this->sendSuccess(200, 'success');
|
||||
}
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_IMAGE)->data($image)->where("id")->eq($task)->exec();
|
||||
|
||||
@@ -406,6 +406,7 @@ $config->objectTables['apistruct'] = TABLE_APISTRUCT;
|
||||
$config->objectTables['repo'] = TABLE_REPO;
|
||||
$config->objectTables['dataview'] = TABLE_DATAVIEW;
|
||||
$config->objectTables['zahost'] = TABLE_ZAHOST;
|
||||
$config->objectTables['zanode'] = TABLE_ZAHOST;
|
||||
$config->objectTables['automation'] = TABLE_AUTOMATION;
|
||||
$config->objectTables['stepResult'] = TABLE_TESTRUN;
|
||||
|
||||
|
||||
@@ -938,6 +938,8 @@ class actionModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
if($actionType == 'restoredsnapshot' && in_array($action->objectType, array('vm', 'zanode')) && $value == 'defaultSnap') $value = $this->lang->$objectType->snapshot->defaultSnapName;
|
||||
|
||||
$desc = str_replace('$' . $key, $value, $desc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,3 +21,4 @@
|
||||
.icon-refresh {font-size: 15px;}
|
||||
.load-indicator:after {top: 33%;}
|
||||
.btn.disabled i {color: #fff;}
|
||||
#statusContainer{min-height: 120px;}
|
||||
|
||||
@@ -35,6 +35,7 @@ function ajaxGetServiceStatus()
|
||||
|
||||
setTimeout(function() {
|
||||
$('#serviceContent').removeClass('loading');
|
||||
$(".service-status, .status-notice").show()
|
||||
}, 500);
|
||||
});
|
||||
return
|
||||
|
||||
@@ -92,7 +92,7 @@ $lang->zahost->image->statusList['created'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
|
||||
$lang->zahost->image->statusList['completed'] = 'Completed';
|
||||
$lang->zahost->image->statusList['completed'] = 'Usable';
|
||||
$lang->zahost->image->statusList['failed'] = 'Failed';
|
||||
|
||||
$lang->zahost->image->imageEmpty = 'No Image';
|
||||
|
||||
@@ -92,7 +92,7 @@ $lang->zahost->image->statusList['created'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
|
||||
$lang->zahost->image->statusList['completed'] = 'Completed';
|
||||
$lang->zahost->image->statusList['completed'] = 'Usable';
|
||||
$lang->zahost->image->statusList['failed'] = 'Failed';
|
||||
|
||||
$lang->zahost->image->imageEmpty = 'No Image';
|
||||
|
||||
@@ -92,7 +92,7 @@ $lang->zahost->image->statusList['created'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
|
||||
$lang->zahost->image->statusList['completed'] = 'Completed';
|
||||
$lang->zahost->image->statusList['completed'] = 'Usable';
|
||||
$lang->zahost->image->statusList['failed'] = 'Failed';
|
||||
|
||||
$lang->zahost->image->imageEmpty = 'No Image';
|
||||
|
||||
@@ -91,7 +91,7 @@ $lang->zahost->image->statusList['created'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
|
||||
$lang->zahost->image->statusList['completed'] = 'Completed';
|
||||
$lang->zahost->image->statusList['completed'] = 'Usable';
|
||||
$lang->zahost->image->statusList['failed'] = 'Failed';
|
||||
|
||||
$lang->zahost->image->imageEmpty = 'No Image';
|
||||
|
||||
@@ -590,6 +590,7 @@ class zahostModel extends model
|
||||
*/
|
||||
public function getServiceStatus($host)
|
||||
{
|
||||
if(in_array($host->status, array('wait', 'offline'))) return $this->lang->zahost->init->serviceStatus;
|
||||
$result = json_decode(commonModel::http("http://{$host->extranet}:{$host->zap}/api/v1/service/check", json_encode(array("services" => "all")), array(), array("Authorization:$host->tokenSN")));
|
||||
if(empty($result) || $result->code != 'success')
|
||||
{
|
||||
|
||||
@@ -105,10 +105,7 @@
|
||||
<div class="detail-content article-content load-indicator" id='serviceContent'>
|
||||
<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'");?>
|
||||
|
||||
@@ -243,9 +243,7 @@ class zanode extends control
|
||||
|
||||
if($error)
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = $error;
|
||||
return $this->send($response);
|
||||
return print(js::alert($error) . js::reload('parent'));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -558,7 +556,7 @@ class zanode extends control
|
||||
{
|
||||
$node = $this->zanode->getNodeById($hostID);
|
||||
$serviceStatus = $this->zanode->getServiceStatus($node);
|
||||
if ($node->status != 'running' && $node->status != 'wait')
|
||||
if ($node->status != 'running')
|
||||
{
|
||||
$serviceStatus['ZenAgent'] = "unknown";
|
||||
$serviceStatus['ZTF'] = "unknown";
|
||||
|
||||
@@ -17,3 +17,4 @@
|
||||
.node-not-wrap{white-space: nowrap;}
|
||||
.btn-info {background-color: unset;}
|
||||
.btn.disabled i {color: #fff;}
|
||||
#serviceContent{min-height: 120px;}
|
||||
|
||||
@@ -99,6 +99,7 @@ function checkServiceStatus(){
|
||||
}
|
||||
setTimeout(function() {
|
||||
$('#serviceContent').removeClass('loading');
|
||||
$(".service-status, .status-notice").show()
|
||||
}, 500);
|
||||
});
|
||||
return
|
||||
@@ -186,7 +187,7 @@ $('#jumpManual').click(function()
|
||||
|
||||
|
||||
$(function(){
|
||||
checkServiceStatus();
|
||||
$('#checkServiceStatus').trigger("click")
|
||||
checkInterval = setInterval(() => {
|
||||
intervalTimes++;
|
||||
if(intervalTimes > 300)
|
||||
|
||||
@@ -86,18 +86,22 @@ $lang->zanode->snapshotName = 'Snapshot Name';
|
||||
$lang->zanode->browseSnapshot = 'Snapshot List';
|
||||
$lang->zanode->createSnapshot = 'Create Snapshot';
|
||||
$lang->zanode->editSnapshot = 'Edit Snapshot';
|
||||
$lang->zanode->restoreSnapshot = 'Revert Snapshot';
|
||||
$lang->zanode->restoreSnapshot = 'Revert From This Snapshot';
|
||||
$lang->zanode->deleteSnapshot = 'Delete Snapshot';
|
||||
$lang->zanode->snapshotEmpty = 'No snapshots';
|
||||
$lang->zanode->confirmDeleteSnapshot = "The snapshot cannot be restored from the recycle bin after being deleted. Are you sure to continue?";
|
||||
|
||||
$lang->zanode->snapshot = new stdClass();
|
||||
$lang->zanode->snapshot->statusList['creating'] = 'Creating';
|
||||
$lang->zanode->snapshot->statusList['completed'] = 'Create Completed';
|
||||
$lang->zanode->snapshot->statusList['inprogress'] = 'Creating';
|
||||
$lang->zanode->snapshot->statusList['completed'] = 'Usable';
|
||||
$lang->zanode->snapshot->statusList['failed'] = 'Create Failed';
|
||||
$lang->zanode->snapshot->statusList['restoring'] = 'Restoring';
|
||||
$lang->zanode->snapshot->statusList['restore_failed'] = 'Restore Failed';
|
||||
$lang->zanode->snapshot->statusList['restore_completed'] = 'Restore Completed';
|
||||
$lang->zanode->snapshot->statusList['restore_completed'] = 'Usable';
|
||||
|
||||
$lang->zanode->snapshot->defaultSnapName = 'DefaultSnapshot';
|
||||
$lang->zanode->snapshot->defaultSnapUser = 'System';
|
||||
|
||||
$lang->zanode->imageNameEmpty = 'Name can not be empty.';
|
||||
$lang->zanode->snapStatusError = 'Snapshot is not ready.';
|
||||
|
||||
@@ -86,18 +86,22 @@ $lang->zanode->snapshotName = 'Snapshot Name';
|
||||
$lang->zanode->browseSnapshot = 'Snapshot List';
|
||||
$lang->zanode->createSnapshot = 'Create Snapshot';
|
||||
$lang->zanode->editSnapshot = 'Edit Snapshot';
|
||||
$lang->zanode->restoreSnapshot = 'Revert Snapshot';
|
||||
$lang->zanode->restoreSnapshot = 'Revert From This Snapshot';
|
||||
$lang->zanode->deleteSnapshot = 'Delete Snapshot';
|
||||
$lang->zanode->snapshotEmpty = 'No snapshots';
|
||||
$lang->zanode->confirmDeleteSnapshot = "The snapshot cannot be restored from the recycle bin after being deleted. Are you sure to continue?";
|
||||
|
||||
$lang->zanode->snapshot = new stdClass();
|
||||
$lang->zanode->snapshot->statusList['creating'] = 'Creating';
|
||||
$lang->zanode->snapshot->statusList['completed'] = 'Create Completed';
|
||||
$lang->zanode->snapshot->statusList['inprogress'] = 'Creating';
|
||||
$lang->zanode->snapshot->statusList['completed'] = 'Usable';
|
||||
$lang->zanode->snapshot->statusList['failed'] = 'Create Failed';
|
||||
$lang->zanode->snapshot->statusList['restoring'] = 'Restoring';
|
||||
$lang->zanode->snapshot->statusList['restore_failed'] = 'Restore Failed';
|
||||
$lang->zanode->snapshot->statusList['restore_completed'] = 'Restore Completed';
|
||||
$lang->zanode->snapshot->statusList['restore_completed'] = 'Usable';
|
||||
|
||||
$lang->zanode->snapshot->defaultSnapName = 'DefaultSnapshot';
|
||||
$lang->zanode->snapshot->defaultSnapUser = 'System';
|
||||
|
||||
$lang->zanode->imageNameEmpty = 'Name can not be empty.';
|
||||
$lang->zanode->snapStatusError = 'Snapshot is not ready.';
|
||||
|
||||
@@ -86,18 +86,22 @@ $lang->zanode->snapshotName = 'Snapshot Name';
|
||||
$lang->zanode->browseSnapshot = 'Snapshot List';
|
||||
$lang->zanode->createSnapshot = 'Create Snapshot';
|
||||
$lang->zanode->editSnapshot = 'Edit Snapshot';
|
||||
$lang->zanode->restoreSnapshot = 'Revert Snapshot';
|
||||
$lang->zanode->restoreSnapshot = 'Revert From This Snapshot';
|
||||
$lang->zanode->deleteSnapshot = 'Delete Snapshot';
|
||||
$lang->zanode->snapshotEmpty = 'No snapshots';
|
||||
$lang->zanode->confirmDeleteSnapshot = "The snapshot cannot be restored from the recycle bin after being deleted. Are you sure to continue?";
|
||||
|
||||
$lang->zanode->snapshot = new stdClass();
|
||||
$lang->zanode->snapshot->statusList['creating'] = 'Creating';
|
||||
$lang->zanode->snapshot->statusList['completed'] = 'Create Completed';
|
||||
$lang->zanode->snapshot->statusList['inprogress'] = 'Creating';
|
||||
$lang->zanode->snapshot->statusList['completed'] = 'Usable';
|
||||
$lang->zanode->snapshot->statusList['failed'] = 'Create Failed';
|
||||
$lang->zanode->snapshot->statusList['restoring'] = 'Restoring';
|
||||
$lang->zanode->snapshot->statusList['restore_failed'] = 'Restore Failed';
|
||||
$lang->zanode->snapshot->statusList['restore_completed'] = 'Restore Completed';
|
||||
$lang->zanode->snapshot->statusList['restore_completed'] = 'Usable';
|
||||
|
||||
$lang->zanode->snapshot->defaultSnapName = 'DefaultSnapshot';
|
||||
$lang->zanode->snapshot->defaultSnapUser = 'System';
|
||||
|
||||
$lang->zanode->imageNameEmpty = 'Name can not be empty.';
|
||||
$lang->zanode->snapStatusError = 'Snapshot is not ready.';
|
||||
|
||||
@@ -86,18 +86,22 @@ $lang->zanode->snapshotName = '快照名称';
|
||||
$lang->zanode->browseSnapshot = '快照列表';
|
||||
$lang->zanode->createSnapshot = '创建快照';
|
||||
$lang->zanode->editSnapshot = '编辑快照';
|
||||
$lang->zanode->restoreSnapshot = '还原快照';
|
||||
$lang->zanode->restoreSnapshot = '还原到此快照';
|
||||
$lang->zanode->deleteSnapshot = '删除快照';
|
||||
$lang->zanode->snapshotEmpty = '无快照';
|
||||
$lang->zanode->confirmDeleteSnapshot = "快照被删除后无法从回收站中还原,您确定继续么?";
|
||||
|
||||
$lang->zanode->snapshot = new stdClass();
|
||||
$lang->zanode->snapshot->statusList['creating'] = '创建中';
|
||||
$lang->zanode->snapshot->statusList['completed'] = '创建完成';
|
||||
$lang->zanode->snapshot->statusList['inprogress'] = '创建中';
|
||||
$lang->zanode->snapshot->statusList['completed'] = '可使用';
|
||||
$lang->zanode->snapshot->statusList['failed'] = '创建失败';
|
||||
$lang->zanode->snapshot->statusList['restoring'] = '还原中';
|
||||
$lang->zanode->snapshot->statusList['restore_failed'] = '还原失败';
|
||||
$lang->zanode->snapshot->statusList['restore_completed'] = '还原成功';
|
||||
$lang->zanode->snapshot->statusList['restore_completed'] = '可使用';
|
||||
|
||||
$lang->zanode->snapshot->defaultSnapName = '初始快照';
|
||||
$lang->zanode->snapshot->defaultSnapUser = '系统';
|
||||
|
||||
$lang->zanode->imageNameEmpty = '名称不能为空';
|
||||
$lang->zanode->snapStatusError = '快照不可用';
|
||||
|
||||
+48
-1
@@ -231,6 +231,53 @@ class zanodemodel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
public function createDefaultSnapshot($zanodeID = 0)
|
||||
{
|
||||
$node = $this->getNodeByID($zanodeID);
|
||||
if($node->status != 'running') dao::$errors['name'] = $this->lang->zanode->apiError['notRunning'];
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$newSnapshot = new stdClass();
|
||||
$newSnapshot->host = $node->id;
|
||||
$newSnapshot->name = "defaultSnap";
|
||||
$newSnapshot->desc = "";
|
||||
$newSnapshot->status = 'creating';
|
||||
$newSnapshot->osName = $node->osName;
|
||||
$newSnapshot->from = 'snapshot';
|
||||
$newSnapshot->createdBy = 'system';
|
||||
$newSnapshot->createdDate = helper::now();
|
||||
|
||||
$this->dao->insert(TABLE_IMAGE)
|
||||
->data($newSnapshot)
|
||||
->autoCheck()
|
||||
->exec();
|
||||
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$newID = $this->dao->lastInsertID();
|
||||
|
||||
/* Prepare create params. */
|
||||
$agnetUrl = 'http://' . $node->ip . ':' . $node->hzap;
|
||||
$param = array(array(
|
||||
'name' => $newSnapshot->name,
|
||||
'task' => $newID,
|
||||
'type' => 'createSnap',
|
||||
'vm' => $node->name
|
||||
));
|
||||
|
||||
$result = json_decode(commonModel::http($agnetUrl . static::SNAPSHOT_CREATE_PATH, json_encode($param,JSON_NUMERIC_CHECK), null, array("Authorization:$node->tokenSN")));
|
||||
|
||||
|
||||
if(!empty($result) and $result->code == 'success')
|
||||
{
|
||||
return $newID;
|
||||
}
|
||||
|
||||
$this->dao->delete()->from(TABLE_IMAGE)->where('id')->eq($newID)->exec();
|
||||
dao::$errors[] = (!empty($result) and !empty($result->msg)) ? $result->msg : $this->app->lang->fail;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Snapshot.
|
||||
*
|
||||
@@ -512,6 +559,7 @@ class zanodemodel extends model
|
||||
->leftJoin(TABLE_IMAGE)->alias('t3')->on('t3.id = t1.image')
|
||||
->where('t1.deleted')->eq(0)
|
||||
->andWhere("t1.type")->eq("node")
|
||||
->andWhere("t2.type")->eq("zahost")
|
||||
->beginIF($query)->andWhere($query)->fi()
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
@@ -756,7 +804,6 @@ class zanodemodel extends model
|
||||
{
|
||||
$node = $this->dao->select('*')->from(TABLE_ZAHOST)
|
||||
->where('mac')->eq($mac)
|
||||
->andWhere("type")->eq('node')
|
||||
->fetch();
|
||||
|
||||
$host = $this->loadModel("zahost")->getByID($node->parent);
|
||||
|
||||
@@ -78,17 +78,25 @@
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
$suspendAttr = "title='{$lang->zanode->suspend}' target='hiddenwin'";
|
||||
$suspendAttr .= $node->status != 'running' && $node->status != 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
|
||||
$suspendAttr .= $node->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
|
||||
|
||||
$resumeAttr = "title='{$lang->zanode->resume}' target='hiddenwin'";
|
||||
$resumeAttr .= $node->status == 'running' || $node->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'";
|
||||
|
||||
$rebootAttr = "title='{$lang->zanode->reboot}' target='hiddenwin'";
|
||||
$rebootAttr .= $node->status == 'shutoff' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'";
|
||||
$rebootAttr .= $node->status == 'shutoff' || $node->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'";
|
||||
|
||||
$closeAttr = "title='{$lang->zanode->shutdown}'";
|
||||
$closeAttr .= $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"';
|
||||
|
||||
$startAttr = "title='{$lang->zanode->boot}'";
|
||||
$startAttr .= $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"';
|
||||
|
||||
$snapshotAttr = "title='{$lang->zanode->createSnapshot}'";
|
||||
$snapshotAttr .= $node->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"';
|
||||
|
||||
$imageAttr = $node->status != 'running' ? ' class="btn btn-action iframe createImage disabled"' : ' class="btn btn-action iframe createImage"';
|
||||
|
||||
common::printLink('zanode', 'getVNC', "id={$node->id}", "<i class='icon icon-remote'></i> ", (in_array($node->status ,array('running', 'launch', 'wait')) ? '_blank' : ''), "title='{$lang->zanode->getVNC}' class='btn desktop " . (in_array($node->status ,array('running', 'launch', 'wait')) ? '':'disabled') . "'", '');
|
||||
if($node->status == "suspend")
|
||||
{
|
||||
@@ -101,11 +109,11 @@
|
||||
|
||||
if($node->status == "shutoff")
|
||||
{
|
||||
common::printLink('zanode', 'start', "zanodeID={$node->id}", "<i class='icon icon-play'></i> ", '', "class='btn ' title='{$lang->zanode->boot}'");
|
||||
common::printLink('zanode', 'start', "zanodeID={$node->id}", "<i class='icon icon-play'></i> ", '', $startAttr);
|
||||
}
|
||||
else
|
||||
{
|
||||
common::printLink('zanode', 'close', "zanodeID={$node->id}", "<i class='icon icon-off'></i> ", '', "class='btn ' title='{$lang->zanode->shutdown}'");
|
||||
common::printLink('zanode', 'close', "zanodeID={$node->id}", "<i class='icon icon-off'></i> ", '', $closeAttr);
|
||||
}
|
||||
|
||||
common::printLink('zanode', 'reboot', "zanodeID={$node->id}", "<i class='icon icon-restart'></i> ", '', $rebootAttr);
|
||||
@@ -117,7 +125,7 @@
|
||||
echo "<button type='button' class='btn dropdown-toggle' data-toggle='context-dropdown' title='{$this->lang->more}'><i class='icon-ellipsis-v'></i></button>";
|
||||
echo "<ul class='dropdown-menu pull-right text-center' role='menu'>";
|
||||
common::printIcon('zanode', 'edit', "id={$node->id}", $node, 'list', '', '', 'btn-action');
|
||||
common::printLink('zanode', 'createImage', "zanodeID={$node->id}", "<i class='icon icon-export'></i> ", '', "class='btn btn-action iframe createImage' title='{$lang->zanode->createImage}' data-width='55%'", '', true);
|
||||
common::printLink('zanode', 'createImage', "zanodeID={$node->id}", "<i class='icon icon-export'></i> ", '', $imageAttr . " title='{$lang->zanode->createImage}' data-width='55%'", '', true);
|
||||
common::printLink('zanode', 'destroy', "zanodeID={$node->id}", "<i class='icon icon-trash'></i> ", '', "title='{$lang->zanode->destroy}' class='btn btn-action' target='hiddenwin'");
|
||||
echo "</ul>";
|
||||
echo "</div>";
|
||||
|
||||
@@ -44,10 +44,20 @@
|
||||
|
||||
$deleteAttr = "title='{$lang->zanode->deleteSnapshot}' target='hiddenwin'";
|
||||
$deleteAttr .= ($snapshot->status == 'restoring' or $snapshot->status == 'creating') ? ' class="btn disabled"' : 'class="btn"';
|
||||
|
||||
$isDefalut = $snapshot->name == 'defaultSnap' && $snapshot->createdBy == 'system';
|
||||
if($isDefalut) $editAttr = $deleteAttr = 'class="btn disabled"';
|
||||
$name = $snapshot->localName ? $snapshot->localName : $snapshot->name;
|
||||
$title = $snapshot->name;
|
||||
if($snapshot->name == 'defaultSnap' && $snapshot->createdBy == 'system')
|
||||
{
|
||||
$name = $lang->zanode->snapshot->defaultSnapName;
|
||||
$title = $name;
|
||||
}
|
||||
?>
|
||||
<td title="<?php echo $snapshot->name;?>"><?php echo $snapshot->localName ? $snapshot->localName : $snapshot->name;?></td>
|
||||
<td title="<?php echo $title;?>"><?php echo $name;?></td>
|
||||
<td class='<?php echo $snapshot->status;?>'><?php echo zget($lang->zanode->snapshot->statusList, $snapshot->status, '');?></td>
|
||||
<td class="c-createdBy"><?php echo zget($users, $snapshot->createdBy, '')?></td>
|
||||
<td class="c-createdBy"><?php echo $snapshot->name == 'defaultSnap' && $snapshot->createdBy == 'system' ? $lang->zanode->snapshot->defaultSnapUser : zget($users, $snapshot->createdBy, '')?></td>
|
||||
<td class='c-datetime'><?php echo $snapshot->createdDate;?></td>
|
||||
<td class='c-actions'>
|
||||
<?php if(common::hasPriv('zanode', 'editSnapshot')) echo html::a('###', '<i class="icon-edit"></i>', 'hiddenwin', $editAttr);?>
|
||||
@@ -63,4 +73,3 @@
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>
|
||||
|
||||
@@ -129,20 +129,20 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
|
||||
<button type='button' id='checkServiceStatus' class='btn btn-info'><i class="icon icon-refresh"></i> <span class='checkStatus'><?php echo $lang->zanode->init->checkStatus;?></span></button>
|
||||
</div>
|
||||
<div class="detail-content statusContainer load-indicator" id='serviceContent'>
|
||||
<div class="service-status">
|
||||
<div class="service-status hide">
|
||||
<span class='dot-symbol dot-zenagent text-danger'>●</span>
|
||||
<span> ZenAgent
|
||||
<span class="zenagent-status"><?php echo $lang->zanode->initializing; ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="service-status">
|
||||
<div class="service-status hide">
|
||||
<span class='dot-symbol dot-ztf text-danger'>●</span>
|
||||
<span> ZTF
|
||||
<span class="ztf-status"><?php echo $lang->zanode->initializing; ?></span>
|
||||
<a class='node-init-install hide' target='hiddenwin' href='javascript:;' data-href='<?php echo $this->createLink('zanode', 'ajaxInstallService', 'nodeID=' . $zanode->id . '&service=ztf');?>'><i class="icon icon-download icon-sm ztf-install-icon"></i><span class="ztf-install"><?php echo $lang->zanode->install ?></span></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="status-notice">
|
||||
<div class="status-notice hide">
|
||||
<span class='init-success hide'><?php echo sprintf($lang->zanode->init->initSuccessNoticeTitle, "<a id='jumpManual' href='javascript:;'>{$lang->zanode->manual}</a>", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?></span>
|
||||
<span class='init-fail hide'><?php echo $lang->zanode->init->initFailNoticeTitle . '<br/>' . $lang->zanode->init->initFailNoticeDesc;?></span>
|
||||
</div>
|
||||
@@ -177,13 +177,19 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
|
||||
<?php
|
||||
if (empty($zanode->deleted)) {
|
||||
$suspendAttr = "title='{$lang->zanode->suspend}' target='hiddenwin'";
|
||||
$suspendAttr .= $zanode->status != 'running' && $zanode->status != 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
|
||||
$suspendAttr .= $zanode->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
|
||||
|
||||
$resumeAttr = "title='{$lang->zanode->resume}' target='hiddenwin'";
|
||||
$resumeAttr .= $zanode->status == 'running' || $zanode->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'";
|
||||
$resumeAttr .= $zanode->status == 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'";
|
||||
|
||||
$rebootAttr = "title='{$lang->zanode->reboot}' target='hiddenwin'";
|
||||
$rebootAttr .= $zanode->status == 'shutoff' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'";
|
||||
$rebootAttr .= $zanode->status == 'shutoff' || $zanode->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'";
|
||||
|
||||
$closeAttr = "title='{$lang->zanode->shutdown}'";
|
||||
$closeAttr .= $zanode->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"';
|
||||
|
||||
$startAttr = "title='{$lang->zanode->boot}'";
|
||||
$startAttr .= $zanode->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"';
|
||||
|
||||
$snapshotAttr = "title='{$lang->zanode->createSnapshot}'";
|
||||
$snapshotAttr .= $zanode->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"';
|
||||
@@ -200,11 +206,11 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
|
||||
|
||||
if($zanode->status == "shutoff")
|
||||
{
|
||||
common::printLink('zanode', 'start', "zanodeID={$zanode->id}", "<i class='icon icon-play'></i> " . $lang->zanode->bootNode, '', "title='{$lang->zanode->boot}' class='btn '");
|
||||
common::printLink('zanode', 'start', "zanodeID={$zanode->id}", "<i class='icon icon-play'></i> " . $lang->zanode->bootNode, '', $startAttr);
|
||||
}
|
||||
else
|
||||
{
|
||||
common::printLink('zanode', 'close', "zanodeID={$zanode->id}", "<i class='icon icon-off'></i> " . $lang->zanode->shutdownNode, '', "title='{$lang->zanode->shutdown}' class='btn '");
|
||||
common::printLink('zanode', 'close', "zanodeID={$zanode->id}", "<i class='icon icon-off'></i> " . $lang->zanode->shutdownNode, '', $closeAttr);
|
||||
}
|
||||
|
||||
common::printLink('zanode', 'reboot', "zanodeID={$zanode->id}", "<i class='icon icon-restart'></i> " . $lang->zanode->rebootNode, '', $rebootAttr);
|
||||
|
||||
Reference in New Issue
Block a user