Skip to content
Snippets Groups Projects
Commit a8b28dfe authored by Charlie Ablett's avatar Charlie Ablett
Browse files

Expose GraphQL web URL and path for epic boards

- Add URL builder handler for Epic Boards
- Add epic board presenter
parent 00d64e00
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,7 +3,7 @@
module Types
class BoardType < BaseObject
graphql_name 'Board'
description 'Represents a project or group board'
description 'Represents a project or group issue board'
accepts ::Board
authorize :read_board
 
Loading
Loading
Loading
Loading
@@ -1528,7 +1528,7 @@ enum BlobViewersType {
}
 
"""
Represents a project or group board
Represents a project or group issue board
"""
type Board {
"""
Loading
Loading
@@ -9415,7 +9415,7 @@ type EpicBoard {
hideClosedList: Boolean
 
"""
Global ID of the board.
Global ID of the epic board.
"""
id: BoardsEpicBoardID!
 
Loading
Loading
@@ -9450,9 +9450,19 @@ type EpicBoard {
): EpicListConnection
 
"""
Name of the board.
Name of the epic board.
"""
name: String
"""
Web path of the epic board.
"""
webPath: String!
"""
Web URL of the epic board.
"""
webUrl: String!
}
 
"""
Loading
Loading
Loading
Loading
@@ -4013,7 +4013,7 @@
{
"kind": "OBJECT",
"name": "Board",
"description": "Represents a project or group board",
"description": "Represents a project or group issue board",
"fields": [
{
"name": "assignee",
Loading
Loading
@@ -25879,7 +25879,7 @@
},
{
"name": "id",
"description": "Global ID of the board.",
"description": "Global ID of the epic board.",
"args": [
 
],
Loading
Loading
@@ -25960,7 +25960,7 @@
},
{
"name": "name",
"description": "Name of the board.",
"description": "Name of the epic board.",
"args": [
 
],
Loading
Loading
@@ -25971,6 +25971,42 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the epic board.",
"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 epic board.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Loading
Loading
@@ -424,7 +424,7 @@ Autogenerated return type of AwardEmojiToggle.
 
### Board
 
Represents a project or group board.
Represents a project or group issue board.
 
| Field | Type | Description |
| ----- | ---- | ----------- |
Loading
Loading
@@ -1685,9 +1685,11 @@ Represents an epic board.
| ----- | ---- | ----------- |
| `hideBacklogList` | Boolean | Whether or not backlog list is hidden. |
| `hideClosedList` | Boolean | Whether or not closed list is hidden. |
| `id` | BoardsEpicBoardID! | Global ID of the board. |
| `id` | BoardsEpicBoardID! | Global ID of the epic board. |
| `lists` | EpicListConnection | Epic board lists. |
| `name` | String | Name of the board. |
| `name` | String | Name of the epic board. |
| `webPath` | String! | Web path of the epic board. |
| `webUrl` | String! | Web URL of the epic board. |
 
### EpicBoardCreatePayload
 
Loading
Loading
Loading
Loading
@@ -9,11 +9,13 @@ class EpicBoardType < BaseObject
accepts ::Boards::EpicBoard
authorize :read_epic_board
 
present_using ::Boards::EpicBoardPresenter
field :id, type: ::Types::GlobalIDType[::Boards::EpicBoard], null: false,
description: 'Global ID of the board.'
description: 'Global ID of the epic board.'
 
field :name, type: GraphQL::STRING_TYPE, null: true,
description: 'Name of the board.'
description: 'Name of the epic board.'
 
field :hide_backlog_list, type: GraphQL::BOOLEAN_TYPE, null: true,
description: 'Whether or not backlog list is hidden.'
Loading
Loading
@@ -27,6 +29,12 @@ class EpicBoardType < BaseObject
description: 'Epic board lists.',
extras: [:lookahead],
resolver: Resolvers::Boards::EpicListsResolver
field :web_path, GraphQL::STRING_TYPE, null: false,
description: 'Web path of the epic board.'
field :web_url, GraphQL::STRING_TYPE, null: false,
description: 'Web URL of the epic board.'
end
end
end
# frozen_string_literal: true
module Boards
class EpicBoardPresenter < Gitlab::View::Presenter::Delegated
presents :epic_board
end
end
Loading
Loading
@@ -13,6 +13,8 @@ def build(object, **options)
case object.itself
when Epic
instance.group_epic_url(object.group, object, **options)
when ::Boards::EpicBoard
instance.group_epic_board_url(object.group, object, **options)
when Iteration
instance.iteration_url(object, **options)
when ::Vulnerability
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@
specify { expect(described_class).to require_graphql_authorizations(:read_epic_board) }
 
it 'has specific fields' do
expected_fields = %w[id name lists hideBacklogList hideClosedList]
expected_fields = %w[id name lists hideBacklogList hideClosedList web_url web_path]
 
expect(described_class).to include_graphql_fields(*expected_fields)
end
Loading
Loading
Loading
Loading
@@ -10,6 +10,7 @@
 
where(:factory, :path_generator) do
:epic | ->(epic) { "/groups/#{epic.group.full_path}/-/epics/#{epic.iid}" }
:epic_board | ->(epic_board) { "/groups/#{epic_board.group.full_path}/-/epic_boards/#{epic_board.id}" }
:vulnerability | ->(vulnerability) { "/#{vulnerability.project.full_path}/-/security/vulnerabilities/#{vulnerability.id}" }
 
:note_on_epic | ->(note) { "/groups/#{note.noteable.group.full_path}/-/epics/#{note.noteable.iid}#note_#{note.id}" }
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment