From 3d3157075c1485875b04ba27adb80213c36bf0e5 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 14 Feb 2023 10:35:01 +0000 Subject: [PATCH 01/86] * Finish task #84712. --- api/v1/entries/hostheartbeat.php | 9 ++++ module/zanode/lang/zh-cn.php | 3 ++ module/zanode/model.php | 48 ++++++++++++++++++++++ module/zanode/view/browsesnapshot.html.php | 7 +++- 4 files changed, 65 insertions(+), 2 deletions(-) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index cec8180eca..e245419fec 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -84,6 +84,15 @@ 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); + $snaps = $this->loadModel('zanode')->getSnapshotList($node->id); + if(empty($snaps)){ + if($vm->status == 'running') $this->loadModel('zanode')->createDefaultSnapshot($node->id); + } + } } } diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index 220b61ae5e..f954e13d41 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -99,6 +99,9 @@ $lang->zanode->snapshot->statusList['restoring'] = '还原中'; $lang->zanode->snapshot->statusList['restore_failed'] = '还原失败'; $lang->zanode->snapshot->statusList['restore_completed'] = '还原成功'; +$lang->zanode->snapshot->defaultSnapName = '初始快照'; +$lang->zanode->snapshot->defaultSnapUser = '系统'; + $lang->zanode->imageNameEmpty = '名称不能为空'; $lang->zanode->imageNameEmpty = '名称不能为空'; $lang->zanode->snapStatusError = '快照不可用'; diff --git a/module/zanode/model.php b/module/zanode/model.php index bd81193d76..936d479e6f 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -231,6 +231,54 @@ 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') + { + $this->loadModel('action')->create('zanode', $zanodeID, 'createdSnapshot', '', $data->name); + 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. * diff --git a/module/zanode/view/browsesnapshot.html.php b/module/zanode/view/browsesnapshot.html.php index 055aa2fc9f..f1ea3462cc 100644 --- a/module/zanode/view/browsesnapshot.html.php +++ b/module/zanode/view/browsesnapshot.html.php @@ -44,10 +44,13 @@ $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 = $restoreAttr = $deleteAttr = 'class="btn disabled"'; ?> - localName ? $snapshot->localName : $snapshot->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);?> From ecaf6e3ec8fa34704d23ef185c9d10b3015cc58e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 15 Feb 2023 10:22:15 +0800 Subject: [PATCH 02/86] * 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); From 375465b56c06981bde172b0e141ba7e42ef2fe74 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 15 Feb 2023 14:35:59 +0800 Subject: [PATCH 03/86] * Finish task 84707. --- module/zanode/view/browse.html.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index 12e85471ea..773bd58fe8 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 .= $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 .= $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") { @@ -117,7 +125,7 @@ echo ""; echo ""; echo ""; From 247f99df1d21c839c057d1e68d0a83734c255bc7 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 15 Feb 2023 14:58:35 +0800 Subject: [PATCH 04/86] * Finish task 84707. --- module/zanode/view/browse.html.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index 773bd58fe8..e30613101c 100644 --- a/module/zanode/view/browse.html.php +++ b/module/zanode/view/browse.html.php @@ -87,10 +87,10 @@ $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 .= $zanode->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; + $closeAttr .= $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; $startAttr = "title='{$lang->zanode->boot}'"; - $startAttr .= $zanode->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; + $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"'; @@ -109,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); From 78f43b07fb07316f683a67b23612bf9ce02ccb21 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 15 Feb 2023 16:03:33 +0800 Subject: [PATCH 05/86] * Fix bug. --- module/zanode/model.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/zanode/model.php b/module/zanode/model.php index 936d479e6f..9d72c1275e 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -804,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); From b61f7002715261990b487f1d384c91307ec3bf4e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 15 Feb 2023 18:07:15 +0800 Subject: [PATCH 06/86] * Finish bug #84711. --- module/zahost/css/view.css | 1 + module/zahost/js/view.js | 1 + module/zahost/view/view.html.php | 5 +---- module/zanode/css/view.css | 1 + module/zanode/js/view.js | 3 ++- module/zanode/view/view.html.php | 6 +++--- 6 files changed, 9 insertions(+), 8 deletions(-) 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/view/view.html.php b/module/zahost/view/view.html.php index 3eaf1ef3f8..012802c1c8 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/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..27bd683563 100644 --- a/module/zanode/js/view.js +++ b/module/zanode/js/view.js @@ -2,11 +2,11 @@ var checkInterval; var intervalTimes = 0; $('#checkServiceStatus').click(function(){ - $('#serviceContent').addClass('loading'); checkServiceStatus(); }) function checkServiceStatus(){ + $('#serviceContent').addClass('loading'); $.get(createLink('zanode', 'ajaxGetServiceStatus', 'nodeID=' + nodeID), function(response) { var resultData = JSON.parse(response); @@ -99,6 +99,7 @@ function checkServiceStatus(){ } setTimeout(function() { $('#serviceContent').removeClass('loading'); + $(".service-status, .status-notice").show() }, 500); }); return diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index 63837c1590..8626e03604 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;?>
From 8fa5b6fc6f3ce06f7735a0cfcf2c61236f48444e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 15 Feb 2023 18:17:18 +0800 Subject: [PATCH 07/86] * Fix bug. --- module/zahost/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/zahost/model.php b/module/zahost/model.php index 96c39aabfe..0a11eca44d 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') { From f334ac0f476c2e64920ff403b323db3a7abb7013 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 15 Feb 2023 18:27:46 +0800 Subject: [PATCH 08/86] * Fix bug. --- module/zanode/view/browsesnapshot.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zanode/view/browsesnapshot.html.php b/module/zanode/view/browsesnapshot.html.php index d1077bdf17..fb3e502ea6 100644 --- a/module/zanode/view/browsesnapshot.html.php +++ b/module/zanode/view/browsesnapshot.html.php @@ -46,7 +46,7 @@ $deleteAttr .= ($snapshot->status == 'restoring' or $snapshot->status == 'creating') ? ' class="btn disabled"' : 'class="btn"'; $isDefalut = $snapshot->name == 'defaultSnap' && $snapshot->createdBy == 'system'; - if($isDefalut) $editAttr = $restoreAttr = $deleteAttr = 'class="btn disabled"'; + if($isDefalut) $editAttr = $deleteAttr = 'class="btn disabled"'; $name = $snapshot->localName ? $snapshot->localName : $snapshot->name; $title = $snapshot->name; if($snapshot->name == 'defaultSnap' && $snapshot->createdBy == 'system') From 1f3a9486e21436f2069163f70da8d565935dce6e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 16 Feb 2023 11:22:05 +0800 Subject: [PATCH 09/86] * Finish task #84706. --- module/zanode/control.php | 4 +--- module/zanode/js/view.js | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/module/zanode/control.php b/module/zanode/control.php index fdaf931fd8..d7fbc3dcaf 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 { diff --git a/module/zanode/js/view.js b/module/zanode/js/view.js index 27bd683563..d46022f99f 100644 --- a/module/zanode/js/view.js +++ b/module/zanode/js/view.js @@ -2,11 +2,11 @@ var checkInterval; var intervalTimes = 0; $('#checkServiceStatus').click(function(){ + $('#serviceContent').addClass('loading'); checkServiceStatus(); }) function checkServiceStatus(){ - $('#serviceContent').addClass('loading'); $.get(createLink('zanode', 'ajaxGetServiceStatus', 'nodeID=' + nodeID), function(response) { var resultData = JSON.parse(response); @@ -187,7 +187,7 @@ $('#jumpManual').click(function() $(function(){ - checkServiceStatus(); + $('#checkServiceStatus').trigger("click") checkInterval = setInterval(() => { intervalTimes++; if(intervalTimes > 300) From 005e2194b8f98066d0a87c74aecd1bb128f8bf81 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 16 Feb 2023 14:34:17 +0800 Subject: [PATCH 10/86] * Segregate mysql data between deploy and test. --- module/zanode/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/zanode/model.php b/module/zanode/model.php index 9d72c1275e..7e85e442f4 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -560,6 +560,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) From 81d1e3e23a5f2b2e2c2867e03d88cda517e5a252 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 16 Feb 2023 16:47:20 +0800 Subject: [PATCH 11/86] * Fix bug #32191. --- config/zentaopms.php | 1 + module/action/model.php | 2 ++ module/zanode/lang/en.php | 2 +- module/zanode/lang/fr.php | 2 +- module/zanode/lang/zh-cn.php | 4 ++-- module/zanode/model.php | 3 +-- module/zanode/view/browsesnapshot.html.php | 1 - 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index 98b7e55e37..8a83216957 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -405,6 +405,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 be95cededf..a40152affd 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -938,6 +938,8 @@ class actionModel extends model } else { + if($actionType == 'restoredsnapshot' && $action->objectType == 'vm' && $value == 'defaultSnap') $value = $this->lang->$objectType->snapshot->defaultSnapName; + $desc = str_replace('$' . $key, $value, $desc); } } diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index c1d66e45fe..fc18f5394a 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -97,7 +97,7 @@ $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'; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 0691c5edee..284b616b49 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -91,7 +91,7 @@ $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'; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index f954e13d41..fd4d76a402 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -93,11 +93,11 @@ $lang->zanode->confirmDeleteSnapshot = "快照被删除后无法从回收站中 $lang->zanode->snapshot = new stdClass(); $lang->zanode->snapshot->statusList['creating'] = '创建中'; -$lang->zanode->snapshot->statusList['completed'] = '创建完成'; +$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 = '系统'; diff --git a/module/zanode/model.php b/module/zanode/model.php index 7e85e442f4..19c5d97c7d 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -270,7 +270,6 @@ class zanodemodel extends model if(!empty($result) and $result->code == 'success') { - $this->loadModel('action')->create('zanode', $zanodeID, 'createdSnapshot', '', $data->name); return $newID; } @@ -420,7 +419,7 @@ class zanodemodel extends model $this->dao->update(TABLE_ZAHOST)->set('status')->eq($status)->where('id')->eq($id)->exec(); } - $this->loadModel('action')->create('zanode', $id, ucfirst($type)); + $this->loadModel('action')->create('zanode', $id, ucfirst($type), $node->name); return; } diff --git a/module/zanode/view/browsesnapshot.html.php b/module/zanode/view/browsesnapshot.html.php index fb3e502ea6..6195869815 100644 --- a/module/zanode/view/browsesnapshot.html.php +++ b/module/zanode/view/browsesnapshot.html.php @@ -73,4 +73,3 @@
-getModuleRoot() . 'common/view/footer.html.php';?> From e0b645b43d7702a53d7b259f830dbe1009f5f1e0 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 17 Feb 2023 15:19:44 +0800 Subject: [PATCH 12/86] * Fix bug #32236. --- module/zanode/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zanode/model.php b/module/zanode/model.php index 19c5d97c7d..52db8fd3a0 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -419,7 +419,7 @@ class zanodemodel extends model $this->dao->update(TABLE_ZAHOST)->set('status')->eq($status)->where('id')->eq($id)->exec(); } - $this->loadModel('action')->create('zanode', $id, ucfirst($type), $node->name); + $this->loadModel('action')->create('zanode', $id, ucfirst($type)); return; } From ae6dbb769c3e96cc9215140aa4b2814e4b5f5a15 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 17 Feb 2023 17:33:13 +0800 Subject: [PATCH 13/86] * Fix restore default snapshot history error. --- module/action/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/action/model.php b/module/action/model.php index a40152affd..b912769a69 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -938,7 +938,7 @@ class actionModel extends model } else { - if($actionType == 'restoredsnapshot' && $action->objectType == 'vm' && $value == 'defaultSnap') $value = $this->lang->$objectType->snapshot->defaultSnapName; + if($actionType == 'restoredsnapshot' && in_array($action->objectType, array('vm', 'zanode')) && $value == 'defaultSnap') $value = $this->lang->$objectType->snapshot->defaultSnapName; $desc = str_replace('$' . $key, $value, $desc); } From 7759e047e4e607d532a161cc6c23f2a33d963c78 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Mon, 20 Feb 2023 08:55:45 +0800 Subject: [PATCH 14/86] * Add snapshot status. --- module/zanode/lang/de.php | 1 + module/zanode/lang/en.php | 1 + module/zanode/lang/fr.php | 1 + module/zanode/lang/zh-cn.php | 1 + 4 files changed, 4 insertions(+) diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 284b616b49..83ff4086a3 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -91,6 +91,7 @@ $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['inprogress'] = 'Creating'; $lang->zanode->snapshot->statusList['completed'] = 'Usable'; $lang->zanode->snapshot->statusList['failed'] = 'Create Failed'; $lang->zanode->snapshot->statusList['restoring'] = 'Restoring'; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index fc18f5394a..a30a4163a4 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -93,6 +93,7 @@ $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['inprogress'] = 'Creating'; $lang->zanode->snapshot->statusList['completed'] = 'Usable'; $lang->zanode->snapshot->statusList['failed'] = 'Create Failed'; $lang->zanode->snapshot->statusList['restoring'] = 'Restoring'; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 284b616b49..83ff4086a3 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -91,6 +91,7 @@ $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['inprogress'] = 'Creating'; $lang->zanode->snapshot->statusList['completed'] = 'Usable'; $lang->zanode->snapshot->statusList['failed'] = 'Create Failed'; $lang->zanode->snapshot->statusList['restoring'] = 'Restoring'; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index fd4d76a402..cf87dbe23d 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -93,6 +93,7 @@ $lang->zanode->confirmDeleteSnapshot = "快照被删除后无法从回收站中 $lang->zanode->snapshot = new stdClass(); $lang->zanode->snapshot->statusList['creating'] = '创建中'; +$lang->zanode->snapshot->statusList['inprogress'] = '创建中'; $lang->zanode->snapshot->statusList['completed'] = '可使用'; $lang->zanode->snapshot->statusList['failed'] = '创建失败'; $lang->zanode->snapshot->statusList['restoring'] = '还原中'; From 14d8a4d8f29f503db6293a8961011c5dbc9d1fb1 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 22 Feb 2023 11:39:21 +0800 Subject: [PATCH 15/86] * Fix bug #32285. --- module/zanode/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zanode/control.php b/module/zanode/control.php index d7fbc3dcaf..8783642c07 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -556,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"; From 87e9402d352dda4faf635b058b346721aa3ebad0 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 22 Feb 2023 13:07:33 +0800 Subject: [PATCH 16/86] * Remove snapshot row when create snap fail. --- api/v1/entries/hostsubmit.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/v1/entries/hostsubmit.php b/api/v1/entries/hostsubmit.php index 268df5fe90..7b538252eb 100644 --- a/api/v1/entries/hostsubmit.php +++ b/api/v1/entries/hostsubmit.php @@ -40,13 +40,18 @@ 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($image->status != 'completed') + { + $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(); From a4ef56b5f01f510c6a6e981c6b6e47cb9a4649fa Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 22 Feb 2023 14:13:30 +0800 Subject: [PATCH 17/86] * Fix php error when vm not exist. --- api/v1/entries/hostheartbeat.php | 9 ++++++--- api/v1/entries/hostsubmit.php | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index e245419fec..e9a0f2ff44 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -88,9 +88,12 @@ class hostHeartbeatEntry extends baseEntry if($vm->status == 'running') { $node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress); - $snaps = $this->loadModel('zanode')->getSnapshotList($node->id); - if(empty($snaps)){ - if($vm->status == 'running') $this->loadModel('zanode')->createDefaultSnapshot($node->id); + 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 7b538252eb..51957aaa52 100644 --- a/api/v1/entries/hostsubmit.php +++ b/api/v1/entries/hostsubmit.php @@ -46,10 +46,13 @@ class hostSubmitEntry extends baseEntry 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($image->status != 'completed') + 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(); + $this->dao->delete()->from(TABLE_IMAGE)->where("id")->eq($task)->exec(); return $this->sendSuccess(200, 'success'); } } From 1bf386225a045b39f428f78b9875834208cf06c7 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Mon, 27 Feb 2023 15:09:26 +0800 Subject: [PATCH 18/86] * Fix zanode lang file. --- module/zanode/lang/de.php | 6 +++++- module/zanode/lang/en.php | 8 ++++---- module/zanode/lang/fr.php | 6 +++++- module/zanode/lang/zh-cn.php | 9 ++++----- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 6fb124d62c..76e365c3a0 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -48,6 +48,7 @@ $lang->zanode->confirmReboot = "Are you sure to restart the ZenAgent Node?"; $lang->zanode->confirmShutdown = "Are you sure to shutdown the ZenAgent Node?"; $lang->zanode->confirmSuspend = "Are you sure to suspend the ZenAgent Node?"; $lang->zanode->confirmResume = "Are you sure to resume the ZenAgent Node?"; +$lang->zanode->confirmRestore = "The ZenAgent Node will be restored to this snapshot state, are you sure you want to continue?"; $lang->zanode->actionSuccess = 'Success'; $lang->zanode->deleted = "Deleted"; $lang->zanode->scriptPath = "Script path"; @@ -90,6 +91,7 @@ $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['failed'] = 'Create Failed'; @@ -97,7 +99,9 @@ $lang->zanode->snapshot->statusList['restoring'] = 'Restoring'; $lang->zanode->snapshot->statusList['restore_failed'] = 'Restore Failed'; $lang->zanode->snapshot->statusList['restore_completed'] = 'Restore Completed'; -$lang->zanode->imageNameEmpty = 'Name can not be empty.'; +$lang->zanode->imageNameEmpty = 'Name can not be empty.'; +$lang->zanode->snapStatusError = 'Snapshot is not ready.'; +$lang->zanode->snapRestoring = 'Snapshot is restoring.'; $lang->zanode->runTimeout = 'Network connection timeout, please check the host and execution node status.'; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 563d3eed23..8f7bc3edb3 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -48,7 +48,6 @@ $lang->zanode->confirmReboot = "Are you sure to restart the ZenAgent Node?"; $lang->zanode->confirmShutdown = "Are you sure to shutdown the ZenAgent Node?"; $lang->zanode->confirmSuspend = "Are you sure to suspend the ZenAgent Node?"; $lang->zanode->confirmResume = "Are you sure to resume the ZenAgent Node?"; -$lang->zanode->confirmRestore = "Are you sure to restore the ZenAgent Node?"; $lang->zanode->confirmRestore = "The ZenAgent Node will be restored to this snapshot state, are you sure you want to continue?"; $lang->zanode->actionSuccess = 'Success'; $lang->zanode->deleted = "Deleted"; @@ -92,6 +91,7 @@ $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['failed'] = 'Create Failed'; @@ -151,8 +151,8 @@ $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
- Click check service status button."; -$lang->zanode->tips = "The execution node is a virtual machine or container instance created by the host machine, which is a test environment for executing test tasks. After the execution node is configured with the automated test environment, the script can be automatically executed, and the results can be viewed in the execution results of Zen Dao's application cases."; -$lang->zanode->scriptTips = 'Write the directory where the script is located on the execution node.'; -$lang->zanode->shellTips = 'Before running the automated test script on the execution node, you can execute a custom shell command.'; +$lang->zanode->tips = "The execution node is a virtual machine or container instance created by the host machine, which is a test environment for executing test tasks. After the execution node is configured with the automated test environment, the script can be automatically executed, and the results can be viewed in the execution results of Zen Dao's application cases."; +$lang->zanode->scriptTips = 'Write the directory where the script is located on the execution node.'; +$lang->zanode->shellTips = 'Before running the automated test script on the execution node, you can execute a custom shell command.'; $lang->zanode->automationTips = 'Before executing the test task on the execution node, you need to set up the execution node corresponding to the product, the directory of the automated test script, and the custom Shell command to execute.'; $lang->zanode->nameUnique = $lang->zanode->name . 'already exist'; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 6fb124d62c..76e365c3a0 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -48,6 +48,7 @@ $lang->zanode->confirmReboot = "Are you sure to restart the ZenAgent Node?"; $lang->zanode->confirmShutdown = "Are you sure to shutdown the ZenAgent Node?"; $lang->zanode->confirmSuspend = "Are you sure to suspend the ZenAgent Node?"; $lang->zanode->confirmResume = "Are you sure to resume the ZenAgent Node?"; +$lang->zanode->confirmRestore = "The ZenAgent Node will be restored to this snapshot state, are you sure you want to continue?"; $lang->zanode->actionSuccess = 'Success'; $lang->zanode->deleted = "Deleted"; $lang->zanode->scriptPath = "Script path"; @@ -90,6 +91,7 @@ $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['failed'] = 'Create Failed'; @@ -97,7 +99,9 @@ $lang->zanode->snapshot->statusList['restoring'] = 'Restoring'; $lang->zanode->snapshot->statusList['restore_failed'] = 'Restore Failed'; $lang->zanode->snapshot->statusList['restore_completed'] = 'Restore Completed'; -$lang->zanode->imageNameEmpty = 'Name can not be empty.'; +$lang->zanode->imageNameEmpty = 'Name can not be empty.'; +$lang->zanode->snapStatusError = 'Snapshot is not ready.'; +$lang->zanode->snapRestoring = 'Snapshot is restoring.'; $lang->zanode->runTimeout = 'Network connection timeout, please check the host and execution node status.'; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index 220b61ae5e..a93e113823 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -99,7 +99,6 @@ $lang->zanode->snapshot->statusList['restoring'] = '还原中'; $lang->zanode->snapshot->statusList['restore_failed'] = '还原失败'; $lang->zanode->snapshot->statusList['restore_completed'] = '还原成功'; -$lang->zanode->imageNameEmpty = '名称不能为空'; $lang->zanode->imageNameEmpty = '名称不能为空'; $lang->zanode->snapStatusError = '快照不可用'; $lang->zanode->snapRestoring = '快照正在还原中'; @@ -130,7 +129,7 @@ $lang->zanode->statusList['restoring'] = '还原中'; $lang->zanode->initNotice = "保存成功,请初始化执行节点或返回列表。"; $lang->zanode->initButton = "去初始化"; -$lang->zanode->init = new stdclass; +$lang->zanode->init = new stdClass(); $lang->zanode->init->statusTitle = "服务状态"; $lang->zanode->init->checkStatus = "检测服务状态"; $lang->zanode->init->not_install = "未安装"; @@ -152,8 +151,8 @@ $lang->zanode->init->title = "初始化执行节点"; $lang->zanode->init->descTitle = "请根据引导完成执行节点上的初始化: "; $lang->zanode->init->initDesc = "- 在执行节点上执行命令:%s %s
- 点击检测服务状态。";$lang->zanode->init->statusTitle = "服务状态"; -$lang->zanode->tips = '执行节点是由宿主机创建的虚拟机或容器实例,是执行测试任务的测试环境,在执行节点配置自动化测试环境后可以自动执行脚本,结果可以在禅道对应用例执行结果中查看。'; -$lang->zanode->scriptTips = '填写执行节点上自动化测试脚本所在的目录。'; -$lang->zanode->shellTips = '在执行节点上运行自动化测试脚本前,可以执行自定义的shell命令。'; +$lang->zanode->tips = '执行节点是由宿主机创建的虚拟机或容器实例,是执行测试任务的测试环境,在执行节点配置自动化测试环境后可以自动执行脚本,结果可以在禅道对应用例执行结果中查看。'; +$lang->zanode->scriptTips = '填写执行节点上自动化测试脚本所在的目录。'; +$lang->zanode->shellTips = '在执行节点上运行自动化测试脚本前,可以执行自定义的shell命令。'; $lang->zanode->automationTips = '在执行节点上执行测试任务前,需要设置产品对应的执行节点,自动化测试脚本的目录以及需要执行的自定义Shell命令。'; $lang->zanode->nameUnique = $lang->zanode->name . '已存在'; From 6399f9dff7d2396e161f789f6cf8eb7587da8fa5 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Mon, 27 Feb 2023 07:41:38 +0000 Subject: [PATCH 19/86] * Format the output. --- tools/prepareupdate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/prepareupdate.php b/tools/prepareupdate.php index b832e58a8c..cae8d0590e 100755 --- a/tools/prepareupdate.php +++ b/tools/prepareupdate.php @@ -113,7 +113,7 @@ class prepareUpdate $bugs = array_filter(explode(',', trim($release->bugs, ','))); if(!empty($stories)) $doneStories .= $title[$product] . "\n"; - if(!empty($fixedBugs)) $fixedBugs .= $title[$product] . "\n"; + if(!empty($bugs)) $fixedBugs .= $title[$product] . "\n"; foreach($stories as $storyID) { $storyTitle = $this->getStoryOrBugTitle('story', $storyID); @@ -266,7 +266,7 @@ class prepareUpdate { `sed -i "s/ \/\/ pms insert position\.$/\\n\\\$lang->upgrade->fromVersions['{$this->internalZT->pmsVersionAB}'] = '{$this->internalZT->pmsVersion}'; \/\/ pms insert position\./" ../module/upgrade/lang/version.php`; `sed -i "s/ \/\/ biz insert position\.$/\\n\\\$lang->upgrade->fromVersions['biz{$this->internalZT->bizVersionAB}'] = 'Biz{$this->internalZT->bizVersion}'; \/\/ biz insert position\./" ../module/upgrade/lang/version.php`; - `sed -i "s/ \/\/ max insert position\.$/\\n\\\$lang->upgrade->fromVersions['max{$this->internalZT->lastMaxVersionAB}'] = 'Max{$this->internalZT->lastMaxVersion}'; \/\/ max insert position\./" ../module/upgrade/lang/version.php`; + `sed -i "s/ \/\/ max insert position\.$/\\n\\\$lang->upgrade->fromVersions['max{$this->internalZT->lastMaxVersionAB}'] = 'Max{$this->internalZT->lastMaxVersion}'; \/\/ max insert position\./" ../module/upgrade/lang/version.php`; } /** From 11507ffff2fdca5621713972481c2cdb19ac9b85 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 27 Feb 2023 16:16:04 +0800 Subject: [PATCH 20/86] * fix bug #32277. --- module/admin/lang/menu.php | 4 ++-- module/custom/lang/de.php | 1 + module/custom/lang/en.php | 1 + module/custom/lang/fr.php | 1 + module/custom/lang/zh-cn.php | 1 + module/custom/view/hours.html.php | 2 +- module/group/lang/resource.php | 2 ++ module/holiday/view/browse.html.php | 2 ++ 8 files changed, 11 insertions(+), 3 deletions(-) diff --git a/module/admin/lang/menu.php b/module/admin/lang/menu.php index 18c422a129..a592e16d5a 100644 --- a/module/admin/lang/menu.php +++ b/module/admin/lang/menu.php @@ -84,12 +84,12 @@ $lang->admin->menuList->model['menuOrder']['15'] = 'waterfall'; $lang->admin->menuList->model['menuOrder']['20'] = 'agileplus'; $lang->admin->menuList->model['menuOrder']['25'] = 'waterfallplus'; -$lang->admin->menuList->model['tabMenu']['common']['project'] = array('link' => "{$lang->project->common}|custom|required|module=project", 'alias' => 'set', 'exclude' => 'custom', 'links' => array('custom|set|')); +$lang->admin->menuList->model['tabMenu']['common']['project'] = array('link' => "{$lang->project->common}|custom|required|module=project", 'alias' => 'set', 'exclude' => 'custom', 'links' => array('custom|set|module=project&field=unitList')); $lang->admin->menuList->model['tabMenu']['common']['stage'] = array('link' => "{$lang->stage->type}|stage|settype|", 'subModule' => 'stage', 'links' => array('stage|browse|')); $lang->admin->menuList->model['tabMenu']['common']['build'] = array('link' => "{$lang->build->common}|custom|required|module=build", 'alias' => 'set', 'exclude' => 'custom'); $lang->admin->menuList->model['tabMenu']['common']['flow'] = array('link' => "{$lang->custom->flow}|custom|flow|", 'divider' => true); $lang->admin->menuList->model['tabMenu']['common']['code'] = array('link' => "{$lang->code}|custom|code|"); -$lang->admin->menuList->model['tabMenu']['common']['hours'] = array('link' => "{$lang->workingHour}|custom|hours|", 'subModule' => 'holiday', 'links' => array('holiday|browse|')); +$lang->admin->menuList->model['tabMenu']['common']['hours'] = array('link' => "{$lang->workingHour}|custom|hours|", 'subModule' => 'holiday', 'links' => array('holiday|browse|', 'custom|hours')); $lang->admin->menuList->model['tabMenu']['waterfall']['stage'] = array('link' => "{$lang->stage->list}|stage|browse|", 'subModule' => 'stage', 'exclude' => 'stage-plusbrowse'); $lang->admin->menuList->model['tabMenu']['waterfallplus']['stage'] = array('link' => "{$lang->stage->list}|stage|plusbrowse|", 'subModule' => 'stage', 'exclude' => 'stage-browse'); $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['5'] = 'project'; diff --git a/module/custom/lang/de.php b/module/custom/lang/de.php index b3140f2c89..1ed0bb6dee 100644 --- a/module/custom/lang/de.php +++ b/module/custom/lang/de.php @@ -10,6 +10,7 @@ $lang->custom->key = 'Key'; $lang->custom->value = 'Value'; $lang->custom->working = 'WorkStyle'; $lang->custom->select = 'Select Concept'; +$lang->custom->hours = 'Hours'; $lang->custom->branch = 'Multi Branch'; $lang->custom->owner = 'Owner'; $lang->custom->module = 'Module'; diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 8f2e139a8d..171bc035f2 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -10,6 +10,7 @@ $lang->custom->key = 'Key'; $lang->custom->value = 'Value'; $lang->custom->working = 'Mode'; $lang->custom->select = 'Select Concept'; +$lang->custom->hours = 'Hours'; $lang->custom->branch = 'Multi-Branch'; $lang->custom->owner = 'Owner'; $lang->custom->module = 'Module'; diff --git a/module/custom/lang/fr.php b/module/custom/lang/fr.php index 2e43227781..f434865205 100644 --- a/module/custom/lang/fr.php +++ b/module/custom/lang/fr.php @@ -10,6 +10,7 @@ $lang->custom->key = 'Clé'; $lang->custom->value = 'Valeur'; $lang->custom->working = 'Mode'; $lang->custom->select = 'Choix du Concept'; +$lang->custom->hours = 'Hours'; $lang->custom->branch = 'Multi-Branches'; $lang->custom->owner = 'Propriétaire'; $lang->custom->module = 'Module'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 8ed08ff52c..1ff729cb98 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -9,6 +9,7 @@ $lang->custom->restore = '恢复默认'; $lang->custom->key = '键'; $lang->custom->value = '值'; $lang->custom->working = '工作方式'; +$lang->custom->hours = '工时'; $lang->custom->select = '请选择流程:'; $lang->custom->branch = '多分支'; $lang->custom->owner = '所有者'; diff --git a/module/custom/view/hours.html.php b/module/custom/view/hours.html.php index 466398467d..50807ab711 100644 --- a/module/custom/view/hours.html.php +++ b/module/custom/view/hours.html.php @@ -17,7 +17,7 @@
diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index d89215cffd..8b3fe28f99 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1444,6 +1444,7 @@ $lang->resource->custom->setDefaultConcept = 'setDefaultConcept'; $lang->resource->custom->deleteStoryConcept = 'deleteStoryConcept'; $lang->resource->custom->kanban = 'kanban'; $lang->resource->custom->code = 'code'; +$lang->resource->custom->hours = 'hours'; $lang->custom->methodOrder[5] = 'index'; $lang->custom->methodOrder[10] = 'set'; @@ -1461,6 +1462,7 @@ $lang->custom->methodOrder[65] = 'setDefaultConcept'; $lang->custom->methodOrder[70] = 'deleteStoryConcept'; $lang->custom->methodOrder[75] = 'kanban'; $lang->custom->methodOrder[80] = 'code'; +$lang->custom->methodOrder[85] = 'hours'; $lang->resource->datatable = new stdclass(); $lang->resource->datatable->setGlobal = 'setGlobal'; diff --git a/module/holiday/view/browse.html.php b/module/holiday/view/browse.html.php index 0f81948867..8aca520eff 100644 --- a/module/holiday/view/browse.html.php +++ b/module/holiday/view/browse.html.php @@ -15,8 +15,10 @@