This commit is contained in:
tanghucheng
2022-12-16 19:16:56 +08:00
parent 3c254c96b2
commit 769c65781b
4 changed files with 58 additions and 7 deletions
+3 -2
View File
@@ -16,8 +16,9 @@
<div class="modal-body">
<p>
<i class="icon-check-circle icon"></i><?php echo $notice;?>
<?php $modalLink = !empty($modalLink) ? $modalLink : '';?>
<?php echo html::a($modalLink, $buttonName, '', 'id="modalLink"');?>
<?php $modalLink = !empty($modalLink) ? $modalLink : '';?>
<?php $class = !empty($modalClass) ? $modalClass : '';?>
<?php echo html::a($modalLink, $buttonName, '', "id='modalLink' class='$class'");?>
</p>
</div>
</div>
+3 -1
View File
@@ -2375,7 +2375,7 @@ class testcase extends control
* @access public
* @return void
*/
public function automation($productID)
public function automation($productID = 0)
{
$this->loadModel('zanode');
$nodeList = $this->zanode->getPairs();
@@ -2397,6 +2397,8 @@ class testcase extends control
$this->view->automation = $automation;
$this->view->nodeList = $nodeList;
$this->view->productID = $productID;
$this->view->products = $this->product->getPairs('', 0, '', 'all');
$this->display();
}
+35 -1
View File
@@ -20,6 +20,12 @@
</div>
<form method='post' target='hiddenwin'>
<table class='table table-form'>
<?php if(!$productID):?>
<tr>
<th class='w-80px'><?php echo $lang->testcase->product;?></th>
<td class='required'><?php echo html::select('product', $products, '', "class='form-control picker-select' onchange='loadProduct(this.value)'");?></td>
</tr>
<?php endif;?>
<tr>
<th class='w-80px'><?php echo $lang->zanode->common;?></th>
<td class='required'><?php echo html::select('node', $nodeList, !empty($automation->node) ? $automation->node : '', "class='form-control picker-select'");?></td>
@@ -34,7 +40,7 @@
</tr>
<tr>
<td colspan='2' class='text-center'>
<?php echo html::hidden('product', $productID);?>
<?php if($productID) echo html::hidden('product', $productID);?>
<?php if($automation) echo html::hidden('id', $automation->id);?>
<?php echo html::submitButton();?>
</td>
@@ -43,4 +49,32 @@
</form>
</div>
</div>
<script>
$(function()
{
if($("#product").length > 0){
$('#product').change();
}
})
function loadProduct(obj)
{
$('#node').data('zui.picker').setValue(<?php echo key($nodeList)?>);
$('#shell').val('');
$('#scriptPath').val('');
var url = createLink('zanode', 'ajaxGetZTFScript', "type=product&objectID=" + obj)
$.get(url, function(result)
{
if(result.result == 'success')
{
data = result.data;
if(!data) return false;
$('#node').data('zui.picker').setValue(data.node)
$('#shell').val(data.shell);
$('#scriptPath').val(data.scriptPath);
$('#submit').before("<input type='hidden' name='id' value='" + data.id + "'>");
}
}, 'json');
}
</script>
<?php include '../../common/view/footer.html.php';?>
+17 -3
View File
@@ -142,8 +142,8 @@ class zanode extends control
$this->view->node = $this->zanode->getNodeById($nodeID);
$this->view->notice = $this->lang->zanode->init->initSuccessNoticeTitle;
$this->view->buttonName = $this->lang->zanode->init->button;
$productID = $this->session->product ? $this->session->product : 0;
$this->view->modalLink = $this->createLink('testcase', 'browse', "productID={$productID}");
$this->view->modalLink = $this->createLink('testcase', 'automation', 0, '', true);
$this->view->modalClass = 'iframe';
$this->view->closeLink = $this->createLink('zanode', 'browse');
$this->display();
@@ -381,7 +381,21 @@ class zanode extends control
}
/**
* ajaxRunZTFScript
* Ajax: get ZTF script.
*
* @access public
* @return void
*/
public function ajaxGetZTFScript($type = 'product', $objectID = 0)
{
$script = array();
if($type == '') $script = $this->zanode->getAutomationByID($objectID);
if($type == 'product') $script = $this->zanode->getAutomationByProduct($objectID);
return $this->send(array('result' => 'success', 'data' => $script));
}
/**
* Ajax: run ZTF script.
*
* @param int $scriptID
* @access public