Commit 28462a20 authored by Jarka Košanová's avatar Jarka Košanová

Manage and display labels from epic graphql

- add labels to epic_type
- Add and remove labels from UpdateEpic mutation
parent de65cca0
---
title: Manage and display labels from epic in the GraphQL API
merge_request: 19642
author:
type: added
...@@ -216,6 +216,11 @@ type CreateDiffNotePayload { ...@@ -216,6 +216,11 @@ type CreateDiffNotePayload {
Autogenerated input type of CreateEpic Autogenerated input type of CreateEpic
""" """
input CreateEpicInput { input CreateEpicInput {
"""
The IDs of labels to be added to the epic.
"""
addLabelIds: [ID!]
""" """
A unique identifier for the client performing the mutation. A unique identifier for the client performing the mutation.
""" """
...@@ -241,6 +246,11 @@ input CreateEpicInput { ...@@ -241,6 +246,11 @@ input CreateEpicInput {
""" """
groupPath: ID! groupPath: ID!
"""
The IDs of labels to be removed from the epic.
"""
removeLabelIds: [ID!]
""" """
The start date of the epic The start date of the epic
""" """
...@@ -1171,6 +1181,31 @@ type Epic implements Noteable { ...@@ -1171,6 +1181,31 @@ type Epic implements Noteable {
last: Int last: Int
): EpicIssueConnection ): EpicIssueConnection
"""
Labels assigned to the epic
"""
labels(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): LabelConnection
""" """
All notes on this noteable All notes on this noteable
""" """
...@@ -5025,6 +5060,11 @@ type TreeEntryEdge { ...@@ -5025,6 +5060,11 @@ type TreeEntryEdge {
Autogenerated input type of UpdateEpic Autogenerated input type of UpdateEpic
""" """
input UpdateEpicInput { input UpdateEpicInput {
"""
The IDs of labels to be added to the epic.
"""
addLabelIds: [ID!]
""" """
A unique identifier for the client performing the mutation. A unique identifier for the client performing the mutation.
""" """
...@@ -5055,6 +5095,11 @@ input UpdateEpicInput { ...@@ -5055,6 +5095,11 @@ input UpdateEpicInput {
""" """
iid: String! iid: String!
"""
The IDs of labels to be removed from the epic.
"""
removeLabelIds: [ID!]
""" """
The start date of the epic The start date of the epic
""" """
......
...@@ -3788,6 +3788,59 @@ ...@@ -3788,6 +3788,59 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "labels",
"description": "Labels assigned to the epic",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "LabelConnection",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "notes", "name": "notes",
"description": "All notes on this noteable", "description": "All notes on this noteable",
...@@ -6251,8 +6304,8 @@ ...@@ -6251,8 +6304,8 @@
}, },
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "UserConnection", "name": "LabelConnection",
"description": "The connection type for User.", "description": "The connection type for Label.",
"fields": [ "fields": [
{ {
"name": "edges", "name": "edges",
...@@ -6265,7 +6318,7 @@ ...@@ -6265,7 +6318,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "UserEdge", "name": "LabelEdge",
"ofType": null "ofType": null
} }
}, },
...@@ -6283,7 +6336,7 @@ ...@@ -6283,7 +6336,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "User", "name": "Label",
"ofType": null "ofType": null
} }
}, },
...@@ -6318,7 +6371,7 @@ ...@@ -6318,7 +6371,7 @@
}, },
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "UserEdge", "name": "LabelEdge",
"description": "An edge in a connection.", "description": "An edge in a connection.",
"fields": [ "fields": [
{ {
...@@ -6347,7 +6400,7 @@ ...@@ -6347,7 +6400,7 @@
], ],
"type": { "type": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "User", "name": "Label",
"ofType": null "ofType": null
}, },
"isDeprecated": false, "isDeprecated": false,
...@@ -6363,8 +6416,103 @@ ...@@ -6363,8 +6416,103 @@
}, },
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "EpicIssueConnection", "name": "Label",
"description": "The connection type for EpicIssue.", "description": null,
"fields": [
{
"name": "color",
"description": "Background color of the label",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "description",
"description": "Description of the label (markdown rendered as HTML for caching)",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "descriptionHtml",
"description": "The GitLab Flavored Markdown rendering of `description`",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "textColor",
"description": "Text color of the label",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "title",
"description": "Content of the label",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "UserConnection",
"description": "The connection type for User.",
"fields": [ "fields": [
{ {
"name": "edges", "name": "edges",
...@@ -6377,7 +6525,7 @@ ...@@ -6377,7 +6525,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "EpicIssueEdge", "name": "UserEdge",
"ofType": null "ofType": null
} }
}, },
...@@ -6395,7 +6543,7 @@ ...@@ -6395,7 +6543,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "EpicIssue", "name": "User",
"ofType": null "ofType": null
} }
}, },
...@@ -6430,7 +6578,7 @@ ...@@ -6430,7 +6578,7 @@
}, },
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "EpicIssueEdge", "name": "UserEdge",
"description": "An edge in a connection.", "description": "An edge in a connection.",
"fields": [ "fields": [
{ {
...@@ -6459,7 +6607,7 @@ ...@@ -6459,7 +6607,7 @@
], ],
"type": { "type": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "EpicIssue", "name": "User",
"ofType": null "ofType": null
}, },
"isDeprecated": false, "isDeprecated": false,
...@@ -6475,74 +6623,21 @@ ...@@ -6475,74 +6623,21 @@
}, },
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "EpicIssue", "name": "EpicIssueConnection",
"description": null, "description": "The connection type for EpicIssue.",
"fields": [ "fields": [
{ {
"name": "assignees", "name": "edges",
"description": "Assignees of the issue", "description": "A list of edges.",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "UserConnection",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "author",
"description": "User that created the issue",
"args": [ "args": [
], ],
"type": { "type": {
"kind": "NON_NULL", "kind": "LIST",
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "User", "name": "EpicIssueEdge",
"ofType": null "ofType": null
} }
}, },
...@@ -6550,22 +6645,26 @@ ...@@ -6550,22 +6645,26 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "closedAt", "name": "nodes",
"description": "Timestamp of when the issue was closed", "description": "A list of nodes.",
"args": [ "args": [
], ],
"type": { "type": {
"kind": "SCALAR", "kind": "LIST",
"name": "Time", "name": null,
"ofType": null "ofType": {
"kind": "OBJECT",
"name": "EpicIssue",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "confidential", "name": "pageInfo",
"description": "Indicates the issue is confidential", "description": "Information to aid in pagination.",
"args": [ "args": [
], ],
...@@ -6573,8 +6672,169 @@ ...@@ -6573,8 +6672,169 @@
"kind": "NON_NULL", "kind": "NON_NULL",
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "SCALAR", "kind": "OBJECT",
"name": "Boolean", "name": "PageInfo",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "EpicIssueEdge",
"description": "An edge in a connection.",
"fields": [
{
"name": "cursor",
"description": "A cursor for use in pagination.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "node",
"description": "The item at the end of the edge.",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "EpicIssue",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "EpicIssue",
"description": null,
"fields": [
{
"name": "assignees",
"description": "Assignees of the issue",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "UserConnection",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "author",
"description": "User that created the issue",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "User",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "closedAt",
"description": "Timestamp of when the issue was closed",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Time",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "confidential",
"description": "Indicates the issue is confidential",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null "ofType": null
} }
}, },
...@@ -7211,294 +7471,23 @@ ...@@ -7211,294 +7471,23 @@
"kind": "SCALAR", "kind": "SCALAR",
"name": "Int", "name": "Int",
"ofType": null "ofType": null
} }
}, },
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "userPermissions",
"description": "Permissions for the current user on the resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "IssuePermissions",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the issue",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL of the issue",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "weight",
"description": null,
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
{
"kind": "INTERFACE",
"name": "Noteable",
"ofType": null
}
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "IssuePermissions",
"description": "Check permissions for the current user on a issue",
"fields": [
{
"name": "adminIssue",
"description": "Whether or not a user can perform `admin_issue` on this resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "createDesign",
"description": "Whether or not a user can perform `create_design` on this resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "createNote",
"description": "Whether or not a user can perform `create_note` on this resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "destroyDesign",
"description": "Whether or not a user can perform `destroy_design` on this resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "readDesign",
"description": "Whether or not a user can perform `read_design` on this resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "readIssue",
"description": "Whether or not a user can perform `read_issue` on this resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "reopenIssue",
"description": "Whether or not a user can perform `reopen_issue` on this resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "updateIssue",
"description": "Whether or not a user can perform `update_issue` on this resource",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "IssueState",
"description": "State of a GitLab issue",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "opened",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "closed",
"description": null,
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "locked", "name": "userPermissions",
"description": null, "description": "Permissions for the current user on the resource",
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "LabelConnection",
"description": "The connection type for Label.",
"fields": [
{
"name": "edges",
"description": "A list of edges.",
"args": [ "args": [
], ],
"type": { "type": {
"kind": "LIST", "kind": "NON_NULL",
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "OBJECT",
"name": "LabelEdge", "name": "IssuePermissions",
"ofType": null "ofType": null
} }
}, },
...@@ -7506,17 +7495,17 @@ ...@@ -7506,17 +7495,17 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "nodes", "name": "webPath",
"description": "A list of nodes.", "description": "Web path of the issue",
"args": [ "args": [
], ],
"type": { "type": {
"kind": "LIST", "kind": "NON_NULL",
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "SCALAR",
"name": "Label", "name": "String",
"ofType": null "ofType": null
} }
}, },
...@@ -7524,8 +7513,8 @@ ...@@ -7524,8 +7513,8 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "pageInfo", "name": "webUrl",
"description": "Information to aid in pagination.", "description": "Web URL of the issue",
"args": [ "args": [
], ],
...@@ -7533,30 +7522,48 @@ ...@@ -7533,30 +7522,48 @@
"kind": "NON_NULL", "kind": "NON_NULL",
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "OBJECT", "kind": "SCALAR",
"name": "PageInfo", "name": "String",
"ofType": null "ofType": null
} }
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
},
{
"name": "weight",
"description": null,
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
} }
], ],
"inputFields": null, "inputFields": null,
"interfaces": [ "interfaces": [
{
"kind": "INTERFACE",
"name": "Noteable",
"ofType": null
}
], ],
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "LabelEdge", "name": "IssuePermissions",
"description": "An edge in a connection.", "description": "Check permissions for the current user on a issue",
"fields": [ "fields": [
{ {
"name": "cursor", "name": "adminIssue",
"description": "A cursor for use in pagination.", "description": "Whether or not a user can perform `admin_issue` on this resource",
"args": [ "args": [
], ],
...@@ -7565,7 +7572,7 @@ ...@@ -7565,7 +7572,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "SCALAR", "kind": "SCALAR",
"name": "String", "name": "Boolean",
"ofType": null "ofType": null
} }
}, },
...@@ -7573,35 +7580,44 @@ ...@@ -7573,35 +7580,44 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "node", "name": "createDesign",
"description": "The item at the end of the edge.", "description": "Whether or not a user can perform `create_design` on this resource",
"args": [ "args": [
], ],
"type": { "type": {
"kind": "OBJECT", "kind": "NON_NULL",
"name": "Label", "name": null,
"ofType": null "ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
} },
], {
"inputFields": null, "name": "createNote",
"interfaces": [ "description": "Whether or not a user can perform `create_note` on this resource",
"args": [
], ],
"enumValues": null, "type": {
"possibleTypes": null "kind": "NON_NULL",
}, "name": null,
{ "ofType": {
"kind": "OBJECT", "kind": "SCALAR",
"name": "Label", "name": "Boolean",
"description": null, "ofType": null
"fields": [ }
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "color", "name": "destroyDesign",
"description": "Background color of the label", "description": "Whether or not a user can perform `destroy_design` on this resource",
"args": [ "args": [
], ],
...@@ -7610,7 +7626,7 @@ ...@@ -7610,7 +7626,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "SCALAR", "kind": "SCALAR",
"name": "String", "name": "Boolean",
"ofType": null "ofType": null
} }
}, },
...@@ -7618,36 +7634,44 @@ ...@@ -7618,36 +7634,44 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "description", "name": "readDesign",
"description": "Description of the label (markdown rendered as HTML for caching)", "description": "Whether or not a user can perform `read_design` on this resource",
"args": [ "args": [
], ],
"type": { "type": {
"kind": "SCALAR", "kind": "NON_NULL",
"name": "String", "name": null,
"ofType": null "ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "descriptionHtml", "name": "readIssue",
"description": "The GitLab Flavored Markdown rendering of `description`", "description": "Whether or not a user can perform `read_issue` on this resource",
"args": [ "args": [
], ],
"type": { "type": {
"kind": "SCALAR", "kind": "NON_NULL",
"name": "String", "name": null,
"ofType": null "ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "textColor", "name": "reopenIssue",
"description": "Text color of the label", "description": "Whether or not a user can perform `reopen_issue` on this resource",
"args": [ "args": [
], ],
...@@ -7656,7 +7680,7 @@ ...@@ -7656,7 +7680,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "SCALAR", "kind": "SCALAR",
"name": "String", "name": "Boolean",
"ofType": null "ofType": null
} }
}, },
...@@ -7664,8 +7688,8 @@ ...@@ -7664,8 +7688,8 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "title", "name": "updateIssue",
"description": "Content of the label", "description": "Whether or not a user can perform `update_issue` on this resource",
"args": [ "args": [
], ],
...@@ -7674,7 +7698,7 @@ ...@@ -7674,7 +7698,7 @@
"name": null, "name": null,
"ofType": { "ofType": {
"kind": "SCALAR", "kind": "SCALAR",
"name": "String", "name": "Boolean",
"ofType": null "ofType": null
} }
}, },
...@@ -7689,6 +7713,35 @@ ...@@ -7689,6 +7713,35 @@
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "ENUM",
"name": "IssueState",
"description": "State of a GitLab issue",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "opened",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "closed",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "locked",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "Milestone", "name": "Milestone",
...@@ -16879,6 +16932,42 @@ ...@@ -16879,6 +16932,42 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "addLabelIds",
"description": "The IDs of labels to be added to the epic.",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
}
},
"defaultValue": null
},
{
"name": "removeLabelIds",
"description": "The IDs of labels to be removed from the epic.",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
}
},
"defaultValue": null
},
{ {
"name": "iid", "name": "iid",
"description": "The iid of the epic to mutate", "description": "The iid of the epic to mutate",
...@@ -17088,6 +17177,42 @@ ...@@ -17088,6 +17177,42 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "addLabelIds",
"description": "The IDs of labels to be added to the epic.",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
}
},
"defaultValue": null
},
{
"name": "removeLabelIds",
"description": "The IDs of labels to be removed from the epic.",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
}
},
"defaultValue": null
},
{ {
"name": "clientMutationId", "name": "clientMutationId",
"description": "A unique identifier for the client performing the mutation.", "description": "A unique identifier for the client performing the mutation.",
......
...@@ -38,6 +38,14 @@ module Mutations ...@@ -38,6 +38,14 @@ module Mutations
GraphQL::BOOLEAN_TYPE, GraphQL::BOOLEAN_TYPE,
required: false, required: false,
description: 'Indicates end date should be sourced from due_date_fixed field not the issue milestones' description: 'Indicates end date should be sourced from due_date_fixed field not the issue milestones'
argument :add_label_ids,
[GraphQL::ID_TYPE],
required: false,
description: 'The IDs of labels to be added to the epic.'
argument :remove_label_ids,
[GraphQL::ID_TYPE],
required: false,
description: 'The IDs of labels to be removed from the epic.'
end end
def validate_arguments!(args) def validate_arguments!(args)
......
...@@ -46,6 +46,8 @@ module Types ...@@ -46,6 +46,8 @@ module Types
::Types::EpicType.connection_type, ::Types::EpicType.connection_type,
null: true, null: true,
resolver: ::Resolvers::EpicResolver resolver: ::Resolvers::EpicResolver
field :labels, Types::LabelType.connection_type, null: true,
description: 'Labels assigned to the epic'
field :has_children, GraphQL::BOOLEAN_TYPE, null: false, method: :has_children? # rubocop:disable Graphql/Descriptions field :has_children, GraphQL::BOOLEAN_TYPE, null: false, method: :has_children? # rubocop:disable Graphql/Descriptions
field :has_issues, GraphQL::BOOLEAN_TYPE, null: false, method: :has_issues? # rubocop:disable Graphql/Descriptions field :has_issues, GraphQL::BOOLEAN_TYPE, null: false, method: :has_issues? # rubocop:disable Graphql/Descriptions
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe GitlabSchema.types['Epic'] do describe GitlabSchema.types['Epic'] do
let(:fields) do let(:fields) do
%i[ %i[
id iid title description state group parent author id iid title description state group parent author labels
start_date start_date_is_fixed start_date_fixed start_date_from_milestones start_date start_date_is_fixed start_date_fixed start_date_from_milestones
due_date due_date_is_fixed due_date_fixed due_date_from_milestones due_date due_date_is_fixed due_date_fixed due_date_from_milestones
closed_at created_at updated_at children has_children has_issues closed_at created_at updated_at children has_children has_issues
......
...@@ -7,7 +7,10 @@ describe 'Updating an Epic' do ...@@ -7,7 +7,10 @@ describe 'Updating an Epic' do
let_it_be(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
let_it_be(:group) { create(:group) } let_it_be(:group) { create(:group) }
let(:epic) { create(:epic, group: group, title: 'original title') } let(:label_1) { create(:group_label, group: group) }
let(:label_2) { create(:group_label, group: group) }
let(:label_3) { create(:group_label, group: group) }
let(:epic) { create(:epic, group: group, title: 'original title', labels: [label_2]) }
let(:attributes) do let(:attributes) do
{ {
...@@ -100,6 +103,15 @@ describe 'Updating an Epic' do ...@@ -100,6 +103,15 @@ describe 'Updating an Epic' do
end end
end end
context 'when changing labels of the epic' do
let(:attributes) { { add_label_ids: [label_1.id, label_3.id], remove_label_ids: label_2.id } }
it 'adds and removes labels correctly' do
post_graphql_mutation(mutation, current_user: current_user)
expect(epic.reload.labels).to match_array([label_1, label_3])
end
end
context 'when there are ActiveRecord validation errors' do context 'when there are ActiveRecord validation errors' do
let(:attributes) { { title: '' } } let(:attributes) { { title: '' } }
......
...@@ -606,6 +606,24 @@ describe Issues::UpdateService, :mailer do ...@@ -606,6 +606,24 @@ describe Issues::UpdateService, :mailer do
end end
end end
context 'when same id is passed as add_label_ids and remove_label_ids' do
let(:params) { { add_label_ids: [label.id], remove_label_ids: [label.id] } }
context 'for a label assigned to an issue' do
it 'removes the label' do
issue.update(labels: [label])
expect(result.label_ids).to be_empty
end
end
context 'for a label not assigned to an issue' do
it 'does not add the label' do
expect(result.label_ids).to be_empty
end
end
end
context 'when duplicate label titles are given' do context 'when duplicate label titles are given' do
let(:params) do let(:params) do
{ labels: [label3.title, label3.title] } { labels: [label3.title, label3.title] }
......
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