* Add zahost module.
This commit is contained in:
@@ -246,6 +246,7 @@ define('TABLE_TESTTASK', '`' . $config->db->prefix . 'testtask`');
|
||||
define('TABLE_TESTRUN', '`' . $config->db->prefix . 'testrun`');
|
||||
define('TABLE_TESTRESULT', '`' . $config->db->prefix . 'testresult`');
|
||||
define('TABLE_USERTPL', '`' . $config->db->prefix . 'usertpl`');
|
||||
define('TABLE_ZAHOST', '`' . $config->db->prefix . 'host`');
|
||||
|
||||
define('TABLE_PRODUCT', '`' . $config->db->prefix . 'product`');
|
||||
define('TABLE_BRANCH', '`' . $config->db->prefix . 'branch`');
|
||||
@@ -402,4 +403,4 @@ $config->waterfallModules = array('workestimation', 'durationestimation', 'budge
|
||||
$config->showMainMenu = true;
|
||||
$config->maxPriValue = '256';
|
||||
|
||||
$config->importWhiteList = array('user', 'task', 'story', 'bug', 'testcase', 'feedback');
|
||||
$config->importWhiteList = array('user', 'task', 'story', 'bug', 'testcase', 'feedback');
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
ALTER TABLE `zt_host` ADD `type` varchar(30) NOT NULL DEFAULT 'normal' AFTER `admin`;
|
||||
ALTER TABLE `zt_host` ADD `virtualSoftware` varchar(30) NOT NULL DEFAULT '' AFTER `type`;
|
||||
ALTER TABLE `zt_vmtemplate` ADD `type` varchar(30) NOT NULL DEFAULT 'normal' AFTER `hostID`;
|
||||
|
||||
@@ -70,6 +70,7 @@ $lang->search = new stdclass();
|
||||
$lang->devops = new stdclass();
|
||||
$lang->team = new stdclass();
|
||||
$lang->automation = new stdclass();
|
||||
$lang->zahost = new stdclass();
|
||||
$lang->personnel = new stdclass();
|
||||
$lang->mail = new stdclass();
|
||||
$lang->testsuite = new stdclass();
|
||||
|
||||
@@ -383,7 +383,7 @@ $lang->qa->menu->testsuite = array('link' => "{$lang->testcase->testsuite}|test
|
||||
$lang->qa->menu->testtask = array('link' => "{$lang->testtask->common}|testtask|browse|productID=%s", 'subModule' => 'testtask', 'alias' => 'view,edit,linkcase,cases,start,close,batchrun,groupcase,report,importunitresult');
|
||||
$lang->qa->menu->report = array('link' => "{$lang->testreport->common}|testreport|browse|productID=%s", 'subModule' => 'testreport');
|
||||
$lang->qa->menu->caselib = array('link' => "{$lang->testcase->caselib}|caselib|browse|libID=0", 'subModule' => 'caselib');
|
||||
$lang->qa->menu->automation = array('link' => "{$lang->automation->common}|automation|browse|productID=%s", 'subModule' => 'automation', 'alias' => '');
|
||||
$lang->qa->menu->automation = array('link' => "{$lang->automation->common}|automation|browse|productID=%s", 'subModule' => 'zahost', 'alias' => '');
|
||||
|
||||
/* QA menu order. */
|
||||
$lang->qa->menuOrder[5] = 'product';
|
||||
@@ -396,6 +396,9 @@ $lang->qa->menuOrder[35] = 'report';
|
||||
$lang->qa->menuOrder[40] = 'caselib';
|
||||
$lang->qa->menuOrder[45] = 'automation';
|
||||
|
||||
$lang->qa->menu->automation['subMenu'] = new stdclass();
|
||||
$lang->qa->menu->automation['subMenu']->browse = array('link' => "{$lang->zahost->common}|zahost|browse|productID=%s", 'alias' => '');
|
||||
|
||||
// $lang->qa->menu->automation['subMenu'] = new stdclass();
|
||||
// $lang->qa->menu->automation['subMenu']->browse = array('link' => "{$lang->intro}|automation|browse|productID=%s", 'alias' => '');
|
||||
// $lang->qa->menu->automation['subMenu']->framework = array('link' => '框架|automation|framework|productID=%s', 'alias' => '');
|
||||
@@ -651,7 +654,8 @@ $lang->navGroup->qa = 'qa';
|
||||
$lang->navGroup->bug = 'qa';
|
||||
$lang->navGroup->testcase = 'qa';
|
||||
$lang->navGroup->testtask = 'qa';
|
||||
$lang->navGroup->automation = 'qa';
|
||||
//$lang->navGroup->automation = 'qa';
|
||||
$lang->navGroup->zahost = 'qa';
|
||||
$lang->navGroup->testreport = 'qa';
|
||||
$lang->navGroup->testcase = 'qa';
|
||||
$lang->navGroup->testtask = 'qa';
|
||||
|
||||
@@ -179,6 +179,7 @@ $lang->score->common = '我的积分';
|
||||
$lang->build->common = '版本';
|
||||
$lang->testreport->common = '测试报告';
|
||||
$lang->automation->common = '自动化';
|
||||
$lang->zahost->common = '宿主机';
|
||||
$lang->team->common = '团队';
|
||||
$lang->user->common = '用户';
|
||||
$lang->custom->common = '自定义';
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$config->zahost->create = new stdclass();
|
||||
$config->zahost->create->requiredFields = 'name,hostType,publicIP,cpuCores,memory,diskSize,tags,instanceNum';
|
||||
$config->zahost->create->ipFields = 'privateIP,publicIP';
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* The control file of zahost of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Jianhua Wang <wangjianhua@easycorp.ltd>
|
||||
* @package zahost
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class zahost extends control
|
||||
{
|
||||
/**
|
||||
* Create host.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$id = $this->zahost->create();
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->zahost->create;
|
||||
$this->view->position[] = html::a($this->createLink('zahost', 'browse'), $this->lang->zahost->common);
|
||||
$this->view->position[] = $this->lang->zahost->create;
|
||||
|
||||
//$this->view->optionMenu = $this->loadModel('tree')->getOptionMenu(0, 'zahost');
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#unit {padding: 0px !important; width:0px; border-left: 0px;}
|
||||
.input-group-addon {border: 0px;}
|
||||
#unit_chosen a {border-left: 0px; border-radius: 0 2px;}
|
||||
@@ -0,0 +1,5 @@
|
||||
$(document).ready(function(){
|
||||
$('#publicIP').change(function(){
|
||||
//@todo check IP
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
$lang->zahost->common = '宿主机';
|
||||
$lang->zahost->browse = '主机列表';
|
||||
$lang->zahost->create = '添加宿主机';
|
||||
$lang->zahost->view = '主机详情';
|
||||
$lang->zahost->edit = '编辑';
|
||||
$lang->zahost->editAction = '编辑主机';
|
||||
$lang->zahost->delete = '删除';
|
||||
$lang->zahost->deleteAction = '删除主机';
|
||||
$lang->zahost->byQuery = '搜索';
|
||||
|
||||
$lang->zahost->name = '名称';
|
||||
$lang->zahost->IP = 'IP';
|
||||
$lang->zahost->publicIP = 'IP';
|
||||
$lang->zahost->memory = '内存大小';
|
||||
$lang->zahost->cpuCores = '单CPU核心数';
|
||||
$lang->zahost->diskSize = '硬盘容量';
|
||||
$lang->zahost->instanceNum = '最大实列数';
|
||||
|
||||
$lang->zahost->createdBy = '由谁创建';
|
||||
$lang->zahost->createdDate = '创建时间';
|
||||
$lang->zahost->editedBy = '由谁编辑';
|
||||
$lang->zahost->editedDate = '编辑时间';
|
||||
$lang->zahost->all = '所有主机';
|
||||
|
||||
$lang->zahost->empty = '暂时没有主机';
|
||||
|
||||
$lang->zahost->virtualSoftware = '虚拟化软件';
|
||||
$lang->zahost->softwareList['kvm'] = 'KVM';
|
||||
|
||||
$lang->zahost->unitList['GB'] = 'GB';
|
||||
$lang->zahost->unitList['TB'] = 'TB';
|
||||
|
||||
$lang->zahost->zaHostType = '主机类型';
|
||||
$lang->zahost->zaHostTypeList['physical'] = '实体主机';
|
||||
#$lang->zahost->zaHostTypeList['virtual'] = '虚拟主机';
|
||||
|
||||
$lang->zahost->confirmDelete = '是否删除该主机记录?';
|
||||
|
||||
$lang->zahost->notice = new stdclass();
|
||||
$lang->zahost->notice->memory = '内存大小只能为数字!';
|
||||
$lang->zahost->notice->diskSize = '硬盘容量只能为数字!';
|
||||
$lang->zahost->notice->cpuNumber = 'CPU数量只能为数字!';
|
||||
$lang->zahost->notice->cpuCores = 'CPU核心数只能为数字!';
|
||||
$lang->zahost->notice->int = '『%s』应当是正整数!';
|
||||
$lang->zahost->notice->ip = '『%s』格式不正确!';
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* The model file of zahost module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Wang Jianhua <wangjiahua@easycorp.ltd>
|
||||
* @package zahost
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class zahostModel extends model
|
||||
{
|
||||
/**
|
||||
* Get host by id.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getById($id)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_ZAHOST)->where('id')->eq($id) ->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a host.
|
||||
*
|
||||
* @access public
|
||||
* @return int|bool
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$hostInfo = fixer::input('post')
|
||||
->setDefault('cpuNumber,cpuCores,diskSize,memory', 0)
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_ZAHOST)->data($hostInfo)
|
||||
->batchCheck($this->config->zahost->create->requiredFields, 'notempty')
|
||||
->batchCheck('diskSize,memory', 'float');
|
||||
if(dao::isError()) return false;
|
||||
|
||||
if(!preg_match('/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/', $hostInfo->publicIP))
|
||||
{
|
||||
dao::$errors['publicIP'] = sprintf($this->lang->zahost->notice->ip, $this->lang->zahost->publicIP);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->dao->insert(TABLE_ZAHOST)->data($hostInfo, $skipFields='name,group')->autoCheck()->exec();
|
||||
$hostID = $this->dao->lastInsertID();
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->loadModel('action')->create('zahost', $hostID, 'created');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* The create view file of zahost module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Jianhua Wang<wangjianhua@easycorp.ltd>
|
||||
* @package zahost
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->zahost->create?></h2>
|
||||
</div>
|
||||
<form method='post' target='hiddenwin' id='ajaxForm'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->zahost->name;?></th>
|
||||
<td><?php echo html::input('name', '', "class='form-control'");?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->zahost->zaHostType;?></th>
|
||||
<td><?php echo html::select('hostType', $lang->zahost->zaHostTypeList, 'virtual', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->zahost->IP;?></th>
|
||||
<td><?php echo html::input('publicIP', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->zahost->cpuCores;?></th>
|
||||
<td><?php echo html::input('cpuCores', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->zahost->memory;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('memory', '', "class='form-control'");?>
|
||||
<span class="input-group-addon"><?php echo $lang->zahost->unitList['GB'];?></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->zahost->diskSize;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('diskSize', '', "class='form-control'");?>
|
||||
<span class='input-group-addon fix-border fix-padding' id='unit'>
|
||||
<?php echo html::select('unit', $lang->zahost->unitList, 'GB', "class='form-control chosen w-50px'");?>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->zahost->virtualSoftware;?></th>
|
||||
<td><?php echo html::select('virtualSoftware', $lang->zahost->softwareList, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->zahost->instanceNum?></th>
|
||||
<td><?php echo html::input('instanceNum', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='text-center form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::backButton();?>
|
||||
<?php echo html::hidden('type', 'za');?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>
|
||||
Reference in New Issue
Block a user