diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/assets/javascripts/api.js | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index c84e73ccdb4..1d8fb1fc5a6 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -1,6 +1,6 @@ import axios from './lib/utils/axios_utils'; import { joinPaths } from './lib/utils/url_utility'; -import flash from '~/flash'; +import { deprecatedCreateFlash as flash } from '~/flash'; import { __ } from '~/locale'; const DEFAULT_PER_PAGE = 20; @@ -9,6 +9,7 @@ const Api = { groupsPath: '/api/:version/groups.json', groupPath: '/api/:version/groups/:id', groupMembersPath: '/api/:version/groups/:id/members', + groupMilestonesPath: '/api/:version/groups/:id/milestones', subgroupsPath: '/api/:version/groups/:id/subgroups', namespacesPath: '/api/:version/namespaces.json', groupPackagesPath: '/api/:version/groups/:id/packages', @@ -55,10 +56,14 @@ const Api = { adminStatisticsPath: '/api/:version/application/statistics', pipelineSinglePath: '/api/:version/projects/:id/pipelines/:pipeline_id', pipelinesPath: '/api/:version/projects/:id/pipelines/', + createPipelinePath: '/api/:version/projects/:id/pipeline', environmentsPath: '/api/:version/projects/:id/environments', + contextCommitsPath: + '/api/:version/projects/:id/merge_requests/:merge_request_iid/context_commits', rawFilePath: '/api/:version/projects/:id/repository/files/:path/raw', issuePath: '/api/:version/projects/:id/issues/:issue_iid', tagsPath: '/api/:version/projects/:id/repository/tags', + freezePeriodsPath: '/api/:version/projects/:id/freeze_periods', group(groupId, callback = () => {}) { const url = Api.buildUrl(Api.groupPath).replace(':id', groupId); @@ -106,6 +111,17 @@ const Api = { }); }, + groupMilestones(id, options) { + const url = Api.buildUrl(this.groupMilestonesPath).replace(':id', encodeURIComponent(id)); + + return axios.get(url, { + params: { + per_page: DEFAULT_PER_PAGE, + ...options, + }, + }); + }, + // Return groups list. Filtered by query groups(query, options, callback = () => {}) { const url = Api.buildUrl(Api.groupsPath); @@ -528,6 +544,12 @@ const Api = { return axios.get(url); }, + createRelease(projectPath, release) { + const url = Api.buildUrl(this.releasesPath).replace(':id', encodeURIComponent(projectPath)); + + return axios.post(url, release); + }, + updateRelease(projectPath, tagName, release) { const url = Api.buildUrl(this.releasePath) .replace(':id', encodeURIComponent(projectPath)) @@ -575,11 +597,45 @@ const Api = { }); }, + createPipeline(id, data) { + const url = Api.buildUrl(this.createPipelinePath).replace(':id', encodeURIComponent(id)); + + return axios.post(url, data, { + headers: { + 'Content-Type': 'application/json', + }, + }); + }, + environments(id) { const url = Api.buildUrl(this.environmentsPath).replace(':id', encodeURIComponent(id)); return axios.get(url); }, + createContextCommits(id, mergeRequestIid, data) { + const url = Api.buildUrl(this.contextCommitsPath) + .replace(':id', encodeURIComponent(id)) + .replace(':merge_request_iid', mergeRequestIid); + + return axios.post(url, data); + }, + + allContextCommits(id, mergeRequestIid) { + const url = Api.buildUrl(this.contextCommitsPath) + .replace(':id', encodeURIComponent(id)) + .replace(':merge_request_iid', mergeRequestIid); + + return axios.get(url); + }, + + removeContextCommits(id, mergeRequestIid, data) { + const url = Api.buildUrl(this.contextCommitsPath) + .replace(':id', id) + .replace(':merge_request_iid', mergeRequestIid); + + return axios.delete(url, { data }); + }, + getRawFile(id, path, params = { ref: 'master' }) { const url = Api.buildUrl(this.rawFilePath) .replace(':id', encodeURIComponent(id)) @@ -616,6 +672,18 @@ const Api = { }); }, + freezePeriods(id) { + const url = Api.buildUrl(this.freezePeriodsPath).replace(':id', encodeURIComponent(id)); + + return axios.get(url); + }, + + createFreezePeriod(id, freezePeriod = {}) { + const url = Api.buildUrl(this.freezePeriodsPath).replace(':id', encodeURIComponent(id)); + + return axios.post(url, freezePeriod); + }, + buildUrl(url) { return joinPaths(gon.relative_url_root || '', url.replace(':version', gon.api_version)); }, |