This commit is contained in:
zhujinyong
2021-12-05 23:51:59 +08:00
20 changed files with 76 additions and 40 deletions
+1 -1
View File
@@ -629,7 +629,7 @@ function notice()
productID = $('#product').val();
projectID = $('#project').val();
link = createLink('build', 'create','executionID=' + executionID + '&productID=' + productID + '&projectID=' + projectID);
link += config.requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes';
if(config.onlybody != 'yes') link += config.requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes';
html += '<a href="' + link + '" data-toggle="modal" data-type="iframe" style="padding-right:5px">' + createBuild + '</a> ';
html += '<a href="javascript:loadExecutionBuilds(' + executionID + ')">' + refresh + '</a>';
}
+2 -1
View File
@@ -44,6 +44,7 @@ class build extends control
}
/* Set menu. */
$executions = array();
if($this->app->tab == 'project')
{
$this->loadModel('project')->setMenu($projectID);
@@ -64,7 +65,7 @@ class build extends control
$executions = $this->execution->getPairs($execution->project);
}
$executionList = $this->execution->getByIdList(array_keys($executions));
$executionList = empty($executions) ? array() : $this->execution->getByIdList(array_keys($executions));
foreach($executionList as $execution)
{
if($execution->lifetime == 'ops') unset($executions[$execution->id]);
+4
View File
@@ -1374,6 +1374,10 @@ class executionModel extends model
{
$link = helper::createLink($module, 'browse', "executionID=%s&from=execution");
}
elseif($module == 'testreport' and $method == 'create')
{
$link = helper::createLink('execution', 'testtask', "executionID=%s");
}
else
{
$link = helper::createLink($module, $method, "executionID=%s");
+1
View File
@@ -0,0 +1 @@
.table-form {min-width: 600px;}
@@ -0,0 +1 @@
.table-form {min-width: 600px;}
+1
View File
@@ -16,6 +16,7 @@ $lang->gitlab->gitlabAccount = 'GitLab Account';
$lang->gitlab->zentaoAccount = 'Zentao Account';
$lang->gitlab->bindingStatus = 'Binding Status';
$lang->gitlab->binded = 'Binded';
$lang->gitlab->bindedError = 'The bound user has been deleted or modified. Please bind again.';
$lang->gitlab->serverFail = 'Connect to GitLab server failed, please check the GitLab server.';
$lang->gitlab->lastUpdate = 'Last Update';
$lang->gitlab->confirmAddWebhook = 'Are you sure about creating Webhook?';
+1
View File
@@ -16,6 +16,7 @@ $lang->gitlab->gitlabAccount = 'GitLab用户';
$lang->gitlab->zentaoAccount = '禅道用户';
$lang->gitlab->bindingStatus = '绑定状态';
$lang->gitlab->binded = '已绑定';
$lang->gitlab->bindedError = '绑定的用户已删除或者已修改,请重新绑定';
$lang->gitlab->serverFail = '连接GitLab服务器异常,请检查GitLab服务器。';
$lang->gitlab->lastUpdate = '最后更新';
$lang->gitlab->confirmAddWebhook = '您确定创建Webhook吗?';
+17 -9
View File
@@ -22,7 +22,7 @@
<tr>
<th colspan='2'><?php echo $lang->gitlab->gitlabAccount;?></th>
<th><?php echo $lang->gitlab->zentaoAccount;?></th>
<th><?php echo $lang->gitlab->bindingStatus;?></th>
<th class='w-150px'><?php echo $lang->gitlab->bindingStatus;?></th>
</tr>
</thead>
<tbody>
@@ -37,11 +37,11 @@
</td>
<td><?php echo html::select("zentaoUsers[$gitlabUser->id]", $userPairs, '', "class='form-control select chosen'" );?></td>
<td></td>
</tr>
<?php endforeach;?>
<?php foreach($gitlabUsers as $gitlabUser):?>
<?php if(!isset($gitlabUser->zentaoAccount)) continue;?>
<tr>
</tr>
<?php endforeach;?>
<?php foreach($gitlabUsers as $gitlabUser):?>
<?php if(!isset($gitlabUser->zentaoAccount)) continue;?>
<tr>
<td class='w-60px'><?php echo html::image($gitlabUser->avatar, "height=40");?></td>
<td>
<strong><?php echo $gitlabUser->realname;?></strong>
@@ -49,9 +49,17 @@
<?php echo $gitlabUser->account . " &lt;" . $gitlabUser->email . "&gt;";?>
</td>
<td><?php echo html::select("zentaoUsers[$gitlabUser->id]", $userPairs, $gitlabUser->zentaoAccount, "class='form-control select chosen'" );?></td>
<td><?php echo isset($bindedUsers[$gitlabUser->zentaoAccount]) ? $lang->gitlab->binded : ""; ?></td>
</tr>
<?php endforeach;?>
<td>
<?php if(isset($bindedUsers[$gitlabUser->zentaoAccount])):?>
<?php if(!empty(zget($userPairs, $gitlabUser->zentaoAccount, ''))):?>
<?php echo $lang->gitlab->binded;?>
<?php else:?>
<?php echo '<span class="text-red">' . $lang->gitlab->bindedError . '</span>';?>
<?php endif;?>
<?php endif;?>
</td>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
+1 -2
View File
@@ -402,8 +402,7 @@ class mr extends control
$MR = $this->mr->getByID($MRID);
$result = $this->mr->close($MR);
if($result['result'] == 'fali') return $this->send($result);
die(js::locate($result['locate'], 'parent'));
return $this->send($result);
}
/**
+1 -1
View File
@@ -1,6 +1,6 @@
$(document).ready(function()
{
$('#mergeButton').click(function()
$('#mergeButton,.mergeButton').click(function()
{
link = $(this).attr('href');
$.getJSON(link, function(response)
+4 -2
View File
@@ -64,11 +64,13 @@
</thead>
<tbody>
<?php foreach($MRList as $MR):?>
<?php if(!isset($projects[$MR->sourceProject])) $projects[$MR->sourceProject] = $this->loadModel('gitlab')->apiGetSingleProject($MR->gitlabID, $MR->sourceProject); ?>
<?php if(!isset($projects[$MR->targetProject])) $projects[$MR->targetProject] = $this->loadModel('gitlab')->apiGetSingleProject($MR->gitlabID, $MR->targetProject); ?>
<tr>
<td class='text'><?php echo $MR->id;?></td>
<td class='text'><?php echo html::a(inlink('view', "mr={$MR->id}"), $MR->title);?></td>
<td class='text'><?php echo $this->loadModel('gitlab')->apiGetSingleProject($MR->gitlabID, $MR->sourceProject)->name_with_namespace . ':' . $MR->sourceBranch;?></td>
<td class='text'><?php echo $this->loadModel('gitlab')->apiGetSingleProject($MR->gitlabID, $MR->targetProject)->name_with_namespace . ':' . $MR->targetBranch;?></td>
<td class='text' title='<?php echo $projects[$MR->sourceProject]->name_with_namespace . ':' . $MR->sourceBranch;?>'><?php echo $projects[$MR->sourceProject]->name_with_namespace . ':' . $MR->sourceBranch;?></td>
<td class='text' title='<?php echo $projects[$MR->targetProject]->name_with_namespace . ':' . $MR->targetBranch;?>'><?php echo $projects[$MR->targetProject]->name_with_namespace . ':' . $MR->targetBranch;?></td>
<?php if($MR->status == 'closed'):?>
<td class='text'><?php echo zget($lang->mr->statusList, $MR->status);?></td>
<?php else:?>
+7 -7
View File
@@ -103,18 +103,18 @@
<div class="btn-toolbar">
<?php common::printBack(inlink('browse', '')); ?>
<?php $acceptDisabled = ($MR->approvalStatus != 'approved' or ($MR->compileID !=0 and $MR->compileStatus != 'success')) ? ' disabled' : ''; ?>
<?php if($rawMR->state == 'opened' and !$rawMR->has_conflicts) echo html::a(inlink('accept', "mr=$MR->id"), '<i class="icon icon-flow"></i> ' . $lang->mr->acceptMR, '', "id='mergeButton' class='btn' $acceptDisabled"); ?>
<?php if($rawMR->state == 'opened' and !$rawMR->has_conflicts) common::printIcon('mr', 'accept', "mr=$MR->id", $MR, 'button', 'flow', 'hiddenwin', 'mergeButton btn', false, $acceptDisabled, $lang->mr->acceptMR);?>
<?php if($rawMR->state == 'opened'): ?>
<?php if($rawMR->has_conflicts or ($MR->compileID !=0 and $MR->compileStatus != 'success') or $MR->approvalStatus == 'approved'):?>
<?php echo html::a(inlink('approval', "mr=$MR->id&action=approve", '', true), '<i class="icon icon-ok"></i> ' . $lang->mr->approve, '', "id='mergeButton' class='btn iframe showinonlybody' disabled"); ?>
<?php common::printIcon('mr', 'approval', "mr=$MR->id&action=approve", $MR, 'button', 'ok', 'hiddenwin', 'mergeButton', true, 'disabled', $lang->mr->approve);?>
<?php else:?>
<?php echo html::a(inlink('approval', "mr=$MR->id&action=approve", '', true), '<i class="icon icon-ok"></i> ' . $lang->mr->approve, '', "id='mergeButton' class='btn iframe showinonlybody'"); ?>
<?php common::printIcon('mr', 'approval', "mr=$MR->id&action=approve", $MR, 'button', 'ok', 'hiddenwin', 'mergeButton btn iframe showinonlybody', true, '', $lang->mr->approve);?>
<?php endif;?>
<?php echo html::a(inlink('approval', "mr=$MR->id&action=reject", '', true), '<i class="icon icon-bug"></i> ' . $lang->mr->reject, '', "id='mergeButton' class='btn iframe showinonlybody'" . ($MR->approvalStatus == 'rejected' ? 'disabled' : '')); ?>
<?php common::printIcon('mr', 'close', "mr=$MR->id", $MR, 'button', 'off', 'hiddenwin');?>
<?php echo html::a(inlink('edit', "mr=$MR->id"), '<i class="icon icon-edit"></i> ' . str_replace($lang->mr->common, '', $lang->mr->edit), '', "id='mergeButton' class='btn'"); ?>
<?php common::printIcon('mr', 'approval', "mr=$MR->id&action=reject", $MR, 'button', 'bug', 'hiddenwin', 'mergeButton btn iframe showinonlybody', true, ($MR->approvalStatus == 'rejected' ? 'disabled' : ''), $lang->mr->reject);?>
<?php common::printIcon('mr', 'close', "mr=$MR->id", $MR, 'button', 'off', 'hiddenwin', 'mergeButton');?>
<?php common::printIcon('mr', 'edit', "mr=$MR->id", $MR, 'button', 'edit');?>
<?php endif;?>
<?php if($rawMR->state == 'closed') echo html::a(inlink('reopen', "mr=$MR->id"), '<i class="icon icon-restart"></i> ' . $lang->mr->reopen, '', "id='mergeButton' class='btn'"); ?>
<?php if($rawMR->state == 'closed') common::printIcon('mr', 'reopen', "mr=$MR->id", $MR, 'button', 'restart', 'hiddenwin', 'mergeButton'); ?>
<?php common::printIcon('mr', 'delete', "mr=$MR->id", $MR, 'button', 'trash', 'hiddenwin');?>
</div>
</div>
+6
View File
@@ -1994,6 +1994,12 @@ class productModel extends model
$projectID = isset($output['projectID']) ? $output['projectID'] : 0;
$link = helper::createLink($module, $method, "productID=%s&branch=" . ($branch ? "%s" : '') . "&groupBy=&projectID=$projectID") . "#app=project";
}
elseif($module == 'testreport' and ($method == 'create' or $method == 'edit'))
{
$vars = $method == 'edit' ? "objectID=%s" : "objectID=&objectType=testtask&extra=%s";
$method = $method == 'edit' ? 'browse' : $method;
$link = helper::createLink($module, $method, $vars);
}
else
{
$link = helper::createLink($module, $method, "productID=%s" . ($branch ? "&branch=%s" : ''));
+7 -5
View File
@@ -382,10 +382,10 @@ class reportModel extends model
{
if(isset($parents[$task->id])) continue;
$project[$task->projectname]['projectID'] = isset($project[$task->projectname]['projectID']) ? $project[$task->projectname]['projectID'] : $task->project;
$project[$task->projectname]['execution'][$task->executionName]['executionID'] = isset($project[$task->projectname]['execution'][$task->executionName]['executionID']) ? $project[$task->projectname]['execution'][$task->executionName]['executionID'] : $task->execution;
$project[$task->projectname]['execution'][$task->executionName]['count'] = isset($project[$task->projectname]['execution'][$task->executionName]['count']) ? $project[$task->projectname]['execution'][$task->executionName]['count'] + 1 : 1;
$project[$task->projectname]['execution'][$task->executionName]['manhour'] = isset($project[$task->projectname]['execution'][$task->executionName]['manhour']) ? $project[$task->projectname]['execution'][$task->executionName]['manhour'] + $task->left : $task->left;
$project[$task->projectname]['projectID'] = isset($project[$task->projectname]['projectID']) ? $project[$task->projectname]['projectID'] : $task->project;
$project[$task->projectname]['execution'][$task->executionName]['executionID'] = isset($project[$task->projectname]['execution'][$task->executionName]['executionID']) ? $project[$task->projectname]['execution'][$task->executionName]['executionID'] : $task->execution;
$project[$task->projectname]['execution'][$task->executionName]['count'] = isset($project[$task->projectname]['execution'][$task->executionName]['count']) ? $project[$task->projectname]['execution'][$task->executionName]['count'] + 1 : 1;
$project[$task->projectname]['execution'][$task->executionName]['manhour'] = isset($project[$task->projectname]['execution'][$task->executionName]['manhour']) ? $project[$task->projectname]['execution'][$task->executionName]['manhour'] + $task->left : $task->left;
$workload[$user]['total']['count'] = isset($workload[$user]['total']['count']) ? $workload[$user]['total']['count'] + 1 : 1;
$workload[$user]['total']['manhour'] = isset($workload[$user]['total']['manhour']) ? $workload[$user]['total']['manhour'] + $task->left : $task->left;
@@ -1059,8 +1059,10 @@ class reportModel extends model
public function getProjectStatusOverview($accounts = array())
{
$projectStatus = $this->dao->select('t1.id,t1.status')->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_TEAM)->alias('t2')->on("t1.id=t2.root && t2.type='project'")
->leftJoin(TABLE_TEAM)->alias('t2')->on("t1.id=t2.root")
->where('t1.type')->in($this->config->systemMode == 'classic' ? 'sprint,stage' : 'project')
->beginIF($this->config->systemMode == 'classic')->andWhere('t2.type')->eq('execution')->fi()
->beginIF($this->config->systemMode == 'new')->andWhere('t2.type')->eq('project')->fi()
->beginIF(!empty($accounts))->andWhere('t2.account')->in($accounts)->fi()
->fetchPairs('id', 'status');
+2
View File
@@ -1,3 +1,5 @@
.side-col .cell {padding: 0px;}
.side-col #legendProjectAndTask .list-unstyled {padding: 10px; border: 1px solid #ddd; border-top: 0px; margin: 0px;}
.tab-pane table {border: 1px solid #ddd; border-top: none;}
.page-title{max-width: 80%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
.pull-left{max-width: 80%;}
+1 -1
View File
@@ -1847,7 +1847,7 @@ class testcase extends control
$caseLang = $this->lang->testcase;
$caseConfig = $this->config->testcase;
$branches = $this->loadModel('branch')->getPairs($productID);
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, empty(array_keys($branches)) ? 0 : array_keys($branches));
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, empty($branches) ? 0 : array_keys($branches));
$stories = $this->loadModel('story')->getProductStoryPairs($productID, $branch);
$fields = $this->testcase->getImportFields($productID);
$fields = array_flip($fields);
+7 -4
View File
@@ -231,10 +231,13 @@ class testcaseModel extends model
*/
public function getModuleCases($productID, $branch = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $browseType = '', $auto = 'no')
{
return $this->dao->select('t1.*, t2.title as storyTitle')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.product')->eq((int)$productID)
->beginIF($this->app->tab == 'project')->andWhere('t1.project')->eq($this->session->project)->fi()
$stmt = $this->dao->select('t1.*, t2.title as storyTitle')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id');
if($this->app->tab == 'project') $stmt = $stmt->leftJoin(TABLE_PROJECTCASE)->alias('t3')->on('t1.id=t3.case');
return $stmt ->where('t1.product')->eq((int)$productID)
->beginIF($this->app->tab == 'project')->andWhere('t3.project')->eq($this->session->project)->fi()
->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi()
->beginIF($browseType == 'wait')->andWhere('t1.status')->eq($browseType)->fi()
+1 -1
View File
@@ -189,7 +189,7 @@ class testreport extends control
$taskPairs = array();
$scopeAndStatus[0] = 'local';
$scopeAndStatus[1] = 'totalStatus';
$tasks = $this->testtask->getProductTasks($productID, $task->branch, 'id_desc', null, $scopeAndStatus);
$tasks = $this->testtask->getProductTasks($productID, empty($objectID) ? 0 : $task->branch, 'id_desc', null, $scopeAndStatus);
foreach($tasks as $testTask)
{
if($testTask->build == 'trunk') continue;
+5 -4
View File
@@ -114,15 +114,16 @@ class treeModel extends model
/**
* Create an option menu in html.
*
* @param int $rootID
* @param string $type
* @param int $startModule
* @param int $branch
* @param int $rootID
* @param string $type
* @param int $startModule
* @param int|array $branch
* @access public
* @return string
*/
public function getOptionMenu($rootID, $type = 'story', $startModule = 0, $branch = 0)
{
if(empty($branch)) $branch = 0;
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getModulePairs();
/* If type of $branch is array, get modules of these branches. */
+6 -2
View File
@@ -969,8 +969,12 @@ class userModel extends model
}
/* Get can manage projects by user. */
$projectAdminGroupID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('projectAdmin')->fetch('id');
$canManageProjects = $this->dao->select('project')->from(TABLE_USERGROUP)->where('`group`')->eq($projectAdminGroupID)->andWhere('account')->eq($account)->fetch('project');
$canManageProjects = array();
if(!defined('IN_UPGRADE'))
{
$projectAdminGroupID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('projectAdmin')->fetch('id');
$canManageProjects = $this->dao->select('project')->from(TABLE_USERGROUP)->where('`group`')->eq($projectAdminGroupID)->andWhere('account')->eq($account)->fetch('project');
}
return array('rights' => $rights, 'acls' => $acls, 'projects' => $canManageProjects);
}