diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-09-06 11:17:06 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-09-06 11:17:06 -0300 |
commit | f9fbae2e2712f3e7416c01c5e7ef6a6e021566b9 (patch) | |
tree | a92d654de065857c1d9dc75a9e1a24058cbc914d /app/assets/javascripts/api.js | |
parent | 563c7de58e010ddbede4fdf5de8229617ef9f96f (diff) | |
download | gitlab-ce-f9fbae2e2712f3e7416c01c5e7ef6a6e021566b9.tar.gz |
Finish backports and fix specs
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 7b00e1fa780..38d1effc77c 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -6,7 +6,8 @@ const Api = { namespacesPath: '/api/:version/namespaces.json', groupProjectsPath: '/api/:version/groups/:id/projects.json', projectsPath: '/api/:version/projects.json', - labelsPath: '/:namespace_path/:project_path/labels', + projectLabelsPath: '/:namespace_path/:project_path/labels', + groupLabelsPath: '/groups/:namespace_path/labels', licensePath: '/api/:version/templates/licenses/:key', gitignorePath: '/api/:version/templates/gitignores/:key', gitlabCiYmlPath: '/api/:version/templates/gitlab_ci_ymls/:key', @@ -74,7 +75,16 @@ const Api = { }, newLabel(namespacePath, projectPath, data, callback) { - const url = Api.buildUrl(Api.labelsPath); + let url; + + if (projectPath) { + url = Api.buildUrl(Api.projectLabelsPath) + .replace(':namespace_path', namespacePath) + .replace(':project_path', projectPath); + } else { + url = Api.buildUrl(Api.groupLabelsPath).replace(':namespace_path', namespacePath); + } + return $.ajax({ url, type: 'POST', |