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; ?>
-
+
-
+
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);
|