Merge branch 'zenops_46_tanghucheng' of https://gitlab.zcorp.cc/easycorp/zentaopms into zenops_46_tanghucheng
This commit is contained in:
@@ -1216,29 +1216,16 @@ $lang->caselib->methodOrder[40] = 'exportTemplate';
|
||||
$lang->caselib->methodOrder[45] = 'import';
|
||||
$lang->caselib->methodOrder[50] = 'showImport';
|
||||
|
||||
$lang->resource->automation = new stdclass();
|
||||
$lang->resource->automation->browse = 'browse';
|
||||
|
||||
$lang->automation->methodOrder[0] = 'browse';
|
||||
|
||||
$lang->resource->zahost = new stdclass();
|
||||
$lang->resource->zahost->browse = 'browse';
|
||||
$lang->resource->zahost->create = 'create';
|
||||
$lang->resource->zahost->edit = 'editAction';
|
||||
$lang->resource->zahost->delete = 'deleteAction';
|
||||
$lang->resource->zahost->browseTemplate = 'browseTemplate';
|
||||
$lang->resource->zahost->createTemplate = 'createTemplate';
|
||||
$lang->resource->zahost->editTemplate = 'editTemplate';
|
||||
$lang->resource->zahost->deleteTemplate = 'deleteTemplate';
|
||||
|
||||
$lang->zahost->methodOrder[0] = 'browse';
|
||||
$lang->zahost->methodOrder[5] = 'create';
|
||||
$lang->zahost->methodOrder[10] = 'edit';
|
||||
$lang->zahost->methodOrder[15] = 'delete';
|
||||
$lang->zahost->methodOrder[20] = 'browseTemplate';
|
||||
$lang->zahost->methodOrder[25] = 'createTemplate';
|
||||
$lang->zahost->methodOrder[30] = 'editTemplate';
|
||||
$lang->zahost->methodOrder[35] = 'deleteTemplate';
|
||||
|
||||
$lang->resource->zanode = new stdclass();
|
||||
$lang->resource->zanode->browse = 'browse';
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
<div class='btn-toolbar pull-right'>
|
||||
<?php if(!empty($productID)): ?>
|
||||
<div class='btn-group'>
|
||||
<?php common::printLink('testcase', 'automation', "productID=$productID", "<i class='icon-testcase muted'> </i>" . $lang->testcase->automation, '', "class='btn btn-link iframe'", true, true)?>
|
||||
<?php common::printLink('testcase', 'automation', "productID=$productID", "<i class='icon-wrench muted'> </i>" . $lang->testcase->automation, '', "class='btn btn-link iframe'", true, true)?>
|
||||
</div>
|
||||
<div class='btn-group'>
|
||||
<button type='button' class='btn btn-link dropdown-toggle' data-toggle='dropdown'>
|
||||
|
||||
@@ -1234,6 +1234,11 @@ class testtask extends control
|
||||
$cancelURL = inlink('runCase', "runID=$runID&caseID=$caseID&version=$version&confirm=no");
|
||||
|
||||
if($automation and $confirm == '') return print(js::confirm($this->lang->zanode->runCaseConfirm, $confirmURL, $cancelURL));
|
||||
if($confirm == 'yes')
|
||||
{
|
||||
$resultID = $this->testtask->initResult($runID, $caseID, $run->case->version, $automation->node);
|
||||
if(!dao::isError()) $this->zanode->runZTFScript($automation->id, $caseID, $resultID);
|
||||
}
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
|
||||
@@ -1170,6 +1170,31 @@ class testtaskModel extends model
|
||||
->fetchGroup('case', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Init testtask result.
|
||||
*
|
||||
* @param int $runID
|
||||
* @param int $caseID
|
||||
* @param int $version
|
||||
* @param int $nodeID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function initResult($runID = 0, $caseID = 0, $version = 0, $nodeID = 0)
|
||||
{
|
||||
$result = new stdClass();
|
||||
$result->run = $runID;
|
||||
$result->case = $caseID;
|
||||
$result->version = $version;
|
||||
$result->node = $nodeID;
|
||||
$result->date = helper::now();
|
||||
$result->lastRunner = $this->app->user->account;
|
||||
|
||||
$this->dao->insert(TABLE_TESTRESULT)->data($result)->autoCheck()->exec();
|
||||
if(!dao::isError()) return $resultID = $this->dao->lastInsertID();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create test result
|
||||
*
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<td colspan='5' class='form-actions'>
|
||||
<?php
|
||||
if($preCase) echo html::a(inlink('runCase', "runID={$preCase['runID']}&caseID={$preCase['caseID']}&version={$preCase['version']}"), $lang->testtask->pre, '', "id='pre' class='btn btn-wide'");
|
||||
if($run->case->status != 'wait') echo html::submitButton();
|
||||
if($run->case->status != 'wait' and $confirm != 'yes') echo html::submitButton();
|
||||
if($nextCase) echo ' ' . html::a(inlink('runCase', "runID={$nextCase['runID']}&caseID={$nextCase['caseID']}&version={$nextCase['version']}"), $lang->testtask->next, '', "id='next' class='btn btn-wide'");
|
||||
echo html::hidden('case', $run->case->id);
|
||||
echo html::hidden('version', $run->case->currentVersion);
|
||||
|
||||
+10
-17
@@ -718,30 +718,23 @@ class zanodemodel extends model
|
||||
/**
|
||||
* Run ZTFScript.
|
||||
*
|
||||
* @param int $scriptID
|
||||
* @param int $caseID
|
||||
* @param int $task //testtaskID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function runZTFScript()
|
||||
public function runZTFScript($scriptID = 0, $caseID = 0, $task = 0)
|
||||
{
|
||||
$automation = $this->getAutomationByID($scriptID);
|
||||
$node = $this->getNodeByID($automation->node);
|
||||
$params = array(
|
||||
'cmd' => '',
|
||||
'ids' => '',
|
||||
'path' => '',
|
||||
'task' => '',
|
||||
'workspace' => ''
|
||||
'cmd' => $automation->shell,
|
||||
'ids' => $caseID,
|
||||
'path' => $automation->scriptPath,
|
||||
'task' => $task
|
||||
);
|
||||
|
||||
$result = json_decode(commonModel::http("http://{$node->ip}:{$node->zap}/api/v1/jobs/add", json_encode($params), array(), array("Authorization:$node->tokenSN")));
|
||||
|
||||
if(empty($result->data) || $result->code != 'success')
|
||||
{
|
||||
$result = new stdclass;
|
||||
$result->data = $this->lang->zanode->init->serviceStatus;
|
||||
}
|
||||
|
||||
return array(
|
||||
"ZenAgent" => "ready",
|
||||
"ZTF" => $result->data->ztfStatus,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user