* Add view zahost.

This commit is contained in:
zhaoke
2022-11-18 01:43:33 +00:00
parent fdf3e3cb16
commit 45e1c4dc20
17 changed files with 238 additions and 16 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ $lang->testtask->common = 'Request';
$lang->score->common = 'Score';
$lang->build->common = 'Build';
$lang->testreport->common = 'Report';
$lang->automation->common = 'Automation';
$lang->automation->common = 'Automation:';
$lang->zahost->common = 'ZAhost';
$lang->executionnode->common = 'Execution Node';
$lang->team->common = 'Team';
+1 -1
View File
@@ -179,7 +179,7 @@ $lang->testtask->common = 'Request';
$lang->score->common = 'Score';
$lang->build->common = 'Build';
$lang->testreport->common = 'Report';
$lang->automation->common = 'Automation';
$lang->automation->common = 'Automation:';
$lang->zahost->common = 'ZAhost';
$lang->executionnode->common = 'Execution Node';
$lang->team->common = 'Team';
+1 -1
View File
@@ -179,7 +179,7 @@ $lang->testtask->common = 'Request';
$lang->score->common = 'Score';
$lang->build->common = 'Build';
$lang->testreport->common = 'Report';
$lang->automation->common = 'Automation';
$lang->automation->common = 'Automation:';
$lang->zahost->common = 'ZAhost';
$lang->executionnode->common = 'Execution Node';
$lang->team->common = 'Team';
+1 -1
View File
@@ -450,7 +450,7 @@ $lang->qa->menu->testsuite = array('link' => "{$lang->testcase->testsuite}|t
$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}|project|other|productID=%s", 'subModule' => 'automation', 'alias' => '', 'class' => "qa-automation-menu");
$lang->qa->menu->zahost = array('link' => "{$lang->zahost->common}|zahost|browse", 'subModule' => 'zahost');
$lang->qa->menu->executionnode = array('link' => "{$lang->executionnode->common}|executionnode|browse", 'subModule' => 'executionnode');
+1 -1
View File
@@ -179,7 +179,7 @@ $lang->testtask->common = '测试单';
$lang->score->common = '我的积分';
$lang->build->common = '版本';
$lang->testreport->common = '测试报告';
$lang->automation->common = '自动化';
$lang->automation->common = '自动化:';
$lang->zahost->common = '宿主机';
$lang->executionnode->common = '执行节点';
$lang->team->common = '团队';
+18
View File
@@ -300,6 +300,24 @@ class executionnodemodel extends model
->fetchAll();
}
/**
* Get node list by hostid.
*
* @param string $browseType
* @param int $param
* @param string $orderBy
* @param object $pager
* @return void
*/
public function getListByHost($hostID, $orderBy = 'id_desc')
{
return $this->dao->select('id, name, vnc, cpu, memory, disk, os, status')->from(TABLE_EXECUTIONNODE)
->where('deleted')->eq(0)
->andWhere("hostID")->eq($hostID)
->orderBy($orderBy)
->fetchAll();
}
/**
* Get Host by id.
+21 -1
View File
@@ -12,7 +12,7 @@
class zahost extends control
{
/**
* View host.
* View host list.
*
* @param string $browseType
* @param string $param
@@ -52,6 +52,26 @@ class zahost extends control
$this->display();
}
/**
* View host.
*
* @param int $id
* @access public
* @return void
*/
public function view($id, $orderBy = 'id_desc')
{
$this->view->title = $this->lang->zahost->view;
$this->view->position[] = html::a($this->createLink('host', 'browse'), $this->lang->zahost->common);
$this->view->position[] = $this->lang->zahost->view;
$this->view->zahost = $this->zahost->getById($id);
$this->view->orderBy = $orderBy;
$this->view->nodeList = $this->loadModel("executionnode")->getListByHost($this->view->zahost->hostID, $orderBy);
$this->view->actions = $this->loadModel('action')->getList('zahost', $id);
$this->display();
}
/**
* Create host.
*
+1 -1
View File
@@ -1,3 +1,3 @@
#unit {padding: 0px !important; width:0px; border-left: 0px;width: 63px;}
.input-group-addon {border: 0px; width: 100px;}
#memory-addon{padding-left: 30px;text-align: left;width: 63px;}
#memory-addon{text-align: center;width: 63px;}
+5
View File
@@ -0,0 +1,5 @@
.zahost-detail .text-right{text-align: right;}
.zahost-detail .col-8{padding-left: 10px;}
.zahost-detail .detail-content{color: #838a9d;}
.table.has-sort-head thead tr th a:after{line-height: 22px;}
.table.has-sort-head thead tr th a:before{line-height: 22px;}
+1
View File
@@ -10,6 +10,7 @@ $lang->zahost->delete = 'Delete';
$lang->zahost->deleteAction = 'Delete Host';
$lang->zahost->byQuery = 'Search';
$lang->zahost->all = 'All';
$lang->zahost->browseNode = 'ExecutionNode Browse';
$lang->zahost->browseTemplate = 'Template Browse';
$lang->zahost->createTemplate = 'Create Template';
$lang->zahost->editTemplate = 'Edit Template';
+2 -1
View File
@@ -10,6 +10,7 @@ $lang->zahost->delete = 'Delete';
$lang->zahost->deleteAction = 'Delete Host';
$lang->zahost->byQuery = 'Search';
$lang->zahost->all = 'All';
$lang->zahost->browseNode = 'ExecutionNode Browse';
$lang->zahost->browseTemplate = 'Template Browse';
$lang->zahost->createTemplate = 'Create Template';
$lang->zahost->editTemplate = 'Edit Template';
@@ -20,7 +21,7 @@ $lang->zahost->IP = 'IP/Domain';
$lang->zahost->address = 'IP/Domain';
$lang->zahost->cpu = 'CPU Cores';
$lang->zahost->memory = 'Memory Size';
$lang->zahost->disk = 'Disk Size';
$lang->zahost->disk = 'Disk Size';
$lang->zahost->desc = 'Description';
$lang->zahost->type = 'Type';
$lang->zahost->status = 'Status';
+2 -1
View File
@@ -10,6 +10,7 @@ $lang->zahost->delete = 'Supprimer';
$lang->zahost->deleteAction = 'Supprimer Hôte';
$lang->zahost->byQuery = 'Recherche';
$lang->zahost->all = 'Tous les hôtes';
$lang->zahost->browseNode = 'ExecutionNode Browse';
$lang->zahost->browseTemplate = 'Template Browse';
$lang->zahost->createTemplate = 'Create Template';
$lang->zahost->editTemplate = 'Edit Template';
@@ -20,7 +21,7 @@ $lang->zahost->IP = 'IP/Domain';
$lang->zahost->address = 'IP';
$lang->zahost->cpu = 'CPU Cores';
$lang->zahost->memory = 'Mémoire Espace';
$lang->zahost->disk = 'Disque Espace';
$lang->zahost->disk = 'Disque Espace';
$lang->zahost->desc = 'Description';
$lang->zahost->type = 'Type';
$lang->zahost->status = 'Status';
+1
View File
@@ -10,6 +10,7 @@ $lang->zahost->delete = 'Delete';
$lang->zahost->deleteAction = 'Delete Host';
$lang->zahost->byQuery = 'Search';
$lang->zahost->all = 'All';
$lang->zahost->browseNode = 'ExecutionNode Browse';
$lang->zahost->browseTemplate = 'Template Browse';
$lang->zahost->createTemplate = 'Create Template';
$lang->zahost->editTemplate = 'Edit Template';
+5 -3
View File
@@ -1,15 +1,17 @@
<?php
$lang->zahost->id = 'ID';
$lang->zahost->common = '宿主机';
$lang->zahost->browse = '主机列表';
$lang->zahost->common = '宿主机';
$lang->zahost->browse = '宿主机列表';
$lang->zahost->create = '添加宿主机';
$lang->zahost->view = '主机详情';
$lang->zahost->view = '宿主机详情';
$lang->zahost->edit = '编辑';
$lang->zahost->editAction = '编辑宿主机';
$lang->zahost->delete = '删除';
$lang->zahost->deleteAction = '删除宿主机';
$lang->zahost->byQuery = '搜索';
$lang->zahost->all = '全部主机';
$lang->zahost->browseNode = '执行节点列表';
$lang->zahost->browseTemplate = '虚拟机模板列表';
$lang->zahost->createTemplate = '创建虚拟机模板';
$lang->zahost->editTemplate = '编辑虚拟机模板';
@@ -108,7 +110,7 @@ $lang->zahost->langList['zh_cn'] = '简体中文';
$lang->zahost->langList['zh_tw'] = '繁体中文';
$lang->zahost->langList['en_us'] = '美式英语';
$lang->zahost->empty = '暂时没有主机';
$lang->zahost->empty = '暂时没有宿主机';
$lang->zahost->templateEmpty = '暂时没有模板';
$lang->zahost->statusList['ready'] = '准备中';
+41 -3
View File
@@ -247,6 +247,8 @@ class zahostModel extends model
$imageData->hostID = $hostID;
$imageData->status = 'created';
$imageData->osCategory = $imageData->os;
unset($imageData->os);
$this->dao->insert(TABLE_IMAGE)->data($imageData, 'desc')->autoCheck()->exec();
if(dao::isError()) return false;
@@ -305,11 +307,11 @@ class zahostModel extends model
foreach($result->data as $status => $group)
{
$currentTask = null;
foreach($group as $task)
foreach($group as $host)
{
if($task->task == $image->id )
if($host->task == $image->id )
{
$currentTask = $task;
$currentTask = $host;
break;
}
}
@@ -435,6 +437,42 @@ class zahostModel extends model
->fetchAll();
}
/**
* Build test task menu.
*
* @param object $host
* @param string $type
* @access public
* @return string
*/
public function buildOperateMenu($host, $type = 'view')
{
$function = 'buildOperate' . ucfirst($type) . 'Menu';
return $this->$function($host);
}
/**
* Build test task view menu.
*
* @param object $host
* @access public
* @return string
*/
public function buildOperateViewMenu($host)
{
if($host->deleted) return '';
$menu = '';
$params = "hostID=$host->hostID";
$menu .= $this->buildMenu('zahost', 'edit', $params, $host, 'view');
$params = "hostID=$host->assetID";
$menu .= $this->buildMenu('zahost', 'delete', $params, $host, 'view', 'trash', 'hiddenwin');
return $menu;
}
/**
* Get VM template list.
*
+1 -1
View File
@@ -59,7 +59,7 @@
<?php foreach($hostList as $host):?>
<tr class='text-left'>
<td><?php printf('%03d', $host->hostID);?></td>
<td title='<?php echo $host->name?>'><?php echo common::hasPriv('zahost', 'browsetemplate') ? html::a($this->inlink('browsetemplate', "id=$host->hostID"), $host->name) : $host->name;?></td>
<td title='<?php echo $host->name?>'><?php echo html::a($this->inlink('view', "id=$host->hostID"), $host->name, '', "");?></td>
<td><?php echo zget($lang->zahost->zaHostTypeList, $host->hostType);?></td>
<td><?php echo $host->address;?></td>
<td><?php echo $host->cpu;?></td>
+135
View File
@@ -0,0 +1,135 @@
<?php
/**
* The 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 Ke Zhao <zhaoke@cnezsoft.com>
* @package zahost
* @version $Id: view.html.php $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php $browseLink = $this->session->zahostList ? $this->session->zahostList : $this->createLink('zahost', 'browse', "");?>
<?php $vars = "id={$zahost->hostID}&orderBy=%s";?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php echo html::backButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, "data-app='{$app->tab}'", 'btn btn-secondary');?>
<div class='divider'></div>
<div class='page-title'>
<span class='label label-id'><?php echo $zahost->assetID;?></span>
<span class='text' title='<?php echo $zahost->name;?>'><?php echo $zahost->name;?></span>
<?php if($zahost->deleted):?>
<span class='label label-danger'><?php echo $lang->zahost->deleted;?></span>
<?php endif; ?>
</div>
</div>
</div>
<div id='mainContent' class='main-row'>
<div class="col-8 main-col">
<div class="cell">
<div class="detail zahost-detail">
<div class="detail-title"><?php echo $lang->zahost->view;?></div>
<div class="detail-content article-content">
<div class="main-row">
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->zaHostType;?>:</div>
<div class="col-8"><?php echo $lang->zahost->zaHostTypeList[$zahost->hostType];?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->address;?>:</div>
<div class="col-8"><?php echo $zahost->address;?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->memory;?>:</div>
<div class="col-8"><?php echo $zahost->memory;?></div>
</div>
</div>
</div>
<div class="main-row">
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->virtualSoftware;?>:</div>
<div class="col-8"><?php echo $zahost->virtualSoftware;?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->cpu;?>:</div>
<div class="col-8"><?php echo $zahost->cpu;?></div>
</div>
</div>
<div class="col-4">
<div class="main-row">
<div class="col-4 text-right"><?php echo $lang->zahost->disk;?>:</div>
<div class="col-8"><?php echo $zahost->disk;?></div>
</div>
</div>
</div>
</div>
</div>
<div class="detail zahost-detail">
<div class="detail-title"><?php echo $lang->zahost->desc;?></div>
<div class="detail-content article-content"><?php echo !empty($zahost->desc) ? $zahost->desc : $lang->noData;?></div>
</div>
<?php if(!empty($nodeList)): ?>
<div class="detail">
<div class="detail-title"><?php echo $lang->zahost->browseNode;?></div>
<div class="detail-content article-content">
<table class='table has-sort-head table-fixed' id='nodeList'>
<thead>
<tr>
<th class='c-name'><?php common::printOrderLink('name', $orderBy, $vars, $lang->zahost->name);?></th>
<th class='c-cpu'><?php common::printOrderLink('cpu', $orderBy, $vars, $lang->executionnode->cpu);?></th>
<th class='c-number'><?php common::printOrderLink('memory', $orderBy, $vars, $lang->executionnode->memory);?></th>
<th class='c-number'><?php common::printOrderLink('disk', $orderBy, $vars, $lang->executionnode->disk);?></th>
<th class='c-os'><?php common::printOrderLink('os', $orderBy, $vars, $lang->executionnode->os);?></th>
<th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->executionnode->status);?></th>
</tr>
</thead>
<tbody>
<?php foreach($nodeList as $node):?>
<tr>
<td title="<?php echo $node->name;?>"><?php echo $node->name;?></td>
<td><?php echo zget($config->executionnode->os->cpu, $node->cpu);?></td>
<td><?php echo $node->memory . $this->lang->zahost->unitList['GB'];?></td>
<td><?php echo $node->disk . zget($this->lang->zahost->unitList, $node->unit);?></td>
<td><?php echo zget($config->executionnode->os->list, $node->os);?></td>
<td><?php echo zget($lang->executionnode->statusList, $node->status);?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
<?php endif; ?>
<?php
$canBeChanged = common::canBeChanged('zahost', $zahost);
if($canBeChanged) $actionFormLink = $this->createLink('action', 'comment', "objectType=zahost&objectID=$zahost->hostID");
?>
</div>
<?php $this->printExtendFields($zahost, 'div', "position=left&inForm=0&inCell=1");?>
<div class='main-actions'>
<div class="btn-toolbar">
<?php echo html::backButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, '', 'btn btn-secondary');?>
<div class='divider'></div>
<?php echo $this->zahost->buildOperateMenu($zahost, 'view');?>
</div>
</div>
</div>
<div class="col-4 side-col">
<div class='cell'><?php include '../../common/view/action.html.php';?></div>
</div>
</div>
<div id='mainActions' class='main-actions'>
<?php common::printPreAndNext($browseLink);?>
</div>
<?php include '../../common/view/footer.html.php';?>