diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index 48feb62d14..1d54b4c9c2 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -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); + } + } + } } } diff --git a/api/v1/entries/hostsubmit.php b/api/v1/entries/hostsubmit.php index 0dd5a83f05..9aea53faf2 100644 --- a/api/v1/entries/hostsubmit.php +++ b/api/v1/entries/hostsubmit.php @@ -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(); diff --git a/config/zentaopms.php b/config/zentaopms.php index 68b7f8b1b8..25efb84a38 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -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; diff --git a/module/action/model.php b/module/action/model.php index 30ddc77468..6a346ac118 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -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); } } diff --git a/module/zahost/css/view.css b/module/zahost/css/view.css index 5d092fc6e2..3c5509e705 100644 --- a/module/zahost/css/view.css +++ b/module/zahost/css/view.css @@ -21,3 +21,4 @@ .icon-refresh {font-size: 15px;} .load-indicator:after {top: 33%;} .btn.disabled i {color: #fff;} +#statusContainer{min-height: 120px;} diff --git a/module/zahost/js/view.js b/module/zahost/js/view.js index 2b07966f7c..4b42db6e78 100644 --- a/module/zahost/js/view.js +++ b/module/zahost/js/view.js @@ -35,6 +35,7 @@ function ajaxGetServiceStatus() setTimeout(function() { $('#serviceContent').removeClass('loading'); + $(".service-status, .status-notice").show() }, 500); }); return diff --git a/module/zahost/lang/de.php b/module/zahost/lang/de.php index b33c6f24cd..eb6f4b21e3 100644 --- a/module/zahost/lang/de.php +++ b/module/zahost/lang/de.php @@ -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'; diff --git a/module/zahost/lang/en.php b/module/zahost/lang/en.php index b33c6f24cd..eb6f4b21e3 100644 --- a/module/zahost/lang/en.php +++ b/module/zahost/lang/en.php @@ -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'; diff --git a/module/zahost/lang/fr.php b/module/zahost/lang/fr.php index b33c6f24cd..eb6f4b21e3 100644 --- a/module/zahost/lang/fr.php +++ b/module/zahost/lang/fr.php @@ -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'; diff --git a/module/zahost/lang/vi.php b/module/zahost/lang/vi.php index f639c0ca5c..2f0672f79a 100644 --- a/module/zahost/lang/vi.php +++ b/module/zahost/lang/vi.php @@ -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'; diff --git a/module/zahost/model.php b/module/zahost/model.php index 4f32d40121..8244095ee8 100644 --- a/module/zahost/model.php +++ b/module/zahost/model.php @@ -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') { diff --git a/module/zahost/view/view.html.php b/module/zahost/view/view.html.php index 1cd6e121a6..06e5396b7d 100644 --- a/module/zahost/view/view.html.php +++ b/module/zahost/view/view.html.php @@ -105,10 +105,7 @@
-
●KVM
-
●Nginx
-
●noVNC
-
●Websockify
+
createLink('zahost', 'browseImage', "hostID=$zahost->id", '', true), $lang->zahost->image->downloadImage, '', "class='iframe'");?> diff --git a/module/zanode/control.php b/module/zanode/control.php index 54f2ba863d..45c7c37102 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -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"; diff --git a/module/zanode/css/view.css b/module/zanode/css/view.css index e89553f2ce..66481a016a 100644 --- a/module/zanode/css/view.css +++ b/module/zanode/css/view.css @@ -17,3 +17,4 @@ .node-not-wrap{white-space: nowrap;} .btn-info {background-color: unset;} .btn.disabled i {color: #fff;} +#serviceContent{min-height: 120px;} diff --git a/module/zanode/js/view.js b/module/zanode/js/view.js index 9472d8a65a..d46022f99f 100644 --- a/module/zanode/js/view.js +++ b/module/zanode/js/view.js @@ -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) diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 76e365c3a0..0845327c96 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -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.'; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 8f7bc3edb3..2a661659a6 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -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.'; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 76e365c3a0..0845327c96 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -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.'; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index a93e113823..3ecd38629b 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -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 = '快照不可用'; diff --git a/module/zanode/model.php b/module/zanode/model.php index 8422f1a1a2..ed5e7c5c43 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -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); diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index ac3db250fa..c47fff9a11 100644 --- a/module/zanode/view/browse.html.php +++ b/module/zanode/view/browse.html.php @@ -78,17 +78,25 @@ 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}", " ", (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}", " ", '', "class='btn ' title='{$lang->zanode->boot}'"); + common::printLink('zanode', 'start', "zanodeID={$node->id}", " ", '', $startAttr); } else { - common::printLink('zanode', 'close', "zanodeID={$node->id}", " ", '', "class='btn ' title='{$lang->zanode->shutdown}'"); + common::printLink('zanode', 'close', "zanodeID={$node->id}", " ", '', $closeAttr); } common::printLink('zanode', 'reboot', "zanodeID={$node->id}", " ", '', $rebootAttr); @@ -117,7 +125,7 @@ echo ""; echo ""; echo "
"; diff --git a/module/zanode/view/browsesnapshot.html.php b/module/zanode/view/browsesnapshot.html.php index d98f24f120..6e0bc97d8f 100644 --- a/module/zanode/view/browsesnapshot.html.php +++ b/module/zanode/view/browsesnapshot.html.php @@ -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; + } ?> - localName ? $snapshot->localName : $snapshot->name;?> + zanode->snapshot->statusList, $snapshot->status, '');?> - createdBy, '')?> + name == 'defaultSnap' && $snapshot->createdBy == 'system' ? $lang->zanode->snapshot->defaultSnapUser : zget($users, $snapshot->createdBy, '')?> createdDate;?> ', 'hiddenwin', $editAttr);?> @@ -63,4 +73,3 @@
-getModuleRoot() . 'common/view/footer.html.php';?> diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index 0c5736e8f2..55683559cd 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -129,20 +129,20 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
-
+
●   ZenAgent   zanode->initializing; ?>
-
+
●   ZTF   zanode->initializing; ?>  '>zanode->install ?>
-
+
zanode->init->initSuccessNoticeTitle, "{$lang->zanode->manual}", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?> zanode->init->initFailNoticeTitle . '
' . $lang->zanode->init->initFailNoticeDesc;?>
@@ -177,13 +177,19 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou 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}", " " . $lang->zanode->bootNode, '', "title='{$lang->zanode->boot}' class='btn '"); + common::printLink('zanode', 'start', "zanodeID={$zanode->id}", " " . $lang->zanode->bootNode, '', $startAttr); } else { - common::printLink('zanode', 'close', "zanodeID={$zanode->id}", " " . $lang->zanode->shutdownNode, '', "title='{$lang->zanode->shutdown}' class='btn '"); + common::printLink('zanode', 'close', "zanodeID={$zanode->id}", " " . $lang->zanode->shutdownNode, '', $closeAttr); } common::printLink('zanode', 'reboot', "zanodeID={$zanode->id}", " " . $lang->zanode->rebootNode, '', $rebootAttr);