* Fix bug #25516.
This commit is contained in:
@@ -104,7 +104,9 @@ class mr extends control
|
||||
return $this->send($result);
|
||||
}
|
||||
|
||||
$hosts = $this->loadModel('pipeline')->getList(array('gitea', 'gitlab'));
|
||||
$repoID = $this->loadModel('repo')->saveState(0);
|
||||
$repo = $this->repo->getRepoByID($repoID);
|
||||
$hosts = $this->loadModel('pipeline')->getList(array('gitea', 'gitlab'));
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$gitlabUsers = $this->loadModel('gitlab')->getGitLabListByAccount();
|
||||
@@ -128,6 +130,7 @@ class mr extends control
|
||||
$this->view->jobList = $this->loadModel('job')->getList();
|
||||
$this->view->hostPairs = $hostPairs;
|
||||
$this->view->hosts = $hosts;
|
||||
$this->view->repo = $repo;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
+40
-20
@@ -32,30 +32,12 @@ function getBranchPriv(project)
|
||||
|
||||
$(function()
|
||||
{
|
||||
$('#hostID').change(function()
|
||||
{
|
||||
var hostID = $('#hostID').val();
|
||||
if(hostID == '') return false;
|
||||
|
||||
if(hosts[hostID].type == 'gitlab')
|
||||
{
|
||||
var url = createLink('repo', 'ajaxGetGitlabProjects', "gitlabID=" + hostID + "&projectIdList=&filter=IS_DEVELOPER");
|
||||
}
|
||||
else
|
||||
{
|
||||
var url = createLink('repo', 'ajaxGetGiteaProjects', "giteaID=" + hostID);
|
||||
}
|
||||
$.get(url, function(response)
|
||||
{
|
||||
$('#sourceProject').html('').append(response);
|
||||
$('#sourceProject').chosen().trigger("chosen:updated");;
|
||||
});
|
||||
});
|
||||
|
||||
$('#sourceProject,#targetProject').change(function()
|
||||
{
|
||||
var hostID = $('#hostID').val();
|
||||
var sourceProject = urlencode($(this).val());
|
||||
if(!sourceProject) return false;
|
||||
|
||||
var branchSelect = $(this).parents('td').find('select[name*=Branch]');
|
||||
var branchUrl = createLink(hosts[hostID].type, 'ajaxGetProjectBranches', hosts[hostID].type + "ID=" + hostID + "&projectID=" + sourceProject);
|
||||
$.get(branchUrl, function(response)
|
||||
@@ -70,6 +52,8 @@ $(function()
|
||||
{
|
||||
var hostID = $('#hostID').val();
|
||||
var sourceProject = urlencode($(this).val());
|
||||
if(!sourceProject) return false;
|
||||
|
||||
var projectUrl = createLink('mr', 'ajaxGetMRTargetProjects', "hostID=" + hostID + "&projectID=" + sourceProject + "&scm=" + hosts[hostID].type);
|
||||
$.get(projectUrl, function(response)
|
||||
{
|
||||
@@ -151,4 +135,40 @@ $(function()
|
||||
$("#jobID").parent().parent().removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
$('#hostID').change(function()
|
||||
{
|
||||
$('#sourceProject').val('');
|
||||
$('#sourceProject').chosen().trigger("chosen:updated");;
|
||||
$('#sourceBranch').val('');
|
||||
$('#sourceBranch').chosen().trigger("chosen:updated");;
|
||||
$('#targetProject').val('');
|
||||
$('#targetProject').chosen().trigger("chosen:updated");;
|
||||
$('#targetBranch').val('');
|
||||
$('#targetBranch').chosen().trigger("chosen:updated");;
|
||||
|
||||
var hostID = $('#hostID').val();
|
||||
if(hostID == '') return false;
|
||||
|
||||
if(hosts[hostID].type == 'gitlab')
|
||||
{
|
||||
var url = createLink('repo', 'ajaxGetGitlabProjects', "gitlabID=" + hostID + "&projectIdList=&filter=IS_DEVELOPER");
|
||||
}
|
||||
else
|
||||
{
|
||||
var url = createLink('repo', 'ajaxGetGiteaProjects', "giteaID=" + hostID);
|
||||
}
|
||||
$.get(url, function(response)
|
||||
{
|
||||
$('#sourceProject').html('').append(response);
|
||||
if(repo.project)
|
||||
{
|
||||
$('#sourceProject').val(repo.project);
|
||||
$('#sourceProject').change();
|
||||
}
|
||||
$('#sourceProject').chosen().trigger("chosen:updated");;
|
||||
});
|
||||
});
|
||||
|
||||
if(repo.gitService) $('#hostID').change();
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::import($jsRoot . 'misc/base64.js');?>
|
||||
<?php js::set('hosts', $hosts);?>
|
||||
<?php js::set('repo', $repo);?>
|
||||
<?php js::set('branchPrivs', array());?>
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div class='main-col main-content'>
|
||||
@@ -23,7 +24,7 @@
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->mr->server;?></th>
|
||||
<td class='required'><?php echo html::select('hostID', array('') + $hostPairs, '', "class='form-control chosen'");?></td>
|
||||
<td class='required'><?php echo html::select('hostID', array('') + $hostPairs, $repo->gitService, "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="white-space: nowrap;"><?php echo $lang->mr->sourceProject;?></th>
|
||||
|
||||
Reference in New Issue
Block a user