mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-18 00:56:41 +10:00
Merge branch 'feature_expose_project_labels' into 'master'
Exposing Project Labels in the REST API The intent here is to expose the tag_list property of the Project entity over the REST API so that any project searches include the information. The specific reason I've implemented this change is for an environment in which multiple gitlab servers exist, where a central portal to the projects that are spread around the network will be useful. Having access to filtering on this fairly large project list based on their labels, will be of great use. This satisfies the feature request http://feedback.gitlab.com/forums/176466-general/suggestions/6325819-project-labels-via-api The change was made in the `lib/api/entities.rb` file. The output of a `GET` to something like `/projects` or `/projects/7` is now: ```javascript { "id": 7, "description": "Veritatis est eaque voluptas magni expedita.", "default_branch": "master", **"tag_list": [ "typeahead", "twitter" ],** "public": false, "archived": false, "visibility_level": 0, ... } ``` See merge request !329
This commit is contained in:
@@ -58,6 +58,7 @@ v 7.10.0 (unreleased)
|
||||
- Fix "Hello @username." references not working by no longer allowing usernames to end in period.
|
||||
- Archive repositories in background worker.
|
||||
- Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user into current namespace.
|
||||
- Project labels are now available over the API under the "tag_list" field (Cristian Medina)
|
||||
|
||||
|
||||
v 7.9.2
|
||||
|
||||
@@ -44,6 +44,10 @@ Parameters:
|
||||
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
|
||||
"http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
|
||||
"web_url": "http://example.com/diaspora/diaspora-client",
|
||||
"tag_list": [
|
||||
"example",
|
||||
"disapora client"
|
||||
],
|
||||
"owner": {
|
||||
"id": 3,
|
||||
"name": "Diaspora",
|
||||
@@ -80,6 +84,10 @@ Parameters:
|
||||
"ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
|
||||
"http_url_to_repo": "http://example.com/brightbox/puppet.git",
|
||||
"web_url": "http://example.com/brightbox/puppet",
|
||||
"tag_list": [
|
||||
"example",
|
||||
"puppet"
|
||||
],
|
||||
"owner": {
|
||||
"id": 4,
|
||||
"name": "Brightbox",
|
||||
@@ -163,6 +171,10 @@ Parameters:
|
||||
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
|
||||
"http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
|
||||
"web_url": "http://example.com/diaspora/diaspora-project-site",
|
||||
"tag_list": [
|
||||
"example",
|
||||
"disapora project"
|
||||
],
|
||||
"owner": {
|
||||
"id": 3,
|
||||
"name": "Diaspora",
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ module API
|
||||
end
|
||||
|
||||
class Project < Grape::Entity
|
||||
expose :id, :description, :default_branch
|
||||
expose :id, :description, :default_branch, :tag_list
|
||||
expose :public?, as: :public
|
||||
expose :archived?, as: :archived
|
||||
expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url
|
||||
|
||||
@@ -57,7 +57,14 @@ describe API::API, api: true do
|
||||
expect(json_response.first['name']).to eq(project.name)
|
||||
expect(json_response.first['owner']['username']).to eq(user.username)
|
||||
end
|
||||
|
||||
|
||||
it 'should include the project labels as the tag_list' do
|
||||
get api('/projects', user)
|
||||
response.status.should == 200
|
||||
json_response.should be_an Array
|
||||
json_response.first.keys.should include('tag_list')
|
||||
end
|
||||
|
||||
context 'and using search' do
|
||||
it 'should return searched project' do
|
||||
get api('/projects', user), { search: project.name }
|
||||
|
||||
Reference in New Issue
Block a user