* Add gitlab tag create function and page.

This commit is contained in:
caoyanyi
2021-12-16 05:13:43 +00:00
parent 372fa0fa9c
commit d9a5f136b1
10 changed files with 152 additions and 2 deletions
+32 -2
View File
@@ -858,7 +858,6 @@ class gitlab extends control
$branchPriv->mergeAccessLevel = 40; // Initialize data, and the operation authority is the maintainers by default.
$branchPriv->pushAccessLevel = 40; // Initialize data, and the operation authority is the maintainers by default.
$gitlab = $this->gitlab->getByID($gitlabID);
$title = $this->lang->gitlab->createBranchPriv;
if($branch)
@@ -881,7 +880,6 @@ class gitlab extends control
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $title;
$this->view->pageTitle = $title;
$this->view->gitlab = $gitlab;
$this->view->gitlabID = $gitlabID;
$this->view->branch = $branch;
$this->view->projectID = $projectID;
@@ -1281,4 +1279,36 @@ class gitlab extends control
}
$this->send($options);
}
/**
* Create a gitlab tag.
*
* @param int $gitlabID
* @param int $projectID
* @access public
* @return void
*/
public function createTag($gitlabID, $projectID)
{
if($_POST)
{
$this->gitlab->createTag($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('browseTag', "gitlabID=$gitlabID&projectID=$projectID")));
}
$gitlabBranches = $this->gitlab->apiGetBranches($gitlabID, $projectID);
$branches = array();
foreach($gitlabBranches as $branch)
{
$branches[$branch->name] = $branch->name;
}
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->createTag;
$this->view->gitlabID = $gitlabID;
$this->view->projectID = $projectID;
$this->view->branches = $branches;
$this->display();
}
}