From 21f861953958cece97df1ed2814e14bd67e1ddbe Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 11 May 2018 17:27:09 +0100 Subject: Show CI jobs in web IDE Closes #44604 --- app/assets/javascripts/api.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/assets/javascripts/api.js') diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 8ad3d18b302..e16d520024b 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -23,6 +23,8 @@ const Api = { commitPath: '/api/:version/projects/:id/repository/commits', 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); @@ -222,6 +224,20 @@ const Api = { }); }, + pipelines(projectPath, params = {}) { + const url = Api.buildUrl(this.pipelinesPath).replace(':id', encodeURIComponent(projectPath)); + + return axios.get(url, { params }); + }, + + pipelineJobs(projectPath, pipelineId) { + const url = Api.buildUrl(this.pipelineJobsPath) + .replace(':id', encodeURIComponent(projectPath)) + .replace(':pipeline_id', pipelineId); + + return axios.get(url); + }, + buildUrl(url) { let urlRoot = ''; if (gon.relative_url_root != null) { -- cgit v1.2.1 From ba90742631a5e1a0d1edc546d5d49b59210642bf Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 14 May 2018 16:30:52 +0100 Subject: group jobs into stages --- app/assets/javascripts/api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/assets/javascripts/api.js') diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index e16d520024b..eb919241318 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -230,12 +230,12 @@ const Api = { return axios.get(url, { params }); }, - pipelineJobs(projectPath, pipelineId) { + pipelineJobs(projectPath, pipelineId, params = {}) { const url = Api.buildUrl(this.pipelineJobsPath) .replace(':id', encodeURIComponent(projectPath)) .replace(':pipeline_id', pipelineId); - return axios.get(url); + return axios.get(url, { params }); }, buildUrl(url) { -- cgit v1.2.1 From c53890548e15c15b38f3aa7911a69a4c24173f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lu=C3=ADs?= Date: Fri, 25 May 2018 10:08:53 +0000 Subject: Resolve "Show CI pipeline status in Web IDE" --- app/assets/javascripts/api.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/assets/javascripts/api.js') diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index eb919241318..ce1069276ab 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -21,6 +21,7 @@ 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', @@ -166,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)) -- cgit v1.2.1