printExtendFields('', 'table', 'columns=3');?>
- lifetime != 'ops') ? '' : 'hidden'?>
+ lifetime != 'ops' and !in_array($execution->attribute, array('request', 'review'))) ? '' : 'hidden'?>
- lifetime != 'ops'):?>
+ lifetime != 'ops' and !in_array($execution->attribute, array('request', 'review'))):?>
| task->selectTestStory;?> |
diff --git a/module/transfer/control.php b/module/transfer/control.php
index a12979c8bd..264fad2164 100755
--- a/module/transfer/control.php
+++ b/module/transfer/control.php
@@ -67,6 +67,11 @@ class transfer extends control
$this->config->transfer->sysDataList = $this->transfer->initSysDataFields();
$fields = $this->config->$model->templateFields;
+ if($model == 'task')
+ {
+ $execution = $this->loadModel('execution')->getByID($executionID);
+ if(isset($execution) and $execution->type == 'ops' or in_array($execution->attribute, array('request', 'review'))) $fields = str_replace('story,', '', $fields);
+ }
/* Init config fieldList. */
$fieldList = $this->transfer->initFieldList($model, $fields);
diff --git a/module/tutorial/js/index.js b/module/tutorial/js/index.js
index 0a3c34e855..5e19f00ecb 100644
--- a/module/tutorial/js/index.js
+++ b/module/tutorial/js/index.js
@@ -414,7 +414,7 @@ $(function()
else
{
var $modulemenu = $$('#subNavbar');
- if(adminMenu) $modulemenu = $$('#navbar');
+ if(task.nav.app == 'admin') $modulemenu = $$('#navbar');
var $modulemenuItem = $modulemenu.find('[data-id="' + task.nav.menu + '"]');
if($modulemenuItem.length && !$modulemenuItem.hasClass('active'))
{
diff --git a/module/zahost/lang/de.php b/module/zahost/lang/de.php
index eb6f4b21e3..c20cbcb3b4 100644
--- a/module/zahost/lang/de.php
+++ b/module/zahost/lang/de.php
@@ -16,6 +16,7 @@ $lang->zahost->browseNode = 'ZAnode Browse';
$lang->zahost->deleted = "Deleted";
$lang->zahost->copy = 'Click to copy';
$lang->zahost->copied = 'Copy successful';
+$lang->zahost->baseInfo = 'Basic information';
$lang->zahost->name = 'Name';
$lang->zahost->IP = 'Extranet Address';
diff --git a/module/zahost/lang/en.php b/module/zahost/lang/en.php
index eb6f4b21e3..c20cbcb3b4 100644
--- a/module/zahost/lang/en.php
+++ b/module/zahost/lang/en.php
@@ -16,6 +16,7 @@ $lang->zahost->browseNode = 'ZAnode Browse';
$lang->zahost->deleted = "Deleted";
$lang->zahost->copy = 'Click to copy';
$lang->zahost->copied = 'Copy successful';
+$lang->zahost->baseInfo = 'Basic information';
$lang->zahost->name = 'Name';
$lang->zahost->IP = 'Extranet Address';
diff --git a/module/zahost/lang/fr.php b/module/zahost/lang/fr.php
index eb6f4b21e3..c20cbcb3b4 100644
--- a/module/zahost/lang/fr.php
+++ b/module/zahost/lang/fr.php
@@ -16,6 +16,7 @@ $lang->zahost->browseNode = 'ZAnode Browse';
$lang->zahost->deleted = "Deleted";
$lang->zahost->copy = 'Click to copy';
$lang->zahost->copied = 'Copy successful';
+$lang->zahost->baseInfo = 'Basic information';
$lang->zahost->name = 'Name';
$lang->zahost->IP = 'Extranet Address';
diff --git a/module/zahost/lang/zh-cn.php b/module/zahost/lang/zh-cn.php
index b62373eece..746a55c035 100644
--- a/module/zahost/lang/zh-cn.php
+++ b/module/zahost/lang/zh-cn.php
@@ -16,6 +16,7 @@ $lang->zahost->browseNode = '执行节点列表';
$lang->zahost->deleted = "已删除";
$lang->zahost->copy = '复制';
$lang->zahost->copied = '复制成功';
+$lang->zahost->baseInfo = '基础信息';
$lang->zahost->name = '名称';
$lang->zahost->IP = 'IP/域名';
diff --git a/module/zahost/view/view.html.php b/module/zahost/view/view.html.php
index 06e5396b7d..d5502a1ec8 100644
--- a/module/zahost/view/view.html.php
+++ b/module/zahost/view/view.html.php
@@ -33,7 +33,7 @@
- zahost->view;?>
+ zahost->baseInfo;?>
+
+ zahost->desc;?>
+ desc) ? htmlspecialchars_decode($zahost->desc) : $lang->noData;?>
+
-
-
- zahost->desc;?>
- desc) ? htmlspecialchars_decode($zahost->desc) : $lang->noData;?>
-
-
diff --git a/module/zanode/config.php b/module/zanode/config.php
index 1096e4e057..c8a81099d6 100644
--- a/module/zanode/config.php
+++ b/module/zanode/config.php
@@ -2,9 +2,10 @@
$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->edit->requiredFields = '';
-$config->zanode->createimage->requiredFields = 'name';
+$config->zanode->create->requiredFields = 'name,host,image,cpu,memory,disk,osName';
+$config->zanode->create->physicsRequiredFields = 'name,extranet,cpu,memory,osName';
+$config->zanode->edit->requiredFields = '';
+$config->zanode->createimage->requiredFields = 'name';
$config->zanode->defaultPort = '55001';
$config->zanode->defaultAccount = 'z';
diff --git a/module/zanode/control.php b/module/zanode/control.php
index 45c7c37102..7360defed1 100644
--- a/module/zanode/control.php
+++ b/module/zanode/control.php
@@ -137,10 +137,15 @@ class zanode extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
- $this->view->title = $this->lang->zanode->editAction;
- $this->view->zanode = $this->zanode->getNodeByID($id);
- $this->view->host = $this->zanode->getHostByID($this->view->zanode->parent);
- $this->view->image = $this->zanode->getImageByID($this->view->zanode->image);
+ $zanode = $this->zanode->getNodeByID($id);
+
+ $this->view->title = $this->lang->zanode->editAction;
+ $this->view->zanode = $zanode;
+ if($zanode->type == 'node')
+ {
+ $this->view->host = $this->zanode->getHostByID($this->view->zanode->parent);
+ $this->view->image = $this->zanode->getImageByID($this->view->zanode->image);
+ }
$this->display();
}
diff --git a/module/zanode/css/browse.css b/module/zanode/css/browse.css
index e30b3b4232..648be7123d 100644
--- a/module/zanode/css/browse.css
+++ b/module/zanode/css/browse.css
@@ -3,7 +3,7 @@
.c-status {width: 70px;}
.c-cpu, .c-host {width: 100px;}
.c-ip{width: 150px;}
-.c-os {width: 120px;}
+.c-os, .c-type {width: 120px;}
.desktop, .createImage{margin-right: 4px;}
#helpTab .icon-help {line-height: unset;}
#bysearchTab {margin-right: 0px;}
diff --git a/module/zanode/css/browse.zh-cn.css b/module/zanode/css/browse.zh-cn.css
new file mode 100644
index 0000000000..d0bb3e1789
--- /dev/null
+++ b/module/zanode/css/browse.zh-cn.css
@@ -0,0 +1 @@
+.c-type {width: 80px;}
diff --git a/module/zanode/js/create.js b/module/zanode/js/create.js
new file mode 100644
index 0000000000..bd96c2ca22
--- /dev/null
+++ b/module/zanode/js/create.js
@@ -0,0 +1,19 @@
+function zahostType()
+{
+ if($('#type').val() == 'physics')
+ {
+ $('#parent').closest('tr').hide();
+ $('#image').closest('tr').hide();
+ $('#extranet').closest('tr').removeClass('hidden');
+ $('#osName').addClass('hidden');
+ $('#osNamePhysics').removeClass('hidden');
+ }
+ else
+ {
+ $('#parent').closest('tr').show();
+ $('#image').closest('tr').show();
+ $('#extranet').closest('tr').addClass('hidden');
+ $('#osName').removeClass('hidden');
+ $('#osNamePhysics').addClass('hidden');
+ }
+}
diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php
index 0845327c96..8b27396080 100644
--- a/module/zanode/lang/de.php
+++ b/module/zanode/lang/de.php
@@ -63,6 +63,9 @@ $lang->zanode->initializing = 'Initializing';
$lang->zanode->showPwd = 'Show Password';
$lang->zanode->hidePwd = 'Hide Password';
+$lang->zanode->typeList['node'] = 'Virtual machine';
+$lang->zanode->typeList['physics'] = 'Physical machine';
+
$lang->automation = new stdClass();
$lang->automation->scriptPath = $lang->zanode->scriptPath;
$lang->automation->node = $lang->zanode->common;
@@ -73,6 +76,7 @@ $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->runCaseConfirm = 'The system detects the presence of an automation script. Whether to execute?';
+$lang->zanode->netError = 'Unable to connect to the physical machine, please check the network and try again.';
$lang->zanode->createImage = 'Create Image';
$lang->zanode->createImaging = 'Creating';
diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php
index 2a661659a6..3a2f5b10bd 100644
--- a/module/zanode/lang/en.php
+++ b/module/zanode/lang/en.php
@@ -63,6 +63,9 @@ $lang->zanode->initializing = 'Initializing';
$lang->zanode->showPwd = 'Show Password';
$lang->zanode->hidePwd = 'Hide Password';
+$lang->zanode->typeList['node'] = 'Virtual machine';
+$lang->zanode->typeList['physics'] = 'Physical machine';
+
$lang->automation = new stdClass();
$lang->automation->scriptPath = $lang->zanode->scriptPath;
$lang->automation->node = $lang->zanode->common;
@@ -73,6 +76,7 @@ $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->runCaseConfirm = 'The system detects the presence of an automation script. Whether to execute?';
+$lang->zanode->netError = 'Unable to connect to the physical machine, please check the network and try again.';
$lang->zanode->createImage = 'Create Image';
$lang->zanode->createImaging = 'Creating';
diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php
index 0845327c96..8b27396080 100644
--- a/module/zanode/lang/fr.php
+++ b/module/zanode/lang/fr.php
@@ -63,6 +63,9 @@ $lang->zanode->initializing = 'Initializing';
$lang->zanode->showPwd = 'Show Password';
$lang->zanode->hidePwd = 'Hide Password';
+$lang->zanode->typeList['node'] = 'Virtual machine';
+$lang->zanode->typeList['physics'] = 'Physical machine';
+
$lang->automation = new stdClass();
$lang->automation->scriptPath = $lang->zanode->scriptPath;
$lang->automation->node = $lang->zanode->common;
@@ -73,6 +76,7 @@ $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->runCaseConfirm = 'The system detects the presence of an automation script. Whether to execute?';
+$lang->zanode->netError = 'Unable to connect to the physical machine, please check the network and try again.';
$lang->zanode->createImage = 'Create Image';
$lang->zanode->createImaging = 'Creating';
diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php
index 3ecd38629b..dcd471c766 100644
--- a/module/zanode/lang/zh-cn.php
+++ b/module/zanode/lang/zh-cn.php
@@ -63,6 +63,9 @@ $lang->zanode->initializing = '初始化中';
$lang->zanode->showPwd = '显示密码';
$lang->zanode->hidePwd = '隐藏密码';
+$lang->zanode->typeList['node'] = '虚拟机';
+$lang->zanode->typeList['physics'] = '物理机';
+
$lang->automation = new stdClass();
$lang->automation->scriptPath = $lang->zanode->scriptPath;
$lang->automation->node = $lang->zanode->common;
@@ -73,6 +76,7 @@ $lang->zanode->noVncPort = '无法获取执行节点端口';
$lang->zanode->nameValid = "名称只能是字母、数字,'-','_','.',且不能以符号开头";
$lang->zanode->empty = '暂时没有执行节点';
$lang->zanode->runCaseConfirm = '系统检测到选择的用例存在自动化测试脚本,是否自动执行用例?';
+$lang->zanode->netError = '无法连接到物理机,请检查网络后重试。';
$lang->zanode->createImage = '导出镜像';
$lang->zanode->createImaging = '正在导出镜像';
diff --git a/module/zanode/model.php b/module/zanode/model.php
index ed5e7c5c43..313eb4d24b 100644
--- a/module/zanode/model.php
+++ b/module/zanode/model.php
@@ -53,12 +53,15 @@ class zanodemodel extends model
*/
public function create()
{
- $data = fixer::input('post')->get();
+ $data = fixer::input('post')
+ ->setIF($this->post->type == 'physics', 'parent', 0)
+ ->setIF($this->post->type == 'physics', 'osName', $this->post->osNamePhysics)
+ ->remove('osNamePhysics')
+ ->get();
/* Batch check fields. */
- $data->type = 'node';
$this->dao->update(TABLE_ZAHOST)->data($data)
- ->batchCheck($this->config->zanode->create->requiredFields, 'notempty');
+ ->batchCheck($data->type == 'node' ? $this->config->zanode->create->requiredFields : $this->config->zanode->create->physicsRequiredFields, 'notempty');
if(dao::isError()) return false;
@@ -69,47 +72,60 @@ class zanodemodel extends model
}
/* If name already exists return error. */
- $node = $this->dao->select('*')->from(TABLE_ZAHOST)->where('name')->eq($data->name)->andWhere('type')->eq('node')->fetch();
+ $node = $this->dao->select('*')->from(TABLE_ZAHOST)->where('name')->eq($data->name)->andWhere('type')->in('node,physics')->fetch();
if($node) return dao::$errors[] = $this->lang->zanode->nameUnique;
- /* Get image. */
- $image = $this->getImageByID($data->image);
-
- /* Get host info. */
- $host = $this->getHostByID($data->parent);
-
- /* Prepare create params. */
- $agnetUrl = 'http://' . $host->extranet . ':' . $host->zap;
- $param = array(
- 'os' => $image->osName,
- 'path' => $image->path,
- 'name' => $data->name,
- 'cpu' => (int)$data->cpuCores,
- 'disk' => (int)$data->diskSize,
- 'memory' => (int)$data->memory,
- );
-
- $result = json_decode(commonModel::http($agnetUrl . static::KVM_CREATE_PATH, json_encode($param), null, array("Authorization:$host->tokenSN")));
-
- if(empty($result))
+ if($data->type == 'physics')
{
- dao::$errors[] = $this->lang->zanode->notFoundAgent;
- return false;
+ $ping = $this->loadModel('zahost')->checkAddress($data->extranet);
+ if(!$ping)
+ {
+ dao::$errors[] = $this->lang->zanode->netError;
+ return false;
+ }
}
- if($result->code != 'success')
+ else
{
- dao::$errors[] = $this->lang->zanode->createVmFail;
- return false;
+ /* Get image. */
+ $image = $this->getImageByID($data->image);
+
+ /* Get host info. */
+ $host = $this->getHostByID($data->parent);
+
+ /* Prepare create params. */
+ $agnetUrl = 'http://' . $host->extranet . ':' . $host->zap;
+ $param = array(
+ 'os' => $image->osName,
+ 'path' => $image->path,
+ 'name' => $data->name,
+ 'cpu' => (int)$data->cpuCores,
+ 'disk' => (int)$data->diskSize,
+ 'memory' => (int)$data->memory,
+ );
+
+ $result = json_decode(commonModel::http($agnetUrl . static::KVM_CREATE_PATH, json_encode($param), null, array("Authorization:$host->tokenSN")));
+
+ if(empty($result))
+ {
+ dao::$errors[] = $this->lang->zanode->notFoundAgent;
+ return false;
+ }
+ if($result->code != 'success')
+ {
+ dao::$errors[] = $this->lang->zanode->createVmFail;
+ return false;
+ }
+
+ /* Prepare create ZenAgent Node data. */
+ $data->image = $data->image;
+ $data->parent = $host->id;
+ $data->mac = $result->data->mac;
+ $data->vnc = (int)$result->data->vnc;
}
- /* Prepare create ZenAgent Node data. */
- $data->image = $data->image;
- $data->parent = $host->id;
- $data->mac = $result->data->mac;
$data->status = static::STATUS_RUNNING;
$data->createdBy = $this->app->user->account;
$data->createdDate = helper::now();
- $data->vnc = (int)$result->data->vnc;
/* Save ZenAgent Node. */
$this->dao->insert(TABLE_ZAHOST)->data($data)->autoCheck()->exec();
@@ -554,12 +570,11 @@ class zanodemodel extends model
$query = str_replace('`hostID`', 't2.`id`', $query);
}
- $list = $this->dao->select('t1.*, t2.name as hostName, t2.extranet,t3.osName')->from(TABLE_ZAHOST)->alias('t1')
+ $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')
->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")->eq("node")
- ->andWhere("t2.type")->eq("zahost")
+ ->andWhere("((t1.type = 'node' and t2.type = 'zahost') or t1.type = 'physics')")
->beginIF($query)->andWhere($query)->fi()
->orderBy($orderBy)
->page($pager)
@@ -771,14 +786,14 @@ 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,t3.osName, t2.tokenSN as tokenSN, t2.secret as secret')->from(TABLE_ZAHOST)
+ $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)
->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->parent);
+ $host = $this->loadModel("zahost")->getByID($node->type == 'node' ? $node->parent : $node->id);
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 c47fff9a11..5e236b48da 100644
--- a/module/zanode/view/browse.html.php
+++ b/module/zanode/view/browse.html.php
@@ -53,6 +53,7 @@
| idAB); ?> |
zanode->name); ?> |
+ zahost->type); ?> |
zanode->extranet); ?> |
zanode->cpuCores); ?> |
zanode->memory); ?> |
@@ -68,6 +69,7 @@
| id; ?> |
inlink('view', "id=$node->id"), $node->name, '', ""); ?> |
+ lang->zanode->typeList, $node->type); ?> |
extranet; ?> |
zanode->os->cpuCores, $node->cpuCores); ?> |
memory . $this->lang->zahost->unitList['GB']; ?> |
@@ -78,22 +80,22 @@
zanode->suspend}' target='hiddenwin'";
- $suspendAttr .= $node->status != 'running' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmSuspend}\")==false) return false;'";
+ $suspendAttr .= $node->type == '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->status == 'running' || $node->status == 'wait' ? ' class="btn disabled"' : "class='btn' target='hiddenwin' onclick='if(confirm(\"{$lang->zanode->confirmResume}\")==false) return false;'";
+ $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->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' || $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->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"';
+ $closeAttr .= $node->type == 'physics' || $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"';
$startAttr = "title='{$lang->zanode->boot}'";
- $startAttr .= $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"';
+ $startAttr .= $node->type == 'physics' || $node->status == 'wait' ? ' class="btn disabled"' : ' class="btn iframe"';
$snapshotAttr = "title='{$lang->zanode->createSnapshot}'";
- $snapshotAttr .= $node->status != 'running' ? ' class="btn disabled"' : ' class="btn iframe"';
+ $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"';
diff --git a/module/zanode/view/create.html.php b/module/zanode/view/create.html.php
index 46cd460261..b704f2d16e 100644
--- a/module/zanode/view/create.html.php
+++ b/module/zanode/view/create.html.php
@@ -22,6 +22,11 @@
| |