From ecaf6e3ec8fa34704d23ef185c9d10b3015cc58e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 15 Feb 2023 10:22:15 +0800 Subject: [PATCH] * Add default snapshot. --- module/zahost/lang/de.php | 2 +- module/zahost/lang/en.php | 2 +- module/zahost/lang/fr.php | 2 +- module/zahost/lang/vi.php | 2 +- module/zanode/control.php | 3 +-- module/zanode/lang/de.php | 7 +++++-- module/zanode/lang/en.php | 5 ++++- module/zanode/lang/fr.php | 5 ++++- module/zanode/view/browsesnapshot.html.php | 9 ++++++++- module/zanode/view/view.html.php | 16 +++++++++++----- 10 files changed, 37 insertions(+), 16 deletions(-) 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/zanode/control.php b/module/zanode/control.php index 245ecbd4c9..fdaf931fd8 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -391,8 +391,7 @@ class zanode extends control } else { - if(isonlybody()) return print(js::alert($this->lang->zanode->actionSuccess) . js::reload('parent.parent')); - return print(js::alert($this->lang->zanode->actionSuccess) . js::locate($this->createLink('zanode', 'browse'), 'parent')); + return print(js::alert($this->lang->zanode->actionSuccess) . js::locate($this->createLink('zanode', 'browse'), 'parent.parent')); } } diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 6fb124d62c..284b616b49 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -91,11 +91,14 @@ $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->statusList['creating'] = 'Creating'; -$lang->zanode->snapshot->statusList['completed'] = 'Create Completed'; +$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.'; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 563d3eed23..c1d66e45fe 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -93,12 +93,15 @@ $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->statusList['creating'] = 'Creating'; -$lang->zanode->snapshot->statusList['completed'] = 'Create Completed'; +$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->defaultSnapName = 'DefaultSnapshot'; +$lang->zanode->snapshot->defaultSnapUser = 'System'; + $lang->zanode->imageNameEmpty = 'Name can not be empty.'; $lang->zanode->snapStatusError = 'Snapshot is not ready.'; $lang->zanode->snapRestoring = 'Snapshot is restoring.'; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 6fb124d62c..0691c5edee 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -95,7 +95,10 @@ $lang->zanode->snapshot->statusList['completed'] = 'Create Completed'; $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.'; diff --git a/module/zanode/view/browsesnapshot.html.php b/module/zanode/view/browsesnapshot.html.php index f1ea3462cc..d1077bdf17 100644 --- a/module/zanode/view/browsesnapshot.html.php +++ b/module/zanode/view/browsesnapshot.html.php @@ -47,8 +47,15 @@ $isDefalut = $snapshot->name == 'defaultSnap' && $snapshot->createdBy == 'system'; if($isDefalut) $editAttr = $restoreAttr = $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, '');?> name == 'defaultSnap' && $snapshot->createdBy == 'system' ? $lang->zanode->snapshot->defaultSnapUser : zget($users, $snapshot->createdBy, '')?> createdDate;?> diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index bfbf82c536..63837c1590 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -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);