* Merge branch 'zenops_46_zhaoke_77683' into zenops_46_tanghucheng.

This commit is contained in:
tanghucheng
2022-12-07 14:10:33 +08:00
parent 30d183fab5
commit 8a43a646ff
11 changed files with 167 additions and 7 deletions
+9 -2
View File
@@ -42,12 +42,19 @@ $lang->zanode->confirmSuspend = "Are you sure to suspend the execution node"
$lang->zanode->confirmResume = "Are you sure to resume the execution node";
$lang->zanode->actionSuccess = 'Success';
$lang->zanode->deleted = "Deleted";
$lang->zanode->scriptPath = "Script path";
$lang->zanode->shell = "Shell";
$lang->zanode->automation = "Automation";
$lang->automation = new stdClass();
$lang->automation->path = $lang->zanode->scriptPath;
$lang->automation->node = $lang->zanode->common;
$lang->zanode->notFoundAgent = 'No Agent service is found';
$lang->zanode->createVmFail = 'Failed to create a execution 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";
$lang->zanode->empty = 'No zanode is found';
$lang->zanode->nameValid = "Name must be letters, numbers,'-''_''.', And cannot begin with a symbol";
$lang->zanode->empty = 'Execution node not found.';
$lang->zanode->empty = 'No Execution Node';
$lang->zanode->createImaging = 'Creating';
+7
View File
@@ -42,6 +42,13 @@ $lang->zanode->confirmSuspend = "Are you sure to suspend the execution node"
$lang->zanode->confirmResume = "Are you sure to resume the execution node";
$lang->zanode->actionSuccess = 'Success';
$lang->zanode->deleted = "Deleted";
$lang->zanode->scriptPath = "Script path";
$lang->zanode->shell = "Shell";
$lang->zanode->automation = "Automation";
$lang->automation = new stdClass();
$lang->automation->path = $lang->zanode->scriptPath;
$lang->automation->node = $lang->zanode->common;
$lang->zanode->notFoundAgent = 'No Agent service is found';
$lang->zanode->createVmFail = 'Failed to create a execution node';
+7
View File
@@ -42,6 +42,13 @@ $lang->zanode->confirmSuspend = "Are you sure to suspend the execution node"
$lang->zanode->confirmResume = "Are you sure to resume the execution node";
$lang->zanode->actionSuccess = 'Success';
$lang->zanode->deleted = "Deleted";
$lang->zanode->scriptPath = "Script path";
$lang->zanode->shell = "Shell";
$lang->zanode->automation = "Automation";
$lang->automation = new stdClass();
$lang->automation->path = $lang->zanode->scriptPath;
$lang->automation->node = $lang->zanode->common;
$lang->zanode->notFoundAgent = 'No Agent service is found';
$lang->zanode->createVmFail = 'Failed to create a execution node';
+7
View File
@@ -42,6 +42,13 @@ $lang->zanode->confirmSuspend = "您确定暂停执行节点吗?";
$lang->zanode->confirmResume = "您确定恢复执行节点吗?";
$lang->zanode->actionSuccess = '操作成功';
$lang->zanode->deleted = "已删除";
$lang->zanode->scriptPath = "脚本目录";
$lang->zanode->shell = "shell命令";
$lang->zanode->automation = "自动化测试";
$lang->automation = new stdClass();
$lang->automation->path = $lang->zanode->scriptPath;
$lang->automation->node = $lang->zanode->common;
$lang->zanode->notFoundAgent = '没有发现Agent服务';
$lang->zanode->createVmFail = '创建执行节点失败';
+49 -1
View File
@@ -352,6 +352,22 @@ class zanodemodel extends model
->fetchAll('id');
}
/**
* Get node pairs.
*
* @param string $orderBy
* @access public
* @return void
*/
public function getPairs($orderBy = 'id_desc')
{
return $this->dao->select('*')->from(TABLE_ZAHOST)
->where('deleted')->eq(0)
->andWhere("type")->eq('node')
->orderBy($orderBy)
->fetchPairs('id', 'name');
}
/**
* Get node list by hostID.
*
@@ -518,7 +534,7 @@ class zanodemodel extends model
$agnetUrl = 'http://' . $node->ip . ':' . $node->hzap . static::KVM_TOKEN_PATH;
$result = json_decode(commonModel::http("$agnetUrl?port={$node->vnc}", array(), array(CURLOPT_CUSTOMREQUEST => 'GET'), array("Authorization:$node->hTokenSN"), 'json'));
if(empty($result) or $result->code != 'success') return false;
$returnData = new stdClass();
@@ -565,6 +581,13 @@ class zanodemodel extends model
return $result;
}
/**
* Build operateMenu for browse view.
*
* @param int $node
* @access public
* @return void
*/
public function buildOperateMenu($node)
{
if($node->deleted) return '';
@@ -626,4 +649,29 @@ class zanodemodel extends model
"ZTF" => $result->data->ztfStatus,
);
}
/**
* Set automation setting.
*
* @access public
* @return void
*/
public function setAutomationSetting()
{
$now = helper::now();
$data = fixer::input('post')
->setDefault('createdBy', $this->app->user->account)
->setDefault('createdDate', $now)
->remove('uid')
->get();
$this->dao->replace(TABLE_AUTOMATION)
->data($data)
->batchcheck('node,scriptPath', 'notempty')
->autoCheck()
->exec();
if(dao::isError()) return false;
return $this->dao->lastInsertID();
}
}