Commit 01317b53 authored by Magdalena Frankiewicz's avatar Magdalena Frankiewicz

Get lables count instead of labels

It seems throughput table does not need labels
but just the counts of labels for MRs
Use CountableConnectionType in LabelType
parent 4209bebf
...@@ -4,6 +4,8 @@ module Types ...@@ -4,6 +4,8 @@ module Types
class LabelType < BaseObject class LabelType < BaseObject
graphql_name 'Label' graphql_name 'Label'
connection_type_class(Types::CountableConnectionType)
authorize :read_label authorize :read_label
field :id, GraphQL::ID_TYPE, null: false, field :id, GraphQL::ID_TYPE, null: false,
......
...@@ -9851,6 +9851,11 @@ type Label { ...@@ -9851,6 +9851,11 @@ type Label {
The connection type for Label. The connection type for Label.
""" """
type LabelConnection { type LabelConnection {
"""
Total count of collection
"""
count: Int!
""" """
A list of edges. A list of edges.
""" """
......
...@@ -27142,6 +27142,24 @@ ...@@ -27142,6 +27142,24 @@
"name": "LabelConnection", "name": "LabelConnection",
"description": "The connection type for Label.", "description": "The connection type for Label.",
"fields": [ "fields": [
{
"name": "count",
"description": "Total count of collection",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "edges", "name": "edges",
"description": "A list of edges.", "description": "A list of edges.",
...@@ -283,10 +283,10 @@ export default { ...@@ -283,10 +283,10 @@ export default {
</li> </li>
<li <li
class="gl-mr-3 gl-display-flex gl-align-items-center" class="gl-mr-3 gl-display-flex gl-align-items-center"
:class="{ 'gl-opacity-5': !item.labels.nodes.length }" :class="{ 'gl-opacity-5': !item.labels.count }"
:data-testid="$options.testIds.LABEL_DETAILS" :data-testid="$options.testIds.LABEL_DETAILS"
> >
<gl-icon name="label" class="gl-mr-1" /><span>{{ item.labels.nodes.length }}</span> <gl-icon name="label" class="gl-mr-1" /><span>{{ item.labels.count }}</span>
</li> </li>
<li <li
class="gl-mr-3 gl-display-flex gl-align-items-center" class="gl-mr-3 gl-display-flex gl-align-items-center"
......
...@@ -54,10 +54,8 @@ query getThroughputTableData( ...@@ -54,10 +54,8 @@ query getThroughputTableData(
additions additions
deletions deletions
} }
labels { labels(first: 0) {
nodes { count
title
}
} }
pipelines { pipelines {
nodes { nodes {
......
...@@ -215,7 +215,7 @@ describe('ThroughputTable', () => { ...@@ -215,7 +215,7 @@ describe('ThroughputTable', () => {
it('includes an active label icon and count when available', async () => { it('includes an active label icon and count when available', async () => {
additionalData({ additionalData({
labels: { labels: {
nodes: [{ title: 'Brinix' }], count: 1,
}, },
}); });
......
...@@ -84,7 +84,7 @@ export const throughputTableData = [ ...@@ -84,7 +84,7 @@ export const throughputTableData = [
}, },
diffStatsSummary: { additions: 2, deletions: 1 }, diffStatsSummary: { additions: 2, deletions: 1 },
labels: { labels: {
nodes: [], count: 0,
}, },
pipelines: { pipelines: {
nodes: [], nodes: [],
......
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