Merge branch '15.0.beta3' of http://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3

This commit is contained in:
zhujinyong
2021-03-18 16:19:35 +08:00
52 changed files with 323 additions and 251 deletions
+24 -15
View File
@@ -19,14 +19,23 @@ class build extends control
* @access public
* @return void
*/
public function create($executionID, $productID = 0)
public function create($executionID = 0, $productID = 0, $projectID = 0)
{
/* Create execution if no execution. */
if($executionID == 0) die(js::locate($this->createLink('execution', 'create'), 'parent'));
/* Load these models. */
$this->loadModel('execution');
$this->loadModel('user');
if($this->app->openApp == 'project')
{
commonModel::setAppObjectID('project', $projectID);
$executions = $this->execution->getPairs($projectID);
$executionID = key($executions);
}
if(!empty($_POST))
{
$buildID = $this->build->create($executionID);
$executionID = $this->post->execution;
$buildID = $this->build->create($executionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('build', $buildID, 'opened');
@@ -36,18 +45,18 @@ class build extends control
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID")));
}
/* Load these models. */
$this->loadModel('execution');
$this->loadModel('user');
/* Set session and get execution by id. */
$this->session->set('buildCreate', $this->app->getURI(true));
$execution = $this->execution->getByID($executionID);
if($this->app->openApp == 'execution')
{
/* Set session and get execution by id. */
$this->session->set('buildCreate', $this->app->getURI(true));
/* Set menu. */
$executions = $this->execution->getPairs($execution->project);
$this->execution->setMenu($executions, $executionID);
commonModel::setAppObjectID('execution', $executionID);
}
/* Set menu. */
$executions = $this->execution->getPairs($execution->project);
$this->execution->setMenu($executions, $executionID);
commonModel::setAppObjectID('execution', $executionID);
$productGroups = $this->execution->getProducts($executionID);
$productID = $productID ? $productID : key($productGroups);
@@ -55,13 +64,13 @@ class build extends control
foreach($productGroups as $product) $products[$product->id] = $product->name;
$this->view->title = $execution->name . $this->lang->colon . $this->lang->build->create;
$this->view->position[] = html::a($this->createLink('execution', 'task', "executionID=$executionID"), $execution->name);
$this->view->position[] = $this->lang->build->create;
$this->view->product = isset($productGroups[$productID]) ? $productGroups[$productID] : '';
$this->view->branches = (isset($productGroups[$productID]) and $productGroups[$productID]->type == 'normal') ? array() : $this->loadModel('branch')->getPairs($productID);
$this->view->executionID = $executionID;
$this->view->products = $products;
$this->view->executions = isset($executions) ? $executions : array();
$this->view->lastBuild = $this->build->getLast($executionID);
$this->view->productGroups = $productGroups;
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
+10 -4
View File
@@ -1,7 +1,7 @@
/**
* Load branches
*
* @param int $productID
* Load branches
*
* @param int $productID
* @access public
* @return void
*/
@@ -9,7 +9,13 @@ function loadBranches(productID)
{
$('#branch').remove();
$('#branch_chosen').remove();
$.get(createLink('branch', 'ajaxGetBranches', 'productID=' + productID + '&oldBranch=' + productGroups[productID]['branch']), function(data)
var oldBranch = 0;
if(typeof(productGroups[productID]) != "undefined")
{
oldBranch = productGroups[productID]['branch'];
}
$.get(createLink('branch', 'ajaxGetBranches', 'productID=' + productID + '&oldBranch=' + oldBranch), function(data)
{
if(data)
{
+23
View File
@@ -4,4 +4,27 @@ $().ready(function()
{
$('#name').val($(this).text()).focus();
});
});
/**
* Load products.
*
* @param int $executionID
* @access public
* @return void
*/
function loadProducts(executionID)
{
$('#product').remove();
$('#product_chosen').remove();
$('#branch').remove();
$('#branch_chosen').remove();
$.get(createLink('product', 'ajaxGetProducts', 'executionID=' + executionID), function(data)
{
if(data)
{
$('.input-group').append(data);
$('#product').chosen();
}
});
}
+2 -3
View File
@@ -60,9 +60,9 @@ class buildModel extends model
*/
public function getProjectBuilds($projectID = 0, $type = 'all', $param = 0)
{
return $this->dao->select('t1.*, t2.name as projectName, t2.id as projectID, t3.name as productName, t4.name as branchName')
return $this->dao->select('t1.*, t2.name as executionName, t2.id as executionID, t3.name as productName, t4.name as branchName')
->from(TABLE_BUILD)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id')
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
->where('t1.project')->eq((int)$projectID)
@@ -293,7 +293,6 @@ class buildModel extends model
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
->where('t1.product')->in($products)
->beginIF($this->lang->navGroup->testtask != 'qa')->andWhere('t1.project')->eq($this->session->PRJ)->fi()
->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
+6
View File
@@ -19,6 +19,12 @@
</div>
<form class='load-indicator main-form form-ajax' id='dataform' method='post' enctype='multipart/form-data'>
<table class='table table-form'>
<?php if(!empty($executions)):?>
<tr>
<th><?php echo $lang->executionCommon;?></th>
<td><?php echo html::select('execution', $executions, $executionID, "onchange='loadProducts(this.value);' class='form-control chosen' required");?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->build->product;?></th>
<?php if(!empty($products)):?>