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
class LabelType < BaseObject
graphql_name 'Label'
connection_type_class(Types::CountableConnectionType)
authorize :read_label
field :id, GraphQL::ID_TYPE, null: false,
......
......@@ -9851,6 +9851,11 @@ type Label {
The connection type for Label.
"""
type LabelConnection {
"""
Total count of collection
"""
count: Int!
"""
A list of edges.
"""
......
......@@ -27142,6 +27142,24 @@
"name": "LabelConnection",
"description": "The connection type for Label.",
"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",
"description": "A list of edges.",
......@@ -283,10 +283,10 @@ export default {
</li>
<li
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"
>
<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
class="gl-mr-3 gl-display-flex gl-align-items-center"
......
......@@ -54,10 +54,8 @@ query getThroughputTableData(
additions
deletions
}
labels {
nodes {
title
}
labels(first: 0) {
count
}
pipelines {
nodes {
......
......@@ -215,7 +215,7 @@ describe('ThroughputTable', () => {
it('includes an active label icon and count when available', async () => {
additionalData({
labels: {
nodes: [{ title: 'Brinix' }],
count: 1,
},
});
......
......@@ -84,7 +84,7 @@ export const throughputTableData = [
},
diffStatsSummary: { additions: 2, deletions: 1 },
labels: {
nodes: [],
count: 0,
},
pipelines: {
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