diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php
index bfa0c99279..bdc3bf6a2f 100644
--- a/module/common/lang/menu.php
+++ b/module/common/lang/menu.php
@@ -317,14 +317,14 @@ $lang->qa->dividerMenu = ',bug,testtask,caselib,';
$lang->devops->menu = new stdclass();
$lang->devops->menu->code = array('link' => "{$lang->repo->common}|repo|browse|repoID=%s", 'alias' => 'diff,view,revision,log,blame,showsynccommit');
$lang->devops->menu->compile = array('link' => "{$lang->devops->compile}|job|browse", 'subModule' => 'compile,job');
-// $lang->devops->menu->gitlab = array('link' => "Gitlab|gitlab|browse", 'alias' => 'create,edit');
+$lang->devops->menu->gitlab = array('link' => "GitLab|gitlab|browse", 'alias' => 'create,edit');
$lang->devops->menu->jenkins = array('link' => "Jenkins|jenkins|browse", 'alias' => 'create,edit');
$lang->devops->menu->maintain = array('link' => "{$lang->devops->repo}|repo|maintain", 'alias' => 'create,edit');
$lang->devops->menu->rules = array('link' => "{$lang->devops->rules}|repo|setrules");
$lang->devops->menuOrder[5] = 'code';
$lang->devops->menuOrder[10] = 'compile';
-// $lang->devops->menuOrder[15] = 'gitlab';
+$lang->devops->menuOrder[15] = 'gitlab';
$lang->devops->menuOrder[20] = 'jenkins';
$lang->devops->menuOrder[25] = 'maintain';
$lang->devops->menuOrder[30] = 'rules';
diff --git a/module/doc/js/objectlibs.js b/module/doc/js/objectlibs.js
index db5256d142..78ada9cc4c 100644
--- a/module/doc/js/objectlibs.js
+++ b/module/doc/js/objectlibs.js
@@ -1,3 +1,8 @@
+$(function()
+{
+ if($.cookie('isFullScreen') == 1) fullScreen();
+})
+
/**
* Ajax delete doc.
*
@@ -45,25 +50,32 @@ function fullScreen()
{
$('#content .actions').addClass('hidden');
requestMethod.call(element);
+ $.cookie('isFullScreen', 1);
}
}
+function exitFullScreen()
+{
+ $('#content .actions').removeClass('hidden');
+ $.cookie('isFullScreen', 0);
+}
+
document.addEventListener("fullscreenchange", function (e)
{
- if(!document.fullscreenElement) $('#content .actions').removeClass('hidden');
+ if(!document.fullscreenElement) exitFullScreen();
})
document.addEventListener("webkitfullscreenchange", function (e)
{
- if(!document.webkitFullscreenElement) $('#content .actions').removeClass('hidden');
+ if(!document.webkitFullscreenElement) exitFullScreen();
})
document.addEventListener("mozfullscreenchange", function (e)
{
- if(!document.mozFullScreenElement) $('#content .actions').removeClass('hidden');
+ if(!document.mozFullScreenElement) exitFullScreen();
})
document.addEventListener("msfullscreenChange", function (e)
{
- if(!document.msfullscreenElement) $('#content .actions').removeClass('hidden');
+ if(!document.msfullscreenElement) exitFullScreen();
})
diff --git a/module/gitlabpipeline/model.php b/module/gitlabpipeline/model.php
new file mode 100644
index 0000000000..747536a539
--- /dev/null
+++ b/module/gitlabpipeline/model.php
@@ -0,0 +1,213 @@
+
+ * @package product
+ * @version $Id: $
+ * @link http://www.zentao.net
+ */
+
+class gitlabpipelineModel extends model
+{
+ /**
+ * Get single pipline by api.
+ *
+ * @param integer $projectID
+ * @param integer $pipelineID
+ * @access public
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipelines.html#get-a-single-pipeline
+ */
+
+ public function apiGetPiplineByID($projectID, $pipelineID)
+ {
+ //Priv 1
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipelines/{$piplinesID}");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * Get piplines list by api.
+ *
+ * @param integer $projectID
+ * @access public
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipelines.html#list-project-pipelines
+ */
+
+ public function apiGetPiplines($projectID)
+ {
+ //Later
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipelines");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * Get a pipeline’s report by api.
+ *
+ * @param integer $projectID
+ * @param integer $pipelineID
+ * @access public
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipelines.html#get-a-pipelines-test-report
+ */
+ public function apiGetPiplineReport($projectID, $pipelineID)
+ {
+ //Later
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipelines/{$pipelineID}/test_report");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * Create a new pipeline by api.
+ *
+ * @param integer $projectID
+ * @param string $reference
+ * @access public
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline
+ */
+ public function apiCreatePipeline($projectID, $reference)
+ {
+ //Priv 1
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipeline");
+ return json_decode(commonModel::http($url, $reference));
+ }
+
+ /**
+ * Retry jobs in a pipeline by api.
+ *
+ * @param integer $projectID
+ * @param integer $pipelineID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipelines.html#retry-jobs-in-a-pipeline
+ */
+ public function apiRetryPipeline($projectID, $pipelineID)
+ {
+ //Priv 2
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipelines/{$piplineID}/retry");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * Cancel a pipeline’s jobs by api.
+ *
+ * @param integer $projectID
+ * @param integer $pipelineID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipelines.html#cancel-a-pipelines-jobs
+ */
+ public function apiPipelineCancel($projectID, $piplineID)
+ {
+ //Priv 1
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipelines/{$pipelineID}/cancel");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * Delete a pipeline-·· by api.
+ *
+ * @param integer $projectID
+ * @param integer $pipelineID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipelines.html#delete-a-pipeline
+ */
+ public function apiDeletePipeline($projectID, $piplineID)
+ {
+ //Later
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipelines/{$piplineID}");
+ return json_decode(commonModel::http($url, null, array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
+ }
+
+ /**
+ * Get all pipeline schedules by api.
+ *
+ * @param integer $projectID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipeline_schedules.html#get-all-pipeline-schedules
+ */
+ public function apiGetPiplineSchedules($projectID)
+ {
+ //Later
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipeline_schedules");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * Delete a pipeline schedule by api.
+ *
+ * @param integer $projectID
+ * @param integer $pipelineScheduleID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipeline_schedules.html#delete-a-pipeline-schedule
+ */
+ public function apiDeletePiplineSchedules($projectID, $pipelineScheduleID)
+ {
+ //Later
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipeline_schedules/{$pipelineScheduleID}/play");
+ return json_decode(commonModel::http($url, null, array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
+ }
+
+ /**
+ * Run a scheduled pipeline immediately by api.
+ *
+ * @param integer $projectID
+ * @param integer $pipelineScheduleID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/pipeline_schedules.html#run-a-scheduled-pipeline-immediately
+ */
+ public function apiRunPiplineSchedule()
+ {
+ //Later
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/jobs/{$jobID}/trace");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * Get a log file by api.
+ *
+ * @param integer $projectID
+ * @param integer $jobID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/jobs.html#get-a-log-file
+ */
+ public function apiPipelineGetlog($projectID, $jobID)
+ {
+ //Priv 2
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/jobs/{$jobID}/trace");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * List pipeline jobs by api.
+ *
+ * @param integer $projectID
+ * @param integer $pipelineID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/jobs.html#list-pipeline-jobs
+ */
+ public function apiGetPipelineJobs($projectID, $pipelineID)
+ {
+ //Priv 2
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/pipelines/{$pipelineID}/jobs");
+ return json_decode(commonModel::http($url));
+ }
+
+ /**
+ * Get a single job by api.
+ *
+ * @param integer $projectID
+ * @param integer $jobID
+ * @return object
+ * @docment https://docs.gitlab.com/ee/api/jobs.html#get-a-single-job
+ */
+ public function apiGetSingleJob($projectID, $jobID)
+ {
+ //Priv 2
+ $url = sprintf($this->loadModel('gitlab')->getApiRoot($gitlabID), "/projects/{$projectID}/jobs/{$jobID}");
+ return json_decode(commonModel::http($url));
+ }
+}
diff --git a/module/job/js/create.js b/module/job/js/create.js
index 1e4801e4bf..8213ede9f0 100644
--- a/module/job/js/create.js
+++ b/module/job/js/create.js
@@ -1,6 +1,12 @@
$('#repo').change(function()
{
var repoID = $(this).val();
+ $.getJSON(createLink('job', 'ajaxGetProductByRepo', 'repoID=' + repoID), function(product)
+ {
+ console.log(product);
+ }
+ );
+
var type = 'Git';
if(typeof(repoTypes[repoID]) != 'undefined') type = repoTypes[repoID];
@@ -82,37 +88,15 @@ $('#triggerType').change(function()
}
});
-$('#gitlabServer').change(function()
-{
- var repoID = $('#repo').val();
- $('#gitlabServerTR #pipeline').remove();
- $('#gitlabServerTR #pipeline_chosen').remove();
- $('#gitlabServerTR .input-group').append("
");
- $.getJSON(createLink('gitlab', 'ajaxGetGitlabPipeline', 'repoID=' + repoID), function(tasks)
- {
- html = "';
- $('#gitlabServerTR .loading').remove();
- $('#gitlabServerTR .input-group').append(html);
-
- $('#gitlabServerTR #pipeline').chosen({drop_direction: 'auto'});
- })
-})
-
$('#jkServer').change(function()
{
var jenkinsID = $(this).val();
- $('#jenkinsServerTR #JkTask').remove();
- $('#jenkinsServerTR #JkTask_chosen').remove();
+ $('#jenkinsServerTR #jkTask').remove();
+ $('#jenkinsServerTR #jkTask_chosen').remove();
$('#jenkinsServerTR .input-group').append("");
$.getJSON(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks)
{
- html = "