* Adjust GitLab.

This commit is contained in:
lichengjun
2021-07-16 16:12:17 +08:00
parent 8409cb5b54
commit b93f366581
4 changed files with 11 additions and 15 deletions
+7 -6
View File
@@ -1118,17 +1118,18 @@ class repo extends control
*/
public function ajaxGetGitlabProjects($host, $token)
{
$host = helper::safe64Decode($host);
$projects = $this->repo->getGitlabProjects($host, $token);
if(!$projects) return $this->send(array('message' => array()));
$projectIdList = $projectIdList ? explode(',', $projectIdList) : null;
$host = helper::safe64decode($host);
$projects = $this->repo->getgitlabprojects($host, $token);
if(!$projects) $this->send(array('message' => array()));
$options = "<option value=''></option>";
foreach($projects as $project)
{
if(!empty($projectIdList) and $project and !in_array($project->id, $projectIdList)) continue;
$options .= "<option value='{$project->id}' data-name='{$project->name}'>{$project->name_with_namespace}</option>";
$options .= "<option value='{$project->id}' data-name='{$project->name}'>{$project->name}:{$project->http_url_to_repo}</option>";
}
die($options);
}
/**
+4 -4
View File
@@ -6,7 +6,7 @@ $(function()
$form = $(this).closest('form');
$form.css('min-height', $form.height());
})
$('#gitlabHost, #gitlabToken').change(function()
{
host = Base64.encode($('#gitlabHost').val());
@@ -20,13 +20,13 @@ $(function()
$('#gitlabProject').chosen().trigger("chosen:updated");;
});
});
$('#gitlabProject').change(function()
{
$option = $(this).find('option:selected');
$('#name').val($option.data('name'));
});
});
function scmChanged(scm)
@@ -37,7 +37,7 @@ function scmChanged(scm)
$('.tips-git').removeClass('hidden');
$('.tips-svn').addClass('hidden');
}
}
else
{
$('.account-fields').removeClass('hidden');
-4
View File
@@ -235,9 +235,6 @@ class repoModel extends model
if($this->post->SCM == 'Gitlab')
{
$this->gitlab->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
/* create webhook for zentao */
$this->gitlab->initWebhooks($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
}
return $repoID;
}
@@ -301,7 +298,6 @@ class repoModel extends model
{
$this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($id)->exec();
$this->dao->delete()->from(TABLE_REPOFILES)->where('repo')->eq($id)->exec();
if($repo->SCM == 'Gitlab') $this->gitlab->initWebhooks($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
return false;
}
-1
View File
@@ -49,7 +49,6 @@
<td class='text-left c-actions'>
<?php
common::printIcon('repo', 'edit', "repoID=$repo->id&objectID=$objectID", '', 'list', 'edit');
if(strtolower($repo->SCM) == "gitlab") common::printIcon('gitlab', 'importIssue', "repo={$repo->id}", '', 'list', 'link'); // disable button instead of hiding it.
if(common::hasPriv('repo', 'delete')) echo html::a($this->createLink('repo', 'delete', "repoID=$repo->id&objectID=$objectID"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->repo->delete}' class='btn'");
?>
</td>