Commit 7c21775a authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '321385-cablett-epic-board-weburl-webpath' into 'master'

Expose GraphQL web URL and path for epic boards

See merge request gitlab-org/gitlab!54277
parents 31a5664d a8b28dfe
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Types module Types
class BoardType < BaseObject class BoardType < BaseObject
graphql_name 'Board' graphql_name 'Board'
description 'Represents a project or group board' description 'Represents a project or group issue board'
accepts ::Board accepts ::Board
authorize :read_board authorize :read_board
......
...@@ -1603,7 +1603,7 @@ enum BlobViewersType { ...@@ -1603,7 +1603,7 @@ enum BlobViewersType {
} }
""" """
Represents a project or group board Represents a project or group issue board
""" """
type Board { type Board {
""" """
...@@ -9490,7 +9490,7 @@ type EpicBoard { ...@@ -9490,7 +9490,7 @@ type EpicBoard {
hideClosedList: Boolean hideClosedList: Boolean
""" """
Global ID of the board. Global ID of the epic board.
""" """
id: BoardsEpicBoardID! id: BoardsEpicBoardID!
...@@ -9525,9 +9525,19 @@ type EpicBoard { ...@@ -9525,9 +9525,19 @@ type EpicBoard {
): EpicListConnection ): EpicListConnection
""" """
Name of the board. Name of the epic board.
""" """
name: String name: String
"""
Web path of the epic board.
"""
webPath: String!
"""
Web URL of the epic board.
"""
webUrl: String!
} }
""" """
......
...@@ -4260,7 +4260,7 @@ ...@@ -4260,7 +4260,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "Board", "name": "Board",
"description": "Represents a project or group board", "description": "Represents a project or group issue board",
"fields": [ "fields": [
{ {
"name": "assignee", "name": "assignee",
...@@ -26126,7 +26126,7 @@ ...@@ -26126,7 +26126,7 @@
}, },
{ {
"name": "id", "name": "id",
"description": "Global ID of the board.", "description": "Global ID of the epic board.",
"args": [ "args": [
], ],
...@@ -26207,7 +26207,7 @@ ...@@ -26207,7 +26207,7 @@
}, },
{ {
"name": "name", "name": "name",
"description": "Name of the board.", "description": "Name of the epic board.",
"args": [ "args": [
], ],
...@@ -26218,6 +26218,42 @@ ...@@ -26218,6 +26218,42 @@
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "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, "inputFields": null,
...@@ -438,7 +438,7 @@ Autogenerated return type of AwardEmojiToggle. ...@@ -438,7 +438,7 @@ Autogenerated return type of AwardEmojiToggle.
### Board ### Board
Represents a project or group board. Represents a project or group issue board.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
...@@ -1699,9 +1699,11 @@ Represents an epic board. ...@@ -1699,9 +1699,11 @@ Represents an epic board.
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `hideBacklogList` | Boolean | Whether or not backlog list is hidden. | | `hideBacklogList` | Boolean | Whether or not backlog list is hidden. |
| `hideClosedList` | Boolean | Whether or not closed 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. | | `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 ### EpicBoardCreatePayload
......
...@@ -9,11 +9,13 @@ module Types ...@@ -9,11 +9,13 @@ module Types
accepts ::Boards::EpicBoard accepts ::Boards::EpicBoard
authorize :read_epic_board authorize :read_epic_board
present_using ::Boards::EpicBoardPresenter
field :id, type: ::Types::GlobalIDType[::Boards::EpicBoard], null: false, 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, 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, field :hide_backlog_list, type: GraphQL::BOOLEAN_TYPE, null: true,
description: 'Whether or not backlog list is hidden.' description: 'Whether or not backlog list is hidden.'
...@@ -27,6 +29,12 @@ module Types ...@@ -27,6 +29,12 @@ module Types
description: 'Epic board lists.', description: 'Epic board lists.',
extras: [:lookahead], extras: [:lookahead],
resolver: Resolvers::Boards::EpicListsResolver 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 end
end end
# frozen_string_literal: true
module Boards
class EpicBoardPresenter < Gitlab::View::Presenter::Delegated
presents :epic_board
end
end
...@@ -13,6 +13,8 @@ module EE ...@@ -13,6 +13,8 @@ module EE
case object.itself case object.itself
when Epic when Epic
instance.group_epic_url(object.group, object, **options) instance.group_epic_url(object.group, object, **options)
when ::Boards::EpicBoard
instance.group_epic_board_url(object.group, object, **options)
when Iteration when Iteration
instance.iteration_url(object, **options) instance.iteration_url(object, **options)
when ::Vulnerability when ::Vulnerability
......
...@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['EpicBoard'] do ...@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['EpicBoard'] do
specify { expect(described_class).to require_graphql_authorizations(:read_epic_board) } specify { expect(described_class).to require_graphql_authorizations(:read_epic_board) }
it 'has specific fields' do 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) expect(described_class).to include_graphql_fields(*expected_fields)
end end
......
...@@ -10,6 +10,7 @@ RSpec.describe Gitlab::UrlBuilder do ...@@ -10,6 +10,7 @@ RSpec.describe Gitlab::UrlBuilder do
where(:factory, :path_generator) do where(:factory, :path_generator) do
:epic | ->(epic) { "/groups/#{epic.group.full_path}/-/epics/#{epic.iid}" } :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}" } :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}" } :note_on_epic | ->(note) { "/groups/#{note.noteable.group.full_path}/-/epics/#{note.noteable.iid}#note_#{note.id}" }
......
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