This commit is contained in:
tanghucheng
2023-01-05 09:01:03 +08:00
parent a85663d8dc
commit 79a7989421
5 changed files with 10 additions and 3 deletions
+1
View File
@@ -129,3 +129,4 @@ $lang->zanode->tips = "The execution node is a virtual machine or container inst
$lang->zanode->scriptTips = 'Write the directory where the script is located on the execution node.';
$lang->zanode->shellTips = 'Before running the automated test script on the execution node, you can execute a custom shell command.';
$lang->zanode->automationTips = 'Before executing the test task on the execution node, you need to set up the execution node corresponding to the product, the directory of the automated test script, and the custom Shell command to execute.';
$lang->zanode->nameUnique = $lang->zanode->name . 'already exist';
+1
View File
@@ -129,3 +129,4 @@ $lang->zanode->tips = "The execution node is a virtual machine or container inst
$lang->zanode->scriptTips = 'Write the directory where the script is located on the execution node.';
$lang->zanode->shellTips = 'Before running the automated test script on the execution node, you can execute a custom shell command.';
$lang->zanode->automationTips = 'Before executing the test task on the execution node, you need to set up the execution node corresponding to the product, the directory of the automated test script, and the custom Shell command to execute.';
$lang->zanode->nameUnique = $lang->zanode->name . 'already exist';
+1
View File
@@ -129,3 +129,4 @@ $lang->zanode->tips = "The execution node is a virtual machine or container inst
$lang->zanode->scriptTips = 'Write the directory where the script is located on the execution node.';
$lang->zanode->shellTips = 'Before running the automated test script on the execution node, you can execute a custom shell command.';
$lang->zanode->automationTips = 'Before executing the test task on the execution node, you need to set up the execution node corresponding to the product, the directory of the automated test script, and the custom Shell command to execute.';
$lang->zanode->nameUnique = $lang->zanode->name . 'already exist';
+1
View File
@@ -129,3 +129,4 @@ $lang->zanode->tips = '执行节点是由宿主机创建的虚拟机或容器实
$lang->zanode->scriptTips = '填写执行节点上自动化测试脚本所在的目录。';
$lang->zanode->shellTips = '在执行节点上运行自动化测试脚本前,可以执行自定义的shell命令。';
$lang->zanode->automationTips = '在执行节点上执行测试任务前,需要设置产品对应的执行节点,自动化测试脚本的目录以及需要执行的自定义Shell命令。';
$lang->zanode->nameUnique = $lang->zanode->name . '已存在';
+6 -3
View File
@@ -52,11 +52,10 @@ class zanodemodel extends model
$data = fixer::input('post')->get();
/* Batch check fields. */
$this->lang->vm = $this->lang->zanode;
$data->type = 'node';
$this->dao->update(TABLE_ZAHOST)->data($data)
->batchCheck($this->config->zanode->create->requiredFields, 'notempty')
->check('name', 'unique', "type='node'");
->batchCheck($this->config->zanode->create->requiredFields, 'notempty');
if(dao::isError()) return false;
if(!preg_match("/^(?!_)(?!-)(?!\.)[a-zA-Z0-9\_\.\-]+$/", $data->name))
@@ -65,6 +64,10 @@ class zanodemodel extends model
return false;
}
/* If name already exists return error. */
$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;
/* Get image. */
$image = $this->getImageByID($data->image);