diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-05-28 20:01:56 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-05-28 20:01:56 +0900 |
commit | 1d20679e9c8b1ba16bebaf982255946e7207b4d4 (patch) | |
tree | 128685af66ca56c751b505a8314ca79dd3b54b34 /app/assets/javascripts/api.js | |
parent | 8e92e25b62ca108de775362e6d2981e54535f094 (diff) | |
parent | 014f5f6a69f63ee42bd94454108268f189b62b18 (diff) | |
download | gitlab-ce-1d20679e9c8b1ba16bebaf982255946e7207b4d4.tar.gz |
Merge branch 'master' into per-project-pipeline-iid
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 8ad3d18b302..ce1069276ab 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -21,8 +21,11 @@ const Api = { issuableTemplatePath: '/:namespace_path/:project_path/templates/:type/:key', usersPath: '/api/:version/users.json', commitPath: '/api/:version/projects/:id/repository/commits', + commitPipelinesPath: '/:project_id/commit/:sha/pipelines', branchSinglePath: '/api/:version/projects/:id/repository/branches/:branch', createBranchPath: '/api/:version/projects/:id/repository/branches', + pipelinesPath: '/api/:version/projects/:id/pipelines', + pipelineJobsPath: '/api/:version/projects/:id/pipelines/:pipeline_id/jobs', group(groupId, callback) { const url = Api.buildUrl(Api.groupPath).replace(':id', groupId); @@ -164,6 +167,19 @@ const Api = { }); }, + commitPipelines(projectId, sha) { + const encodedProjectId = projectId + .split('/') + .map(fragment => encodeURIComponent(fragment)) + .join('/'); + + const url = Api.buildUrl(Api.commitPipelinesPath) + .replace(':project_id', encodedProjectId) + .replace(':sha', encodeURIComponent(sha)); + + return axios.get(url); + }, + branchSingle(id, branch) { const url = Api.buildUrl(Api.branchSinglePath) .replace(':id', encodeURIComponent(id)) @@ -222,6 +238,20 @@ const Api = { }); }, + pipelines(projectPath, params = {}) { + const url = Api.buildUrl(this.pipelinesPath).replace(':id', encodeURIComponent(projectPath)); + + return axios.get(url, { params }); + }, + + pipelineJobs(projectPath, pipelineId, params = {}) { + const url = Api.buildUrl(this.pipelineJobsPath) + .replace(':id', encodeURIComponent(projectPath)) + .replace(':pipeline_id', pipelineId); + + return axios.get(url, { params }); + }, + buildUrl(url) { let urlRoot = ''; if (gon.relative_url_root != null) { |