From 37df7cfba84383cc7b8d2b5a91e591cf868ed0c2 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 2 Mar 2023 09:56:28 +0800 Subject: [PATCH 01/35] save --- api/v1/entries/hostheartbeat.php | 6 +++++- module/zanode/lang/de.php | 2 ++ module/zanode/lang/en.php | 2 ++ module/zanode/lang/fr.php | 2 ++ module/zanode/lang/zh-cn.php | 28 +++++++++++++------------ module/zanode/model.php | 36 ++++++++++++++++++++++---------- 6 files changed, 51 insertions(+), 25 deletions(-) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index 1d54b4c9c2..313f7f12bb 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -69,6 +69,11 @@ class hostHeartbeatEntry extends baseEntry foreach($vms as $vm) { $heartbeat = strtotime(substr($vm->heartbeat, 0, 19)); + $node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress); + + if(empty($node)) continue; + if(in_array($node->status, array('restoring', 'Creating_img', 'Creating_snap'))) + $vm->status = $node->status; $vmData = array( 'vnc' => $vm->vncPortOnHost, 'zap' => $vm->agentPortOnHost, @@ -87,7 +92,6 @@ class hostHeartbeatEntry extends baseEntry if($vm->status == 'running') { - $node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress); if(!empty($node)) { $snaps = $this->loadModel('zanode')->getSnapshotList($node->id); diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 8b27396080..282d1ae03a 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -133,6 +133,8 @@ $lang->zanode->statusList['destroy_fail'] = 'Destroy Fail'; $lang->zanode->statusList['wait'] = 'Initializing'; $lang->zanode->statusList['online'] = 'Online'; $lang->zanode->statusList['restoring'] = 'Restoring'; +$lang->zanode->statusList['Creating_snap'] = 'Creating Snapshot'; +$lang->zanode->statusList['Creating_img'] = 'Creating Image'; $lang->zanode->initNotice = "Succeeded. Please initialize the execution node or return to the list."; $lang->zanode->initButton = "Initialize"; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 3a2f5b10bd..ab4a6edec6 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -133,6 +133,8 @@ $lang->zanode->statusList['destroy_fail'] = 'Destroy Fail'; $lang->zanode->statusList['wait'] = 'Initializing'; $lang->zanode->statusList['online'] = 'Online'; $lang->zanode->statusList['restoring'] = 'Restoring'; +$lang->zanode->statusList['Creating_snap'] = 'Creating Snapshot'; +$lang->zanode->statusList['Creating_img'] = 'Creating Image'; $lang->zanode->initNotice = "Succeeded. Please initialize the execution node or return to the list."; $lang->zanode->initButton = "Initialize"; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 8b27396080..282d1ae03a 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -133,6 +133,8 @@ $lang->zanode->statusList['destroy_fail'] = 'Destroy Fail'; $lang->zanode->statusList['wait'] = 'Initializing'; $lang->zanode->statusList['online'] = 'Online'; $lang->zanode->statusList['restoring'] = 'Restoring'; +$lang->zanode->statusList['Creating_snap'] = 'Creating Snapshot'; +$lang->zanode->statusList['Creating_img'] = 'Creating Image'; $lang->zanode->initNotice = "Succeeded. Please initialize the execution node or return to the list."; $lang->zanode->initButton = "Initialize"; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index dcd471c766..26483125af 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -120,19 +120,21 @@ $lang->zanode->apiError['notRunning'] = '请检查执行节点状态'; $lang->zanode->publicList[0] = '不共享'; $lang->zanode->publicList[1] = '共享'; -$lang->zanode->statusList['created'] = '已创建'; -$lang->zanode->statusList['launch'] = '运行中'; -$lang->zanode->statusList['ready'] = '运行中'; -$lang->zanode->statusList['running'] = '运行中'; -$lang->zanode->statusList['suspend'] = '休眠'; -$lang->zanode->statusList['offline'] = '下线'; -$lang->zanode->statusList['destroy'] = '已销毁'; -$lang->zanode->statusList['shutoff'] = '已关机'; -$lang->zanode->statusList['shutodown'] = '已关机'; -$lang->zanode->statusList['destroy_fail'] = '销毁失败'; -$lang->zanode->statusList['wait'] = '初始化中'; -$lang->zanode->statusList['online'] = '已上架'; -$lang->zanode->statusList['restoring'] = '还原中'; +$lang->zanode->statusList['created'] = '已创建'; +$lang->zanode->statusList['launch'] = '运行中'; +$lang->zanode->statusList['ready'] = '运行中'; +$lang->zanode->statusList['running'] = '运行中'; +$lang->zanode->statusList['suspend'] = '休眠'; +$lang->zanode->statusList['offline'] = '下线'; +$lang->zanode->statusList['destroy'] = '已销毁'; +$lang->zanode->statusList['shutoff'] = '已关机'; +$lang->zanode->statusList['shutodown'] = '已关机'; +$lang->zanode->statusList['destroy_fail'] = '销毁失败'; +$lang->zanode->statusList['wait'] = '初始化中'; +$lang->zanode->statusList['online'] = '已上架'; +$lang->zanode->statusList['restoring'] = '还原中'; +$lang->zanode->statusList['Creating_snap'] = '创建快照中'; +$lang->zanode->statusList['Creating_img'] = '导出镜像中'; $lang->zanode->initNotice = "保存成功,请初始化执行节点或返回列表。"; $lang->zanode->initButton = "去初始化"; diff --git a/module/zanode/model.php b/module/zanode/model.php index 313eb4d24b..8c88c6fe03 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -12,16 +12,19 @@ class zanodemodel extends model { - const STATUS_CREATED = 'created'; - const STATUS_LAUNCH = 'launch'; - const STATUS_FAIL_CREATE = 'vm_fail_create'; - const STATUS_RUNNING = 'running'; - const STATUS_SHUTOFF = 'shutoff'; - const STATUS_BUSY = 'busy'; - const STATUS_READY = 'ready'; - const STATUS_UNKNOWN = 'unknown'; - const STATUS_DESTROY = 'destroy'; - const STATUS_DESTROY_FAIL = 'vim_destroy_fail'; + const STATUS_CREATED = 'created'; + const STATUS_LAUNCH = 'launch'; + const STATUS_FAIL_CREATE = 'vm_fail_create'; + const STATUS_RUNNING = 'running'; + const STATUS_SHUTOFF = 'shutoff'; + const STATUS_BUSY = 'busy'; + const STATUS_READY = 'ready'; + const STATUS_UNKNOWN = 'unknown'; + const STATUS_DESTROY = 'destroy'; + const STATUS_RESTORING = 'restoring'; + const STATUS_CREATING_SNAP = 'Creating_snap'; + const STATUS_CREATING_IMG = 'Creating_img'; + const STATUS_DESTROY_FAIL = 'vim_destroy_fail'; const KVM_CREATE_PATH = '/api/v1/kvm/create'; const KVM_TOKEN_PATH = '/api/v1/virtual/getVncToken'; @@ -181,7 +184,12 @@ class zanodemodel extends model $result = json_decode(commonModel::http($agnetUrl . static::KVM_EXPORT_PATH, json_encode($param,JSON_NUMERIC_CHECK), null, array("Authorization:$node->tokenSN"))); - if(!empty($result) and $result->code == 'success') return $newID; + + if(!empty($result) and $result->code == 'success') + { + $this->dao->update(TABLE_HOST)->set('status')->eq(static::STATUS_CREATING_SNAP)->where('id')->eq($node->id)->exec(); + return $newID; + } $this->dao->delete()->from(TABLE_IMAGE)->where('id')->eq($newID)->exec(); return false; @@ -239,11 +247,14 @@ class zanodemodel extends model if(!empty($result) and $result->code == 'success') { $this->loadModel('action')->create('zanode', $zanodeID, 'createdSnapshot', '', $data->name); + $this->dao->update(TABLE_HOST)->set('status')->eq(static::STATUS_CREATING_SNAP)->where('id')->eq($node->id)->exec(); + 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; } @@ -286,11 +297,14 @@ class zanodemodel extends model if(!empty($result) and $result->code == 'success') { + $this->dao->update(TABLE_HOST)->set('status')->eq(static::STATUS_CREATING_SNAP)->where('id')->eq($node->id)->exec(); + 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; } From 00ab26727adc0558c0e8d8ed1181518f1bfb92c8 Mon Sep 17 00:00:00 2001 From: zenggang Date: Fri, 3 Mar 2023 05:32:02 +0000 Subject: [PATCH 02/35] * Finish task#85878,85879,85880,85881 --- module/testcase/css/automation.css | 1 + module/testcase/js/automation.js | 8 ++++++++ module/testcase/view/automation.html.php | 13 +++++++------ module/zahost/control.php | 15 ++++++++++++++- module/zanode/control.php | 12 ++++++++++++ module/zanode/css/browse.css | 3 +++ module/zanode/css/view.css | 1 + module/zanode/js/create.js | 23 ++++++++++++++++++++++- module/zanode/model.php | 4 ++-- module/zanode/view/browse.html.php | 6 +++--- module/zanode/view/create.html.php | 8 ++++---- module/zanode/view/view.html.php | 2 +- www/static/svg/snapshot.svg | 10 ++++++++++ 13 files changed, 88 insertions(+), 18 deletions(-) create mode 100644 module/testcase/css/automation.css create mode 100644 module/testcase/js/automation.js create mode 100644 www/static/svg/snapshot.svg diff --git a/module/testcase/css/automation.css b/module/testcase/css/automation.css new file mode 100644 index 0000000000..dc2b387672 --- /dev/null +++ b/module/testcase/css/automation.css @@ -0,0 +1 @@ +table a.refresh {border-color: white;} diff --git a/module/testcase/js/automation.js b/module/testcase/js/automation.js new file mode 100644 index 0000000000..29a66f56fc --- /dev/null +++ b/module/testcase/js/automation.js @@ -0,0 +1,8 @@ +function loadNodes() +{ + var nodeLink = createLink('zanode', 'ajaxGetNodes'); + $('#nodeIdBox').load(nodeLink, function() + { + $('#nodeIdBox').find('#node').picker(); + }); +} diff --git a/module/testcase/view/automation.html.php b/module/testcase/view/automation.html.php index 20a2d96b99..f14d333418 100644 --- a/module/testcase/view/automation.html.php +++ b/module/testcase/view/automation.html.php @@ -33,26 +33,27 @@ zanode->common;?> - node) ? $automation->node : '', "class='form-control picker-select'");?> - + node) ? $automation->node : '', "class='form-control picker-select'");?> + + createLink('zanode', 'create'), $lang->zanode->create, '', "class='text-primary' target='_blank'");?> + ", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$lang->refresh}' onclick='loadNodes()'");?> + zanode->scriptPath;?> - scriptPath) ? $automation->scriptPath : '', "class='form-control'");?> + scriptPath) ? $automation->scriptPath : '', "class='form-control' placeholder='{$lang->zanode->scriptTips}'");?> - zanode->shell;?> - shell) ? $automation->shell : '', "rows='6' class='form-control'");?> + shell) ? $automation->shell : '', "rows='6' class='form-control' placeholder='{$lang->zanode->shellTips}'");?> - diff --git a/module/zahost/control.php b/module/zahost/control.php index 0e25e3911e..1af478abed 100644 --- a/module/zahost/control.php +++ b/module/zahost/control.php @@ -44,7 +44,7 @@ class zahost extends control $showFeature = false; $accounts = !empty($this->config->global->skipAutomation) ? $this->config->global->skipAutomation : ''; - if(strpos(",$accounts,", $this->app->user->account) === false) + if(strpos(",$accounts,", $this->app->user->account) === false) { $showFeature = true; $accounts .= ',' . $this->app->user->account; @@ -109,6 +109,7 @@ class zahost extends control } $viewLink = $this->createLink('zahost', 'view', "hostID=$hostID"); + if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => 'parent.loadHosts()')); return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $viewLink)); } @@ -368,4 +369,16 @@ class zahost extends control return $this->send(array('result' => 'success', 'message' => '', 'data' => $serviceStatus)); } + + /** + * Ajax:get hosts. + * + * @access public + * @return void + */ + public function ajaxGetHosts() + { + $hostList = $this->zahost->getPairs(); + return print(html::select("parent", $hostList, '', "class='form-control chosen'")); + } } diff --git a/module/zanode/control.php b/module/zanode/control.php index 7360defed1..d10c470029 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -626,4 +626,16 @@ class zanode extends control return $this->send(array('result' => 'success', 'message' => 'success')); } } + + /** + * Ajax:get nodes. + * + * @access public + * @return void + */ + public function ajaxGetNodes() + { + $nodeList = $this->zanode->getPairs(); + return print(html::select("node", $nodeList, '', "class='form-control picker-select'")); + } } diff --git a/module/zanode/css/browse.css b/module/zanode/css/browse.css index 648be7123d..2fa468e984 100644 --- a/module/zanode/css/browse.css +++ b/module/zanode/css/browse.css @@ -7,3 +7,6 @@ .desktop, .createImage{margin-right: 4px;} #helpTab .icon-help {line-height: unset;} #bysearchTab {margin-right: 0px;} + +.c-actions a img{position: relative; left: -80px; filter: drop-shadow(#18a6fd 80px 0); width: 18px;} +.c-actions a.disabled img {filter: drop-shadow(#313c52 80px 0);} diff --git a/module/zanode/css/view.css b/module/zanode/css/view.css index 66481a016a..1c198cb0cf 100644 --- a/module/zanode/css/view.css +++ b/module/zanode/css/view.css @@ -17,4 +17,5 @@ .node-not-wrap{white-space: nowrap;} .btn-info {background-color: unset;} .btn.disabled i {color: #fff;} +.btn-toolbar a img{margin-bottom: 1px;} #serviceContent{min-height: 120px;} diff --git a/module/zanode/js/create.js b/module/zanode/js/create.js index bd96c2ca22..4fa5ae9c80 100644 --- a/module/zanode/js/create.js +++ b/module/zanode/js/create.js @@ -1,4 +1,10 @@ -function zahostType() +/** + * Change zanode type. + * + * @access public + * @return void + */ +function zanodeType() { if($('#type').val() == 'physics') { @@ -17,3 +23,18 @@ function zahostType() $('#osNamePhysics').addClass('hidden'); } } + +/** + * Load hosts. + * + * @access public + * @return void + */ +function loadHosts() +{ + var hostLink = createLink('zahost', 'ajaxGetHosts'); + $('#hostIdBox').load(hostLink, function() + { + $('#hostIdBox').find('#parent').chosen(); + }); +} diff --git a/module/zanode/model.php b/module/zanode/model.php index 313eb4d24b..cd278381fb 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -622,7 +622,7 @@ class zanodemodel extends model { return $this->dao->select('*')->from(TABLE_ZAHOST) ->where('deleted')->eq(0) - ->andWhere("type")->eq('node') + ->andWhere("type")->in('node,physics') ->orderBy($orderBy) ->fetchAll('id'); } @@ -638,7 +638,7 @@ class zanodemodel extends model { return $this->dao->select('*')->from(TABLE_ZAHOST) ->where('deleted')->eq(0) - ->andWhere("type")->eq('node') + ->andWhere("type")->in('node,physics') ->orderBy($orderBy) ->fetchPairs('id', 'name'); } diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index e586757bfa..6f32044c4f 100644 --- a/module/zanode/view/browse.html.php +++ b/module/zanode/view/browse.html.php @@ -53,7 +53,7 @@ idAB); ?> zanode->name); ?> - zahost->type); ?> + zahost->type); ?> zanode->extranet); ?> zanode->cpuCores); ?> zanode->memory); ?> @@ -69,7 +69,7 @@ id; ?> inlink('view', "id=$node->id"), $node->name, '', ""); ?> - lang->zanode->typeList, $node->type); ?> + lang->zanode->typeList, $node->type); ?> extranet; ?> zanode->os->cpuCores, $node->cpuCores); ?> memory . $this->lang->zahost->unitList['GB']; ?> @@ -119,7 +119,7 @@ } common::printLink('zanode', 'reboot', "zanodeID={$node->id}", " ", '', $rebootAttr); - common::printLink('zanode', 'createSnapshot', "zanodeID={$node->id}", " ", '', $snapshotAttr, true, true); + common::printLink('zanode', 'createSnapshot', "zanodeID={$node->id}", " ", '', $snapshotAttr, true, true); if(common::hasPriv('zanode', 'createImage') or common::hasPriv('zanode', 'destroy')) { diff --git a/module/zanode/view/create.html.php b/module/zanode/view/create.html.php index 19f1a570df..766e69d26f 100644 --- a/module/zanode/view/create.html.php +++ b/module/zanode/view/create.html.php @@ -22,15 +22,15 @@
- + - + - - + + diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index 9a9c9ad15c..64686fcb72 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -212,7 +212,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou } common::printLink('zanode', 'reboot', "zanodeID={$zanode->id}", " " . $lang->zanode->rebootNode, '', $rebootAttr); - common::printLink('zanode', 'createSnapshot', "zanodeID={$zanode->id}", " " . $lang->zanode->createSnapshot, '', $snapshotAttr, true, true); + common::printLink('zanode', 'createSnapshot', "zanodeID={$zanode->id}", " " . $lang->zanode->createSnapshot, '', $snapshotAttr, true, true); } ?> diff --git a/www/static/svg/snapshot.svg b/www/static/svg/snapshot.svg new file mode 100644 index 0000000000..7de17aeb33 --- /dev/null +++ b/www/static/svg/snapshot.svg @@ -0,0 +1,10 @@ + + + 相机_o + + + + + + + From a762eb46e5ee3c2ecab8cf550192a1ed6ec17ccf Mon Sep 17 00:00:00 2001 From: zenggang Date: Fri, 3 Mar 2023 08:35:31 +0000 Subject: [PATCH 03/35] * Fix bug#32639 --- module/zanode/view/create.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zanode/view/create.html.php b/module/zanode/view/create.html.php index 766e69d26f..bddd7ac64f 100644 --- a/module/zanode/view/create.html.php +++ b/module/zanode/view/create.html.php @@ -30,7 +30,7 @@ - + From ff2825ae458549b94e272f8c64b15b6dcd638055 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 9 Mar 2023 11:30:19 +0800 Subject: [PATCH 04/35] * Finish task #86009. --- module/zanode/css/browsesnapshot.css | 1 + module/zanode/css/view.css | 1 + module/zanode/view/view.html.php | 13 ++++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/module/zanode/css/browsesnapshot.css b/module/zanode/css/browsesnapshot.css index d5033bef8f..583507c6a8 100644 --- a/module/zanode/css/browsesnapshot.css +++ b/module/zanode/css/browsesnapshot.css @@ -1,4 +1,5 @@ #main{min-width: 0!important;padding:0!important;} +#main .container{padding:0!important;} body{background-color: #fff!important;} .c-createdBy {width: 100px;} diff --git a/module/zanode/css/view.css b/module/zanode/css/view.css index 66481a016a..adb03140cd 100644 --- a/module/zanode/css/view.css +++ b/module/zanode/css/view.css @@ -18,3 +18,4 @@ .btn-info {background-color: unset;} .btn.disabled i {color: #fff;} #serviceContent{min-height: 120px;} +.btn-snap-create{width: 100px;height: 30px;} \ No newline at end of file diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index 9a9c9ad15c..dab1821780 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -156,7 +156,18 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
-
zanode->browseSnapshot;?>
+
+ zanode->browseSnapshot;?> +
+ status == 'running'){ + $snapshotAttr = "title='{$lang->zanode->createSnapshot}'"; + $snapshotAttr .= $zanode->status != 'running' ? ' class="btn btn-snap-create disabled"' : ' class="btn btn-primary btn-snap-create iframe"'; + common::printLink('zanode', 'createSnapshot', "zanodeID={$zanode->id}", " " . $lang->zanode->createSnapshot, '', $snapshotAttr, true, true); + } + ?> +
+
createLink('zanode', 'browseSnapshot', "nodeID=$zanode->id", '', true) . "' frameborder='no' allowfullscreen='true' mozallowfullscreen='true' webkitallowfullscreen='true' allowtransparency='true' scrolling='auto' style='min-height:300px;'>";?> From 4a7ceadf9b04ed865418f97606d0acb1fc95f165 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 9 Mar 2023 15:38:01 +0800 Subject: [PATCH 05/35] * Finish task #86155. --- api/v1/entries/hostheartbeat.php | 2 +- api/v1/entries/hostsubmit.php | 9 ++++++++- module/zanode/css/browse.css | 2 +- module/zanode/lang/de.php | 5 +++-- module/zanode/lang/en.php | 5 +++-- module/zanode/lang/fr.php | 5 +++-- module/zanode/lang/zh-cn.php | 5 +++-- module/zanode/model.php | 13 ++++++++++--- module/zanode/view/browse.html.php | 8 ++++---- module/zanode/view/view.html.php | 6 +++--- 10 files changed, 39 insertions(+), 21 deletions(-) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index 313f7f12bb..85a7b60e63 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -72,7 +72,7 @@ class hostHeartbeatEntry extends baseEntry $node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress); if(empty($node)) continue; - if(in_array($node->status, array('restoring', 'Creating_img', 'Creating_snap'))) + if(in_array($node->status, array('restoring', 'creating_img', 'creating_snap'))) $vm->status = $node->status; $vmData = array( 'vnc' => $vm->vncPortOnHost, diff --git a/api/v1/entries/hostsubmit.php b/api/v1/entries/hostsubmit.php index 9aea53faf2..07bb56112c 100644 --- a/api/v1/entries/hostsubmit.php +++ b/api/v1/entries/hostsubmit.php @@ -31,6 +31,7 @@ class hostSubmitEntry extends baseEntry $image = new stdclass(); $task = $this->requestBody->task; $image->status = $this->requestBody->status; + $image->status == 'complete' && $image->status = "completed"; $this->dao = $this->loadModel('common')->dao; $id = $this->dao->select('id')->from(TABLE_ZAHOST) @@ -40,10 +41,11 @@ class hostSubmitEntry extends baseEntry if(!$id) return $this->sendError(400, 'Secret error.'); - $imageInfo = $this->dao->select('`status`,`from`', 'name')->from(TABLE_IMAGE) + $imageInfo = $this->dao->select('`status`,`from`,name,host')->from(TABLE_IMAGE) ->where('id')->eq($task) ->fetch(); if(empty($imageInfo)) return $this->sendSuccess(200, 'success'); + if($imageInfo->from == 'snapshot' && $imageInfo->status == 'restoring') { if(in_array($image->status, array('failed', 'completed'))) $image->status = $image->status == 'completed' ? 'restore_completed' : 'restore_failed'; @@ -59,6 +61,11 @@ class hostSubmitEntry extends baseEntry $this->dao->update(TABLE_IMAGE)->data($image)->where("id")->eq($task)->exec(); + if($imageInfo->from != 'zentao' && in_array($imageInfo->status, array('creating', 'restoring'))) + { + $this->dao->update(TABLE_ZAHOST)->data(array("status" => "wait"))->where("id")->eq($imageInfo->host)->exec(); + } + return $this->sendSuccess(200, 'success'); } } diff --git a/module/zanode/css/browse.css b/module/zanode/css/browse.css index 648be7123d..0e04690ee1 100644 --- a/module/zanode/css/browse.css +++ b/module/zanode/css/browse.css @@ -1,6 +1,6 @@ .c-id {width: 70px;} .c-memory{width: 100px;} -.c-status {width: 70px;} +.c-status {width: 90px;} .c-cpu, .c-host {width: 100px;} .c-ip{width: 150px;} .c-os, .c-type {width: 120px;} diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 8fbb963c7c..0f86afb3bc 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -72,6 +72,7 @@ $lang->automation->scriptPath = $lang->zanode->scriptPath; $lang->automation->node = $lang->zanode->common; $lang->zanode->notFoundAgent = 'No Agent service is found'; +$lang->zanode->busy = 'This Node is %s, please wait for the operation to complete.'; $lang->zanode->createVmFail = 'Failed to create a ZenAgent Node'; $lang->zanode->noVncPort = 'Failed to get vnc port'; $lang->zanode->nameValid = "The name can only be letters, numbers, '-', '_', '.', and cannot start with a symbol"; @@ -134,8 +135,8 @@ $lang->zanode->statusList['destroy_fail'] = 'Destroy Fail'; $lang->zanode->statusList['wait'] = 'Initializing'; $lang->zanode->statusList['online'] = 'Online'; $lang->zanode->statusList['restoring'] = 'Restoring'; -$lang->zanode->statusList['Creating_snap'] = 'Creating Snapshot'; -$lang->zanode->statusList['Creating_img'] = 'Creating Image'; +$lang->zanode->statusList['creating_snap'] = 'Creating Snapshot'; +$lang->zanode->statusList['creating_img'] = 'Creating Image'; $lang->zanode->initNotice = "Succeeded. Please initialize the execution node or return to the list."; $lang->zanode->initButton = "Initialize"; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 66252eaadf..efd7bd1161 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -72,6 +72,7 @@ $lang->automation->scriptPath = $lang->zanode->scriptPath; $lang->automation->node = $lang->zanode->common; $lang->zanode->notFoundAgent = 'No Agent service is found'; +$lang->zanode->busy = 'This Node is %s, please wait for the operation to complete.'; $lang->zanode->createVmFail = 'Failed to create a ZenAgent Node'; $lang->zanode->noVncPort = 'Failed to get vnc port'; $lang->zanode->nameValid = "The name can only be letters, numbers, '-', '_', '.', and cannot start with a symbol"; @@ -134,8 +135,8 @@ $lang->zanode->statusList['destroy_fail'] = 'Destroy Fail'; $lang->zanode->statusList['wait'] = 'Initializing'; $lang->zanode->statusList['online'] = 'Online'; $lang->zanode->statusList['restoring'] = 'Restoring'; -$lang->zanode->statusList['Creating_snap'] = 'Creating Snapshot'; -$lang->zanode->statusList['Creating_img'] = 'Creating Image'; +$lang->zanode->statusList['creating_snap'] = 'Creating Snapshot'; +$lang->zanode->statusList['creating_img'] = 'Creating Image'; $lang->zanode->initNotice = "Succeeded. Please initialize the execution node or return to the list."; $lang->zanode->initButton = "Initialize"; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 8fbb963c7c..0f86afb3bc 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -72,6 +72,7 @@ $lang->automation->scriptPath = $lang->zanode->scriptPath; $lang->automation->node = $lang->zanode->common; $lang->zanode->notFoundAgent = 'No Agent service is found'; +$lang->zanode->busy = 'This Node is %s, please wait for the operation to complete.'; $lang->zanode->createVmFail = 'Failed to create a ZenAgent Node'; $lang->zanode->noVncPort = 'Failed to get vnc port'; $lang->zanode->nameValid = "The name can only be letters, numbers, '-', '_', '.', and cannot start with a symbol"; @@ -134,8 +135,8 @@ $lang->zanode->statusList['destroy_fail'] = 'Destroy Fail'; $lang->zanode->statusList['wait'] = 'Initializing'; $lang->zanode->statusList['online'] = 'Online'; $lang->zanode->statusList['restoring'] = 'Restoring'; -$lang->zanode->statusList['Creating_snap'] = 'Creating Snapshot'; -$lang->zanode->statusList['Creating_img'] = 'Creating Image'; +$lang->zanode->statusList['creating_snap'] = 'Creating Snapshot'; +$lang->zanode->statusList['creating_img'] = 'Creating Image'; $lang->zanode->initNotice = "Succeeded. Please initialize the execution node or return to the list."; $lang->zanode->initButton = "Initialize"; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index 2205d1ce1c..6b7e4d7565 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -72,6 +72,7 @@ $lang->automation->scriptPath = $lang->zanode->scriptPath; $lang->automation->node = $lang->zanode->common; $lang->zanode->notFoundAgent = '没有发现Agent服务'; +$lang->zanode->busy = '节点正在%s, 请等待操作完成'; $lang->zanode->createVmFail = '创建执行节点失败'; $lang->zanode->noVncPort = '无法获取执行节点端口'; $lang->zanode->nameValid = "名称只能是字母、数字,'-','_','.',且不能以符号开头"; @@ -134,8 +135,8 @@ $lang->zanode->statusList['destroy_fail'] = '销毁失败'; $lang->zanode->statusList['wait'] = '初始化中'; $lang->zanode->statusList['online'] = '已上架'; $lang->zanode->statusList['restoring'] = '还原中'; -$lang->zanode->statusList['Creating_snap'] = '创建快照中'; -$lang->zanode->statusList['Creating_img'] = '导出镜像中'; +$lang->zanode->statusList['creating_snap'] = '创建快照中'; +$lang->zanode->statusList['creating_img'] = '导出镜像中'; $lang->zanode->initNotice = "保存成功,请初始化执行节点或返回列表。"; $lang->zanode->initButton = "去初始化"; diff --git a/module/zanode/model.php b/module/zanode/model.php index 8c88c6fe03..b74e88339a 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -22,8 +22,8 @@ class zanodemodel extends model const STATUS_UNKNOWN = 'unknown'; const STATUS_DESTROY = 'destroy'; const STATUS_RESTORING = 'restoring'; - const STATUS_CREATING_SNAP = 'Creating_snap'; - const STATUS_CREATING_IMG = 'Creating_img'; + const STATUS_CREATING_SNAP = 'creating_snap'; + const STATUS_CREATING_IMG = 'creating_img'; const STATUS_DESTROY_FAIL = 'vim_destroy_fail'; const KVM_CREATE_PATH = '/api/v1/kvm/create'; @@ -187,7 +187,7 @@ class zanodemodel extends model if(!empty($result) and $result->code == 'success') { - $this->dao->update(TABLE_HOST)->set('status')->eq(static::STATUS_CREATING_SNAP)->where('id')->eq($node->id)->exec(); + $this->dao->update(TABLE_HOST)->set('status')->eq(static::STATUS_CREATING_IMG)->where('id')->eq($node->id)->exec(); return $newID; } @@ -429,6 +429,11 @@ class zanodemodel extends model { $node = $this->getNodeByID($id); + if(in_array($node->status, array('restoring', 'creating_img', 'creating_snap'))) + { + return sprintf($this->lang->zanode->busy, $this->lang->zanode->statusList[$node->status]); + } + /* Prepare create params. */ $agnetUrl = 'http://' . $node->ip . ':' . $node->hzap; $path = '/api/v1/kvm/' . $node->name . '/' . $type; @@ -835,6 +840,8 @@ class zanodemodel extends model ->where('mac')->eq($mac) ->fetch(); + if(empty($node)) return $node; + $host = $this->loadModel("zahost")->getByID($node->parent); if($node->status == 'running' || $node->status == 'ready') { diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index e586757bfa..6fad0df376 100644 --- a/module/zanode/view/browse.html.php +++ b/module/zanode/view/browse.html.php @@ -86,18 +86,18 @@ $resumeAttr .= $node->type == 'physics' || $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->type == 'physics' || $node->status == 'shutoff' || $node->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'"; + $rebootAttr .= $node->type == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring', 'shutoff')) ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'"; $closeAttr = "title='{$lang->zanode->shutdown}'"; - $closeAttr .= $node->type == 'physics' || $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; + $closeAttr .= $node->type == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"'; $startAttr = "title='{$lang->zanode->boot}'"; - $startAttr .= $node->type == 'physics' || $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; + $startAttr .= $node->type == 'physics' || in_array($node->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"'; $snapshotAttr = "title='{$lang->zanode->createSnapshot}'"; $snapshotAttr .= $node->type == 'physics' || $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"'; + $imageAttr = $node->status != 'running' && $node->status != 'creating_img' ? ' 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") diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index dab1821780..288eee8ed9 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -192,13 +192,13 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou $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' || $zanode->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'"; + $rebootAttr .= in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring', 'shutoff')) ? ' 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 .= in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"'; $startAttr = "title='{$lang->zanode->boot}'"; - $startAttr .= $zanode->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; + $startAttr .= in_array($zanode->status, array('wait', 'creating_img', 'creating_snap', 'restoring')) ? ' class="btn disabled"' : ' class="btn iframe"'; $snapshotAttr = "title='{$lang->zanode->createSnapshot}'"; $snapshotAttr .= $zanode->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"'; From a94b33dc8b8de6771bd4948d54e88c2b8be07d55 Mon Sep 17 00:00:00 2001 From: zenggang Date: Fri, 10 Mar 2023 01:52:04 +0000 Subject: [PATCH 06/35] * Finish task#86410,86409 --- module/gitea/css/create.css | 2 ++ module/gitea/view/create.html.php | 1 - module/gitlab/css/create.css | 2 ++ module/gitlab/lang/de.php | 2 +- module/gitlab/lang/en.php | 2 +- module/gitlab/lang/fr.php | 2 +- module/gitlab/lang/zh-cn.php | 2 +- module/gitlab/view/browse.html.php | 2 +- module/gitlab/view/create.html.php | 1 - module/gogs/css/create.css | 2 ++ module/gogs/view/create.html.php | 1 - module/jenkins/css/create.css | 2 ++ module/jenkins/view/create.html.php | 8 ++------ module/sonarqube/css/create.css | 2 ++ module/sonarqube/view/create.html.php | 1 - 15 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 module/gitea/css/create.css create mode 100644 module/gitlab/css/create.css create mode 100644 module/gogs/css/create.css create mode 100644 module/jenkins/css/create.css diff --git a/module/gitea/css/create.css b/module/gitea/css/create.css new file mode 100644 index 0000000000..807e1a132b --- /dev/null +++ b/module/gitea/css/create.css @@ -0,0 +1,2 @@ +.main-content>.center-block {max-width: 800px;} +#giteaForm table {width: 600px;} diff --git a/module/gitea/view/create.html.php b/module/gitea/view/create.html.php index a5a176aa6c..e42c7b0f33 100644 --- a/module/gitea/view/create.html.php +++ b/module/gitea/view/create.html.php @@ -22,7 +22,6 @@
- diff --git a/module/gitlab/css/create.css b/module/gitlab/css/create.css new file mode 100644 index 0000000000..09df31008b --- /dev/null +++ b/module/gitlab/css/create.css @@ -0,0 +1,2 @@ +.main-content>.center-block {max-width: 800px;} +#gitlabForm table {width: 600px;} diff --git a/module/gitlab/lang/de.php b/module/gitlab/lang/de.php index cf37e4bbec..60aa6179d5 100644 --- a/module/gitlab/lang/de.php +++ b/module/gitlab/lang/de.php @@ -5,7 +5,7 @@ $lang->gitlab->search = 'Search'; $lang->gitlab->create = 'Create GitLab'; $lang->gitlab->edit = 'Edit GitLab'; $lang->gitlab->view = 'View GitLab'; -$lang->gitlab->bindUser = 'Bind User'; +$lang->gitlab->bindUser = 'Permission Setting'; $lang->gitlab->webhook = 'Webhook'; $lang->gitlab->bindProduct = "Import {$lang->productCommon}"; $lang->gitlab->importIssue = 'Import Issue'; diff --git a/module/gitlab/lang/en.php b/module/gitlab/lang/en.php index cf37e4bbec..60aa6179d5 100644 --- a/module/gitlab/lang/en.php +++ b/module/gitlab/lang/en.php @@ -5,7 +5,7 @@ $lang->gitlab->search = 'Search'; $lang->gitlab->create = 'Create GitLab'; $lang->gitlab->edit = 'Edit GitLab'; $lang->gitlab->view = 'View GitLab'; -$lang->gitlab->bindUser = 'Bind User'; +$lang->gitlab->bindUser = 'Permission Setting'; $lang->gitlab->webhook = 'Webhook'; $lang->gitlab->bindProduct = "Import {$lang->productCommon}"; $lang->gitlab->importIssue = 'Import Issue'; diff --git a/module/gitlab/lang/fr.php b/module/gitlab/lang/fr.php index cf37e4bbec..60aa6179d5 100644 --- a/module/gitlab/lang/fr.php +++ b/module/gitlab/lang/fr.php @@ -5,7 +5,7 @@ $lang->gitlab->search = 'Search'; $lang->gitlab->create = 'Create GitLab'; $lang->gitlab->edit = 'Edit GitLab'; $lang->gitlab->view = 'View GitLab'; -$lang->gitlab->bindUser = 'Bind User'; +$lang->gitlab->bindUser = 'Permission Setting'; $lang->gitlab->webhook = 'Webhook'; $lang->gitlab->bindProduct = "Import {$lang->productCommon}"; $lang->gitlab->importIssue = 'Import Issue'; diff --git a/module/gitlab/lang/zh-cn.php b/module/gitlab/lang/zh-cn.php index 8483edf40c..37f1528d86 100644 --- a/module/gitlab/lang/zh-cn.php +++ b/module/gitlab/lang/zh-cn.php @@ -5,7 +5,7 @@ $lang->gitlab->search = '搜索'; $lang->gitlab->create = '添加GitLab'; $lang->gitlab->edit = '编辑GitLab'; $lang->gitlab->view = '查看GitLab'; -$lang->gitlab->bindUser = '绑定用户'; +$lang->gitlab->bindUser = '权限设置'; $lang->gitlab->webhook = 'Webhook'; $lang->gitlab->bindProduct = "关联{$lang->productCommon}"; $lang->gitlab->importIssue = '关联issue'; diff --git a/module/gitlab/view/browse.html.php b/module/gitlab/view/browse.html.php index 37dde0aabe..cb47b665e9 100644 --- a/module/gitlab/view/browse.html.php +++ b/module/gitlab/view/browse.html.php @@ -56,7 +56,7 @@ diff --git a/module/gitlab/view/create.html.php b/module/gitlab/view/create.html.php index 9df06b923e..4c34df003a 100644 --- a/module/gitlab/view/create.html.php +++ b/module/gitlab/view/create.html.php @@ -23,7 +23,6 @@ - diff --git a/module/gogs/css/create.css b/module/gogs/css/create.css new file mode 100644 index 0000000000..eca6cd5850 --- /dev/null +++ b/module/gogs/css/create.css @@ -0,0 +1,2 @@ +.main-content>.center-block {max-width: 800px;} +#gogsForm table {width: 600px;} diff --git a/module/gogs/view/create.html.php b/module/gogs/view/create.html.php index 62c109f8fd..eab94d08c6 100644 --- a/module/gogs/view/create.html.php +++ b/module/gogs/view/create.html.php @@ -22,7 +22,6 @@ - diff --git a/module/jenkins/css/create.css b/module/jenkins/css/create.css new file mode 100644 index 0000000000..84a9608681 --- /dev/null +++ b/module/jenkins/css/create.css @@ -0,0 +1,2 @@ +.main-content>.center-block {max-width: 800px;} +#jenkinsForm table {width: 600px;} diff --git a/module/jenkins/view/create.html.php b/module/jenkins/view/create.html.php index 75e91d1574..ed065495dd 100644 --- a/module/jenkins/view/create.html.php +++ b/module/jenkins/view/create.html.php @@ -22,12 +22,10 @@ - - @@ -35,13 +33,11 @@ - - + - - + - From 567b3d79c61d94f06180c427db4ff25eaa715e10 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 10 Mar 2023 20:01:06 +0800 Subject: [PATCH 07/35] * Finish task #86397. --- module/gitlab/control.php | 29 ++++++++++++-- module/gitlab/css/common.css | 7 ++++ module/gitlab/js/binduser.js | 11 +++++ module/gitlab/lang/de.php | 5 ++- module/gitlab/lang/en.php | 5 ++- module/gitlab/lang/fr.php | 5 ++- module/gitlab/lang/vi.php | 5 ++- module/gitlab/lang/zh-cn.php | 5 ++- module/gitlab/lang/zh-tw.php | 2 + module/gitlab/view/binduser.html.php | 60 +++++++++++++++++++--------- 10 files changed, 107 insertions(+), 27 deletions(-) create mode 100644 module/gitlab/js/binduser.js diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 33cfacfc41..2242e946d9 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -132,7 +132,7 @@ class gitlab extends control * @access public * @return void */ - public function bindUser($gitlabID) + public function bindUser($gitlabID, $type = 'all') { $userPairs = $this->loadModel('user')->getPairs('noclosed|noletter'); @@ -188,11 +188,32 @@ class gitlab extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer)); } + $gitlabUsers = $this->gitlab->apiGetUsers($gitlabID); + $bindedUsers = $this->gitlab->getUserAccountIdPairs($gitlabID); + $matchedResult = $this->gitlab->getMatchedUsers($gitlabID, $gitlabUsers, $zentaoUsers); + $matchedResult = array_column(json_decode(json_encode($matchedResult), true), null, "email"); + + $gitlabUsers = array_filter($gitlabUsers, function($item) use($bindedUsers, $userPairs, $type) + { + if($type == 'all') return true; + + if(in_array($item->id, $bindedUsers)) + { + $zentaoAccount = isset($item->zentaoAccount) ? zget($userPairs, $item->zentaoAccount, '') : ''; + return $type == 'binded' ? !empty($zentaoAccount) : empty($zentaoAccount); + } + return $type == 'binded' ? false : true; + }); + $this->view->title = $this->lang->gitlab->bindUser; + $this->view->zentaoUsers = $zentaoUsers; $this->view->userPairs = $userPairs; - $this->view->gitlabUsers = $this->gitlab->apiGetUsers($gitlabID); - $this->view->bindedUsers = $this->gitlab->getUserAccountIdPairs($gitlabID); - $this->view->matchedResult = $this->gitlab->getMatchedUsers($gitlabID, $this->view->gitlabUsers, $zentaoUsers); + $this->view->type = $type; + $this->view->gitlabID = $gitlabID; + $this->view->gitlabUsers = $gitlabUsers; + $this->view->bindedUsers = $bindedUsers; + $this->view->matchedResult = $matchedResult; + $this->display(); } diff --git a/module/gitlab/css/common.css b/module/gitlab/css/common.css index ad50c2a1d2..d31a13a052 100644 --- a/module/gitlab/css/common.css +++ b/module/gitlab/css/common.css @@ -1,2 +1,9 @@ #publicTip {padding-left: 10px;} .table-form>tbody>tr>th {width: 110px;} +.gitlab-bind .btn-info{background-color: unset;color:unset;padding: 6px 6px;} +.gitlab-bind .btn-info.active{color: #2e7fff;background-color: rgba(239,239,239,.8); +border-color: rgba(0,0,0,0);} +.gitlab-bind-all{padding: 1px 6px;margin-left: 5px;border-radius: 10px;background: white;} +.img-circle {border-radius: 50%;} +.gitlab-account-desc{color: #9EA3B0;font-size: 12px;} +.gitlab-user-select .chosen-container{max-width: 200px;} \ No newline at end of file diff --git a/module/gitlab/js/binduser.js b/module/gitlab/js/binduser.js new file mode 100644 index 0000000000..a4b6cc07c2 --- /dev/null +++ b/module/gitlab/js/binduser.js @@ -0,0 +1,11 @@ +$(document).ready(function() +{ + $('.gitlab-user-bind').change(function() + { + var user = zentaoUsers[$(this).val()]; + if(user !== undefined) + { + $(this).parent().parent().find('.email').text(user.email) + } + }); +}); \ No newline at end of file diff --git a/module/gitlab/lang/de.php b/module/gitlab/lang/de.php index cf37e4bbec..61af111258 100644 --- a/module/gitlab/lang/de.php +++ b/module/gitlab/lang/de.php @@ -13,9 +13,12 @@ $lang->gitlab->delete = 'Delete GitLab'; $lang->gitlab->confirmDelete = 'Do you want to delete this GitLab server?'; $lang->gitlab->gitlabAvatar = 'Avatar'; $lang->gitlab->gitlabAccount = 'GitLab Account'; -$lang->gitlab->gitlabEmail = 'Email'; +$lang->gitlab->gitlabEmail = 'GitLab User\'s Email'; +$lang->gitlab->zentaoEmail = 'Zentao User\'s Email'; $lang->gitlab->zentaoAccount = 'Zentao Account'; +$lang->gitlab->accountDesc = '(Automatically match users with the same email)'; $lang->gitlab->bindingStatus = 'Binding Status'; +$lang->gitlab->all = 'All'; $lang->gitlab->notBind = 'Not bind'; $lang->gitlab->binded = 'Binded'; $lang->gitlab->bindedError = 'The bound user has been deleted or modified. Please bind again.'; diff --git a/module/gitlab/lang/en.php b/module/gitlab/lang/en.php index cf37e4bbec..61af111258 100644 --- a/module/gitlab/lang/en.php +++ b/module/gitlab/lang/en.php @@ -13,9 +13,12 @@ $lang->gitlab->delete = 'Delete GitLab'; $lang->gitlab->confirmDelete = 'Do you want to delete this GitLab server?'; $lang->gitlab->gitlabAvatar = 'Avatar'; $lang->gitlab->gitlabAccount = 'GitLab Account'; -$lang->gitlab->gitlabEmail = 'Email'; +$lang->gitlab->gitlabEmail = 'GitLab User\'s Email'; +$lang->gitlab->zentaoEmail = 'Zentao User\'s Email'; $lang->gitlab->zentaoAccount = 'Zentao Account'; +$lang->gitlab->accountDesc = '(Automatically match users with the same email)'; $lang->gitlab->bindingStatus = 'Binding Status'; +$lang->gitlab->all = 'All'; $lang->gitlab->notBind = 'Not bind'; $lang->gitlab->binded = 'Binded'; $lang->gitlab->bindedError = 'The bound user has been deleted or modified. Please bind again.'; diff --git a/module/gitlab/lang/fr.php b/module/gitlab/lang/fr.php index cf37e4bbec..9e16581a3c 100644 --- a/module/gitlab/lang/fr.php +++ b/module/gitlab/lang/fr.php @@ -13,9 +13,12 @@ $lang->gitlab->delete = 'Delete GitLab'; $lang->gitlab->confirmDelete = 'Do you want to delete this GitLab server?'; $lang->gitlab->gitlabAvatar = 'Avatar'; $lang->gitlab->gitlabAccount = 'GitLab Account'; -$lang->gitlab->gitlabEmail = 'Email'; +$lang->gitlab->gitlabEmail = 'GitLab User\'s Email'; +$lang->gitlab->zentaoEmail = 'Zentao User\'s Email'; $lang->gitlab->zentaoAccount = 'Zentao Account'; +$lang->gitlab->accountDesc = '(System will automatically match users with the same email address)'; $lang->gitlab->bindingStatus = 'Binding Status'; +$lang->gitlab->all = 'All'; $lang->gitlab->notBind = 'Not bind'; $lang->gitlab->binded = 'Binded'; $lang->gitlab->bindedError = 'The bound user has been deleted or modified. Please bind again.'; diff --git a/module/gitlab/lang/vi.php b/module/gitlab/lang/vi.php index f3b3b2d451..f858af5575 100644 --- a/module/gitlab/lang/vi.php +++ b/module/gitlab/lang/vi.php @@ -13,9 +13,12 @@ $lang->gitlab->delete = 'Delete GitLab'; $lang->gitlab->confirmDelete = 'Do you want to delete this GitLab server?'; $lang->gitlab->gitlabAvatar = 'Avatar'; $lang->gitlab->gitlabAccount = 'GitLab Account'; -$lang->gitlab->gitlabEmail = 'Email'; +$lang->gitlab->gitlabEmail = 'GitLab User\'s Email'; +$lang->gitlab->zentaoEmail = 'Zentao User\'s Email'; $lang->gitlab->zentaoAccount = 'Zentao Account'; +$lang->gitlab->accountDesc = '(System will automatically match users with the same email address)'; $lang->gitlab->bindingStatus = 'Binding Status'; +$lang->gitlab->all = 'All'; $lang->gitlab->notBind = 'Not bind'; $lang->gitlab->binded = 'Binded'; $lang->gitlab->bindedError = 'The bound user has been deleted or modified. Please bind again.'; diff --git a/module/gitlab/lang/zh-cn.php b/module/gitlab/lang/zh-cn.php index 8483edf40c..138b3dd931 100644 --- a/module/gitlab/lang/zh-cn.php +++ b/module/gitlab/lang/zh-cn.php @@ -13,9 +13,12 @@ $lang->gitlab->delete = '删除GitLab'; $lang->gitlab->confirmDelete = '确认删除该GitLab吗?'; $lang->gitlab->gitlabAvatar = '头像'; $lang->gitlab->gitlabAccount = 'GitLab用户'; -$lang->gitlab->gitlabEmail = '邮箱'; +$lang->gitlab->gitlabEmail = 'GitLab用户邮箱'; +$lang->gitlab->zentaoEmail = '禅道用户邮箱'; $lang->gitlab->zentaoAccount = '禅道用户'; +$lang->gitlab->accountDesc = '(系统会将相同邮箱地址的用户自动匹配)'; $lang->gitlab->bindingStatus = '绑定状态'; +$lang->gitlab->all = '全部'; $lang->gitlab->notBind = '未绑定'; $lang->gitlab->binded = '已绑定'; $lang->gitlab->bindedError = '绑定的用户已删除或者已修改,请重新绑定'; diff --git a/module/gitlab/lang/zh-tw.php b/module/gitlab/lang/zh-tw.php index 3ceb69d896..81e5f2714f 100644 --- a/module/gitlab/lang/zh-tw.php +++ b/module/gitlab/lang/zh-tw.php @@ -13,7 +13,9 @@ $lang->gitlab->delete = '刪除GitLab'; $lang->gitlab->confirmDelete = '確認刪除該GitLab嗎?'; $lang->gitlab->gitlabAccount = 'GitLab用戶'; $lang->gitlab->zentaoAccount = '禪道用戶'; +$lang->gitlab->accountDesc = '(系統會將相同郵箱地址的用戶自動匹配)'; $lang->gitlab->bindingStatus = '綁定狀態'; +$lang->gitlab->all = '全部'; $lang->gitlab->binded = '已綁定'; $lang->gitlab->bindedError = '綁定的用戶已刪除或者已修改,請重新綁定'; $lang->gitlab->serverFail = '連接GitLab伺服器異常,請檢查GitLab伺服器。'; diff --git a/module/gitlab/view/binduser.html.php b/module/gitlab/view/binduser.html.php index d06281144c..8c89ec2f27 100644 --- a/module/gitlab/view/binduser.html.php +++ b/module/gitlab/view/binduser.html.php @@ -11,19 +11,45 @@ */ ?> +createLink('gitlab', 'browse', ""); ?> +
-
-

gitlab->bindUser;?>

+
+ ' . $lang->goback, $browseLink, 'self', "data-app='{$app->tab}'", 'btn btn-secondary'); + + $allLink = $this->createLink('gitlab', 'binduser', "gitlabID={$gitlabID}&type=all"); + $bindedLink = $this->createLink('gitlab', 'binduser', "gitlabID={$gitlabID}&type=binded"); + $notBindLink = $this->createLink('gitlab', 'binduser', "gitlabID={$gitlabID}&type=notBind"); + if($type == 'all') + { + echo html::linkButton('' . $lang->gitlab->all . "" . count($gitlabUsers) . "", $allLink, 'self', "data-app='{$app->tab}'", 'btn btn-info active'); + echo html::linkButton('' . $lang->gitlab->notBind, $notBindLink, 'self', "data-app='{$app->tab}'", 'btn btn-info'); + echo html::linkButton('' . $lang->gitlab->binded, $bindedLink, 'self', "data-app='{$app->tab}'", 'btn btn-info'); + } + else if($type == 'binded') + { + echo html::linkButton('' . $lang->gitlab->all, $allLink, 'self', "data-app='{$app->tab}'", 'btn btn-info'); + echo html::linkButton('' . $lang->gitlab->notBind, $notBindLink, 'self', "data-app='{$app->tab}'", 'btn btn-info'); + echo html::linkButton('' . $lang->gitlab->binded . "" . count($gitlabUsers) . "", $bindedLink, 'self', "data-app='{$app->tab}'", 'btn btn-info active'); + } + else + { + echo html::linkButton('' . $lang->gitlab->all, $allLink, 'self', "data-app='{$app->tab}'", 'btn btn-info'); + echo html::linkButton('' . $lang->gitlab->notBind . "" . count($gitlabUsers) . "", $notBindLink, 'self', "data-app='{$app->tab}'", 'btn btn-info active'); + echo html::linkButton('' . $lang->gitlab->binded, $bindedLink, 'self', "data-app='{$app->tab}'", 'btn btn-info'); + } + ?>
-
zahost->type;?>zanode->typeList, 'virtual', "class='form-control chosen' onchange='zahostType()'")?>zanode->typeList, 'virtual', "class='form-control chosen' onchange='zanodeType()'")?>
zanode->hostName;?>createLink('zahost', 'create') . '?onlybody=yes', $lang->zahost->create, '', "class='text-primary iframe'");?>
zanode->name;?>
zanode->hostName;?> createLink('zahost', 'create') . '?onlybody=yes', $lang->zahost->create, '', "class='text-primary iframe'");?>createLink('zahost', 'create', array(), '', true), $lang->zahost->create, '', "class='text-primary iframe'");?>
zanode->name;?>
gitea->name;?>
gitea->url;?>
gitlab->name;?> gitlab->placeholder->name}'");?>
gitlab->url;?>
gogs->name;?>
gogs->url;?>
jenkins->name; ?>
jenkins->url; ?>
jenkins->account;?>
jenkins->token;?>jenkins->tokenFirst;?>jenkins->tokenFirst}'");?>
jenkins->password;?>jenkins->tips;?>jenkins->tips}'");?>
diff --git a/module/sonarqube/css/create.css b/module/sonarqube/css/create.css index 22cf991723..bf9498be54 100644 --- a/module/sonarqube/css/create.css +++ b/module/sonarqube/css/create.css @@ -1,2 +1,4 @@ .table-form .c-name {width: 130px;} .table-form .c-input {width: 650px;} +.main-content>.center-block {max-width: 900px;} +#sonarqubeForm table {width: 700px;} diff --git a/module/sonarqube/view/create.html.php b/module/sonarqube/view/create.html.php index 2aa74e49d2..35988a653b 100644 --- a/module/sonarqube/view/create.html.php +++ b/module/sonarqube/view/create.html.php @@ -22,7 +22,6 @@
sonarqube->name;?> sonarqube->placeholder->name}'");?>
sonarqube->url;?>
+
- - + + @@ -32,29 +58,27 @@ zentaoAccount)) continue;?> id]", $gitlabUser->realname);?> - - - - + + + zentaoAccount)) continue;?> id]", $gitlabUser->realname);?> - - + + From 5db08a5f04154cfd0be7a163bdb964ff3067ee81 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 14 Mar 2023 17:40:43 +0800 Subject: [PATCH 08/35] * Add support physics machine in zanode module,finish task #85169 cost:10h. --- api/v1/entries/hostheartbeat.php | 21 +++++++++----- module/zanode/config.php | 2 +- module/zanode/control.php | 19 ++++++------- module/zanode/css/view.css | 5 ++-- module/zanode/js/create.js | 2 +- module/zanode/js/view.js | 26 ++++++++++++++++-- module/zanode/lang/de.php | 6 ++-- module/zanode/lang/en.php | 6 ++-- module/zanode/lang/fr.php | 3 ++ module/zanode/lang/zh-cn.php | 6 ++-- module/zanode/model.php | 44 ++++++++++++++++++++---------- module/zanode/view/browse.html.php | 16 +++++------ module/zanode/view/create.html.php | 2 +- module/zanode/view/edit.html.php | 10 +++---- module/zanode/view/view.html.php | 34 +++++++++++++---------- 15 files changed, 131 insertions(+), 71 deletions(-) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index 1d54b4c9c2..16946fb0f7 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -28,8 +28,8 @@ class hostHeartbeatEntry extends baseEntry /* Check param. */ $status = $this->requestBody->status; - $vms = $this->requestBody->Vms; - $zap = $this->requestBody->port; + $vms = !empty($this->requestBody->Vms) ? $this->requestBody->Vms : array(); + $zap = !empty($this->requestBody->port) ? $this->requestBody->port : 0; $now = helper::now(); if(!$status) return $this->sendError(400, 'Params error.'); @@ -37,7 +37,7 @@ class hostHeartbeatEntry extends baseEntry $conditionValue = $secret ? $secret : $token; $this->dao = $this->loadModel('common')->dao; - $hostInfo = $this->dao->select('id,tokenSN')->from(TABLE_ZAHOST) + $hostInfo = $this->dao->select('id,tokenSN,hostType')->from(TABLE_ZAHOST) ->beginIF($secret)->where('secret')->eq($secret)->fi() ->beginIF(!$secret)->where('tokenSN')->eq($token) ->andWhere('tokenTime')->gt($now)->fi() @@ -83,11 +83,18 @@ 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') + if($hostInfo->hostType == 'physics') { - $node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress); + $this->dao->update(TABLE_ZAHOST)->data($vmData)->where('id')->eq($hostInfo->id)->exec(); + } + else + { + $this->dao->update(TABLE_ZAHOST)->data($vmData)->where('mac')->eq($vm->macAddress)->exec(); + } + + if($vm->status == 'running' && $hostInfo->hostType != 'physics') + { + $node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress); if(!empty($node)) { $snaps = $this->loadModel('zanode')->getSnapshotList($node->id); diff --git a/module/zanode/config.php b/module/zanode/config.php index c8a81099d6..cf21004640 100644 --- a/module/zanode/config.php +++ b/module/zanode/config.php @@ -12,7 +12,7 @@ $config->zanode->defaultAccount = 'z'; $config->zanode->defaultWinAccount = 'admin'; $config->zanode->defaultPwd = 'CQdliYQn6tKkoFhP'; -$config->zanode->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -szvm -z%s'; +$config->zanode->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -s zvm -k %s -z %s'; $config->zanode->os = new stdClass(); diff --git a/module/zanode/control.php b/module/zanode/control.php index d10c470029..87ee162afc 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -161,17 +161,16 @@ class zanode extends control $node = $this->zanode->getNodeByID($id); $vnc = $this->zanode->getVncUrl($node); - /* Add action log. */ - // if(!empty($vnc->token)) $this->loadModel('action')->create('zanode', $id, 'getVNC'); - - $this->view->url = $node->ip . ":" . $node->hzap; - $this->view->host = !empty($vnc->hostIP) ? $vnc->hostIP:''; - $this->view->token = !empty($vnc->token) ? $vnc->token:''; - $this->view->title = $this->lang->zanode->view; - $this->view->zanode = $node; + $this->view->url = $node->ip . ":" . $node->hzap; + $this->view->host = !empty($vnc->hostIP) ? $vnc->hostIP:''; + $this->view->token = !empty($vnc->token) ? $vnc->token:''; + $this->view->title = $this->lang->zanode->view; + $this->view->zanode = $node; $this->view->snapshotList = $this->zanode->getSnapshotList($id); - $this->view->actions = $this->loadModel('action')->getList('zanode', $id); - $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->view->initBash = sprintf($this->config->zanode->initBash, $node->secret, getWebRoot(true)); + $this->view->actions = $this->loadModel('action')->getList('zanode', $id); + $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->display(); } diff --git a/module/zanode/css/view.css b/module/zanode/css/view.css index 1c198cb0cf..2861d331c8 100644 --- a/module/zanode/css/view.css +++ b/module/zanode/css/view.css @@ -7,10 +7,10 @@ .zanode-mt-8{margin-top: 8px;} .zanode-status-text{margin-left: 10px;font:small-caption;color:#838a9d;} .zanode-status-text i{color:#18a6fd} -.status-notice{margin-top: 8px;margin-left: 18px;line-height: 28px;} +.status-notice{margin-top: 16px;line-height: 28px;} .status-notice a{color: #2463c7;} .service-status a{color: #2463c7;} -.service-status{margin-top: 10px;} +.service-status{margin-top: 5px;} .vnc-detail{height: 60vh;min-height: 550px;} .vnc-mask{width: 100%;height:100%;background-color: rgba(0,0,0,0);position: absolute;z-index: 1;} .checkStatus{color: #313c52;} @@ -19,3 +19,4 @@ .btn.disabled i {color: #fff;} .btn-toolbar a img{margin-bottom: 1px;} #serviceContent{min-height: 120px;} +.zanode-init{padding:15px;background: #f4f5f7;margin:10px 0;} diff --git a/module/zanode/js/create.js b/module/zanode/js/create.js index 4fa5ae9c80..153bc3b0d0 100644 --- a/module/zanode/js/create.js +++ b/module/zanode/js/create.js @@ -6,7 +6,7 @@ */ function zanodeType() { - if($('#type').val() == 'physics') + if($('#hostType').val() == 'physics') { $('#parent').closest('tr').hide(); $('#image').closest('tr').hide(); diff --git a/module/zanode/js/view.js b/module/zanode/js/view.js index d46022f99f..8a3d6c81c5 100644 --- a/module/zanode/js/view.js +++ b/module/zanode/js/view.js @@ -88,14 +88,14 @@ function checkServiceStatus(){ if(!isSuccess) { - // $('.init-fail').show(); + $('.init-fail').show(); $('.init-success').hide(); } else { clearInterval(checkInterval) $('.init-success').show(); - // $('.init-fail').hide(); + $('.init-fail').hide(); } setTimeout(function() { $('#serviceContent').removeClass('loading'); @@ -161,6 +161,28 @@ $('.btn-pwd-copy').live('click', function() }, 2000) }) +$('.btn-init-copy').live('click', function() +{ + var copyText = $('#initBash'); + copyText.show(); + copyText .select(); + document.execCommand("Copy"); + copyText.hide(); + $('.btn-init-copy').tooltip({ + trigger: 'click', + placement: 'top', + title: zanodeLang.copied, + tipClass: 'tooltip-success' + }); + + $(this).tooltip('show'); + var that = this; + setTimeout(function() + { + $(that).tooltip('hide') + }, 2000) +}) + $('.btn-pwd-show').live('click', function() { var pwd = $('#pwd-copy').text(); diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index 2d269e533c..2af03c56ef 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -63,6 +63,9 @@ $lang->zanode->manual = 'Manual'; $lang->zanode->initializing = 'Initializing'; $lang->zanode->showPwd = 'Show Password'; $lang->zanode->hidePwd = 'Hide Password'; +$lang->zanode->baseInfo = 'Basic information'; +$lang->zanode->cpuUnit = 'CORE'; +$lang->zanode->IP = 'Extranet Address'; $lang->zanode->typeList['node'] = 'Virtual machine'; $lang->zanode->typeList['physics'] = 'Physical machine'; @@ -149,8 +152,7 @@ $lang->zanode->init->next = "Next"; $lang->zanode->init->button = "Go To Settings"; $lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; -$lang->zanode->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:"; -$lang->zanode->init->initFailNoticeDesc = "1. Re-execute the script
2. Review the initialization FAQ"; +$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; $lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 996e12770c..0201c94e57 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -63,6 +63,9 @@ $lang->zanode->manual = 'Manual'; $lang->zanode->initializing = 'Initializing'; $lang->zanode->showPwd = 'Show Password'; $lang->zanode->hidePwd = 'Hide Password'; +$lang->zanode->baseInfo = 'Basic information'; +$lang->zanode->cpuUnit = 'CORE'; +$lang->zanode->IP = 'Extranet Address'; $lang->zanode->typeList['node'] = 'Virtual machine'; $lang->zanode->typeList['physics'] = 'Physical machine'; @@ -149,8 +152,7 @@ $lang->zanode->init->next = "Next"; $lang->zanode->init->button = "Go To Settings"; $lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; -$lang->zanode->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:"; -$lang->zanode->init->initFailNoticeDesc = "1. Re-execute the script
2. Review the initialization FAQ"; +$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; $lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index 2d269e533c..91a75a7818 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -63,6 +63,9 @@ $lang->zanode->manual = 'Manual'; $lang->zanode->initializing = 'Initializing'; $lang->zanode->showPwd = 'Show Password'; $lang->zanode->hidePwd = 'Hide Password'; +$lang->zanode->baseInfo = 'Basic information'; +$lang->zanode->cpuUnit = 'CORE'; +$lang->zanode->IP = 'Extranet Address'; $lang->zanode->typeList['node'] = 'Virtual machine'; $lang->zanode->typeList['physics'] = 'Physical machine'; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index abfcbd593d..74b264d066 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -63,6 +63,9 @@ $lang->zanode->manual = '手册'; $lang->zanode->initializing = '初始化中'; $lang->zanode->showPwd = '显示密码'; $lang->zanode->hidePwd = '隐藏密码'; +$lang->zanode->baseInfo = '基础信息'; +$lang->zanode->cpuUnit = '核'; +$lang->zanode->IP = 'IP/域名'; $lang->zanode->typeList['node'] = '虚拟机'; $lang->zanode->typeList['physics'] = '物理机'; @@ -149,8 +152,7 @@ $lang->zanode->init->next = "下一步"; $lang->zanode->init->button = "去设置"; $lang->zanode->init->initSuccessNoticeTitle = "服务已就绪,还需两步即可在执行节点上执行自动化测试:
1、根据%s配置自动化测试运行环境。
2、进行%s"; -$lang->zanode->init->initFailNoticeTitle = "初始化失败,请查看初始化脚本执行日志并尝试以下两种解决方案:"; -$lang->zanode->init->initFailNoticeDesc = "1、 重新执行脚本
2、 查看初始化常见问题"; +$lang->zanode->init->initFailNotice = "服务未就绪,在执行节点上执行安装服务命令或查看帮助."; $lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', diff --git a/module/zanode/model.php b/module/zanode/model.php index cd278381fb..4079c65161 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -54,14 +54,22 @@ class zanodemodel extends model public function create() { $data = fixer::input('post') - ->setIF($this->post->type == 'physics', 'parent', 0) - ->setIF($this->post->type == 'physics', 'osName', $this->post->osNamePhysics) + ->setIF($this->post->hostType == 'physics', 'parent', 0) + ->setIF($this->post->hostType == 'physics', 'osName', $this->post->osNamePhysics) ->remove('osNamePhysics') ->get(); + $data->type = "node"; + + if($data->hostType == 'physics') + { + $data->secret = md5($data->name . time()); + $data->status = "offline"; + } + /* Batch check fields. */ $this->dao->update(TABLE_ZAHOST)->data($data) - ->batchCheck($data->type == 'node' ? $this->config->zanode->create->requiredFields : $this->config->zanode->create->physicsRequiredFields, 'notempty'); + ->batchCheck($data->hostType != 'physics' ? $this->config->zanode->create->requiredFields : $this->config->zanode->create->physicsRequiredFields, 'notempty'); if(dao::isError()) return false; @@ -72,10 +80,10 @@ class zanodemodel extends model } /* If name already exists return error. */ - $node = $this->dao->select('*')->from(TABLE_ZAHOST)->where('name')->eq($data->name)->andWhere('type')->in('node,physics')->fetch(); + $node = $this->dao->select('*')->from(TABLE_ZAHOST)->where('name')->eq($data->name)->andWhere('type')->eq('node')->fetch(); if($node) return dao::$errors[] = $this->lang->zanode->nameUnique; - if($data->type == 'physics') + if($data->hostType == 'physics') { $ping = $this->loadModel('zahost')->checkAddress($data->extranet); if(!$ping) @@ -450,7 +458,7 @@ class zanodemodel extends model { $node = $this->getNodeByID($id); - if($node) + if($node && $node->hostType != 'physics') { $req = array( 'name' => $node->name ); $agnetUrl = 'http://' . $node->ip . ':' . $node->hzap; @@ -570,11 +578,11 @@ class zanodemodel extends model $query = str_replace('`hostID`', 't2.`id`', $query); } - $list = $this->dao->select("t1.*, t2.name as hostName, if(t1.type='node', t2.extranet, t1.extranet) extranet,if(t1.type='node', t3.osName, t1.osName) osName")->from(TABLE_ZAHOST)->alias('t1') + $list = $this->dao->select("t1.*, t2.name as hostName, if(t1.hostType='', t2.extranet, t1.extranet) extranet,if(t1.hostType='', t3.osName, t1.osName) osName")->from(TABLE_ZAHOST)->alias('t1') ->leftJoin(TABLE_ZAHOST)->alias('t2')->on('t1.parent = t2.id') ->leftJoin(TABLE_IMAGE)->alias('t3')->on('t3.id = t1.image') ->where('t1.deleted')->eq(0) - ->andWhere("((t1.type = 'node' and t2.type = 'zahost') or t1.type = 'physics')") + ->andWhere("t1.type = 'node'") ->beginIF($query)->andWhere($query)->fi() ->orderBy($orderBy) ->page($pager) @@ -587,7 +595,9 @@ class zanodemodel extends model foreach($list as $l) { - $host = zget($hosts, $l->parent); + $host = $l->hostType == '' ? zget($hosts, $l->parent) : clone $l; + $host->status = in_array($host->status, array('running', 'ready')) ? "online" : $host->status; + if($l->status == 'running' || $l->status == 'ready') { if(empty($host)) @@ -604,7 +614,7 @@ class zanodemodel extends model if(time() - strtotime($l->heartbeat) > 60) { - $l->status = 'wait'; + $l->status = $l->hostType == '' ? 'wait' : 'offline'; } } } @@ -654,6 +664,8 @@ class zanodemodel extends model */ public function getListByHost($hostID, $orderBy = 'id_desc') { + if(!$hostID) return array(); + $list = $this->dao->select('id, name, vnc, cpuCores, memory, diskSize, osName, status, heartbeat')->from(TABLE_ZAHOST) ->where('deleted')->eq(0) ->andWhere("parent")->eq($hostID) @@ -786,14 +798,16 @@ class zanodemodel extends model */ public function getNodeByID($id) { - $node = $this->dao->select("t1.*, t2.name as hostName, t2.extranet as ip,t2.zap as hzap,if(t1.type='node', t3.osName, t1.osName) osName, t2.tokenSN as tokenSN, t2.secret as secret")->from(TABLE_ZAHOST) + $node = $this->dao->select("t1.*, t2.name as hostName, if(t1.hostType='', t2.extranet, t1.extranet) ip,t2.zap as hzap,if(t1.hostType='', t3.osName, t1.osName) osName, if(t1.hostType='', t2.tokenSN, t1.tokenSN) tokenSN, if(t1.hostType='', t2.secret, t1.secret) secret")->from(TABLE_ZAHOST) ->alias('t1') ->leftJoin(TABLE_ZAHOST)->alias('t2')->on('t1.parent = t2.id') ->leftJoin(TABLE_IMAGE)->alias('t3')->on('t3.id = t1.image') ->where('t1.id')->eq($id) ->fetch(); - $host = $this->loadModel("zahost")->getByID($node->type == 'node' ? $node->parent : $node->id); + $host = $node->hostType == '' ? $this->loadModel("zahost")->getByID($node->parent) : clone $node; + $host->status = in_array($host->status, array('running', 'ready')) ? "online" : $host->status; + if($node->status == 'running' || $node->status == 'ready') { if(empty($host) || $host->status != 'online') @@ -802,7 +816,7 @@ class zanodemodel extends model } elseif(time() - strtotime($node->heartbeat) > 60) { - $node->status = 'wait'; + $node->status = $node->hostType == '' ? 'wait' : 'offline'; } } @@ -821,7 +835,9 @@ class zanodemodel extends model ->where('mac')->eq($mac) ->fetch(); - $host = $this->loadModel("zahost")->getByID($node->parent); + $host = $node->hostType == '' ? $this->loadModel("zahost")->getByID($node->parent) : $node; + $host->status = in_array($host->status, array('running', 'ready')) ? "online" : $host->status; + if($node->status == 'running' || $node->status == 'ready') { if(empty($host) || $host->status != 'online') diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index 6f32044c4f..26e45c9bd5 100644 --- a/module/zanode/view/browse.html.php +++ b/module/zanode/view/browse.html.php @@ -80,26 +80,26 @@
gitlab->gitlabAvatar;?> gitlab->gitlabAccount;?> gitlab->gitlabEmail;?>gitlab->zentaoAccount;?>gitlab->zentaoEmail;?>gitlab->zentaoAccount;?> gitlab->bindingStatus;?>
avatar, "height=40");?> - realname;?> -
- account;?> +
+ avatar, "height=20 width=20 class='img-circle'");?> + realname . '@' . $gitlabUser->account;?> email;?>id]", $userPairs, '', "class='form-control select chosen'" );?>gitlab->notBind;?>id]", $userPairs, '', "class='form-control select chosen gitlab-user-bind'" );?>' . $lang->gitlab->notBind . '';?>
avatar, "height=40");?> - realname;?> -
- account;?> + avatar, "height=20 width=20 class='img-circle'");?> + realname . '@' . $gitlabUser->account;?>
email;?>id]", $userPairs, $gitlabUser->zentaoAccount, "class='form-control select chosen'" );?>id]", $userPairs, $gitlabUser->zentaoAccount, "class='form-control select chosen gitlab-user-bind'" );?> id, $bindedUsers)):?> zentaoAccount, '');?> @@ -64,7 +88,7 @@ ' . $lang->gitlab->bindedError . '';?> - gitlab->notBind;?> + ' . $lang->gitlab->notBind . '';?>
zanode->suspend}' target='hiddenwin'"; - $suspendAttr .= $node->type == 'physics' || $node->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'"; + $suspendAttr .= $node->hostType == 'physics' || $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->type == 'physics' || $node->status == 'running' || $node->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'"; + $resumeAttr .= $node->hostType == 'physics' || $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->type == 'physics' || $node->status == 'shutoff' || $node->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'"; + $rebootAttr .= $node->hostType == 'physics' || $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->type == 'physics' || $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; + $closeAttr .= $node->hostType == 'physics' || $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; $startAttr = "title='{$lang->zanode->boot}'"; - $startAttr .= $node->type == 'physics' || $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; + $startAttr .= $node->hostType == 'physics' || $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; $snapshotAttr = "title='{$lang->zanode->createSnapshot}'"; - $snapshotAttr .= $node->type == 'physics' || $node->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"'; + $snapshotAttr .= $node->hostType == 'physics' || $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"'; + $imageAttr = $node->hostType == 'physics' || $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') . "'", ''); + common::printLink('zanode', 'getVNC', "id={$node->id}", " ", (in_array($node->status ,array('running', 'launch', 'wait')) ? '_blank' : ''), "title='{$lang->zanode->getVNC}' class='btn desktop " . ($node->hostType == '' && in_array($node->status ,array('running', 'launch', 'wait')) ? '':'disabled') . "'", ''); if($node->status == "suspend") { common::printLink('zanode', 'resume', "zanodeID={$node->id}", " ", '', $resumeAttr); diff --git a/module/zanode/view/create.html.php b/module/zanode/view/create.html.php index bddd7ac64f..49a581691a 100644 --- a/module/zanode/view/create.html.php +++ b/module/zanode/view/create.html.php @@ -24,7 +24,7 @@ - + diff --git a/module/zanode/view/edit.html.php b/module/zanode/view/edit.html.php index e733b205a0..a2e6b12940 100644 --- a/module/zanode/view/edit.html.php +++ b/module/zanode/view/edit.html.php @@ -21,7 +21,7 @@
zahost->type;?>zanode->typeList, 'virtual', "class='form-control chosen' onchange='zanodeType()'")?>zanode->typeList, 'virtual', "class='form-control chosen' onchange='zanodeType()'")?>
- type == 'node'):?> + hostType != 'physics'):?> @@ -29,17 +29,17 @@ - + - type == 'node'):?> + hostType != 'physics'):?> - + @@ -69,7 +69,7 @@ - + diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index 64686fcb72..52247cdec6 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -44,7 +44,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
-
zahost->baseInfo; ?>
+
zanode->baseInfo; ?>
@@ -63,7 +63,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
zanode->cpuCores; ?>:
-
cpuCores . ' ' . $lang->zahost->cpuUnit; ?>
+
cpuCores . ' ' . $lang->zanode->cpuUnit; ?>
@@ -132,28 +132,34 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou zanode->init->statusTitle; ?>
-
+
● -   ZenAgent   +  ZenAgent   zanode->initializing; ?>
● -   ZTF   +  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;?>
+
+ zanode->init->initFailNotice;?> + +
+ "; ?> +
+
- + hostType == ''):?>
zanode->browseSnapshot;?>
@@ -175,23 +181,23 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou deleted)) { $suspendAttr = "title='{$lang->zanode->suspend}' target='hiddenwin'"; - $suspendAttr .= $zanode->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'"; + $suspendAttr .= $zanode->hostType == 'physics' || $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' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'"; + $resumeAttr .= $zanode->hostType == 'physics' || $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' || $zanode->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmReboot}\")==false) return false;'"; + $rebootAttr .= $zanode->hostType == 'physics' || $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"'; + $closeAttr .= $zanode->hostType == 'physics' || $zanode->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; $startAttr = "title='{$lang->zanode->boot}'"; - $startAttr .= $zanode->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; + $startAttr .= $zanode->hostType == 'physics' || $zanode->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"'; $snapshotAttr = "title='{$lang->zanode->createSnapshot}'"; - $snapshotAttr .= $zanode->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"'; - common::printLink('zanode', 'getVNC', "id={$zanode->id}", " " . $lang->zanode->getVNC, in_array($zanode->status ,array('running', 'launch', 'wait')) ? '_blank' : '', "title='{$lang->zanode->getVNC}' class='btn desktop " . (in_array($zanode->status ,array('running', 'launch', 'wait')) ? '':'disabled') . "'", ''); + $snapshotAttr .= $zanode->hostType == 'physics' || $zanode->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"'; + common::printLink('zanode', 'getVNC', "id={$zanode->id}", " " . $lang->zanode->getVNC, in_array($zanode->status ,array('running', 'launch', 'wait')) ? '_blank' : '', "title='{$lang->zanode->getVNC}' class='btn desktop " . ($zanode->hostType == '' && in_array($zanode->status ,array('running', 'launch', 'wait')) ? '':'disabled') . "'", ''); if($zanode->status == "suspend") { From dad27dc1ade7e0b4f413766dc5e20a54e1e6cf28 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 16 Mar 2023 08:45:29 +0800 Subject: [PATCH 09/35] * Fix hostType error when add vm node. --- api/v1/entries/hostheartbeat.php | 1 + module/zanode/model.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index 16946fb0f7..38ae856782 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -85,6 +85,7 @@ class hostHeartbeatEntry extends baseEntry if($hostInfo->hostType == 'physics') { + unset($vmData['extranet']); $this->dao->update(TABLE_ZAHOST)->data($vmData)->where('id')->eq($hostInfo->id)->exec(); } else diff --git a/module/zanode/model.php b/module/zanode/model.php index 4079c65161..8ba9790777 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -66,6 +66,10 @@ class zanodemodel extends model $data->secret = md5($data->name . time()); $data->status = "offline"; } + else + { + $data->hostType = ''; + } /* Batch check fields. */ $this->dao->update(TABLE_ZAHOST)->data($data) From 75c713bab085843ec8372473c1bed29f4f61380c Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 16 Mar 2023 09:40:13 +0800 Subject: [PATCH 10/35] * Add curl instead file_get_contents in zahost model. --- module/zahost/model.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/zahost/model.php b/module/zahost/model.php index 8244095ee8..e147b70e06 100644 --- a/module/zahost/model.php +++ b/module/zahost/model.php @@ -193,7 +193,8 @@ class zahostModel extends model */ public function getImageList($hostID, $browseType = 'all', $param = 0, $orderBy = 'id', $pager = null) { - $imageList = json_decode(file_get_contents($this->config->zahost->imageListUrl)); + $imageList = json_decode(commonModel::http($this->config->zahost->imageListUrl, array(), array())); + if(empty($imageList)) return array(); $downloadedImageList = $this->dao->select('*')->from(TABLE_IMAGE) ->where('host')->eq($hostID) @@ -256,7 +257,7 @@ class zahostModel extends model */ public function createImage($hostID, $imageName) { - $imageList = json_decode(file_get_contents($this->config->zahost->imageListUrl)); + $imageList = json_decode(commonModel::http($this->config->zahost->imageListUrl, array(), array())); $imageData = new stdclass; foreach($imageList as $item) if($item->name == $imageName) $imageData = $item; From f6f2c4d495fca437883a04a540887e38a9cec84f Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 17 Mar 2023 08:50:07 +0800 Subject: [PATCH 11/35] * Vm node hide init fail notice. --- module/zanode/css/view.css | 1 - module/zanode/view/view.html.php | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/module/zanode/css/view.css b/module/zanode/css/view.css index 2861d331c8..accc4028e8 100644 --- a/module/zanode/css/view.css +++ b/module/zanode/css/view.css @@ -18,5 +18,4 @@ .btn-info {background-color: unset;} .btn.disabled i {color: #fff;} .btn-toolbar a img{margin-bottom: 1px;} -#serviceContent{min-height: 120px;} .zanode-init{padding:15px;background: #f4f5f7;margin:10px 0;} diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index 52247cdec6..eef65f293f 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -148,6 +148,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
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%'", '')); ?> + hostType == 'physics'):?>
zanode->init->initFailNotice;?> @@ -155,6 +156,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou "; ?>
+
From 1f5f93d58346344d2971ab2d2f4a757439313dca Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 17 Mar 2023 09:00:16 +0800 Subject: [PATCH 12/35] * Fix bug #32870. --- module/zanode/css/view.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zanode/css/view.css b/module/zanode/css/view.css index adb03140cd..12eec6037e 100644 --- a/module/zanode/css/view.css +++ b/module/zanode/css/view.css @@ -18,4 +18,4 @@ .btn-info {background-color: unset;} .btn.disabled i {color: #fff;} #serviceContent{min-height: 120px;} -.btn-snap-create{width: 100px;height: 30px;} \ No newline at end of file +.btn-snap-create{height: 30px;} \ No newline at end of file From d95057d9a20d718bbec71a488e1ad7f7d9a08414 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 17 Mar 2023 10:42:08 +0800 Subject: [PATCH 13/35] * Fix vm status error. --- api/v1/entries/hostheartbeat.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index 38ae856782..9220e77b8a 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -37,7 +37,7 @@ class hostHeartbeatEntry extends baseEntry $conditionValue = $secret ? $secret : $token; $this->dao = $this->loadModel('common')->dao; - $hostInfo = $this->dao->select('id,tokenSN,hostType')->from(TABLE_ZAHOST) + $hostInfo = $this->dao->select('id,tokenSN,hostType,type')->from(TABLE_ZAHOST) ->beginIF($secret)->where('secret')->eq($secret)->fi() ->beginIF(!$secret)->where('tokenSN')->eq($token) ->andWhere('tokenTime')->gt($now)->fi() @@ -45,7 +45,7 @@ class hostHeartbeatEntry extends baseEntry if(empty($hostInfo->id)) { if(empty($token)) return $this->sendError(400, 'Secret error.'); - $hostInfo = $this->dao->select('id,tokenSN')->from(TABLE_ZAHOST) + $hostInfo = $this->dao->select('id,tokenSN,hostType,type')->from(TABLE_ZAHOST) ->where('oldTokenSN')->eq($token) ->andWhere('tokenTime')->gt(date(DT_DATETIME1, strtotime($now) - 30))->fi() ->fetch(); @@ -83,7 +83,7 @@ class hostHeartbeatEntry extends baseEntry if($heartbeat > 0) $vmData['heartbeat'] = date("Y-m-d H:i:s", $heartbeat); - if($hostInfo->hostType == 'physics') + if($hostInfo->type == 'node' && $hostInfo->hostType == 'physics') { unset($vmData['extranet']); $this->dao->update(TABLE_ZAHOST)->data($vmData)->where('id')->eq($hostInfo->id)->exec(); From 30dc9afb0a533b4c83bbba3a6f48e1c3a5108846 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 17 Mar 2023 11:03:21 +0800 Subject: [PATCH 14/35] - Remove repeat var. --- api/v1/entries/hostheartbeat.php | 1 - 1 file changed, 1 deletion(-) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index 186a72b8f2..100d5d0199 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -101,7 +101,6 @@ class hostHeartbeatEntry extends baseEntry if($vm->status == 'running' && !$isPhysicsNode) { - $node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress); if(!empty($node)) { $snaps = $this->loadModel('zanode')->getSnapshotList($node->id); From 8631c957cf23bff2ebd384b448847e739f6b8791 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 17 Mar 2023 15:09:36 +0800 Subject: [PATCH 15/35] * Add sync button in testcase view. --- module/testcase/control.php | 3 +++ module/testcase/view/automation.html.php | 4 ++++ 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 + module/zanode/model.php | 11 +++++++++++ 7 files changed, 22 insertions(+) diff --git a/module/testcase/control.php b/module/testcase/control.php index aeb2164d89..eb57fa0cbf 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -2400,6 +2400,9 @@ class testcase extends control if(dao::isError()) return print(js::error(dao::getError())); + if(!empty($_POST['syncToZentao'])) + $this->zanode->syncCasesToZentao($_POST['scriptPath']); + $nodeID = $_POST['node']; $node = $this->zanode->getNodeByID($_POST['node']); diff --git a/module/testcase/view/automation.html.php b/module/testcase/view/automation.html.php index 20a2d96b99..169bfe77af 100644 --- a/module/testcase/view/automation.html.php +++ b/module/testcase/view/automation.html.php @@ -46,6 +46,10 @@
+ + + + - + From a3406e07e61f2386bfbfafeb063f3964b2259e6e Mon Sep 17 00:00:00 2001 From: zenggang Date: Thu, 23 Mar 2023 08:31:32 +0000 Subject: [PATCH 25/35] * Fix bug#32868 --- module/zanode/css/view.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zanode/css/view.css b/module/zanode/css/view.css index d9631fc750..14980da02f 100644 --- a/module/zanode/css/view.css +++ b/module/zanode/css/view.css @@ -17,6 +17,6 @@ .node-not-wrap{white-space: nowrap;} .btn-info {background-color: unset;} .btn.disabled i {color: #fff;} -.btn-toolbar a img{margin-bottom: 1px;} +.btn-toolbar a img{margin-bottom: 2px;} .zanode-init{padding:15px;background: #f4f5f7;margin:10px 0;} .btn-snap-create{height: 30px;} From e9a8544bc0046f23bab737a9e6ab0aaf033f6062 Mon Sep 17 00:00:00 2001 From: zenggang Date: Fri, 24 Mar 2023 02:58:00 +0000 Subject: [PATCH 26/35] * Fix bug#33298,33196 adjust style --- module/common/lang/menu.php | 2 +- module/repo/control.php | 8 +++++++- module/repo/css/import.css | 1 + module/repo/lang/zh-cn.php | 2 +- module/repo/view/maintain.html.php | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index c9904f160c..d0b2203a5b 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -497,7 +497,7 @@ $lang->devops->menu->set['subMenu']->repo = array('link' => "{$lang->devops $lang->devops->menu->set['subMenu']->gitlab = array('link' => 'GitLab|gitlab|browse', 'subModule' => 'gitlab'); $lang->devops->menu->set['subMenu']->gogs = array('link' => 'Gogs|gogs|browse', 'subModule' => 'gogs'); $lang->devops->menu->set['subMenu']->gitea = array('link' => 'Gitea|gitea|browse', 'subModule' => 'gitea'); -$lang->devops->menu->set['subMenu']->jenkins = array('link' => 'Jenkins|jenkins|browse', 'subModule' => ''); +$lang->devops->menu->set['subMenu']->jenkins = array('link' => 'Jenkins|jenkins|browse', 'subModule' => 'jenkins'); $lang->devops->menu->set['subMenu']->sonarqube = array('link' => 'SonarQube|sonarqube|browse', 'subModule' => 'sonarqube'); $lang->devops->menu->set['subMenu']->setrules = array('link' => "{$lang->devops->rules}|repo|setrules"); diff --git a/module/repo/control.php b/module/repo/control.php index 4c00355215..1b240199cd 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -1749,8 +1749,14 @@ class repo extends control ->setDefault('projects', array()) ->get(); + $productIds = $postData->products; + if(empty($productIds)) + { + $products = $this->loadModel('product')->getPairs('', 0, '', 'all'); + $productIds = array_keys($products); + } /* Get all projects that can be accessed. */ - $accessProjects = $this->loadModel('product')->getProjectPairsByProductIDList($postData->products); + $accessProjects = $this->loadModel('product')->getProjectPairsByProductIDList($productIds); $selectedProjects = array_intersect(array_keys($accessProjects), $postData->projects); diff --git a/module/repo/css/import.css b/module/repo/css/import.css index 8a5bae21aa..3b68af13d0 100644 --- a/module/repo/css/import.css +++ b/module/repo/css/import.css @@ -5,3 +5,4 @@ .main-table thead>tr {border-bottom: none; height: 45px;} .main-table tbody>tr {border-bottom: none; height: 42px;} .icon-close {cursor: pointer;} +a.btn-active-text {line-height: 19px;} diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php index c801417147..3f5db6da02 100644 --- a/module/repo/lang/zh-cn.php +++ b/module/repo/lang/zh-cn.php @@ -32,7 +32,7 @@ $lang->repo->blameTmpl = '第 %line 行代码相关信息 $lang->repo->notRelated = '暂时没有关联禅道对象'; $lang->repo->browseAction = '浏览代码库'; -$lang->repo->createAction = '创建代码库'; +$lang->repo->createAction = '添加代码库'; $lang->repo->editAction = '编辑代码库'; $lang->repo->diffAction = '版本对比'; $lang->repo->downloadAction = '下载代码库文件'; diff --git a/module/repo/view/maintain.html.php b/module/repo/view/maintain.html.php index 907c05fdcd..c22c59515e 100644 --- a/module/repo/view/maintain.html.php +++ b/module/repo/view/maintain.html.php @@ -17,7 +17,7 @@
" . $this->lang->repo->importAction, '', "class='btn btn-link'");?> - " . $this->lang->repo->create, '', "class='btn btn-primary'");?> + " . $this->lang->repo->createAction, '', "class='btn btn-primary'");?>
From 5db6ae03acba790f83be700a180753b0296249ef Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 24 Mar 2023 13:05:27 +0800 Subject: [PATCH 27/35] * Finish task #88024,88025. --- module/zanode/config.php | 33 +++++++++++++++- module/zanode/control.php | 5 ++- module/zanode/css/common.css | 2 + module/zanode/js/create.js | 31 ++++++++++++++- module/zanode/js/view.js | 12 +++++- module/zanode/lang/de.php | 9 +++-- module/zanode/lang/en.php | 9 +++-- module/zanode/lang/fr.php | 9 +++-- module/zanode/lang/zh-cn.php | 11 ++++-- module/zanode/model.php | 2 +- module/zanode/view/browse.html.php | 2 +- module/zanode/view/create.html.php | 8 +++- module/zanode/view/edit.html.php | 2 +- module/zanode/view/view.html.php | 63 +++++++++++++++++++++++++++--- 14 files changed, 169 insertions(+), 29 deletions(-) diff --git a/module/zanode/config.php b/module/zanode/config.php index cf21004640..447e580967 100644 --- a/module/zanode/config.php +++ b/module/zanode/config.php @@ -3,7 +3,7 @@ $config->zanode->create = new stdClass(); $config->zanode->edit = new stdClass(); $config->zanode->createimage = new stdClass(); $config->zanode->create->requiredFields = 'name,host,image,cpu,memory,disk,osName'; -$config->zanode->create->physicsRequiredFields = 'name,extranet,cpu,memory,osName'; +$config->zanode->create->physicsRequiredFields = 'name,extranet,cpu,memory,osNamePhysics'; $config->zanode->edit->requiredFields = ''; $config->zanode->createimage->requiredFields = 'name'; @@ -13,6 +13,7 @@ $config->zanode->defaultWinAccount = 'admin'; $config->zanode->defaultPwd = 'CQdliYQn6tKkoFhP'; $config->zanode->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -s zvm -k %s -z %s'; +$config->zanode->initPosh = 'Invoke-WebRequest -UseBasicParsing -Uri "https://pkg.qucheng.com/zenagent/zagent-vm.ps1" -OutFile "./install-zanget-vm.ps1"; &"./install-zanget-vm.ps1" -s %s -z %s'; $config->zanode->os = new stdClass(); @@ -51,3 +52,33 @@ $config->zanode->editor->create = array('id' => 'desc', 'tools' => 'simpleT $config->zanode->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools'); $config->zanode->editor->createimage = array('id' => 'desc', 'tools' => 'simpleTools'); $config->zanode->editor->view = array('id' => 'comment,lastComment', 'tools' => 'simpleTools'); + +$config->zanode->osType = array('linux' => 'Linux', 'windows' => 'Microsoft Windows'); + +$config->zanode->linuxList[''] = ''; +$config->zanode->linuxList['centOS65'] = 'CentOS 6.5'; +$config->zanode->linuxList['centOS66'] = 'CentOS 6.6'; +$config->zanode->linuxList['centOS67'] = 'CentOS 6.7'; +$config->zanode->linuxList['centOS70'] = 'CentOS 7.0'; +$config->zanode->linuxList['centOS71'] = 'CentOS 7.1'; +$config->zanode->linuxList['centOS79'] = 'CentOS 7.9'; + +$config->zanode->linuxList['ubuntu1404'] = 'Ubuntu 14.04'; +$config->zanode->linuxList['ubuntu1604'] = 'Ubuntu 16.04'; +$config->zanode->linuxList['ubuntu1804'] = 'Ubuntu 18.04'; +$config->zanode->linuxList['ubuntu2004'] = 'Ubuntu 20.04'; + +$config->zanode->linuxList['debianBullseye'] = 'Debian Bullseye'; +$config->zanode->linuxList['debianBuster'] = 'Debian Buster'; + +$config->zanode->windowsList[''] = ''; +$config->zanode->windowsList['win10'] = 'Windows 10'; +$config->zanode->windowsList['winserver08x64'] = 'Windows Server2008 x64'; +$config->zanode->windowsList['winserver12'] = 'Windows Server2012'; +$config->zanode->windowsList['winserver16'] = 'Windows Server2016'; + +$config->zanode->versionToOs[''] = ''; +$config->zanode->versionToOs['win10'] = 'windows'; +$config->zanode->versionToOs['winserver08x64'] = 'windows'; +$config->zanode->versionToOs['winserver12'] = 'windows'; +$config->zanode->versionToOs['winserver16'] = 'windows'; \ No newline at end of file diff --git a/module/zanode/control.php b/module/zanode/control.php index 87ee162afc..b403c4e337 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -167,7 +167,7 @@ class zanode extends control $this->view->title = $this->lang->zanode->view; $this->view->zanode = $node; $this->view->snapshotList = $this->zanode->getSnapshotList($id); - $this->view->initBash = sprintf($this->config->zanode->initBash, $node->secret, getWebRoot(true)); + $this->view->initBash = sprintf(zget($this->config->zanode->versionToOs, $node->osName, '') != '' ? $this->config->zanode->initPosh : $this->config->zanode->initBash, $node->secret, getWebRoot(true)); $this->view->actions = $this->loadModel('action')->getList('zanode', $id); $this->view->users = $this->loadModel('user')->getPairs('noletter'); @@ -563,8 +563,9 @@ class zanode extends control if ($node->status != 'running') { $serviceStatus['ZenAgent'] = "unknown"; - $serviceStatus['ZTF'] = "unknown"; + $serviceStatus['ZTF'] = "unknown"; } + $node->status = $node->status == 'online' ? 'ready' : $node->status; $serviceStatus['node'] = $node->status; return $this->send(array('result' => 'success', 'message' => '', 'data' => $serviceStatus)); diff --git a/module/zanode/css/common.css b/module/zanode/css/common.css index 1ef909a85b..8190cc895c 100644 --- a/module/zanode/css/common.css +++ b/module/zanode/css/common.css @@ -1 +1,3 @@ .icon-help{line-height: 34px;} +#osNamePhysicsContainer{display: flex;} +#osNamePhysicsContainer select{margin-right: 5px;} \ No newline at end of file diff --git a/module/zanode/js/create.js b/module/zanode/js/create.js index 153bc3b0d0..efad795dbe 100644 --- a/module/zanode/js/create.js +++ b/module/zanode/js/create.js @@ -12,7 +12,7 @@ function zanodeType() $('#image').closest('tr').hide(); $('#extranet').closest('tr').removeClass('hidden'); $('#osName').addClass('hidden'); - $('#osNamePhysics').removeClass('hidden'); + $('#osNamePhysicsContainer').removeClass('hidden'); } else { @@ -20,7 +20,7 @@ function zanodeType() $('#image').closest('tr').show(); $('#extranet').closest('tr').addClass('hidden'); $('#osName').removeClass('hidden'); - $('#osNamePhysics').addClass('hidden'); + $('#osNamePhysicsContainer').addClass('hidden'); } } @@ -38,3 +38,30 @@ function loadHosts() $('#hostIdBox').find('#parent').chosen(); }); } + +$(function() +{ + $('#osNamePhysicsPre').on('change', function() + { + console.log($(this).val()) + if($(this).val() == 'linux') + { + $('#osNamePhysics').empty(); + for(var i in linuxList) + { + console.log(linuxList[i]) + $('#osNamePhysics').append('') + } + } + else + { + $('#osNamePhysics').empty(); + for(var i in windowsList) + { + console.log(windowsList[i]) + $('#osNamePhysics').append('') + } + } + $('#osNamePhysics').trigger('chosen:updated'); + }) +}) \ No newline at end of file diff --git a/module/zanode/js/view.js b/module/zanode/js/view.js index 8a3d6c81c5..a662d9a178 100644 --- a/module/zanode/js/view.js +++ b/module/zanode/js/view.js @@ -36,7 +36,14 @@ function checkServiceStatus(){ { if(resultData.data[key] == 'unknown') { - $('.ztf-status').text(zanodeLang.init.unknown) + if(hostType == 'physics') + { + $('.ztf-status').text(zanodeLang.init.not_install) + } + else + { + $('.ztf-status').text(zanodeLang.init.unknown) + } } else { @@ -210,6 +217,9 @@ $('#jumpManual').click(function() $(function(){ $('#checkServiceStatus').trigger("click") + if(hostType == 'physics'){ + return; + } checkInterval = setInterval(() => { intervalTimes++; if(intervalTimes > 300) diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index a066079d06..e267876755 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -22,6 +22,7 @@ $lang->zanode->getVNC = 'Remote management'; $lang->zanode->all = 'All'; $lang->zanode->byQuery = 'Search'; $lang->zanode->osName = 'System'; +$lang->zanode->osNamePhysics = 'System'; $lang->zanode->image = 'VM Image'; $lang->zanode->imageName = 'Image Name'; $lang->zanode->name = 'Name'; @@ -29,7 +30,8 @@ $lang->zanode->start = 'Start After Created'; $lang->zanode->hostName = 'Host Name'; $lang->zanode->host = $lang->zanode->hostName; $lang->zanode->extranet = 'IP/Domain'; -$lang->zanode->sshAddress = 'SSH Command'; +$lang->zanode->sshCommand = 'SSH Command'; +$lang->zanode->sshAddress = 'SSH Address'; $lang->zanode->osArch = 'Arch'; $lang->zanode->cpuCores = 'CPU'; $lang->zanode->defaultUser = 'Default Account Name'; @@ -154,8 +156,9 @@ $lang->zanode->init->ready = "Ready"; $lang->zanode->init->next = "Next"; $lang->zanode->init->button = "Go To Settings"; -$lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; -$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; +$lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; +$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; +$lang->zanode->init->initFailNoticeOnPhysics = "The service has not been installed yet, please check the service status after executing the following command on the execution node。See Help"; $lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index d5079ea53f..32d75cb283 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -22,6 +22,7 @@ $lang->zanode->getVNC = 'Remote management'; $lang->zanode->all = 'All'; $lang->zanode->byQuery = 'Search'; $lang->zanode->osName = 'System'; +$lang->zanode->osNamePhysics = 'System'; $lang->zanode->image = 'VM Image'; $lang->zanode->imageName = 'Image Name'; $lang->zanode->name = 'Name'; @@ -29,7 +30,8 @@ $lang->zanode->start = 'Start After Created'; $lang->zanode->hostName = 'Host Name'; $lang->zanode->host = $lang->zanode->hostName; $lang->zanode->extranet = 'IP/Domain'; -$lang->zanode->sshAddress = 'SSH Command'; +$lang->zanode->sshCommand = 'SSH Command'; +$lang->zanode->sshAddress = 'SSH Address'; $lang->zanode->osArch = 'Arch'; $lang->zanode->cpuCores = 'CPU'; $lang->zanode->defaultUser = 'Default Account Name'; @@ -154,8 +156,9 @@ $lang->zanode->init->ready = "Ready"; $lang->zanode->init->next = "Next"; $lang->zanode->init->button = "Go To Settings"; -$lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; -$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; +$lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; +$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; +$lang->zanode->init->initFailNoticeOnPhysics = "The service has not been installed yet, please check the service status after executing the following command on the execution node。See Help"; $lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index a066079d06..e267876755 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -22,6 +22,7 @@ $lang->zanode->getVNC = 'Remote management'; $lang->zanode->all = 'All'; $lang->zanode->byQuery = 'Search'; $lang->zanode->osName = 'System'; +$lang->zanode->osNamePhysics = 'System'; $lang->zanode->image = 'VM Image'; $lang->zanode->imageName = 'Image Name'; $lang->zanode->name = 'Name'; @@ -29,7 +30,8 @@ $lang->zanode->start = 'Start After Created'; $lang->zanode->hostName = 'Host Name'; $lang->zanode->host = $lang->zanode->hostName; $lang->zanode->extranet = 'IP/Domain'; -$lang->zanode->sshAddress = 'SSH Command'; +$lang->zanode->sshCommand = 'SSH Command'; +$lang->zanode->sshAddress = 'SSH Address'; $lang->zanode->osArch = 'Arch'; $lang->zanode->cpuCores = 'CPU'; $lang->zanode->defaultUser = 'Default Account Name'; @@ -154,8 +156,9 @@ $lang->zanode->init->ready = "Ready"; $lang->zanode->init->next = "Next"; $lang->zanode->init->button = "Go To Settings"; -$lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; -$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; +$lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; +$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; +$lang->zanode->init->initFailNoticeOnPhysics = "The service has not been installed yet, please check the service status after executing the following command on the execution node。See Help"; $lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index 794e92aca1..40426b0ee7 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -22,6 +22,7 @@ $lang->zanode->getVNC = '远程'; $lang->zanode->all = '全部'; $lang->zanode->byQuery = '搜索'; $lang->zanode->osName = '操作系统'; +$lang->zanode->osNamePhysics = '操作系统'; $lang->zanode->image = '镜像'; $lang->zanode->imageName = '镜像名称'; $lang->zanode->name = '名称'; @@ -29,7 +30,8 @@ $lang->zanode->start = '创建后自动开启'; $lang->zanode->hostName = '所属宿主机'; $lang->zanode->host = $lang->zanode->hostName; $lang->zanode->extranet = 'IP/域名'; -$lang->zanode->sshAddress = 'SSH命令'; +$lang->zanode->sshCommand = 'SSH命令'; +$lang->zanode->sshAddress = 'SSH地址'; $lang->zanode->osArch = '架构'; $lang->zanode->cpuCores = 'CPU'; $lang->zanode->defaultUser = '默认用户'; @@ -136,7 +138,7 @@ $lang->zanode->statusList['shutoff'] = '已关机'; $lang->zanode->statusList['shutodown'] = '已关机'; $lang->zanode->statusList['destroy_fail'] = '销毁失败'; $lang->zanode->statusList['wait'] = '初始化中'; -$lang->zanode->statusList['online'] = '已上架'; +$lang->zanode->statusList['online'] = '运行中'; $lang->zanode->statusList['restoring'] = '还原中'; $lang->zanode->statusList['creating_snap'] = '创建快照中'; $lang->zanode->statusList['creating_img'] = '导出镜像中'; @@ -154,8 +156,9 @@ $lang->zanode->init->ready = "已就绪"; $lang->zanode->init->next = "下一步"; $lang->zanode->init->button = "去设置"; -$lang->zanode->init->initSuccessNoticeTitle = "服务已就绪,还需两步即可在执行节点上执行自动化测试:
1、根据%s配置自动化测试运行环境。
2、进行%s"; -$lang->zanode->init->initFailNotice = "服务未就绪,在执行节点上执行安装服务命令或查看帮助."; +$lang->zanode->init->initSuccessNoticeTitle = "服务已就绪,还需两步即可在执行节点上执行自动化测试:
1、根据%s配置自动化测试运行环境。
2、进行%s"; +$lang->zanode->init->initFailNotice = "服务未就绪,在执行节点上执行安装服务命令或查看帮助."; +$lang->zanode->init->initFailNoticeOnPhysics = "服务还没有安装,请在执行节点执行以下命令后检测服务状态。查看帮助"; $lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', diff --git a/module/zanode/model.php b/module/zanode/model.php index fcd5bdad85..9d8496106b 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -59,7 +59,6 @@ class zanodemodel extends model $data = fixer::input('post') ->setIF($this->post->hostType == 'physics', 'parent', 0) ->setIF($this->post->hostType == 'physics', 'osName', $this->post->osNamePhysics) - ->remove('osNamePhysics') ->get(); $data->type = "node"; @@ -80,6 +79,7 @@ class zanodemodel extends model if(dao::isError()) return false; + unset($data->osNamePhysics); if(!preg_match("/^(?!_)(?!-)(?!\.)[a-zA-Z0-9\_\.\-]+$/", $data->name)) { dao::$errors[] = $this->lang->zanode->nameValid; diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index cffabea247..e88f0ead05 100644 --- a/module/zanode/view/browse.html.php +++ b/module/zanode/view/browse.html.php @@ -69,7 +69,7 @@
- + diff --git a/module/zanode/view/create.html.php b/module/zanode/view/create.html.php index 49a581691a..67829d80d7 100644 --- a/module/zanode/view/create.html.php +++ b/module/zanode/view/create.html.php @@ -13,6 +13,8 @@ getModuleRoot() . 'common/view/kindeditor.html.php';?> +zanode->linuxList);?> +zanode->windowsList);?>
@@ -71,8 +73,10 @@
diff --git a/module/zanode/view/edit.html.php b/module/zanode/view/edit.html.php index a2e6b12940..603cc39b6a 100644 --- a/module/zanode/view/edit.html.php +++ b/module/zanode/view/edit.html.php @@ -69,7 +69,7 @@ - + diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index 8685d308d0..751b42d6e0 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -21,11 +21,13 @@ id) ?> zanode); ?> status); ?> +hostType); ?> -session->zanodeList ? $this->session->zanodeList : $this->createLink('zanode', 'browse', ""); ?> +session->zanodeList ? $this->session->zanodeList : $this->createLink('zanode', 'browse', "");?> id}&orderBy=%s"; $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccount : $config->zanode->defaultAccount; +$ssh = $zanode->hostType == 'physics' ? $zanode->extranet : ($zanode->ssh ? 'ssh ' . $account . '@' . $zanode->ip . ' -p ' . $zanode->ssh : ''); ?>
zanode->hostName;?> name, "class='form-control' readonly='readonly'");?>
zanode->name;?>name, "class='form-control' placeholder=\"{$lang->zanode->nameValid}\" readonly='readonly'");?>name, "class='form-control' placeholder=\"{$lang->zanode->nameValid}\" " . ($zanode->hostType != 'physics' ? "readonly='readonly'" : ''));?>
zanode->image;?> name, "class='form-control' readonly='readonly'");?>
zahost->IP;?>zanode->IP;?> extranet, "class='form-control' readonly='readonly'");?>
zanode->osName;?>osName, "class='form-control' readonly='readonly'")?>osName, "class='form-control' " . ($zanode->hostType != 'physics' ? "readonly='readonly'" : ''))?>
zanode->desc ?>
$lang->zanode->syncToZentao), '');?>
zanode->shell;?> diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index a3f4e4e192..ace6532139 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -53,6 +53,7 @@ $lang->zanode->confirmRestore = "The ZenAgent Node will be restored to this sna $lang->zanode->actionSuccess = 'Success'; $lang->zanode->deleted = "Deleted"; $lang->zanode->scriptPath = "Script path"; +$lang->zanode->syncToZentao = "Sync cases in the directory to Zentao"; $lang->zanode->shell = "Shell"; $lang->zanode->automation = "Automation"; $lang->zanode->install = "Install"; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 6ea6e5acbd..835c2cbf13 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -53,6 +53,7 @@ $lang->zanode->confirmRestore = "The ZenAgent Node will be restored to this sna $lang->zanode->actionSuccess = 'Success'; $lang->zanode->deleted = "Deleted"; $lang->zanode->scriptPath = "Script path"; +$lang->zanode->syncToZentao = "Sync cases in the directory to Zentao"; $lang->zanode->shell = "Shell"; $lang->zanode->automation = "Automation"; $lang->zanode->install = "Install"; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index a3f4e4e192..ace6532139 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -53,6 +53,7 @@ $lang->zanode->confirmRestore = "The ZenAgent Node will be restored to this sna $lang->zanode->actionSuccess = 'Success'; $lang->zanode->deleted = "Deleted"; $lang->zanode->scriptPath = "Script path"; +$lang->zanode->syncToZentao = "Sync cases in the directory to Zentao"; $lang->zanode->shell = "Shell"; $lang->zanode->automation = "Automation"; $lang->zanode->install = "Install"; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index 8e0215ced4..d361645b28 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -53,6 +53,7 @@ $lang->zanode->confirmRestore = "执行节点将会还原至此快照状态, $lang->zanode->actionSuccess = '操作成功'; $lang->zanode->deleted = "已删除"; $lang->zanode->scriptPath = "脚本目录"; +$lang->zanode->syncToZentao = "同步脚本信息到禅道"; $lang->zanode->shell = "shell命令"; $lang->zanode->automation = "自动化设置"; $lang->zanode->install = "安装"; diff --git a/module/zanode/model.php b/module/zanode/model.php index 313eb4d24b..43ebb7d7a4 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -1048,6 +1048,7 @@ class zanodemodel extends model { $now = helper::now(); $data = fixer::input('post') + ->remove('syncToZentao') ->setDefault('createdBy', $this->app->user->account) ->setDefault('createdDate', $now) ->setDefault('node', 0) @@ -1098,4 +1099,14 @@ class zanodemodel extends model return dao::$errors = $this->lang->zanode->runTimeout; } } + + /** + * Sync cases in dir to zentao. + * + * @access public + * @return void + */ + public function syncCasesToZentao($path) + { + } } From c6efd7142652d27b015b8fe56c0c4ebb954aff39 Mon Sep 17 00:00:00 2001 From: zenggang Date: Fri, 17 Mar 2023 08:33:40 +0000 Subject: [PATCH 16/35] * Finish task#86376,86375 --- module/group/lang/resource.php | 40 +++++++++--------- module/repo/control.php | 47 ++++++++++++++++++++- module/repo/css/import.css | 7 ++++ module/repo/js/import.js | 53 ++++++++++++++++++++++++ module/repo/lang/de.php | 5 +++ module/repo/lang/en.php | 5 +++ module/repo/lang/fr.php | 5 +++ module/repo/lang/zh-cn.php | 5 +++ module/repo/model.php | 61 ++++++++++++++++++++++++++++ module/repo/view/import.html.php | 65 ++++++++++++++++++++++++++++++ module/repo/view/maintain.html.php | 1 + 11 files changed, 274 insertions(+), 20 deletions(-) create mode 100644 module/repo/css/import.css create mode 100644 module/repo/js/import.js create mode 100644 module/repo/view/import.html.php diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 4047a0a235..af6d5b691e 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1303,26 +1303,28 @@ $lang->resource->repo->linkStory = 'linkStory'; $lang->resource->repo->linkBug = 'linkBug'; $lang->resource->repo->linkTask = 'linkTask'; $lang->resource->repo->unlink = 'unlink'; +$lang->resource->repo->import = 'importAction'; -$lang->repo->methodOrder[5] = 'create'; -$lang->repo->methodOrder[10] = 'edit'; -$lang->repo->methodOrder[15] = 'delete'; -$lang->repo->methodOrder[20] = 'showSyncCommit'; -$lang->repo->methodOrder[25] = 'maintain'; -$lang->repo->methodOrder[30] = 'browse'; -$lang->repo->methodOrder[35] = 'view'; -$lang->repo->methodOrder[40] = 'diff'; -$lang->repo->methodOrder[45] = 'log'; -$lang->repo->methodOrder[50] = 'revision'; -$lang->repo->methodOrder[55] = 'blame'; -$lang->repo->methodOrder[60] = 'download'; -$lang->repo->methodOrder[65] = 'setRules'; -$lang->repo->methodOrder[70] = 'apiGetRepoByUrl'; -$lang->repo->methodOrder[75] = 'downloadCode'; -$lang->repo->methodOrder[80] = 'linkStory'; -$lang->repo->methodOrder[85] = 'linkBug'; -$lang->repo->methodOrder[90] = 'linkTask'; -$lang->repo->methodOrder[95] = 'unlink'; +$lang->repo->methodOrder[5] = 'create'; +$lang->repo->methodOrder[10] = 'edit'; +$lang->repo->methodOrder[15] = 'delete'; +$lang->repo->methodOrder[20] = 'showSyncCommit'; +$lang->repo->methodOrder[25] = 'maintain'; +$lang->repo->methodOrder[30] = 'browse'; +$lang->repo->methodOrder[35] = 'view'; +$lang->repo->methodOrder[40] = 'diff'; +$lang->repo->methodOrder[45] = 'log'; +$lang->repo->methodOrder[50] = 'revision'; +$lang->repo->methodOrder[55] = 'blame'; +$lang->repo->methodOrder[60] = 'download'; +$lang->repo->methodOrder[65] = 'setRules'; +$lang->repo->methodOrder[70] = 'apiGetRepoByUrl'; +$lang->repo->methodOrder[75] = 'downloadCode'; +$lang->repo->methodOrder[80] = 'linkStory'; +$lang->repo->methodOrder[85] = 'linkBug'; +$lang->repo->methodOrder[90] = 'linkTask'; +$lang->repo->methodOrder[95] = 'unlink'; +$lang->repo->methodOrder[100] = 'import'; $lang->resource->ci = new stdclass(); $lang->resource->ci->commitResult = 'commitResult'; diff --git a/module/repo/control.php b/module/repo/control.php index 32ea458c9f..4c00355215 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -1382,6 +1382,50 @@ class repo extends control return $this->send(array('result' => 'success', 'revision' => $revision)); } + /** + * Import repos. + * + * @param int $server + * @access public + * @return void + */ + public function import($server = 0) + { + if($_POST) + { + $this->repo->batchCreate(); + + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->repo->createLink('maintain'))); + } + + $gitlabList = $this->loadModel('gitlab')->getList(); + $gitlab = empty($server) ? array_shift($gitlabList) : $this->gitlab->getById($server); + + $repoList = array(); + if(!empty($gitlab)) + { + $repoList = $this->gitlab->apiGetProjects($gitlab->id); + $existRepoList = $this->dao->select('serviceProject,name')->from(TABLE_REPO) + ->where('SCM')->eq(ucfirst($gitlab->type)) + ->andWhere('serviceHost')->eq($gitlab->id) + ->fetchPairs(); + foreach($repoList as $key => $repo) + { + if(isset($existRepoList[$repo->id])) unset($repoList[$key]); + } + } + + $products = $this->loadModel('product')->getPairs('', 0, '', 'all'); + + $this->view->gitlabPairs = $this->gitlab->getPairs(); + $this->view->products = $products; + $this->view->projects = $this->product->getProjectPairsByProductIDList(array_keys($products)); + $this->view->gitlab = $gitlab; + $this->view->repoList = array_values($repoList); + $this->display(); + } + /** * Ajax sync comment. * @@ -1710,7 +1754,8 @@ class repo extends control $selectedProjects = array_intersect(array_keys($accessProjects), $postData->projects); - return print (html::select('projects[]', $accessProjects, $selectedProjects, "class='form-control chosen' multiple")); + $name = isset($postData->number) ? "projects[{$postData->number}][]" : 'projects[]'; + return print (html::select($name, $accessProjects, $selectedProjects, "class='form-control chosen' multiple")); } /** diff --git a/module/repo/css/import.css b/module/repo/css/import.css new file mode 100644 index 0000000000..8a5bae21aa --- /dev/null +++ b/module/repo/css/import.css @@ -0,0 +1,7 @@ +#repoList td.form-actions {padding: 7px;} +#repoList td.form-actions a {line-height: 18px;} + +.main-table .table {cursor: default;} +.main-table thead>tr {border-bottom: none; height: 45px;} +.main-table tbody>tr {border-bottom: none; height: 42px;} +.icon-close {cursor: pointer;} diff --git a/module/repo/js/import.js b/module/repo/js/import.js new file mode 100644 index 0000000000..cb3fa9e895 --- /dev/null +++ b/module/repo/js/import.js @@ -0,0 +1,53 @@ +/** + * Delete the project. + * + * @param object $icon + * @access public + * @return void + */ +function delItem(icon) +{ + $(icon).closest('tr').remove(); + checkItem(); +} + +/** + * Check the project. + * + * @access public + * @return void + */ +function checkItem() +{ + if(!$("#repoList tbody tr").length) $("#submit").prop('disabled', true); +} + +$(function() +{ + checkItem(); + + $(document).on('change', '[id^=product]', function() + { + var i = $(this).attr('id').replace(/[^0-9]/ig, ''); + var projects = $('#projects' + i).val(); + var products = $(this).val(); + $.post(createLink('repo', 'ajaxProjectsOfProducts'), {products, projects, 'number':i}, function(response) + { + $('#projectContainer' + i).html('').append(response); + $('#projects' + i).chosen().trigger("chosen:updated"); + }); + }); + +}); + +/** + * Change server. + * + * @access public + * @return void + */ +function selectServer() +{ + var server = $('#servers').val(); + window.location.href = createLink('repo', 'import', 'server=' + server); +} diff --git a/module/repo/lang/de.php b/module/repo/lang/de.php index 73f4cc4a63..90d9276f33 100644 --- a/module/repo/lang/de.php +++ b/module/repo/lang/de.php @@ -46,6 +46,11 @@ $lang->repo->httpClone = 'Clone with HTTP'; $lang->repo->cloneUrl = 'Clone URL'; $lang->repo->linkTask = 'Link Task'; $lang->repo->unlinkedTasks = 'Unlinked Tasks'; +$lang->repo->importAction = 'Import Repo'; +$lang->repo->import = 'Import'; +$lang->repo->importName = 'Name after import'; +$lang->repo->importServer = 'Please select a server'; +$lang->repo->gitlabList = 'Gitlab Repo'; $lang->repo->submit = 'Submit'; $lang->repo->cancel = 'Cancel'; diff --git a/module/repo/lang/en.php b/module/repo/lang/en.php index 2c2c3b9d26..7d3a299d1b 100644 --- a/module/repo/lang/en.php +++ b/module/repo/lang/en.php @@ -46,6 +46,11 @@ $lang->repo->httpClone = 'Clone with HTTP'; $lang->repo->cloneUrl = 'Clone URL'; $lang->repo->linkTask = 'Link Task'; $lang->repo->unlinkedTasks = 'Unlinked Tasks'; +$lang->repo->importAction = 'Import Repo'; +$lang->repo->import = 'Import'; +$lang->repo->importName = 'Name after import'; +$lang->repo->importServer = 'Please select a server'; +$lang->repo->gitlabList = 'Gitlab Repo'; $lang->repo->submit = 'Submit'; $lang->repo->cancel = 'Cancel'; diff --git a/module/repo/lang/fr.php b/module/repo/lang/fr.php index 3fe607091f..4a1f2a0c11 100644 --- a/module/repo/lang/fr.php +++ b/module/repo/lang/fr.php @@ -46,6 +46,11 @@ $lang->repo->httpClone = 'Clone with HTTP'; $lang->repo->cloneUrl = 'Clone URL'; $lang->repo->linkTask = 'Link Task'; $lang->repo->unlinkedTasks = 'Unlinked Tasks'; +$lang->repo->importAction = 'Import Repo'; +$lang->repo->import = 'Import'; +$lang->repo->importName = 'Name after import'; +$lang->repo->importServer = 'Please select a server'; +$lang->repo->gitlabList = 'Gitlab Repo'; $lang->repo->submit = 'Soumettre'; $lang->repo->cancel = 'Annuler'; diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php index 42654aa451..c801417147 100644 --- a/module/repo/lang/zh-cn.php +++ b/module/repo/lang/zh-cn.php @@ -46,6 +46,11 @@ $lang->repo->httpClone = '使用HTTP克隆'; $lang->repo->cloneUrl = '克隆地址'; $lang->repo->linkTask = '关联任务'; $lang->repo->unlinkedTasks = '未关联任务'; +$lang->repo->importAction = '导入代码库'; +$lang->repo->import = '导入'; +$lang->repo->importName = '导入后的名称'; +$lang->repo->importServer = '请选择服务器'; +$lang->repo->gitlabList = 'Gitlab代码库'; $lang->repo->submit = '提交'; $lang->repo->cancel = '取消'; diff --git a/module/repo/model.php b/module/repo/model.php index 18071a5972..f810ceb24e 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -244,6 +244,67 @@ class repoModel extends model return $repoID; } + /** + * Batch create repos. + * + * @access public + * @return bool + */ + public function batchCreate() + { + $repos = fixer::input('post')->get(); + + $dataAry = array(); + foreach($repos as $key => $val) + { + if(strpos($key, 'serviceProject') === 0) + { + $i = substr($key, 14); + if(empty($repos->{'product' . $i})) dao::$errors['product' . $i][] = sprintf($this->lang->error->notempty, $this->lang->repo->product); + if(empty($repos->{'name' . $i})) dao::$errors['name' . $i][] = sprintf($this->lang->error->notempty, $this->lang->repo->name); + + if(!empty($repos->{'product' . $i}) and !empty($repos->{'name' . $i})) $dataAry[] = array('serviceProject' => $repos->{'serviceProject' . $i}, 'product' => implode(',', $repos->{'product' . $i}), 'name' => $repos->{'name' . $i}, 'projects' => empty($repos->projects[$i]) ? '' : implode(',', $repos->projects[$i])); + } + } + if(dao::isError()) return false; + + foreach($dataAry as $data) + { + $repo = new stdclass(); + $repo->serviceHost = $repos->serviceHost; + $repo->serviceProject = $data['serviceProject']; + $repo->product = $data['product']; + $repo->name = $data['name']; + $repo->projects = $data['projects']; + $repo->SCM = 'Gitlab'; + $repo->encoding = 'utf-8'; + $repo->encrypt = 'base64'; + + $this->dao->insert(TABLE_REPO)->data($repo) + ->batchCheck($this->config->repo->create->requiredFields, 'notempty') + ->check('serviceHost,serviceProject', 'notempty') + ->check('name', 'unique', "`SCM` = '{$repo->SCM}'") + ->check('serviceProject', 'unique', "`SCM` = '{$repo->SCM}' and `serviceHost` = '{$repo->serviceHost}'") + ->autoCheck() + ->exec(); + + if(dao::isError()) return false; + + $repoID = $this->dao->lastInsertID(); + + if($repo->SCM == 'Gitlab') + { + /* Add webhook. */ + $repo = $this->getRepoByID($repoID); + $this->loadModel('gitlab')->addPushWebhook($repo); + } + + $actionID = $this->loadModel('action')->create('repo', $repoID, 'created'); + } + + return true; + } + /** * Update a repo. * diff --git a/module/repo/view/import.html.php b/module/repo/view/import.html.php new file mode 100644 index 0000000000..cc1fe06a60 --- /dev/null +++ b/module/repo/view/import.html.php @@ -0,0 +1,65 @@ + + * @package repo + * @version $Id$ + * @link http://www.zentao.net + */ +?> + + +
+ + id);?> + + + + + + + + + + + + $repo): ?> + + + + + + + + + + + + + + +
repo->gitlabList;?>repo->importName;?>repo->product;?>repo->projects;?>
+ id);?> + name_with_namespace;?> + + name, "class='form-control'");?> +
+ repo->import); ?> + + app->tab == 'devops') echo html::a(inlink('maintain', ""), $lang->goback, '', 'class="btn btn-wide"');?> + +
+ +
+ diff --git a/module/repo/view/maintain.html.php b/module/repo/view/maintain.html.php index 0351fe1171..907c05fdcd 100644 --- a/module/repo/view/maintain.html.php +++ b/module/repo/view/maintain.html.php @@ -16,6 +16,7 @@ createLink('repo', 'maintain'), "{$lang->repo->maintain}", '', "class='btn btn-link btn-active-text'");?>
+ " . $this->lang->repo->importAction, '', "class='btn btn-link'");?> " . $this->lang->repo->create, '', "class='btn btn-primary'");?>
From 8c7414226ce0af5e7dc67489c8b63f9f55fafeb8 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 21 Mar 2023 10:14:12 +0800 Subject: [PATCH 17/35] * Fix bug #33114. --- module/zanode/model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/zanode/model.php b/module/zanode/model.php index 5b7d9b41cd..b147f16142 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -631,7 +631,7 @@ class zanodemodel extends model if($host->status != 'online' || time() - strtotime($host->heartbeat) > 60) { - $l->status = self::STATUS_SHUTOFF; + $l->status = $l->hostType == '' ? 'wait' : 'offline'; continue; } @@ -641,6 +641,7 @@ class zanodemodel extends model } } } + var_dump($list);die; return $list; } From d9aaa1f4616bb81cced3b3f2e5ad64b49fba9eeb Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 21 Mar 2023 10:14:29 +0800 Subject: [PATCH 18/35] * Fix bug #33114. --- module/zanode/model.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/zanode/model.php b/module/zanode/model.php index b147f16142..fcd5bdad85 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -641,7 +641,6 @@ class zanodemodel extends model } } } - var_dump($list);die; return $list; } From 4055ee45aaae750ff2b47c3ab4e5b0378d01af92 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 21 Mar 2023 10:17:19 +0800 Subject: [PATCH 19/35] + Fix bug #33118. --- module/zanode/lang/fr.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index dd4710ced0..a066079d06 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -155,8 +155,7 @@ $lang->zanode->init->next = "Next"; $lang->zanode->init->button = "Go To Settings"; $lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it takes two steps to execute the automated test on the execution node:
1. Configure the automated test running environment according to the %s
2. Go to %s"; -$lang->zanode->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:"; -$lang->zanode->init->initFailNoticeDesc = "1. Re-execute the script
2. Review the initialization FAQ"; +$lang->zanode->init->initFailNotice = "Fail,Execute the installation service command on the node or See Help."; $lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', From cc81f8dd439eb5750185b552dc582d5103a726b4 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 22 Mar 2023 14:20:26 +0800 Subject: [PATCH 20/35] * Fix bug #32701. --- api/v1/entries/testsuite.php | 2 +- api/v1/entries/testsuites.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/v1/entries/testsuite.php b/api/v1/entries/testsuite.php index ab6047a9d2..a06fa5711b 100644 --- a/api/v1/entries/testsuite.php +++ b/api/v1/entries/testsuite.php @@ -21,7 +21,7 @@ class testsuiteEntry extends entry public function get($testsuiteID) { $control = $this->loadController('testsuite', 'view'); - $control->view($testsuiteID, $this->param('version', 0)); + $control->view($testsuiteID, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); $data = $this->getData(); if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404(); diff --git a/api/v1/entries/testsuites.php b/api/v1/entries/testsuites.php index 22012099fc..ece087dc4e 100644 --- a/api/v1/entries/testsuites.php +++ b/api/v1/entries/testsuites.php @@ -24,7 +24,7 @@ class testsuitesEntry extends entry if(empty($productID)) return $this->sendError(400, 'Need product id.'); $control = $this->loadController('testsuite', 'browse'); - $control->browse($productID, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); + $control->browse($productID, 'all', $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); $data = $this->getData(); if(isset($data->status) and $data->status == 'success') From c7fb972550f7c66644504412f700cdc1e73e3c87 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 22 Mar 2023 14:29:16 +0800 Subject: [PATCH 21/35] * Fix bug #32700. --- api/v1/entries/testcases.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/v1/entries/testcases.php b/api/v1/entries/testcases.php index d4fcaab2a0..9aa0ff714f 100644 --- a/api/v1/entries/testcases.php +++ b/api/v1/entries/testcases.php @@ -36,7 +36,7 @@ class testcasesEntry extends entry } $control = $this->loadController('testcase', 'browse'); - $control->browse($productID, $this->param('branch', ''), $type, $param, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); + $control->browse($productID, $this->param('branch', ''), $type, $param, '', $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); $data = $this->getData(); From 23caed765a52b8af5c17c6a576b53edbe50f48a0 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 23 Mar 2023 08:37:35 +0800 Subject: [PATCH 22/35] * Fix case version error in ciresult api. --- module/testtask/model.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module/testtask/model.php b/module/testtask/model.php index ca2d2ad3b4..7d84ac6ba8 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1888,11 +1888,13 @@ class testtaskModel extends model $caseID = $case->id; $oldCase = $this->dao->select('*')->from(TABLE_CASE)->where('id')->eq($caseID)->fetch(); - $this->dao->update(TABLE_CASE)->data($case)->where('id')->eq($caseID)->exec(); - + $case->version = $oldCase->version; + $case->openedDate = $oldCase->openedDate; + $changes = common::createChanges($oldCase, $case); if($changes) { + $this->dao->update(TABLE_CASE)->data($case)->where('id')->eq($caseID)->exec(); $actionID = $this->action->create('case', $caseID, 'Edited'); $this->action->logHistory($actionID, $changes); } @@ -2329,7 +2331,7 @@ class testtaskModel extends model $caseStep = new stdclass(); $caseStep->type = 'step'; - $caseStep->desc = ''; + $caseStep->desc = $step->name; $caseStep->expect = $step->checkPoints[0]->expect; $case->steps[] = $caseStep; From f88c705e6a48379bbd66a0425424ec545fa1e76a Mon Sep 17 00:00:00 2001 From: zenggang Date: Thu, 23 Mar 2023 02:09:38 +0000 Subject: [PATCH 23/35] * Fix bug#33135 --- lib/scm/gitlab.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 799b674608..a8f5b9d454 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -836,7 +836,7 @@ class gitlab return array(); } - if($httpCode == 500) return array(); + if($httpCode == 500 or $httpCode == 404) return array(); return json_decode($response); } } From 294b30157355a257144abe60f1b47a8d48f406fb Mon Sep 17 00:00:00 2001 From: zenggang Date: Thu, 23 Mar 2023 07:58:15 +0000 Subject: [PATCH 24/35] * Fix bug#33106 --- module/zanode/view/browse.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index cffabea247..fdae12124b 100644 --- a/module/zanode/view/browse.html.php +++ b/module/zanode/view/browse.html.php @@ -69,7 +69,7 @@
id; ?> inlink('view', "id=$node->id"), $node->name, '', ""); ?>lang->zanode->typeList, $node->type); ?>hostType == 'physics' ? $this->lang->zanode->typeList['physics'] : $this->lang->zanode->typeList['node']; ?> extranet; ?> zanode->os->cpuCores, $node->cpuCores); ?> memory . $this->lang->zahost->unitList['GB']; ?>
id; ?> inlink('view', "id=$node->id"), $node->name, '', ""); ?>lang->zanode->typeList, $node->type); ?>lang->zanode->typeList, $node->hostType, zget($this->lang->zanode->typeList, $node->type)); ?> extranet; ?> zanode->os->cpuCores, $node->cpuCores); ?> memory . $this->lang->zahost->unitList['GB']; ?>
zanode->osName;?> - - + +
zanode->osName;?>osName, "class='form-control' " . ($zanode->hostType != 'physics' ? "readonly='readonly'" : ''))?>hostType != 'physics' ? $zanode->osName : zget($config->zanode->linuxList, $zanode->osName, zget($config->zanode->windowsList, $zanode->osName)), "class='form-control' readonly='readonly'")?>
zanode->desc ?>