Merge branch 'devops18'
This commit is contained in:
@@ -20,8 +20,8 @@ class gitlabWebhookEntry extends baseEntry
|
||||
*/
|
||||
public function post()
|
||||
{
|
||||
$repoID= $this->param('repoID');
|
||||
if(empty($id)) return;
|
||||
$repoID = $this->param('repoID');
|
||||
if(empty($repoID)) return;
|
||||
|
||||
$this->loadModel('repo');
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ $filter->rules->orderBy = '/^\w+_(desc|asc)$/i';
|
||||
$filter->rules->browseType = '/^by\w+$/i';
|
||||
$filter->rules->word = '/^\w+$/';
|
||||
$filter->rules->paramName = '/^[a-zA-Z0-9_\.]+$/';
|
||||
$filter->rules->paramValue = '/^[a-zA-Z0-9=_,`#+\^\/\.%\|\x7f-\xff\-]+$/';
|
||||
$filter->rules->paramValue = '/^[a-zA-Z0-9=_,`#+\^\/\.%\*\|\x7f-\xff\-]+$/';
|
||||
|
||||
$filter->default = new stdclass();
|
||||
$filter->default->moduleName = 'code';
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
ALTER TABLE zt_productplan ADD `status` enum('wait','doing','done','closed') NOT NULL default 'wait' AFTER `title`;
|
||||
ALTER TABLE zt_product modify column `reviewer` text NOT NULL;
|
||||
|
||||
+1
-1
@@ -933,7 +933,7 @@ CREATE TABLE IF NOT EXISTS `zt_product` (
|
||||
`RD` varchar(30) NOT NULL,
|
||||
`acl` enum('open','private','custom') NOT NULL default 'open',
|
||||
`whitelist` text NOT NULL,
|
||||
`reviewer` varchar(255) NOT NULL,
|
||||
`reviewer` text NOT NULL,
|
||||
`createdBy` varchar(30) NOT NULL,
|
||||
`createdDate` datetime NOT NULL,
|
||||
`createdVersion` varchar(20) NOT NULL,
|
||||
|
||||
@@ -617,6 +617,7 @@ class gitlab
|
||||
|
||||
$param = new stdclass();
|
||||
$param->path = urldecode($path);
|
||||
$param->ref_name = $this->branch;
|
||||
|
||||
$fromDate = $this->getCommittedDate($fromRevision);
|
||||
$toDate = $this->getCommittedDate($toRevision);
|
||||
|
||||
@@ -126,6 +126,7 @@ $lang->action->objectTypes['gitlabgroup'] = 'GitLab Group';
|
||||
$lang->action->objectTypes['gitlabbranch'] = 'GitLab Branch';
|
||||
$lang->action->objectTypes['gitlabbranchpriv'] = 'GitLab Protected Branches';
|
||||
$lang->action->objectTypes['gitlabtag'] = 'GitLab Tag';
|
||||
$lang->action->objectTypes['gitlabtagpriv'] = 'GitLab Tag Protected';
|
||||
$lang->action->objectTypes['kanbanspace'] = 'Kanban Space';
|
||||
$lang->action->objectTypes['kanban'] = 'Kanban';
|
||||
$lang->action->objectTypes['kanbanregion'] = 'Kanban Region';
|
||||
|
||||
@@ -126,6 +126,7 @@ $lang->action->objectTypes['gitlabgroup'] = 'GitLab群组';
|
||||
$lang->action->objectTypes['gitlabbranch'] = 'GitLab分支';
|
||||
$lang->action->objectTypes['gitlabbranchpriv'] = 'GitLab保护分支';
|
||||
$lang->action->objectTypes['gitlabtag'] = 'GitLab标签';
|
||||
$lang->action->objectTypes['gitlabtagpriv'] = 'GitLab标签保护';
|
||||
$lang->action->objectTypes['kanbanspace'] = '看板空间';
|
||||
$lang->action->objectTypes['kanban'] = '看板';
|
||||
$lang->action->objectTypes['kanbanregion'] = '看板区域';
|
||||
|
||||
@@ -164,6 +164,7 @@ $lang->bug->labelConfirmed = 'Confirmed';
|
||||
$lang->bug->labelPostponed = 'Postponed';
|
||||
$lang->bug->changed = 'Changed';
|
||||
$lang->bug->storyChanged = 'Story Changed';
|
||||
$lang->bug->linkMR = 'Related MRs';
|
||||
|
||||
/* Page tags. */
|
||||
$lang->bug->lblAssignedTo = 'AssignTo';
|
||||
|
||||
@@ -164,6 +164,7 @@ $lang->bug->labelConfirmed = '已确认';
|
||||
$lang->bug->labelPostponed = '被延期';
|
||||
$lang->bug->changed = '已变动';
|
||||
$lang->bug->storyChanged = '需求变动';
|
||||
$lang->bug->linkMR = '相关合并请求';
|
||||
|
||||
/* 页面标签。*/
|
||||
$lang->bug->lblAssignedTo = '当前指派';
|
||||
|
||||
@@ -164,6 +164,7 @@ $lang->bug->labelConfirmed = '已確認';
|
||||
$lang->bug->labelPostponed = '被延期';
|
||||
$lang->bug->changed = '已變動';
|
||||
$lang->bug->storyChanged = '需求變動';
|
||||
$lang->bug->linkMR = '相關合并請求';
|
||||
|
||||
/* 頁面標籤。*/
|
||||
$lang->bug->lblAssignedTo = '當前指派';
|
||||
|
||||
@@ -495,6 +495,7 @@ class bugModel extends model
|
||||
if($bug->linkBug) $bug->linkBugTitles = $this->dao->select('id,title')->from(TABLE_BUG)->where('id')->in($bug->linkBug)->fetchPairs();
|
||||
if($bug->toStory > 0) $bug->toStoryTitle = $this->dao->findById($bug->toStory)->from(TABLE_STORY)->fields('title')->fetch('title');
|
||||
if($bug->toTask > 0) $bug->toTaskTitle = $this->dao->findById($bug->toTask)->from(TABLE_TASK)->fields('name')->fetch('name');
|
||||
$bug->linkMRTitles = $this->loadModel('mr')->getLinkedMRPairs($bugID, 'bug');
|
||||
|
||||
$bug->toCases = array();
|
||||
$toCases = $this->dao->select('id, title')->from(TABLE_CASE)->where('`fromBug`')->eq($bugID)->fetchAll();
|
||||
|
||||
@@ -374,7 +374,7 @@
|
||||
<table class="table table-data">
|
||||
<tbody>
|
||||
<tr class='text-top'>
|
||||
<th class='w-80px'><?php echo $lang->bug->linkBug;?></th>
|
||||
<th class='w-90px'><?php echo $lang->bug->linkBug;?></th>
|
||||
<td>
|
||||
<?php
|
||||
if(isset($bug->linkBugTitles))
|
||||
@@ -389,7 +389,7 @@
|
||||
</tr>
|
||||
<?php if($bug->case):?>
|
||||
<tr>
|
||||
<th class='w-60px'><?php echo $lang->bug->fromCase;?></th>
|
||||
<th><?php echo $lang->bug->fromCase;?></th>
|
||||
<td><?php echo html::a($this->createLink('testcase', 'view', "caseID=$bug->case&caseVersion=" . ($bug->testtask ? "&from=testtask&taskID={$bug->testtask}" : ''), '', true), "#$bug->case $bug->caseTitle", '', "class='iframe' data-width='80%'");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
@@ -418,6 +418,18 @@
|
||||
<td><?php echo html::a($this->createLink('task', 'view', "taskID=$bug->toTask", '', true), "#$bug->toTask $bug->toTaskTitle", '', "class='iframe' data-width='80%'");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->bug->linkMR;?></th>
|
||||
<td>
|
||||
<?php
|
||||
$canViewMR = common::hasPriv('mr', 'view');
|
||||
foreach($bug->linkMRTitles as $MRID => $linkMRTitle)
|
||||
{
|
||||
echo ($canViewMR ? html::a($this->createLink('mr', 'view', "MRID=$MRID"), "#$MRID $linkMRTitle") : "#$MRID $linkMRTitle") . '<br />';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
+16
-23
@@ -201,7 +201,10 @@ class ciModel extends model
|
||||
$this->dao->update(TABLE_JOB)->set('lastExec')->eq(helper::now())->set('lastStatus')->eq($status)->where('id')->eq($build->job)->exec();
|
||||
|
||||
if($status == 'building') return;
|
||||
|
||||
$relateMR = $this->dao->select('*')->from(TABLE_MR)->where('compileID')->eq($build->id)->fetch();
|
||||
if(empty($relateMR)) return;
|
||||
|
||||
if(isset($relateMR->synced) and $relateMR->synced == '0' and $status == 'success')
|
||||
{
|
||||
$newMR = new stdclass();
|
||||
@@ -230,21 +233,13 @@ class ciModel extends model
|
||||
*/
|
||||
if(isset($rawMR->message) and !isset($rawMR->iid))
|
||||
{
|
||||
foreach($this->lang->mr->apiErrorMap as $key => $errorMsg)
|
||||
$errorMessage = $rawMR->message;
|
||||
$rawMR = $this->mr->apiGetSameOpened($relateMR->gitlabID, $relateMR->sourceProject, $MRObject->source_branch, $MRObject->target_project_id, $MRObject->target_branch);
|
||||
if(empty($rawMR) or !isset($rawMR->iid))
|
||||
{
|
||||
if(strpos($errorMsg, '/') === 0)
|
||||
{
|
||||
$result = preg_match($errorMsg, $rawMR->message[0], $matches);
|
||||
if($result) $errorMessage = sprintf(zget($this->lang->mr->errorLang, $key), $matches[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($rawMR->message[0] == $errorMsg) $errorMessage = zget($this->lang->mr->errorLang, $key, $rawMR->message[0]);
|
||||
}
|
||||
|
||||
if(isset($errorMessage)) break;
|
||||
$errorMessage = $this->mr->convertApiError($errorMessage);
|
||||
$newMR->syncError = sprintf($this->lang->mr->apiError->createMR, $errorMessage);
|
||||
}
|
||||
$newMR->syncError = sprintf($this->lang->mr->apiError->createMR, isset($errorMessage) ? $errorMessage : $rawMR->message[0]);
|
||||
}
|
||||
elseif(!isset($rawMR->iid))
|
||||
{
|
||||
@@ -253,24 +248,22 @@ class ciModel extends model
|
||||
|
||||
if(!empty($rawMR->iid))
|
||||
{
|
||||
$newMR->mriid = $rawMR->iid;
|
||||
$newMR->status = $rawMR->state;
|
||||
$newMR->synced = '1';
|
||||
$newMR->mriid = $rawMR->iid;
|
||||
$newMR->status = $rawMR->state;
|
||||
$newMR->synced = '1';
|
||||
$newMR->syncError = '';
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_MR)->data($newMR)
|
||||
->where('id')->eq($relateMR->id)
|
||||
->exec();
|
||||
$this->dao->update(TABLE_MR)->data($newMR)->where('id')->eq($relateMR->id)->exec();
|
||||
}
|
||||
else
|
||||
elseif($status != 'success')
|
||||
{
|
||||
$newMR = new stdclass();
|
||||
$newMR->status = 'closed';
|
||||
$newMR->mergeStatus = 'cannot_merge_by_fail';
|
||||
$newMR->compileStatus = $status;
|
||||
|
||||
$this->dao->update(TABLE_MR)->data($newMR)
|
||||
->where('id')->eq($relateMR->id)
|
||||
->exec();
|
||||
$this->dao->update(TABLE_MR)->data($newMR)->where('id')->eq($relateMR->id)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class companyModel extends model
|
||||
{
|
||||
/**
|
||||
* Set menu.
|
||||
*
|
||||
*
|
||||
* @param int $dept
|
||||
* @access public
|
||||
* @return void
|
||||
@@ -31,7 +31,7 @@ class companyModel extends model
|
||||
|
||||
/**
|
||||
* Get company list.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -42,7 +42,7 @@ class companyModel extends model
|
||||
|
||||
/**
|
||||
* Get the first company.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -53,8 +53,8 @@ class companyModel extends model
|
||||
|
||||
/**
|
||||
* Get company info by id.
|
||||
*
|
||||
* @param int $companyID
|
||||
*
|
||||
* @param int $companyID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
@@ -131,7 +131,7 @@ class companyModel extends model
|
||||
|
||||
/**
|
||||
* Update a company.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
+175
-1
@@ -845,6 +845,9 @@ class gitlab extends control
|
||||
*/
|
||||
public function createBranchPriv($gitlabID, $projectID, $branch = '')
|
||||
{
|
||||
/* Fix error when request type is PATH_INFO and the branch name contains '-'.*/
|
||||
if($branch) $branch = str_replace('*', '-', $branch);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$this->gitlab->createBranchPriv($gitlabID, $projectID, $branch);
|
||||
@@ -914,8 +917,14 @@ class gitlab extends control
|
||||
*/
|
||||
public function deleteBranchPriv($gitlabID, $projectID, $branch, $confirm = 'no')
|
||||
{
|
||||
if($confirm != 'yes') die(js::confirm($this->lang->gitlab->branch->confirmDelete , inlink('deleteBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch&confirm=yes")));
|
||||
if($confirm != 'yes')
|
||||
{
|
||||
$branch = urlencode($branch);
|
||||
die(js::confirm($this->lang->gitlab->branch->confirmDelete , inlink('deleteBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch&confirm=yes")));
|
||||
}
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the branch name contains '-'.*/
|
||||
$branch = str_replace('*', '-', $branch);
|
||||
$reponse = $this->gitlab->apiDeleteBranchPriv($gitlabID, $projectID, $branch);
|
||||
|
||||
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
|
||||
@@ -974,6 +983,169 @@ class gitlab extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Browse gitlab protect tag.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browseTagPriv($gitlabID, $projectID, $orderBy = 'name_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$this->session->set('gitlabTagPrivList', $this->app->getURI(true));
|
||||
$keyword = fixer::input('post')->setDefault('keyword', '')->get('keyword');
|
||||
|
||||
$gitlabTags = array();
|
||||
$allTags = $this->gitlab->apiGetTags($gitlabID, $projectID);
|
||||
foreach($allTags as $tag)
|
||||
{
|
||||
$gitlabTags[$tag->name] = $tag;
|
||||
}
|
||||
|
||||
$tagList = array();
|
||||
$gitlabProtectTags = $this->gitlab->apiGetTagPrivs($gitlabID, $projectID);
|
||||
foreach($gitlabProtectTags as $gitlabProtectTag)
|
||||
{
|
||||
$tag = new stdClass();
|
||||
$tag->name = $gitlabProtectTag->name;
|
||||
$tag->lastCommitter = isset($gitlabTags[$tag->name]) ? $gitlabTags[$tag->name]->commit->committer_name : '';
|
||||
$tag->accessLevels = $gitlabProtectTag->create_access_levels;
|
||||
|
||||
$tagList[] = $tag;
|
||||
}
|
||||
|
||||
/* Data search. */
|
||||
if($keyword)
|
||||
{
|
||||
foreach($tagList as $key => $tag)
|
||||
{
|
||||
if(strpos($tag->name, $keyword) === false) unset($tagList[$key]);
|
||||
}
|
||||
$tagList = array_values($tagList);
|
||||
}
|
||||
|
||||
/* Data sort. */
|
||||
list($order, $sort) = explode('_', $orderBy);
|
||||
$orderList = array();
|
||||
foreach($tagList as $tag) $orderList[] = $tag->$order;
|
||||
array_multisort($orderList, $sort == 'desc' ? SORT_DESC : SORT_ASC, $tagList);
|
||||
|
||||
/* Pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$recTotal = count($tagList);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
$tagList = array_chunk($tagList, $pager->recPerPage);
|
||||
|
||||
$this->view->gitlab = $this->gitlab->getByID($gitlabID);
|
||||
$this->view->pager = $pager;
|
||||
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->browseTagPriv;
|
||||
$this->view->gitlabID = $gitlabID;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->keyword = $keyword;
|
||||
$this->view->project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
$this->view->gitlabTagList = empty($tagList) ? $tagList: $tagList[$pageID - 1];
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a gitlab protect tag.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createTagPriv($gitlabID, $projectID)
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$this->gitlab->createTagPriv($gitlabID, $projectID);
|
||||
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browseTagPriv', "gitlabID=$gitlabID&projectID=$projectID")));
|
||||
}
|
||||
|
||||
$gitlabTags = $this->gitlab->apiGetTags($gitlabID, $projectID);
|
||||
$protectTags = $this->gitlab->apiGetTagPrivs($gitlabID, $projectID, '', 'name_asc');
|
||||
$protectNames = array_keys($protectTags);
|
||||
|
||||
$tags = array();
|
||||
foreach($gitlabTags as $tag)
|
||||
{
|
||||
if(!in_array($tag->name, $protectNames)) $tags[$tag->name] = $tag->name;
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->createTagPriv;
|
||||
$this->view->gitlabID = $gitlabID;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->tags = $tags;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a gitlab protect tag.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param string $tag
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function editTagPriv($gitlabID, $projectID, $tag = '')
|
||||
{
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tag = str_replace('*', '-', $tag);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$this->gitlab->createTagPriv($gitlabID, $projectID, $tag);
|
||||
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browseTagPriv', "gitlabID=$gitlabID&projectID=$projectID")));
|
||||
}
|
||||
|
||||
$tagPriv = $this->gitlab->apiGetSingleTagPriv($gitlabID, $projectID, $tag);
|
||||
$tagPriv->createAccessLevel = $this->gitlab->checkAccessLevel($tagPriv->create_access_levels);
|
||||
|
||||
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->editTagPriv;
|
||||
$this->view->gitlabID = $gitlabID;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->tagPriv = $tagPriv;
|
||||
$this->view->tag = $tag;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a gitlab protect tag.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param string $tag
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteTagPriv($gitlabID, $projectID, $tag)
|
||||
{
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tag = str_replace('*', '-', $tag);
|
||||
$reponse = $this->gitlab->apiDeleteTagPriv($gitlabID, $projectID, $tag);
|
||||
|
||||
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
|
||||
if(!$reponse or substr($reponse->message, 0, 2) == '20')
|
||||
{
|
||||
$this->loadModel('action')->create('gitlabtagpriv', 0, 'deleted', '', $tag);
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
die(js::alert($reponse->message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Import gitlab issue to zentaopms.
|
||||
*
|
||||
@@ -1372,6 +1544,8 @@ class gitlab extends control
|
||||
{
|
||||
if($confirm != 'yes') die(js::confirm($this->lang->gitlab->tag->confirmDelete , inlink('deleteTag', "gitlabID=$gitlabID&projectID=$projectID&tagName=$tagName&confirm=yes")));
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tagName = str_replace('*', '-', $tagName);
|
||||
$reponse = $this->gitlab->apiDeleteTag($gitlabID, $projectID, $tagName);
|
||||
|
||||
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
.text-c-counts > span {margin-left: 5px;}
|
||||
#mainMenu .pull-left {margin-right: 15px;}
|
||||
.c-actions-1 {width: 60px;}
|
||||
|
||||
#gitlabTagList .text-c-name .has-prefix{position: relative; display: flex; align-items: center;}
|
||||
#gitlabTagList .text-c-name .label {flex: none;}
|
||||
#gitlabTagList .text-c-name .tag-name {display: inline-block; max-width: calc(100% - 50px); padding-right: 10px;}
|
||||
@@ -0,0 +1,17 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#tagSearch').click(function()
|
||||
{
|
||||
triggerSearch();
|
||||
});
|
||||
$('#keyword').keypress(function(event)
|
||||
{
|
||||
if(event.which == 13) triggerSearch();
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function triggerSearch()
|
||||
{
|
||||
$("#tagForm").submit();
|
||||
}
|
||||
+19
-11
@@ -32,6 +32,7 @@ $lang->gitlab->browseUser = "User List";
|
||||
$lang->gitlab->browseGroup = "Group List";
|
||||
$lang->gitlab->browseBranch = "GitLab Branch List";
|
||||
$lang->gitlab->browseTag = "GitLab Tag List";
|
||||
$lang->gitlab->browseTagPriv = "GitLab Tag protected List";
|
||||
$lang->gitlab->gitlabIssue = "GitLab Issue";
|
||||
$lang->gitlab->zentaoProduct = 'Zentao Product';
|
||||
$lang->gitlab->objectType = 'Type'; // task, bug, story
|
||||
@@ -54,6 +55,9 @@ $lang->gitlab->editBranchPriv = 'Edit branch protected';
|
||||
$lang->gitlab->deleteBranchPriv = 'Delete branch protected';
|
||||
$lang->gitlab->createTag = 'Create Tag';
|
||||
$lang->gitlab->deleteTag = 'Delete tag';
|
||||
$lang->gitlab->createTagPriv = 'Create tag protected';
|
||||
$lang->gitlab->editTagPriv = 'Edit tag protected';
|
||||
$lang->gitlab->deleteTagPriv = 'Delete tag protected';
|
||||
|
||||
$lang->gitlab->id = 'ID';
|
||||
$lang->gitlab->name = "GitLab Name";
|
||||
@@ -207,14 +211,18 @@ $lang->gitlab->branch->emptyPrivNameError = "Branch cannot be empty.";
|
||||
$lang->gitlab->branch->issetPrivNameError = "The protection branch already exists";
|
||||
|
||||
$lang->gitlab->tag = new stdclass();
|
||||
$lang->gitlab->tag->name = 'Tag name';
|
||||
$lang->gitlab->tag->ref = 'Create from';
|
||||
$lang->gitlab->tag->lastCommitter = 'Last Committer';
|
||||
$lang->gitlab->tag->lastCommittedDate = 'Last Committed Date';
|
||||
$lang->gitlab->tag->placeholderSearch = "Enter branch tag";
|
||||
$lang->gitlab->tag->message = 'Message';
|
||||
$lang->gitlab->tag->emptyNameError = "Name cannot be empty.";
|
||||
$lang->gitlab->tag->emptyRefError = "Create from cannot be empty.";
|
||||
$lang->gitlab->tag->issetNameError = "The tag already exists";
|
||||
$lang->gitlab->tag->confirmDelete = 'Do you want to delete this GitLab tag?';
|
||||
$lang->gitlab->tag->protected = 'Protected';
|
||||
$lang->gitlab->tag->name = 'Tag name';
|
||||
$lang->gitlab->tag->ref = 'Create from';
|
||||
$lang->gitlab->tag->lastCommitter = 'Last Committer';
|
||||
$lang->gitlab->tag->lastCommittedDate = 'Last Committed Date';
|
||||
$lang->gitlab->tag->placeholderSearch = "Enter branch tag";
|
||||
$lang->gitlab->tag->message = 'Message';
|
||||
$lang->gitlab->tag->emptyNameError = "Name cannot be empty.";
|
||||
$lang->gitlab->tag->emptyRefError = "Create from cannot be empty.";
|
||||
$lang->gitlab->tag->issetNameError = "The tag already exists";
|
||||
$lang->gitlab->tag->confirmDelete = 'Do you want to delete this GitLab tag?';
|
||||
$lang->gitlab->tag->protected = 'Protected';
|
||||
$lang->gitlab->tag->accessLevel = 'Allow creation';
|
||||
$lang->gitlab->tag->protectConfirmDel = 'Do you want to delete this GitLab tag protected?';
|
||||
$lang->gitlab->tag->emptyPrivNameError = 'Tag cannot be empty.';
|
||||
$lang->gitlab->tag->issetPrivNameError = 'The protection tag already exists.';
|
||||
|
||||
@@ -32,6 +32,7 @@ $lang->gitlab->browseUser = "用户列表";
|
||||
$lang->gitlab->browseGroup = "群组列表";
|
||||
$lang->gitlab->browseBranch = "GitLab分支列表";
|
||||
$lang->gitlab->browseTag = "GitLab标签列表";
|
||||
$lang->gitlab->browseTagPriv = "GitLab标签保护列表";
|
||||
$lang->gitlab->gitlabIssue = "{$lang->gitlab->common} issue";
|
||||
$lang->gitlab->zentaoProduct = '禅道产品';
|
||||
$lang->gitlab->objectType = '类型'; // task, bug, story
|
||||
@@ -54,6 +55,9 @@ $lang->gitlab->editBranchPriv = '编辑分支保护';
|
||||
$lang->gitlab->deleteBranchPriv = '删除分支保护';
|
||||
$lang->gitlab->createTag = '创建标签';
|
||||
$lang->gitlab->deleteTag = '删除标签';
|
||||
$lang->gitlab->createTagPriv = '创建标签保护';
|
||||
$lang->gitlab->editTagPriv = '编辑标签保护';
|
||||
$lang->gitlab->deleteTagPriv = '删除标签保护';
|
||||
|
||||
$lang->gitlab->id = 'ID';
|
||||
$lang->gitlab->name = "{$lang->gitlab->common}名称";
|
||||
@@ -207,14 +211,18 @@ $lang->gitlab->branch->emptyPrivNameError = "分支不能为空";
|
||||
$lang->gitlab->branch->issetPrivNameError = "已存在该保护分支";
|
||||
|
||||
$lang->gitlab->tag = new stdclass();
|
||||
$lang->gitlab->tag->name = '标签名';
|
||||
$lang->gitlab->tag->ref = '创建自';
|
||||
$lang->gitlab->tag->lastCommitter = '最后提交';
|
||||
$lang->gitlab->tag->lastCommittedDate = '最后修改时间';
|
||||
$lang->gitlab->tag->placeholderSearch = "请输入标签名称";
|
||||
$lang->gitlab->tag->message = '信息';
|
||||
$lang->gitlab->tag->emptyNameError = "标签名不能为空";
|
||||
$lang->gitlab->tag->emptyRefError = "创建自不能为空";
|
||||
$lang->gitlab->tag->issetNameError = "已存在该标签";
|
||||
$lang->gitlab->tag->confirmDelete = '确认删除该GitLab标签吗?';
|
||||
$lang->gitlab->tag->protected = '受保护';
|
||||
$lang->gitlab->tag->name = '标签名';
|
||||
$lang->gitlab->tag->ref = '创建自';
|
||||
$lang->gitlab->tag->lastCommitter = '最后提交';
|
||||
$lang->gitlab->tag->lastCommittedDate = '最后修改时间';
|
||||
$lang->gitlab->tag->placeholderSearch = "请输入标签名称";
|
||||
$lang->gitlab->tag->message = '信息';
|
||||
$lang->gitlab->tag->emptyNameError = "标签名不能为空";
|
||||
$lang->gitlab->tag->emptyRefError = "创建自不能为空";
|
||||
$lang->gitlab->tag->issetNameError = "已存在该标签";
|
||||
$lang->gitlab->tag->confirmDelete = '确认删除该GitLab标签吗?';
|
||||
$lang->gitlab->tag->protected = '受保护';
|
||||
$lang->gitlab->tag->accessLevel = '允许创建';
|
||||
$lang->gitlab->tag->protectConfirmDel = '确认删除该GitLab标签保护吗?';
|
||||
$lang->gitlab->tag->emptyPrivNameError = "标签不能为空";
|
||||
$lang->gitlab->tag->issetPrivNameError = "已存在该保护标签";
|
||||
|
||||
@@ -54,6 +54,8 @@ $lang->gitlab->editBranchPriv = '編輯分支保護';
|
||||
$lang->gitlab->deleteBranchPriv = '刪除分支保護';
|
||||
$lang->gitlab->createTag = '創建標籤';
|
||||
$lang->gitlab->deleteTag = '刪除標籤';
|
||||
$lang->gitlab->createTagPriv = '創建標簽保護';
|
||||
$lang->gitlab->editTagPriv = '編輯標簽保護';
|
||||
|
||||
$lang->gitlab->id = 'ID';
|
||||
$lang->gitlab->name = "{$lang->gitlab->common}名稱";
|
||||
@@ -207,14 +209,17 @@ $lang->gitlab->branch->emptyPrivNameError = "分支不能為空";
|
||||
$lang->gitlab->branch->issetPrivNameError = "已存在該保護分支";
|
||||
|
||||
$lang->gitlab->tag = new stdclass();
|
||||
$lang->gitlab->tag->name = '標籤名';
|
||||
$lang->gitlab->tag->ref = '創建自';
|
||||
$lang->gitlab->tag->lastCommitter = '最後提交';
|
||||
$lang->gitlab->tag->lastCommittedDate = '最後修改時間';
|
||||
$lang->gitlab->tag->placeholderSearch = "請輸入標籤名稱";
|
||||
$lang->gitlab->tag->message = '信息';
|
||||
$lang->gitlab->tag->emptyNameError = "標籤名不能為空";
|
||||
$lang->gitlab->tag->emptyRefError = "創建自不能為空";
|
||||
$lang->gitlab->tag->issetNameError = "已存在該標籤";
|
||||
$lang->gitlab->tag->confirmDelete = '確認刪除該GitLab標籤嗎?';
|
||||
$lang->gitlab->tag->protected = '受保護';
|
||||
$lang->gitlab->tag->name = '標籤名';
|
||||
$lang->gitlab->tag->ref = '創建自';
|
||||
$lang->gitlab->tag->lastCommitter = '最後提交';
|
||||
$lang->gitlab->tag->lastCommittedDate = '最後修改時間';
|
||||
$lang->gitlab->tag->placeholderSearch = "請輸入標籤名稱";
|
||||
$lang->gitlab->tag->message = '信息';
|
||||
$lang->gitlab->tag->emptyNameError = "標籤名不能為空";
|
||||
$lang->gitlab->tag->emptyRefError = "創建自不能為空";
|
||||
$lang->gitlab->tag->issetNameError = "已存在該標籤";
|
||||
$lang->gitlab->tag->confirmDelete = '確認刪除該GitLab標籤嗎?';
|
||||
$lang->gitlab->tag->protected = '受保護';
|
||||
$lang->gitlab->tag->accessLevel = '允許創建';
|
||||
$lang->gitlab->tag->emptyPrivNameError = '標簽不能爲空';
|
||||
$lang->gitlab->tag->issetPrivNameError = '已存在該保護標簽';
|
||||
|
||||
+136
-7
@@ -608,7 +608,7 @@ class gitlabModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function apiGetProjectsPager($gitlabID, $keyword = '', $orderBy = '', $pager = null)
|
||||
public function apiGetProjectsPager($gitlabID, $keyword = '', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$gitlab = $this->getByID($gitlabID);
|
||||
if(!$gitlab) return array();
|
||||
@@ -1485,8 +1485,16 @@ class gitlabModel extends model
|
||||
|
||||
if(!$pager)
|
||||
{
|
||||
$url = sprintf($apiRoot, "/projects/{$projectID}/repository/tags");
|
||||
return json_decode(commonModel::http($url));
|
||||
$allResults = array();
|
||||
$url = sprintf($apiRoot, "/projects/{$projectID}/repository/tags");
|
||||
for($page = 1; true; $page++)
|
||||
{
|
||||
$results = json_decode(commonModel::http($url . "&&page={$page}&per_page=100"));
|
||||
if(!empty($results)) $allResults = array_merge($allResults, $results);
|
||||
if(count($results)<100) break;
|
||||
}
|
||||
|
||||
return $allResults;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1517,10 +1525,56 @@ class gitlabModel extends model
|
||||
if(!(int)$gitlabID or !(int)$projectID or empty($tagName)) return false;
|
||||
|
||||
$apiRoot = $this->getApiRoot($gitlabID);
|
||||
$tagName = urlencode($tagName);
|
||||
$url = sprintf($apiRoot, "/projects/{$projectID}/repository/tags/{$tagName}");
|
||||
return json_decode(commonModel::http($url, array(), $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get protect tags of one project.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function apiGetTagPrivs($gitlabID, $projectID)
|
||||
{
|
||||
$apiRoot = $this->getApiRoot($gitlabID);
|
||||
$url = sprintf($apiRoot, "/projects/{$projectID}/protected_tags");
|
||||
|
||||
$allResults = array();
|
||||
for($page = 1; true; $page++)
|
||||
{
|
||||
$results = json_decode(commonModel::http($url . "&&page={$page}&per_page=100"));
|
||||
if(!empty($results)) $allResults = array_merge($allResults, $results);
|
||||
if(count($results)<100) break;
|
||||
}
|
||||
|
||||
$tags = array();
|
||||
foreach($allResults as $tag) $tags[$tag->name] = $tag;
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a gitab protect tag by api.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param string $tag
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function apiDeleteTagPriv($gitlabID, $projectID, $tag)
|
||||
{
|
||||
if(empty($gitlabID)) return false;
|
||||
$apiRoot = $this->getApiRoot($gitlabID);
|
||||
$tag = urlencode($tag);
|
||||
$url = sprintf($apiRoot, "/projects/{$projectID}/protected_tags/{$tag}");
|
||||
return json_decode(commonModel::http($url, array(), $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check webhook token by HTTP_X_GITLAB_TOKEN.
|
||||
*
|
||||
@@ -2354,10 +2408,18 @@ class gitlabModel extends model
|
||||
{
|
||||
foreach($response->message as $field => $fieldErrors)
|
||||
{
|
||||
foreach($fieldErrors as $error)
|
||||
if(is_string($fieldErrors))
|
||||
{
|
||||
$errorKey = array_search($error, $this->lang->gitlab->apiError);
|
||||
if($error) dao::$errors[$field][] = $errorKey === false ? $error : zget($this->lang->gitlab->errorLang, $errorKey);
|
||||
$errorKey = array_search($fieldErrors, $this->lang->gitlab->apiError);
|
||||
if($fieldErrors) dao::$errors[$field][] = $errorKey === false ? $fieldErrors : zget($this->lang->gitlab->errorLang, $errorKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($fieldErrors as $error)
|
||||
{
|
||||
$errorKey = array_search($error, $this->lang->gitlab->apiError);
|
||||
if($error) dao::$errors[$field][] = $errorKey === false ? $error : zget($this->lang->gitlab->errorLang, $errorKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2425,7 +2487,8 @@ class gitlabModel extends model
|
||||
public function apiGetSingleBranchPriv($gitlabID, $projectID, $branch)
|
||||
{
|
||||
if(empty($gitlabID)) return false;
|
||||
$url = sprintf($this->getApiRoot($gitlabID), "/projects/$projectID/protected_branches/$branch");
|
||||
$branch = urlencode($branch);
|
||||
$url = sprintf($this->getApiRoot($gitlabID), "/projects/$projectID/protected_branches/$branch");
|
||||
return json_decode(commonModel::http($url));
|
||||
}
|
||||
|
||||
@@ -2493,6 +2556,72 @@ class gitlabModel extends model
|
||||
return json_decode(commonModel::http($url, array(), $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create gitlab protect tag.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param string $tag
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function createTagPriv($gitlabID, $projectID, $tag = '')
|
||||
{
|
||||
$priv = fixer::input('post')->get();
|
||||
if(empty($priv->name)) dao::$errors['name'][] = $this->lang->gitlab->branch->emptyPrivNameError;
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$singleTag = $this->apiGetSingleTagPriv($gitlabID, $projectID, $priv->name);
|
||||
if(empty($tag) && !empty($singleTag->id)) dao::$errors['name'][] = $this->lang->gitlab->tag->issetPrivNameError;
|
||||
if(dao::isError()) return false;
|
||||
|
||||
if(!empty($tag) && !empty($singleTag->name)) $this->apiDeleteTagPriv($gitlabID, $projectID, $tag);
|
||||
$response = $this->apiCreateTagPriv($gitlabID, $projectID, $priv);
|
||||
|
||||
if(!empty($response->id))
|
||||
{
|
||||
$action = empty($tag) ? 'created' : 'edited';
|
||||
$this->loadModel('action')->create('gitlabtagpriv', $response->id, $action, '', $response->name);
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->apiErrorHandling($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get single protct tag by API.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param string $tag
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function apiGetSingleTagPriv($gitlabID, $projectID, $tag)
|
||||
{
|
||||
if(empty($gitlabID)) return false;
|
||||
$tag = urlencode($tag);
|
||||
$url = sprintf($this->getApiRoot($gitlabID), "/projects/$projectID/protected_tags/$tag");
|
||||
return json_decode(commonModel::http($url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a gitab protect tag by api.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param object $priv
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function apiCreateTagPriv($gitlabID, $projectID, $priv)
|
||||
{
|
||||
if(empty($gitlabID)) return false;
|
||||
if(empty($priv->name)) return false;
|
||||
$url = sprintf($this->getApiRoot($gitlabID), "/projects/" . $projectID . '/protected_tags');
|
||||
return json_decode(commonModel::http($url, $priv));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check access level.
|
||||
*
|
||||
|
||||
@@ -62,8 +62,10 @@
|
||||
<td class='text' title="<?php echo $levelLang[$branch->push_access_level];?>"><?php echo $levelLang[$branch->push_access_level];?></td>
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
if(common::hasPriv('gitlab', 'editBranchPriv')) common::printLink('gitlab', 'editBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch->name", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->editBranchPriv} class='btn btn-primary'");
|
||||
if(common::hasPriv('gitlab', 'deleteBranchPriv')) echo html::a($this->createLink('gitlab', 'deleteBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch->name"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteBranchPriv}' class='btn'");
|
||||
/* Fix error when request type is PATH_INFO and the branch name contains '-'.*/
|
||||
$branchName = str_replace('-', '*', $branch->name);
|
||||
if(common::hasPriv('gitlab', 'editBranchPriv')) common::printLink('gitlab', 'editBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branchName", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->editBranchPriv} class='btn btn-primary'");
|
||||
if(common::hasPriv('gitlab', 'deleteBranchPriv')) echo html::a($this->createLink('gitlab', 'deleteBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branchName"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteBranchPriv}' class='btn'");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<th class='c-name text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->gitlab->project->name);?></th>
|
||||
<th class='text-left'></th>
|
||||
<th class='text-left'><?php echo $lang->gitlab->lastUpdate;?></th>
|
||||
<th class='c-actions-5'><?php echo $lang->actions;?></th>
|
||||
<th class='c-actions-6'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -70,6 +70,7 @@
|
||||
common::printLink('gitlab', 'browseBranch', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-treemap'></i> ", '', "title='{$lang->gitlab->browseBranch}' class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'browseBranchPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-branch-lock'></i> ", '', "title='{$lang->gitlab->branch->accessLevel}' class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'browseTag', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-tag'></i> ", '', "title='{$lang->gitlab->browseTag}' class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'browseTagPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-tag-lock'></i> ", '', "title='{$lang->gitlab->browseTagPriv}' class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'editProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-edit'></i> ", '', "title='{$lang->gitlab->project->edit}' class='btn btn-primary'");
|
||||
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'deleteProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteProject}' class='btn'");
|
||||
?>
|
||||
|
||||
@@ -67,8 +67,10 @@
|
||||
<td class='text'><?php echo $gitlabTag->updated?></td>
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tagName = str_replace('-', '*', $gitlabTag->name);
|
||||
$isDisabled = $gitlabTag->protected ? 'disabled' : '';
|
||||
common::printLink('gitlab', 'deleteTag', "gitlabID=$gitlabID&projectID={$projectID}&tag_name={$gitlabTag->name}", "<i class='icon icon-trash'></i> ", '', "title='{$lang->gitlab->deleteTag}' class='btn btn-primary' target='hiddenwin' $isDisabled");
|
||||
common::printLink('gitlab', 'deleteTag', "gitlabID=$gitlabID&projectID={$projectID}&tag_name=$tagName", "<i class='icon icon-trash'></i> ", '', "title='{$lang->gitlab->deleteTag}' class='btn btn-primary' target='hiddenwin' $isDisabled");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* The browse view file of gitlab module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Gang Zeng <zenggang@easycorp.ltd>
|
||||
* @package gitlab
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::set('vars', "keyword=%s&orderBy=id_desc&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID=1")?>
|
||||
<?php js::set('gitlabID', $gitlabID)?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class='pull-left'>
|
||||
<?php echo html::linkButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, $this->createLink('gitlab', 'browseProject', "gitlabID=$gitlabID"), 'self', '','btn btn-secondary');?>
|
||||
</div>
|
||||
<div id="sidebarHeader">
|
||||
<div class="title" title="<?php echo $project->name_with_namespace; ?>"><?php echo $project->name_with_namespace; ?></div>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-left">
|
||||
<div>
|
||||
<form id='tagForm' method='post'>
|
||||
<?php echo html::input('keyword', $keyword, "class='form-control' placeholder='{$lang->gitlab->tag->placeholderSearch}' style='display: inline-block;width:auto;margin:0 10px'");?>
|
||||
<a id="tagSearch" class="btn btn-primary"><?php echo $lang->gitlab->search?></a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php common::printLink('gitlab', 'createTagPriv', "gitlabID=$gitlabID&projectID=$projectID", "<i class='icon icon-plus'></i> " . $lang->gitlab->createTagPriv, '', "class='btn btn-primary'");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(empty($gitlabTagList)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->noData;?></span>
|
||||
<?php if(empty($keyword) and common::hasPriv('gitlab', 'createTag')):?>
|
||||
<?php echo html::a($this->createLink('gitlab', 'createTagPriv', "gitlabID=$gitlabID&projectID=$projectID"), "<i class='icon icon-plus'></i> " . $lang->gitlab->createTagPriv, '', "class='btn btn-info'");?>
|
||||
<?php endif;?>
|
||||
</p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div id='mainContent' class='main-row'>
|
||||
<form class='main-table' id='ajaxForm' method='post'>
|
||||
<table id='gitlabTagList' class='table has-sort-head table-fixed'>
|
||||
<?php $vars = "gitlabID={$gitlabID}&projectID={$projectID}&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='c-name text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->gitlab->tag->name);?></th>
|
||||
<th class='text-left'><?php echo $lang->gitlab->tag->lastCommitter;?></th>
|
||||
<th class='text-left'><?php common::printOrderLink('accessLevels', $orderBy, $vars, $lang->gitlab->tag->accessLevel);?></th>
|
||||
<th class='c-actions-2'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($gitlabTagList as $id => $gitlabTag): ?>
|
||||
<?php $gitlabTag->accessLevel = $this->gitlab->checkAccessLevel($gitlabTag->accessLevels); ?>
|
||||
<tr class='text'>
|
||||
<td class='text-c-name' title='<?php echo $gitlabTag->name;?>'><?php echo $gitlabTag->name;?></td>
|
||||
<td class='text'><?php echo $gitlabTag->lastCommitter;?></td>
|
||||
<td class='text'><?php echo zget($lang->gitlab->branch->branchCreationLevelList, $gitlabTag->accessLevel);?></td>
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tagName = str_replace('-', '*', $gitlabTag->name);
|
||||
common::printLink('gitlab', 'editTagPriv', "gitlabID=$gitlabID&projectID=$projectID&tag_name=$tagName", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->editTagPriv} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'deleteTagPriv', "gitlabID=$gitlabID&projectID={$projectID}&tag_name=$tagName", "<i class='icon icon-trash'></i> ", '', "title='{$lang->gitlab->deleteTagPriv}' class='btn btn-primary' target='hiddenwin' onclick='if(confirm(\"{$lang->gitlab->tag->protectConfirmDel}\")==false) return false;'");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if($gitlabTagList):?>
|
||||
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* The create view file of protect tag of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yuchun Li <liyuchun@easycorp.ltd>
|
||||
* @package gitlab
|
||||
* @version $Id$
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div class='main-col main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->gitlab->createTagPriv;?></h2>
|
||||
</div>
|
||||
<form id='branchForm' method='post' class='form-ajax' enctype="multipart/form-data">
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-110px'><?php echo $lang->gitlab->tag->name;?></th>
|
||||
<td><?php echo html::select('name', $tags, '', "class='form-control chosen'");?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->gitlab->tag->accessLevel;?></th>
|
||||
<td><?php echo html::select('create_access_level', $lang->gitlab->branch->branchCreationLevelList, '40', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php if(!isonlybody()) echo html::a(inlink('browseTagPriv', "gitlabID=$gitlabID&projectID=$projectID"), $lang->goback, '', 'class="btn btn-wide"');?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* The edit view file of protect tag of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yuchun Li <liyuchun@easycorp.ltd>
|
||||
* @package gitlab
|
||||
* @version $Id$
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div class='main-col main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->gitlab->editTagPriv;?></h2>
|
||||
</div>
|
||||
<form id='branchForm' method='post' class='form-ajax' enctype="multipart/form-data">
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-110px'><?php echo $lang->gitlab->tag->name;?></th>
|
||||
<td><?php echo html::input('tagName', $tag, "class='form-control' disabled");?></td>
|
||||
<td></td>
|
||||
<?php echo html::hidden('name', $tag);?>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->gitlab->tag->accessLevel;?></th>
|
||||
<td><?php echo html::select('create_access_level', $lang->gitlab->branch->branchCreationLevelList, $tagPriv->createAccessLevel, "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php if(!isonlybody()) echo html::a(inlink('browseTagPriv', "gitlabID=$gitlabID&projectID=$projectID"), $lang->goback, '', 'class="btn btn-wide"');?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -1348,6 +1348,10 @@ $lang->resource->gitlab->deleteBranchPriv = 'deleteBranchPriv';
|
||||
$lang->resource->gitlab->browseTag = 'browseTag';
|
||||
$lang->resource->gitlab->createTag = 'createTag';
|
||||
$lang->resource->gitlab->deleteTag = 'deleteTag';
|
||||
$lang->resource->gitlab->browseTagPriv = 'browseTagPriv';
|
||||
$lang->resource->gitlab->createTagPriv = 'createTagPriv';
|
||||
$lang->resource->gitlab->editTagPriv = 'editTagPriv';
|
||||
$lang->resource->gitlab->deleteTagPriv = 'deleteTagPriv';
|
||||
|
||||
$lang->gitlab->methodOrder[5] = 'browse';
|
||||
$lang->gitlab->methodOrder[10] = 'create';
|
||||
@@ -1375,6 +1379,8 @@ $lang->gitlab->methodOrder[120] = 'webhook';
|
||||
$lang->gitlab->methodOrder[125] = 'createWebhook';
|
||||
$lang->gitlab->methodOrder[130] = 'manageProjectMembers';
|
||||
$lang->gitlab->methodOrder[135] = 'browseTag';
|
||||
$lang->gitlab->methodOrder[140] = 'browseTagPriv';
|
||||
$lang->gitlab->methodOrder[145] = 'deleteTagPriv';
|
||||
|
||||
/* merge request. */
|
||||
$lang->resource->mr = new stdclass();
|
||||
@@ -1383,7 +1389,7 @@ $lang->resource->mr->apiCreate = 'apiCreate';
|
||||
$lang->resource->mr->browse = 'browse';
|
||||
$lang->resource->mr->edit = 'edit';
|
||||
$lang->resource->mr->delete = 'delete';
|
||||
$lang->resource->mr->view = 'overview';
|
||||
$lang->resource->mr->view = 'view';
|
||||
$lang->resource->mr->accept = 'accept';
|
||||
$lang->resource->mr->diff = 'viewDiff';
|
||||
$lang->resource->mr->link = 'linkList';
|
||||
|
||||
+29
-13
@@ -97,11 +97,11 @@ class mr extends control
|
||||
$this->mr->apiCreate();
|
||||
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = '';
|
||||
$response['message'] = $this->lang->saveSuccess;
|
||||
if(dao::isError())
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = dao::getError();
|
||||
$response['message'] = join("\n", dao::getError());
|
||||
}
|
||||
|
||||
return $this->send($response);
|
||||
@@ -150,21 +150,19 @@ class mr extends control
|
||||
$this->loadModel('job');
|
||||
$this->loadModel('compile');
|
||||
|
||||
$repoList = array();
|
||||
$repoList = array();
|
||||
$rawRepoList = $this->repo->getGitLabRepoList($MR->gitlabID, $MR->sourceProject);
|
||||
foreach($rawRepoList as $rawRepo) $repoList[$rawRepo->id] = "[$rawRepo->id] $rawRepo->name";
|
||||
|
||||
$jobList = array();
|
||||
$rawJobList = $this->job->getListByRepoID($MR->repoID);
|
||||
foreach($rawJobList as $rawJob) $jobList[$rawJob->id] = "[$rawJob->id] $rawJob->name";
|
||||
if($MR->repoID)
|
||||
{
|
||||
$rawJobList = $this->job->getListByRepoID($MR->repoID);
|
||||
foreach($rawJobList as $rawJob) $jobList[$rawJob->id] = "[$rawJob->id] $rawJob->name";
|
||||
}
|
||||
|
||||
$compileList = array();
|
||||
$rawCompileList = $this->compile->getListByJobID($MR->jobID);
|
||||
foreach($rawCompileList as $rawCompile) $compileList[$rawCompile->id] = "[$rawCompile->id] [{$this->lang->compile->statusList[$rawCompile->status]}] $rawCompile->name";
|
||||
|
||||
$this->view->repoList = $repoList;
|
||||
$this->view->jobList = !empty($MR->repoID) ? $jobList : array();
|
||||
$this->view->compileList = !empty($MR->jobID) ? $compileList : array();
|
||||
$this->view->repoList = $repoList;
|
||||
$this->view->jobList = !empty($MR->repoID) ? $jobList : array();
|
||||
|
||||
$this->view->title = $this->lang->mr->edit;
|
||||
$this->view->MR = $MR;
|
||||
@@ -232,7 +230,7 @@ class mr extends control
|
||||
$this->view->compile = $this->loadModel('compile')->getById($MR->compileID);
|
||||
$this->view->compileJob = $MR->jobID ? $this->loadModel('job')->getById($MR->jobID) : false;
|
||||
|
||||
$this->view->title = $this->lang->mr->overview;
|
||||
$this->view->title = $this->lang->mr->view;
|
||||
$this->view->MR = $MR;
|
||||
$this->view->rawMR = isset($rawMR) ? $rawMR : false;
|
||||
$this->view->product = $product;
|
||||
@@ -937,4 +935,22 @@ class mr extends control
|
||||
foreach($compileList as $compile) $options .= "<option value='{$compile->id}' data-name='{$compile->name}'>[{$compile->id}] [{$this->lang->compile->statusList[$compile->status]}] {$compile->name}</option>";
|
||||
$this->send($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax check same opened mr for source branch.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxCheckSameOpened($gitlabID)
|
||||
{
|
||||
$sourceProject = $this->post->sourceProject;
|
||||
$sourceBranch = $this->post->sourceBranch;
|
||||
$targetProject = $this->post->targetProject;
|
||||
$targetBranch = $this->post->targetBranch;
|
||||
|
||||
$result = $this->mr->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
die(json_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
+53
-28
@@ -2,10 +2,10 @@ $(function()
|
||||
{
|
||||
$('#gitlabID').change(function()
|
||||
{
|
||||
gitlabID = $('#gitlabID').val();
|
||||
var gitlabID = $('#gitlabID').val();
|
||||
if(gitlabID == '') return false;
|
||||
|
||||
url = createLink('repo', 'ajaxgetgitlabprojects', "gitlabID=" + gitlabID);
|
||||
var url = createLink('repo', 'ajaxgetgitlabprojects', "gitlabID=" + gitlabID);
|
||||
$.get(url, function(response)
|
||||
{
|
||||
$('#sourceProject').html('').append(response);
|
||||
@@ -15,9 +15,10 @@ $(function()
|
||||
|
||||
$('#sourceProject,#targetProject').change(function()
|
||||
{
|
||||
sourceProject = $(this).val();
|
||||
var branchSelect = $(this).parents('td').find('select[name*=Branch]');
|
||||
branchUrl = createLink('gitlab', 'ajaxgetprojectbranches', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
|
||||
var gitlabID = $('#gitlabID').val();
|
||||
var sourceProject = $(this).val();
|
||||
var branchSelect = $(this).parents('td').find('select[name*=Branch]');
|
||||
var branchUrl = createLink('gitlab', 'ajaxgetprojectbranches', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
|
||||
$.get(branchUrl, function(response)
|
||||
{
|
||||
branchSelect.html('').append(response);
|
||||
@@ -28,15 +29,16 @@ $(function()
|
||||
|
||||
$('#sourceProject').change(function()
|
||||
{
|
||||
sourceProject = $(this).val();
|
||||
projectUrl = createLink('mr', 'ajaxGetMRTargetProjects', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
|
||||
var gitlabID = $('#gitlabID').val();
|
||||
var sourceProject = $(this).val();
|
||||
var projectUrl = createLink('mr', 'ajaxGetMRTargetProjects', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
|
||||
$.get(projectUrl, function(response)
|
||||
{
|
||||
$('#targetProject').html('').append(response);
|
||||
$('#targetProject').chosen().trigger("chosen:updated");;
|
||||
});
|
||||
|
||||
repoUrl = createLink('mr', 'ajaxGetRepoList', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
|
||||
var repoUrl = createLink('mr', 'ajaxGetRepoList', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
|
||||
$.get(repoUrl, function(response)
|
||||
{
|
||||
$('#repoID').html('').append(response);
|
||||
@@ -44,10 +46,34 @@ $(function()
|
||||
});
|
||||
});
|
||||
|
||||
$('#sourceBranch,#targetBranch').change(function()
|
||||
{
|
||||
var sourceProject = $('#sourceProject').val();
|
||||
var sourceBranch = $('#sourceBranch').val();
|
||||
var targetProject = $('#targetProject').val();
|
||||
var targetBranch = $('#targetBranch').val();
|
||||
if(!sourceProject || !sourceBranch || !targetProject || !targetBranch) return false;
|
||||
|
||||
var $this = $(this);
|
||||
var gitlabID = $('#gitlabID').val();
|
||||
var repoUrl = createLink('mr', 'ajaxCheckSameOpened', "gitlabID=" + gitlabID);
|
||||
$.post(repoUrl, {"sourceProject": sourceProject, "sourceBranch": sourceBranch, "targetProject": targetProject, "targetBranch": targetBranch}, function(response)
|
||||
{
|
||||
response = $.parseJSON(response);
|
||||
if(response.result == 'fail')
|
||||
{
|
||||
alert(response.message);
|
||||
$this.val('').trigger('chosen:updated');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
$('#targetProject').change(function()
|
||||
{
|
||||
targetProject = $(this).val();
|
||||
var gitlabID = $('#gitlabID').val();
|
||||
var assignee = $("#assignee").parents('td').find('select[name*=assignee]');
|
||||
var reviewer = $("#reviewer").parents('td').find('select[name*=reviewer]');
|
||||
usersUrl = createLink('gitlab', 'ajaxgetmruserpairs', "gitlabID=" + gitlabID + "&projectID=" + targetProject);
|
||||
@@ -63,8 +89,8 @@ $(function()
|
||||
|
||||
$('#repoID').change(function()
|
||||
{
|
||||
repoID = $(this).val();
|
||||
jobUrl = createLink('mr', 'ajaxGetJobList', "repoID=" + repoID);
|
||||
var repoID = $(this).val();
|
||||
var jobUrl = createLink('mr', 'ajaxGetJobList', "repoID=" + repoID);
|
||||
$.get(jobUrl, function(response)
|
||||
{
|
||||
$('#jobID').html('').append(response);
|
||||
@@ -74,8 +100,8 @@ $(function()
|
||||
|
||||
$('#jobID').change(function()
|
||||
{
|
||||
jobID = $(this).val();
|
||||
compileUrl = createLink('mr', 'ajaxGetCompileList', "job=" + jobID);
|
||||
var jobID = $(this).val();
|
||||
var compileUrl = createLink('mr', 'ajaxGetCompileList', "job=" + jobID);
|
||||
$.get(compileUrl, function(response)
|
||||
{
|
||||
$('#compile').html('').append(response);
|
||||
@@ -83,20 +109,19 @@ $(function()
|
||||
});
|
||||
});
|
||||
|
||||
$("#needCI").change(function()
|
||||
{
|
||||
if(this.checked == false)
|
||||
{
|
||||
$("#jobID").prop("disabled", true);
|
||||
$('#jobID').chosen().trigger("chosen:updated");;
|
||||
$("#jobID").parent().parent().addClass('hidden');
|
||||
}
|
||||
if(this.checked == true)
|
||||
{
|
||||
$("#jobID").prop("disabled", false);
|
||||
$('#jobID').chosen().trigger("chosen:updated");;
|
||||
$("#jobID").parent().parent().removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
$("#needCI").change(function()
|
||||
{
|
||||
if(this.checked == false)
|
||||
{
|
||||
$("#jobID").prop("disabled", true);
|
||||
$('#jobID').chosen().trigger("chosen:updated");;
|
||||
$("#jobID").parent().parent().addClass('hidden');
|
||||
}
|
||||
if(this.checked == true)
|
||||
{
|
||||
$("#jobID").prop("disabled", false);
|
||||
$('#jobID').chosen().trigger("chosen:updated");;
|
||||
$("#jobID").parent().parent().removeClass('hidden');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+10
-10
@@ -1,26 +1,26 @@
|
||||
$(function ()
|
||||
{
|
||||
{
|
||||
$('#repoID').change(function ()
|
||||
{
|
||||
{
|
||||
repoID = $(this).val();
|
||||
jobUrl = createLink('mr', 'ajaxGetJobList', "repoID=" + repoID);
|
||||
$.get(jobUrl, function (response)
|
||||
{
|
||||
{
|
||||
$('#jobID').html('').append(response);
|
||||
$('#jobID').chosen().trigger("chosen:updated");;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#jobID').change(function ()
|
||||
{
|
||||
{
|
||||
jobID = $(this).val();
|
||||
compileUrl = createLink('mr', 'ajaxGetCompileList', "job=" + jobID);
|
||||
$.get(compileUrl, function (response)
|
||||
{
|
||||
{
|
||||
$('#compile').html('').append(response);
|
||||
$('#compile').chosen().trigger("chosen:updated");;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#needCI").change(function()
|
||||
{
|
||||
@@ -28,4 +28,4 @@ $(function ()
|
||||
if(this.checked == true) $("#jobID").parent().parent().removeClass('hidden');
|
||||
});
|
||||
$("#needCI").trigger('change');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$lang->mr = new stdclass;
|
||||
$lang->mr->common = "Merge Request";
|
||||
$lang->mr->overview = "Survey";
|
||||
$lang->mr->view = "Survey";
|
||||
$lang->mr->create = "Create";
|
||||
$lang->mr->apiCreate = "Interface: Create";
|
||||
$lang->mr->browse = "Browse";
|
||||
@@ -105,6 +105,7 @@ $lang->mr->apiError->createMR = "Failed to create a merge request through API. R
|
||||
$lang->mr->apiError->sudo = "Unable to operate with the GitLab account bound to the current user. Reason: %s";
|
||||
|
||||
$lang->mr->createFailedFromAPI = "Failed to create Merge Request.";
|
||||
$lang->mr->hasSameOpenedMR = "There are duplicate and unclosed merge requests.";
|
||||
$lang->mr->accessGitlabFailed = "Unable to connect to the GitLab server.";
|
||||
$lang->mr->reopenSuccess = "The merge request was reopened.";
|
||||
$lang->mr->closeSuccess = "Merge request closed.";
|
||||
@@ -113,17 +114,17 @@ $lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and ta
|
||||
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
|
||||
|
||||
$lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch';
|
||||
$lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: !%u';
|
||||
$lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u';
|
||||
|
||||
$lang->mr->from = "from";
|
||||
$lang->mr->to = "to";
|
||||
$lang->mr->at = "at";
|
||||
|
||||
$lang->mr->pipeline = "Pipeline";
|
||||
$lang->mr->pipelineSuccess = "Success";
|
||||
$lang->mr->pipelineFailed = "Failed";
|
||||
$lang->mr->pipeline = "Pipeline";
|
||||
$lang->mr->pipelineSuccess = "Success";
|
||||
$lang->mr->pipelineFailed = "Failed";
|
||||
$lang->mr->pipelineCanceled = "Canceled";
|
||||
$lang->mr->pipelineUnknown = "Unknown";
|
||||
$lang->mr->pipelineUnknown = "Unknown";
|
||||
|
||||
$lang->mr->pipelineStatus = array();
|
||||
$lang->mr->pipelineStatus['success'] = "success";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$lang->mr = new stdclass;
|
||||
$lang->mr->common = "合并请求";
|
||||
$lang->mr->overview = "概况";
|
||||
$lang->mr->view = "概况";
|
||||
$lang->mr->create = "创建{$lang->mr->common}";
|
||||
$lang->mr->apiCreate = "接口:创建{$lang->mr->common}";
|
||||
$lang->mr->browse = "浏览{$lang->mr->common}";
|
||||
@@ -105,6 +105,7 @@ $lang->mr->apiError->createMR = "通过API创建合并请求失败,失败原
|
||||
$lang->mr->apiError->sudo = "无法以当前用户绑定的GitLab账户进行操作,失败原因:%s";
|
||||
|
||||
$lang->mr->createFailedFromAPI = "创建合并请求失败。";
|
||||
$lang->mr->hasSameOpenedMR = "存在重复并且未关闭的合并请求。";
|
||||
$lang->mr->accessGitlabFailed = "当前无法连接到GitLab服务器。";
|
||||
$lang->mr->reopenSuccess = "已重新打开合并请求。";
|
||||
$lang->mr->closeSuccess = "已关闭合并请求。";
|
||||
@@ -113,17 +114,17 @@ $lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and ta
|
||||
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
|
||||
|
||||
$lang->mr->errorLang[1] = '源项目分支与目标项目分支不能相同';
|
||||
$lang->mr->errorLang[2] = '存在另外一个同样的合并请求在源项目分支中: !%u';
|
||||
$lang->mr->errorLang[2] = '存在另外一个同样的合并请求在源项目分支中: ID%u';
|
||||
|
||||
$lang->mr->from = "从";
|
||||
$lang->mr->to = "合并到";
|
||||
$lang->mr->at = "于";
|
||||
|
||||
$lang->mr->pipeline = "流水线";
|
||||
$lang->mr->pipelineSuccess = "已通过";
|
||||
$lang->mr->pipelineFailed = "未通过";
|
||||
$lang->mr->pipeline = "流水线";
|
||||
$lang->mr->pipelineSuccess = "已通过";
|
||||
$lang->mr->pipelineFailed = "未通过";
|
||||
$lang->mr->pipelineCanceled = "已取消";
|
||||
$lang->mr->pipelineUnknown = "未知";
|
||||
$lang->mr->pipelineUnknown = "未知";
|
||||
|
||||
$lang->mr->pipelineStatus = array();
|
||||
$lang->mr->pipelineStatus['success'] = "已通过";
|
||||
@@ -136,6 +137,7 @@ $lang->mr->hasNoConflict = "可以合并";
|
||||
$lang->mr->acceptMR = "合并";
|
||||
$lang->mr->mergeFailed = "无法合并,请核对合并请求状态";
|
||||
$lang->mr->mergeSuccess = "已成功合并";
|
||||
$lang->mr->mergeSuccess = "已成功合并";
|
||||
|
||||
$lang->mr->todomessage = "项目中指派给你了";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$lang->mr = new stdclass;
|
||||
$lang->mr->common = "合併請求";
|
||||
$lang->mr->overview = "概況";
|
||||
$lang->mr->view = "概況";
|
||||
$lang->mr->create = "創建{$lang->mr->common}";
|
||||
$lang->mr->apiCreate = "介面:創建{$lang->mr->common}";
|
||||
$lang->mr->browse = "瀏覽{$lang->mr->common}";
|
||||
|
||||
+128
-24
@@ -93,6 +93,9 @@ class mrModel extends model
|
||||
->add('createdDate', helper::now())
|
||||
->get();
|
||||
|
||||
$result = $this->checkSameOpened($MR->gitlabID, $MR->sourceProject, $MR->sourceBranch, $MR->targetProject, $MR->targetBranch);
|
||||
if($result['result'] == 'fail') return $result;
|
||||
|
||||
/* Exec Job */
|
||||
if(isset($MR->jobID) && $MR->jobID)
|
||||
{
|
||||
@@ -138,21 +141,8 @@ class mrModel extends model
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_MR)->where('id')->eq($MRID)->exec();
|
||||
|
||||
foreach($this->lang->mr->apiErrorMap as $key => $errorMsg)
|
||||
{
|
||||
if(strpos($errorMsg, '/') === 0)
|
||||
{
|
||||
$result = preg_match($errorMsg, $rawMR->message[0], $matches);
|
||||
if($result) $errorMessage = sprintf(zget($this->lang->mr->errorLang, $key), $matches[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($rawMR->message[0] == $errorMsg) $errorMessage = zget($this->lang->mr->errorLang, $key, $rawMR->message[0]);
|
||||
}
|
||||
|
||||
if(isset($errorMessage)) break;
|
||||
}
|
||||
return array('result' => 'fail', 'message' => sprintf($this->lang->mr->apiError->createMR, isset($errorMessage) ? $errorMessage : $rawMR->message[0]));
|
||||
$errorMessage = $this->convertApiError($rawMR->message);
|
||||
return array('result' => 'fail', 'message' => sprintf($this->lang->mr->apiError->createMR, $errorMessage));
|
||||
}
|
||||
|
||||
/* Create MR failed. */
|
||||
@@ -171,10 +161,7 @@ class mrModel extends model
|
||||
$newMR->mergeStatus = $rawMR->merge_status;
|
||||
|
||||
/* Update MR in Zentao database. */
|
||||
$this->dao->update(TABLE_MR)->data($newMR)
|
||||
->where('id')->eq($MRID)
|
||||
->autoCheck()
|
||||
->exec();
|
||||
$this->dao->update(TABLE_MR)->data($newMR)->where('id')->eq($MRID)->autoCheck()->exec();
|
||||
if(dao::isError()) return array('result' => 'fail', 'message' => dao::getError());
|
||||
return array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => helper::createLink('mr', 'browse'));
|
||||
}
|
||||
@@ -209,6 +196,7 @@ class mrModel extends model
|
||||
$MR->title = $this->lang->mr->common . ' ' . $postData->RepoSrcBranch . $this->lang->mr->to . $postData->RepoDistBranch ;
|
||||
$MR->repoID = $repo->id;
|
||||
$MR->jobID = isset($repo->job->id) ? $repo->job->id : 0;
|
||||
$MR->status = 'opened';
|
||||
$MR->synced = '0';
|
||||
$MR->needCI = '1';
|
||||
$MR->hasNoConflict = $postData->MergeStatus ? '0' : '1';
|
||||
@@ -216,6 +204,13 @@ class mrModel extends model
|
||||
$MR->createdBy = $this->app->user->account;
|
||||
$MR->createdDate = date('Y-m-d H:i:s');
|
||||
|
||||
$result = $this->checkSameOpened($MR->gitlabID, $MR->sourceProject, $MR->sourceBranch, $MR->targetProject, $MR->targetBranch);
|
||||
if($result['result'] == 'fail')
|
||||
{
|
||||
dao::$errors[] = $result['message'];
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->dao->insert(TABLE_MR)->data($MR, $this->config->mr->create->skippedFields)
|
||||
->batchCheck($this->config->mr->apicreate->requiredFields, 'notempty')
|
||||
->autoCheck()
|
||||
@@ -238,17 +233,16 @@ class mrModel extends model
|
||||
$compile = $this->loadModel('compile')->getByQueue($pipeline->queue);
|
||||
$newMR->compileID = $compile->id;
|
||||
$newMR->compileStatus = $compile->status;
|
||||
if($newMR->compileStatus == 'failure') $newMR->status = 'closed';
|
||||
}
|
||||
else
|
||||
{
|
||||
$newMR->compileStatus = $pipeline->status;
|
||||
if($newMR->compileStatus == 'create_fail') $newMR->status = 'closed';
|
||||
}
|
||||
|
||||
/* Update MR in Zentao database. */
|
||||
$this->dao->update(TABLE_MR)->data($newMR)
|
||||
->where('id')->eq($MRID)
|
||||
->autoCheck()
|
||||
->exec();
|
||||
$this->dao->update(TABLE_MR)->data($newMR)->where('id')->eq($MRID)->autoCheck()->exec();
|
||||
if(dao::isError()) return false;
|
||||
}
|
||||
return true;
|
||||
@@ -303,6 +297,11 @@ class mrModel extends model
|
||||
|
||||
/* Known issue: `reviewer_ids` takes no effect. */
|
||||
$rawMR = $this->apiUpdateMR($oldMR->gitlabID, $oldMR->targetProject, $oldMR->mriid, $newMR);
|
||||
if(!isset($rawMR->id) and isset($rawMR->message))
|
||||
{
|
||||
$errorMessage = $this->convertApiError($rawMR->message);
|
||||
return array('result' => 'fail', 'message' => $errorMessage);
|
||||
}
|
||||
|
||||
/* Update MR in Zentao database. */
|
||||
$this->dao->update(TABLE_MR)->data($MR, $this->config->mr->edit->skippedFields)
|
||||
@@ -533,6 +532,35 @@ class mrModel extends model
|
||||
return json_decode(commonModel::http($url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get same opened mr by api.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $sourceProject
|
||||
* @param string $sourceBranch
|
||||
* @param int $targetProject
|
||||
* @param string $targetBranch
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch)
|
||||
{
|
||||
if(empty($gitlabID) or empty($sourceProject) or empty($sourceBranch) or empty($targetProject) or empty($targetBranch)) return null;
|
||||
|
||||
$url = sprintf($this->loadModel('gitlab')->getApiRoot((int)$gitlabID), "/projects/{$sourceProject}/merge_requests") . "&state=opened&source_branch={$sourceBranch}&target_branch={$targetBranch}";
|
||||
$response = json_decode(commonModel::http($url));
|
||||
|
||||
if($response)
|
||||
{
|
||||
foreach($response as $mr)
|
||||
{
|
||||
if(empty($mr->source_project_id) or empty($mr->target_project_id)) return null;
|
||||
if($mr->source_project_id == $sourceProject and $mr->target_project_id == $targetProject) return $mr;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get single MR by API.
|
||||
*
|
||||
@@ -1254,6 +1282,24 @@ class mrModel extends model
|
||||
return $links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get linked MR pairs.
|
||||
*
|
||||
* @param int $objectID
|
||||
* @param string $objectType
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLinkedMRPairs($objectID, $objectType = 'story')
|
||||
{
|
||||
return $this->dao->select("t2.id,t2.title")->from(TABLE_RELATION)->alias('t1')
|
||||
->leftJoin(TABLE_MR)->alias('t2')->on('t1.AID = t2.id')
|
||||
->where('t1.AType')->eq('mr')
|
||||
->andWhere('t1.BType')->eq($objectType)
|
||||
->andWhere('t1.BID')->eq($objectID)
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an mr link.
|
||||
*
|
||||
@@ -1327,7 +1373,7 @@ class mrModel extends model
|
||||
$commits = array();
|
||||
foreach($DiffCommits as $DiffCommit)
|
||||
{
|
||||
$commits[] = substr($DiffCommit->id, 0, 10);
|
||||
if(isset($DiffCommit->id)) $commits[] = substr($DiffCommit->id, 0, 10);
|
||||
}
|
||||
|
||||
return $this->dao->select('objectID')->from(TABLE_ACTION)->where('objectType')->eq($type)->andWhere('extra')->in($commits)->fetchPairs('objectID');
|
||||
@@ -1400,4 +1446,62 @@ class mrModel extends model
|
||||
$this->action->create('task', $task->id, 'mergedmr', '', helper::createLink('mr', 'view', "mr={$MR->id}"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check same opened mr for source branch.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $sourceProject
|
||||
* @param string $sourceBranch
|
||||
* @param int $targetProject
|
||||
* @param string $targetBranch
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch)
|
||||
{
|
||||
if(empty($sourceProject) or empty($sourceBranch) or empty($targetProject) or empty($targetBranch)) return array('result' => 'success');
|
||||
|
||||
$dbOpenedCount = $this->dao->select('count(*) as count')->from(TABLE_MR)
|
||||
->where('gitlabID')->eq($gitlabID)
|
||||
->andWhere('sourceProject')->eq($sourceProject)
|
||||
->andWhere('sourceBranch')->eq($sourceBranch)
|
||||
->andWhere('targetProject')->eq($targetProject)
|
||||
->andWhere('targetBranch')->eq($targetBranch)
|
||||
->andWhere('status')->eq('opened')
|
||||
->andWhere('deleted')->eq('0')
|
||||
->fetch('count');
|
||||
if($dbOpenedCount > 0) return array('result' => 'fail', 'message' => $this->lang->mr->hasSameOpenedMR);
|
||||
|
||||
if($this->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch)) return array('result' => 'fail', 'message' => $this->lang->mr->hasSameOpenedMR);
|
||||
return array('result' => 'success');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert API error.
|
||||
*
|
||||
* @param array $message
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function convertApiError($message)
|
||||
{
|
||||
if(is_array($message)) $message = $message[0];
|
||||
if(!is_string($message)) return $message;
|
||||
|
||||
foreach($this->lang->mr->apiErrorMap as $key => $errorMsg)
|
||||
{
|
||||
if(strpos($errorMsg, '/') === 0)
|
||||
{
|
||||
$result = preg_match($errorMsg, $message, $matches);
|
||||
if($result) $errorMessage = sprintf(zget($this->lang->mr->errorLang, $key), $matches[1]);
|
||||
}
|
||||
elseif($message == $errorMsg)
|
||||
{
|
||||
$errorMessage = zget($this->lang->mr->errorLang, $key, $message);
|
||||
}
|
||||
if(isset($errorMessage)) break;
|
||||
}
|
||||
return isset($errorMessage) ? $errorMessage : $message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<?php endif;?>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
common::printLink('mr', 'view', "mr={$MR->id}", '<i class="icon icon-eye"></i>', '', "title='{$lang->mr->overview}' class='btn btn-info'");
|
||||
common::printLink('mr', 'view', "mr={$MR->id}", '<i class="icon icon-eye"></i>', '', "title='{$lang->mr->view}' class='btn btn-info'");
|
||||
common::printLink('mr', 'edit', "mr={$MR->id}", '<i class="icon icon-edit"></i>', '', "title='{$lang->mr->edit}' class='btn btn-info'");
|
||||
common::printLink('mr', 'diff', "mr={$MR->id}", '<i class="icon icon-diff"></i>', '', "title='{$lang->mr->viewDiff}' class='btn btn-info'");
|
||||
common::printLink('mr', 'link', "mr={$MR->id}", '<i class="icon icon-link"></i>', '', "title='{$lang->mr->link}' class='btn btn-info'" . ($MR->linkButton == false ? 'disabled' : ''));
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='tabs' id='tabsNav'>
|
||||
<ul class='nav nav-tabs'>
|
||||
<li><?php echo html::a(inlink('view', "mr={$MR->id}"), $lang->mr->overview);?></li>
|
||||
<li><?php echo html::a(inlink('view', "mr={$MR->id}"), $lang->mr->view);?></li>
|
||||
<li class='active'><?php echo html::a('#', $lang->mr->viewDiff);?></li>
|
||||
<li><?php echo html::a(inlink('link', "mr={$MR->id}&type=story"), html::icon($lang->icons['story'], 'text-primary') . ' ' . $lang->productplan->linkedStories);?></a></li>
|
||||
<li><?php echo html::a(inlink('link', "mr={$MR->id}&type=bug"), html::icon($lang->icons['bug'], 'text-red') . ' ' . $lang->productplan->linkedBugs);?></a></li>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='tabs' id='tabsNav'>
|
||||
<ul class='nav nav-tabs'>
|
||||
<li><?php echo html::a(inlink('view', "mr={$MR->id}"), $lang->mr->overview);?></li>
|
||||
<li><?php echo html::a(inlink('view', "mr={$MR->id}"), $lang->mr->view);?></li>
|
||||
<li><?php echo html::a(inlink('diff', "mr={$MR->id}"), $lang->mr->viewDiff);?></li>
|
||||
<li class='<?php if($type == 'story') echo 'active'?>'><a href='#stories' data-toggle='tab'><?php echo html::icon($lang->icons['story'], 'text-primary') . ' ' . $lang->productplan->linkedStories;?></a></li>
|
||||
<li class='<?php if($type == 'bug') echo 'active'?>'><a href='#bugs' data-toggle='tab'><?php echo html::icon($lang->icons['bug'], 'text-red') . ' ' . $lang->productplan->linkedBugs;?></a></li>
|
||||
@@ -168,7 +168,7 @@
|
||||
<?php printf('%03d', $bug->id);?>
|
||||
</td>
|
||||
<td><span class='label-pri label-pri-<?php echo $bug->pri;?>' title='<?php echo zget($lang->bug->priList, $bug->pri, $bug->pri);?>'><?php echo zget($lang->bug->priList, $bug->pri, $bug->pri);?></span></td>
|
||||
<td class='text-left nobr' title='<?php echo $bug->title?>'><?php echo html::a($this->createLink('bug', 'view', "bugID=$bug->id"), $bug->title, '', 'data-app="product"');?></td>
|
||||
<td class='text-left nobr' title='<?php echo $bug->title?>'><?php echo html::a($this->createLink('bug', 'view', "bugID=$bug->id"), $bug->title);?></td>
|
||||
<td><?php echo zget($users, $bug->openedBy);?></td>
|
||||
<td><?php echo zget($users, $bug->assignedTo);?></td>
|
||||
<td>
|
||||
@@ -230,7 +230,7 @@
|
||||
<?php printf('%03d', $task->id);?>
|
||||
</td>
|
||||
<td><span class='label-pri label-pri-<?php echo $task->pri;?>' title='<?php echo zget($lang->task->priList, $task->pri, $task->pri);?>'><?php echo zget($lang->task->priList, $task->pri, $task->pri);?></span></td>
|
||||
<td class='text-left nobr' title='<?php echo $task->name?>'><?php echo html::a($this->createLink('task', 'view', "taskID=$task->id"), $task->name, '', 'data-app="product"');?></td>
|
||||
<td class='text-left nobr' title='<?php echo $task->name?>'><?php echo html::a($this->createLink('task', 'view', "taskID=$task->id"), $task->name);?></td>
|
||||
<td><?php echo zget($users, $task->finishedBy);?></td>
|
||||
<td><?php echo zget($users, $task->assignedTo);?></td>
|
||||
<td>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<div id="mainContent" class="main-content">
|
||||
<div class='tabs' id='tabsNav'>
|
||||
<ul class='nav nav-tabs'>
|
||||
<li class='active'><?php echo html::a('###', $lang->mr->overview);?></li>
|
||||
<li class='active'><?php echo html::a('###', $lang->mr->view);?></li>
|
||||
<li><?php echo html::a(inlink('diff', "mr={$MR->id}"), $lang->mr->viewDiff);?></li>
|
||||
<li><?php echo html::a(inlink('link', "mr={$MR->id}&type=story"), html::icon($lang->icons['story'], 'text-primary') . ' ' . $lang->productplan->linkedStories);?></a></li>
|
||||
<li><?php echo html::a(inlink('link', "mr={$MR->id}&type=bug"), html::icon($lang->icons['bug'], 'text-red') . ' ' . $lang->productplan->linkedBugs);?></a></li>
|
||||
|
||||
@@ -1048,7 +1048,7 @@ class product extends control
|
||||
/* Get product reviewers. */
|
||||
$product = $this->product->getByID($productID);
|
||||
$productReviewers = $product->reviewer;
|
||||
if(!$productReviewers) $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
if(!$productReviewers and $product->acl != 'open') $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
|
||||
$storyReviewers = '';
|
||||
if($storyID)
|
||||
|
||||
@@ -852,7 +852,7 @@ class productModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStories($productID, $branch, $browseType, $queryID, $moduleID, $type = 'story', $sort, $pager)
|
||||
public function getStories($productID, $branch, $browseType, $queryID, $moduleID, $type = 'story', $sort = 'id_desc', $pager = null)
|
||||
{
|
||||
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getStories();
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ class programModel extends model
|
||||
->fetchGroup('program');
|
||||
|
||||
$productPairs = array();
|
||||
foreach($productGroup as $programID => $products)
|
||||
foreach($productGroup as $programID => $products)
|
||||
{
|
||||
foreach($products as $product) $productPairs[$product->id] = $product->id;
|
||||
}
|
||||
@@ -496,7 +496,7 @@ class programModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStakeholders($programID = 0, $orderBy = '', $pager = null)
|
||||
public function getStakeholders($programID = 0, $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
return $this->dao->select('t2.account,t2.realname,t2.role,t2.qq,t2.mobile,t2.phone,t2.weixin,t2.email,t1.id,t1.type,t1.from,t1.key')->from(TABLE_STAKEHOLDER)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.user=t2.account')
|
||||
|
||||
@@ -563,6 +563,7 @@ class repo extends control
|
||||
$this->commonAction($repoID, $objectID);
|
||||
$this->scm->setEngine($repo);
|
||||
$log = $this->scm->log('', $revision, $revision);
|
||||
$log[0]->comment = $this->repo->replaceCommentLink($log[0]->comment);
|
||||
|
||||
$history = $this->dao->select('*')->from(TABLE_REPOHISTORY)->where('revision')->eq($log[0]->revision)->andWhere('repo')->eq($repoID)->fetch();
|
||||
if($history)
|
||||
@@ -1206,12 +1207,6 @@ class repo extends control
|
||||
*/
|
||||
public function ajaxGetRules()
|
||||
{
|
||||
$regRules = $this->repo->processRules();
|
||||
$rawRules = $this->config->repo->rules;
|
||||
|
||||
$data = array();
|
||||
$data['reg'] = $regRules;
|
||||
$data['raw'] = $rawRules;
|
||||
return $this->send(array('status' => 'success', 'rules' => json_encode($data)));
|
||||
return $this->send(array('status' => 'success', 'rules' => $this->config->repo->rules));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +581,11 @@ class repoModel extends model
|
||||
if($entry == '/' or empty($entry))$comments->page($pager, 't1.id');
|
||||
$comments = $comments->fetchAll('revision');
|
||||
|
||||
foreach($comments as $repoComment) $repoComment->comment = $this->replaceCommentLink($repoComment->comment);
|
||||
foreach($comments as $repoComment)
|
||||
{
|
||||
$repoComment->originalComment = $repoComment->comment;
|
||||
$repoComment->comment = $this->replaceCommentLink($repoComment->comment);
|
||||
}
|
||||
return $comments;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ if(isset($entry)) $pathInfo .= '&type=file';
|
||||
<?php endif;?>
|
||||
<td><?php echo substr($log->time, 0, 10);?></td>
|
||||
<td><?php echo $log->committer;?></td>
|
||||
<?php $comment = htmlSpecialString($log->comment, ENT_QUOTES);?>
|
||||
<td title='<?php echo $comment?>' class='comment'><?php echo $log->comment?></td>
|
||||
<td title='<?php echo $log->originalComment?>' class='comment'><?php echo $log->comment?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
@@ -305,7 +305,7 @@ class story extends control
|
||||
|
||||
/* Get reviewers. */
|
||||
$reviewers = $product->reviewer;
|
||||
if(!$reviewers) $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
if(!$reviewers and $product->acl != 'open') $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
|
||||
/* Set Custom. */
|
||||
foreach(explode(',', $this->config->story->list->customCreateFields) as $field) $customFields[$field] = $this->lang->story->$field;
|
||||
@@ -469,7 +469,7 @@ class story extends control
|
||||
|
||||
/* Get reviewers. */
|
||||
$reviewers = $product->reviewer;
|
||||
if(!$reviewers) $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
if(!$reviewers and $product->acl != 'open') $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
|
||||
/* Init vars. */
|
||||
$planID = $plan;
|
||||
@@ -685,7 +685,7 @@ class story extends control
|
||||
|
||||
/* Get product reviewers. */
|
||||
$productReviewers = $product->reviewer;
|
||||
if(!$productReviewers) $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
if(!$productReviewers and $product->acl != 'open') $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
|
||||
$this->story->replaceURLang($story->type);
|
||||
|
||||
@@ -937,7 +937,7 @@ class story extends control
|
||||
|
||||
/* Get product reviewers. */
|
||||
$productReviewers = $product->reviewer;
|
||||
if(!$productReviewers) $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
if(!$productReviewers and $product->acl != 'open') $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
|
||||
|
||||
/* Assign. */
|
||||
$this->view->title = $this->lang->story->change . "STORY" . $this->lang->colon . $this->view->story->title;
|
||||
@@ -1014,6 +1014,7 @@ class story extends control
|
||||
$bugs = $this->dao->select('id,title')->from(TABLE_BUG)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->fetchAll();
|
||||
$fromBug = $this->dao->select('id,title')->from(TABLE_BUG)->where('toStory')->eq($storyID)->fetch();
|
||||
$cases = $this->dao->select('id,title')->from(TABLE_CASE)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->fetchAll();
|
||||
$linkedMRs = $this->loadModel('mr')->getLinkedMRPairs($storyID, 'story');
|
||||
$modulePath = $this->tree->getParents($story->module);
|
||||
$storyModule = empty($story->module) ? '' : $this->tree->getById($story->module);
|
||||
|
||||
@@ -1054,6 +1055,7 @@ class story extends control
|
||||
$this->view->fromBug = $fromBug;
|
||||
$this->view->cases = $cases;
|
||||
$this->view->story = $story;
|
||||
$this->view->linkedMRs = $linkedMRs;
|
||||
$this->view->track = $this->story->getTrackByID($story->id);
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->reviewers = $reviewers;
|
||||
|
||||
@@ -163,6 +163,7 @@ $lang->story->field = 'Sync Field';
|
||||
$lang->story->completeRate = 'Completion Rate';
|
||||
$lang->story->reviewed = 'Reviewed';
|
||||
$lang->story->toBeReviewed = 'To Be Reviewed';
|
||||
$lang->story->linkMR = 'Related MRs';
|
||||
|
||||
$lang->story->ditto = 'Ditto';
|
||||
$lang->story->dittoNotice = 'This story is not linked to the same product as the last one is!';
|
||||
|
||||
@@ -163,6 +163,7 @@ $lang->story->field = '同步的字段';
|
||||
$lang->story->completeRate = '完成率';
|
||||
$lang->story->reviewed = '已评审';
|
||||
$lang->story->toBeReviewed = '待评审';
|
||||
$lang->story->linkMR = '相关合并请求';
|
||||
|
||||
$lang->story->ditto = '同上';
|
||||
$lang->story->dittoNotice = "该{$lang->SRCommon}与上一{$lang->SRCommon}不属于同一产品!";
|
||||
|
||||
@@ -502,7 +502,7 @@
|
||||
<tbody>
|
||||
<?php if(!empty($fromBug)):?>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->story->legendFromBug;?></th>
|
||||
<th class='w-90px'><?php echo $lang->story->legendFromBug;?></th>
|
||||
<td class='pd-0'>
|
||||
<ul class='list-unstyled'>
|
||||
<?php echo "<li title='#$fromBug->id $fromBug->title'>" . html::a($this->createLink('bug', 'view', "bugID=$fromBug->id", '', true), "#$fromBug->id $fromBug->title", '', "class='iframe' data-width='80%'") . '</li>';?>
|
||||
@@ -511,7 +511,7 @@
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->story->legendBugs;?></th>
|
||||
<th class='w-90px'><?php echo $lang->story->legendBugs;?></th>
|
||||
<td class='pd-0'>
|
||||
<ul class='list-unstyled'>
|
||||
<?php
|
||||
@@ -538,6 +538,27 @@
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->story->linkMR;?></th>
|
||||
<td class='pd-0'>
|
||||
<ul class='list-unstyled'>
|
||||
<?php
|
||||
$mrPriv = common::hasPriv('mr', 'view');
|
||||
foreach($linkedMRs as $MRID => $linkMRTitle)
|
||||
{
|
||||
if($mrPriv)
|
||||
{
|
||||
echo "<li title='#$MRID $linkMRTitle'>" . html::a($this->createLink('mr', 'view', "MRID=$MRID"), "#$MRID $linkMRTitle") . '</li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<li title='#$MRID $linkMRTitle'>" . "#$MRID $linkMRTitle" . '</li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
+10
-9
@@ -760,15 +760,16 @@ class task extends control
|
||||
$position[] = $this->lang->task->common;
|
||||
$position[] = $this->lang->task->view;
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->execution = $execution;
|
||||
$this->view->task = $task;
|
||||
$this->view->actions = $this->loadModel('action')->getList('task', $taskID);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('task', $taskID);
|
||||
$this->view->product = $this->tree->getProduct($task->module);
|
||||
$this->view->modulePath = $this->tree->getParents($task->module);
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->execution = $execution;
|
||||
$this->view->task = $task;
|
||||
$this->view->actions = $this->loadModel('action')->getList('task', $taskID);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('task', $taskID);
|
||||
$this->view->product = $this->tree->getProduct($task->module);
|
||||
$this->view->modulePath = $this->tree->getParents($task->module);
|
||||
$this->view->linkMRTitles = $this->loadModel('mr')->getLinkedMRPairs($taskID, 'task');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
.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%;}
|
||||
.pull-left{max-width: 80%;}
|
||||
.MRThWidth {width: 90px !important;}
|
||||
|
||||
@@ -160,6 +160,7 @@ $lang->task->noFinished = 'Unfinished';
|
||||
$lang->task->noClosed = 'Unclosed';
|
||||
$lang->task->yesterdayFinished = 'Task Finished Yesterday';
|
||||
$lang->task->allTasks = 'Task';
|
||||
$lang->task->linkMR = 'Related MRs';
|
||||
|
||||
$lang->task->statusList[''] = '';
|
||||
$lang->task->statusList['wait'] = 'Waiting';
|
||||
@@ -199,6 +200,7 @@ $lang->task->legendEffort = 'Effort';
|
||||
$lang->task->legendLife = 'Task Life';
|
||||
$lang->task->legendDesc = 'Task Description';
|
||||
$lang->task->legendDetail = 'Task Detail';
|
||||
$lang->task->legendMisc = 'Misc.';
|
||||
|
||||
$lang->task->confirmDelete = "Do you want to delete this task?";
|
||||
$lang->task->confirmDeleteEstimate = "Do you want to delete it?";
|
||||
|
||||
@@ -160,6 +160,7 @@ $lang->task->noFinished = '未完成';
|
||||
$lang->task->noClosed = '未关闭';
|
||||
$lang->task->yesterdayFinished = '昨日完成任务数';
|
||||
$lang->task->allTasks = '总任务';
|
||||
$lang->task->linkMR = '相关合并请求';
|
||||
|
||||
$lang->task->statusList[''] = '';
|
||||
$lang->task->statusList['wait'] = '未开始';
|
||||
@@ -199,6 +200,7 @@ $lang->task->legendEffort = '工时信息';
|
||||
$lang->task->legendLife = '任务的一生';
|
||||
$lang->task->legendDesc = '任务描述';
|
||||
$lang->task->legendDetail = '任务详情';
|
||||
$lang->task->legendMisc = '其他相关';
|
||||
|
||||
$lang->task->confirmDelete = "您确定要删除这个任务吗?";
|
||||
$lang->task->confirmDeleteEstimate = "您确定要删除这个记录吗?";
|
||||
|
||||
@@ -160,6 +160,7 @@ $lang->task->noFinished = '未完成';
|
||||
$lang->task->noClosed = '未關閉';
|
||||
$lang->task->yesterdayFinished = '昨日完成任務數';
|
||||
$lang->task->allTasks = '總任務';
|
||||
$lang->task->linkMR = '相關合并請求';
|
||||
|
||||
$lang->task->statusList[''] = '';
|
||||
$lang->task->statusList['wait'] = '未開始';
|
||||
@@ -199,6 +200,7 @@ $lang->task->legendEffort = '工時信息';
|
||||
$lang->task->legendLife = '任務的一生';
|
||||
$lang->task->legendDesc = '任務描述';
|
||||
$lang->task->legendDetail = '任務詳情';
|
||||
$lang->task->legendMisc = '其他相關';
|
||||
|
||||
$lang->task->confirmDelete = "您確定要刪除這個任務嗎?";
|
||||
$lang->task->confirmDeleteEstimate = "您確定要刪除這個記錄嗎?";
|
||||
|
||||
@@ -359,43 +359,64 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='cell'>
|
||||
<details class="detail" open>
|
||||
<summary class="detail-title"><?php echo $lang->task->legendEffort;?></summary>
|
||||
<div class="detail-content">
|
||||
<table class='table table-data'>
|
||||
<tr>
|
||||
<th class='effortThWidth'><?php echo $lang->task->estimate;?></th>
|
||||
<td><?php echo $task->estimate . $lang->workingHour;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->consumed;?></th>
|
||||
<td><?php echo round($task->consumed, 2) . $lang->workingHour;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->left;?></th>
|
||||
<td><?php echo $task->left . $lang->workingHour;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->estStarted;?></th>
|
||||
<td><?php echo $task->estStarted;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->realStarted;?></th>
|
||||
<td><?php echo helper::isZeroDate($task->realStarted) ? '' : $task->realStarted; ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->deadline;?></th>
|
||||
<td>
|
||||
<?php
|
||||
echo $task->deadline;
|
||||
if(isset($task->delay)) printf($lang->task->delayWarning, $task->delay);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="cell">
|
||||
<div class='tabs'>
|
||||
<ul class='nav nav-tabs'>
|
||||
<li class='active'><a href='#legendEffort' data-toggle='tab'><?php echo $lang->task->legendEffort;?></a></li>
|
||||
<li><a href='#legendMisc' data-toggle='tab'><?php echo $lang->task->legendMisc;?></a></li>
|
||||
</ul>
|
||||
<div class='tab-content'>
|
||||
<div class='tab-pane active' id='legendEffort'>
|
||||
<table class="table table-data">
|
||||
<tr>
|
||||
<th class='effortThWidth'><?php echo $lang->task->estimate;?></th>
|
||||
<td><?php echo $task->estimate . $lang->workingHour;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->consumed;?></th>
|
||||
<td><?php echo round($task->consumed, 2) . $lang->workingHour;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->left;?></th>
|
||||
<td><?php echo $task->left . $lang->workingHour;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->estStarted;?></th>
|
||||
<td><?php echo $task->estStarted;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->realStarted;?></th>
|
||||
<td><?php echo helper::isZeroDate($task->realStarted) ? '' : $task->realStarted; ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->deadline;?></th>
|
||||
<td>
|
||||
<?php
|
||||
echo $task->deadline;
|
||||
if(isset($task->delay)) printf($lang->task->delayWarning, $task->delay);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class='tab-pane' id='legendMisc'>
|
||||
<table class="table table-data">
|
||||
<tr>
|
||||
<th class='MRThWidth'><?php echo $lang->task->linkMR;?></th>
|
||||
<td>
|
||||
<?php
|
||||
$canViewMR = common::hasPriv('mr', 'view');
|
||||
foreach($linkMRTitles as $MRID => $linkMRTitle)
|
||||
{
|
||||
echo ($canViewMR ? html::a($this->createLink('mr', 'view', "MRID=$MRID"), "#$MRID $linkMRTitle") : "#$MRID $linkMRTitle") . '<br />';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
<?php $this->printExtendFields($task, 'div', "position=right&inForm=0&inCell=1");?>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 mrModel::apiGetSameOpened();
|
||||
cid=0
|
||||
pid=0
|
||||
|
||||
使用正确的gitlabID,sourceProject,sourceBranch,targetProject,targetBranch >> success
|
||||
使用空的gitlabID >> null
|
||||
使用空的sourceProject >> null
|
||||
使用空的sourceBranch >> null
|
||||
使用空的targetProject >> null
|
||||
使用空的targetBranch >> null
|
||||
使用错误的gitlabID >> null
|
||||
使用错误的sourceProject >> null
|
||||
使用错误的sourceBranch >> null
|
||||
使用错误的targetProject >> null
|
||||
使用错误的targetBranch >> null
|
||||
|
||||
*/
|
||||
$mrModel = $tester->loadModel('mr');
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if(isset($result->iid)) $result = 'success';
|
||||
r($result) && p() && e('success'); //使用正确的gitlabID, sourceProject,sourceBranch,targetProject,targetBranch
|
||||
|
||||
$gitlabID = '';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用空的gitlabID
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用空的sourceProject
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = '';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用空的sourceBranch
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用空的targetProject
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = '';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用空的targetBranch
|
||||
|
||||
$gitlabID = 'test';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用错误的gitlabID
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = 'test';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用错误的sourceProject
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用错误的sourceBranch
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = 'test';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用错误的targetProject
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'main';
|
||||
$result = $mrModel->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
if($result === null) $result = 'null';
|
||||
r($result) && p() && e('null'); //使用错误的targetBranch
|
||||
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 mrModel::checkSameOpened();
|
||||
cid=0
|
||||
pid=0
|
||||
|
||||
使用正确的gitlabID,sourceProject,sourceBranch,targetProject,targetBranch >> fail
|
||||
使用空的gitlabID >> success
|
||||
使用空的sourceProject >> success
|
||||
使用空的sourceBranch >> success
|
||||
使用空的targetProject >> success
|
||||
使用空的targetBranch >> success
|
||||
使用错误的gitlabID >> success
|
||||
使用错误的sourceProject >> success
|
||||
使用错误的sourceBranch >> success
|
||||
使用错误的targetProject >> success
|
||||
使用错误的targetBranch >> success
|
||||
|
||||
*/
|
||||
$mrModel = $tester->loadModel('mr');
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('fail'); //使用正确的gitlabID, sourceProject,sourceBranch,targetProject,targetBranch
|
||||
|
||||
$gitlabID = '';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用空的gitlabID
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用空的sourceProject
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = '';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用空的sourceBranch
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用空的targetProject
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = '';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用空的targetBranch
|
||||
|
||||
$gitlabID = 'test';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用错误的gitlabID
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = 'test';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用错误的sourceProject
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用错误的sourceBranch
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = 'test';
|
||||
$targetBranch = 'master';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用错误的targetProject
|
||||
|
||||
$gitlabID = '1';
|
||||
$sourceProject = '42';
|
||||
$sourceBranch = 'branch-08';
|
||||
$targetProject = '42';
|
||||
$targetBranch = 'main';
|
||||
$result = $mrModel->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
|
||||
r($result) && p('result') && e('success'); //使用错误的targetBranch
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 mrModel::convertApiError();
|
||||
cid=0
|
||||
pid=0
|
||||
|
||||
使用正确的message >> success
|
||||
使用空的message >> success
|
||||
|
||||
*/
|
||||
$mrModel = $tester->loadModel('mr');
|
||||
|
||||
$message = array();
|
||||
$message[0] = 'Another open merge request already exists for this source branch: !11';
|
||||
$result = $mrModel->convertApiError($message);
|
||||
if($result != $message[0]) $result = 'success';
|
||||
r($result) && p('') && e('success'); //使用正确的message
|
||||
|
||||
$message = '';
|
||||
$result = $mrModel->convertApiError($message);
|
||||
if(empty($result)) $result = 'success';
|
||||
r($result) && p('') && e('success'); //使用空的message
|
||||
Reference in New Issue
Block a user