Commit 2a5ca841 authored by Robert Schilling's avatar Robert Schilling

API: Expose text_color for project and group labels

parent 7a8f8714
---
title: 'API: Expose text_color for project and group labels'
merge_request: 25172
author: Robert Schilling
type: added
...@@ -28,6 +28,7 @@ Example response: ...@@ -28,6 +28,7 @@ Example response:
"id": 7, "id": 7,
"name": "bug", "name": "bug",
"color": "#FF0000", "color": "#FF0000",
"text_color" : "#FFFFFF",
"description": null, "description": null,
"open_issues_count": 0, "open_issues_count": 0,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -38,6 +39,7 @@ Example response: ...@@ -38,6 +39,7 @@ Example response:
"id": 4, "id": 4,
"name": "feature", "name": "feature",
"color": "#228B22", "color": "#228B22",
"text_color" : "#FFFFFF",
"description": null, "description": null,
"open_issues_count": 0, "open_issues_count": 0,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -73,6 +75,7 @@ Example response: ...@@ -73,6 +75,7 @@ Example response:
"id": 9, "id": 9,
"name": "Feature Proposal", "name": "Feature Proposal",
"color": "#FFA500", "color": "#FFA500",
"text_color" : "#FFFFFF",
"description": "Describes new ideas", "description": "Describes new ideas",
"open_issues_count": 0, "open_issues_count": 0,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -108,6 +111,7 @@ Example response: ...@@ -108,6 +111,7 @@ Example response:
"id": 9, "id": 9,
"name": "Feature Idea", "name": "Feature Idea",
"color": "#FFA500", "color": "#FFA500",
"text_color" : "#FFFFFF",
"description": "Describes new ideas", "description": "Describes new ideas",
"open_issues_count": 0, "open_issues_count": 0,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -158,6 +162,7 @@ Example response: ...@@ -158,6 +162,7 @@ Example response:
"id": 9, "id": 9,
"name": "Feature Idea", "name": "Feature Idea",
"color": "#FFA500", "color": "#FFA500",
"text_color" : "#FFFFFF",
"description": "Describes new ideas", "description": "Describes new ideas",
"open_issues_count": 0, "open_issues_count": 0,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -192,6 +197,7 @@ Example response: ...@@ -192,6 +197,7 @@ Example response:
"id": 9, "id": 9,
"name": "Feature Idea", "name": "Feature Idea",
"color": "#FFA500", "color": "#FFA500",
"text_color" : "#FFFFFF",
"description": "Describes new ideas", "description": "Describes new ideas",
"open_issues_count": 0, "open_issues_count": 0,
"closed_issues_count": 0, "closed_issues_count": 0,
......
...@@ -24,6 +24,7 @@ Example response: ...@@ -24,6 +24,7 @@ Example response:
"id" : 1, "id" : 1,
"name" : "bug", "name" : "bug",
"color" : "#d9534f", "color" : "#d9534f",
"text_color" : "#FFFFFF",
"description": "Bug reported by user", "description": "Bug reported by user",
"open_issues_count": 1, "open_issues_count": 1,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -34,6 +35,7 @@ Example response: ...@@ -34,6 +35,7 @@ Example response:
{ {
"id" : 4, "id" : 4,
"color" : "#d9534f", "color" : "#d9534f",
"text_color" : "#FFFFFF",
"name" : "confirmed", "name" : "confirmed",
"description": "Confirmed issue", "description": "Confirmed issue",
"open_issues_count": 2, "open_issues_count": 2,
...@@ -46,6 +48,7 @@ Example response: ...@@ -46,6 +48,7 @@ Example response:
"id" : 7, "id" : 7,
"name" : "critical", "name" : "critical",
"color" : "#d9534f", "color" : "#d9534f",
"text_color" : "#FFFFFF",
"description": "Critical issue. Need fix ASAP", "description": "Critical issue. Need fix ASAP",
"open_issues_count": 1, "open_issues_count": 1,
"closed_issues_count": 3, "closed_issues_count": 3,
...@@ -57,6 +60,7 @@ Example response: ...@@ -57,6 +60,7 @@ Example response:
"id" : 8, "id" : 8,
"name" : "documentation", "name" : "documentation",
"color" : "#f0ad4e", "color" : "#f0ad4e",
"text_color" : "#FFFFFF",
"description": "Issue about documentation", "description": "Issue about documentation",
"open_issues_count": 1, "open_issues_count": 1,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -67,6 +71,7 @@ Example response: ...@@ -67,6 +71,7 @@ Example response:
{ {
"id" : 9, "id" : 9,
"color" : "#5cb85c", "color" : "#5cb85c",
"text_color" : "#FFFFFF",
"name" : "enhancement", "name" : "enhancement",
"description": "Enhancement proposal", "description": "Enhancement proposal",
"open_issues_count": 1, "open_issues_count": 1,
...@@ -105,6 +110,7 @@ Example response: ...@@ -105,6 +110,7 @@ Example response:
"id" : 10, "id" : 10,
"name" : "feature", "name" : "feature",
"color" : "#5843AD", "color" : "#5843AD",
"text_color" : "#FFFFFF",
"description":null, "description":null,
"open_issues_count": 0, "open_issues_count": 0,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -161,6 +167,7 @@ Example response: ...@@ -161,6 +167,7 @@ Example response:
"id" : 8, "id" : 8,
"name" : "docs", "name" : "docs",
"color" : "#8E44AD", "color" : "#8E44AD",
"text_color" : "#FFFFFF",
"description": "Documentation", "description": "Documentation",
"open_issues_count": 1, "open_issues_count": 1,
"closed_issues_count": 0, "closed_issues_count": 0,
...@@ -196,6 +203,7 @@ Example response: ...@@ -196,6 +203,7 @@ Example response:
"id" : 1, "id" : 1,
"name" : "bug", "name" : "bug",
"color" : "#d9534f", "color" : "#d9534f",
"text_color" : "#FFFFFF",
"description": "Bug reported by user", "description": "Bug reported by user",
"open_issues_count": 1, "open_issues_count": 1,
"closed_issues_count": 0, "closed_issues_count": 0,
......
...@@ -1003,7 +1003,7 @@ module API ...@@ -1003,7 +1003,7 @@ module API
end end
class LabelBasic < Grape::Entity class LabelBasic < Grape::Entity
expose :id, :name, :color, :description expose :id, :name, :color, :description, :text_color
end end
class Label < LabelBasic class Label < LabelBasic
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"id" : { "type": "integer" }, "id" : { "type": "integer" },
"name" : { "type": "string "}, "name" : { "type": "string "},
"color" : { "type": "string "}, "color" : { "type": "string "},
"text_color" : { "type": "string "},
"description" : { "type": "string "}, "description" : { "type": "string "},
"open_issues_count" : { "type": "integer "}, "open_issues_count" : { "type": "integer "},
"closed_issues_count" : { "type": "integer "}, "closed_issues_count" : { "type": "integer "},
......
...@@ -20,7 +20,7 @@ describe API::Labels do ...@@ -20,7 +20,7 @@ describe API::Labels do
create(:labeled_merge_request, labels: [priority_label], author: user, source_project: project ) create(:labeled_merge_request, labels: [priority_label], author: user, source_project: project )
expected_keys = %w( expected_keys = %w(
id name color description id name color text_color description
open_issues_count closed_issues_count open_merge_requests_count open_issues_count closed_issues_count open_merge_requests_count
subscribed priority subscribed priority
) )
...@@ -43,6 +43,7 @@ describe API::Labels do ...@@ -43,6 +43,7 @@ describe API::Labels do
expect(label1_response['open_merge_requests_count']).to eq(0) expect(label1_response['open_merge_requests_count']).to eq(0)
expect(label1_response['name']).to eq(label1.name) expect(label1_response['name']).to eq(label1.name)
expect(label1_response['color']).to be_present expect(label1_response['color']).to be_present
expect(label1_response['text_color']).to be_present
expect(label1_response['description']).to be_nil expect(label1_response['description']).to be_nil
expect(label1_response['priority']).to be_nil expect(label1_response['priority']).to be_nil
expect(label1_response['subscribed']).to be_falsey expect(label1_response['subscribed']).to be_falsey
...@@ -52,6 +53,7 @@ describe API::Labels do ...@@ -52,6 +53,7 @@ describe API::Labels do
expect(group_label_response['open_merge_requests_count']).to eq(0) expect(group_label_response['open_merge_requests_count']).to eq(0)
expect(group_label_response['name']).to eq(group_label.name) expect(group_label_response['name']).to eq(group_label.name)
expect(group_label_response['color']).to be_present expect(group_label_response['color']).to be_present
expect(group_label_response['text_color']).to be_present
expect(group_label_response['description']).to be_nil expect(group_label_response['description']).to be_nil
expect(group_label_response['priority']).to be_nil expect(group_label_response['priority']).to be_nil
expect(group_label_response['subscribed']).to be_falsey expect(group_label_response['subscribed']).to be_falsey
...@@ -61,6 +63,7 @@ describe API::Labels do ...@@ -61,6 +63,7 @@ describe API::Labels do
expect(priority_label_response['open_merge_requests_count']).to eq(1) expect(priority_label_response['open_merge_requests_count']).to eq(1)
expect(priority_label_response['name']).to eq(priority_label.name) expect(priority_label_response['name']).to eq(priority_label.name)
expect(priority_label_response['color']).to be_present expect(priority_label_response['color']).to be_present
expect(priority_label_response['text_color']).to be_present
expect(priority_label_response['description']).to be_nil expect(priority_label_response['description']).to be_nil
expect(priority_label_response['priority']).to eq(3) expect(priority_label_response['priority']).to eq(3)
expect(priority_label_response['subscribed']).to be_falsey expect(priority_label_response['subscribed']).to be_falsey
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment