Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1d2e4ddb
Commit
1d2e4ddb
authored
Jan 06, 2021
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose web_url and web_path board fields
These fields can be used to get Web UI url/path for a board.
parent
a15b3fe1
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
83 additions
and
1 deletion
+83
-1
app/graphql/types/board_type.rb
app/graphql/types/board_type.rb
+8
-0
app/presenters/board_presenter.rb
app/presenters/board_presenter.rb
+5
-0
changelogs/unreleased/add_boards_url.yml
changelogs/unreleased/add_boards_url.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+10
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+36
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+2
-0
lib/gitlab/url_builder.rb
lib/gitlab/url_builder.rb
+10
-0
spec/factories/boards.rb
spec/factories/boards.rb
+4
-0
spec/graphql/types/board_type_spec.rb
spec/graphql/types/board_type_spec.rb
+1
-1
spec/lib/gitlab/url_builder_spec.rb
spec/lib/gitlab/url_builder_spec.rb
+2
-0
No files found.
app/graphql/types/board_type.rb
View file @
1d2e4ddb
...
...
@@ -7,6 +7,8 @@ module Types
accepts
::
Board
authorize
:read_board
present_using
BoardPresenter
field
:id
,
type:
GraphQL
::
ID_TYPE
,
null:
false
,
description:
'ID (global ID) of the board'
field
:name
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
...
...
@@ -24,6 +26,12 @@ module Types
description:
'Lists of the board'
,
resolver:
Resolvers
::
BoardListsResolver
,
extras:
[
:lookahead
]
field
:web_path
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web path of the board.'
field
:web_url
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web URL of the board.'
end
end
...
...
app/presenters/board_presenter.rb
0 → 100644
View file @
1d2e4ddb
# frozen_string_literal: true
class
BoardPresenter
<
Gitlab
::
View
::
Presenter
::
Delegated
presents
:board
end
changelogs/unreleased/add_boards_url.yml
0 → 100644
View file @
1d2e4ddb
---
title
:
Exposed web_path and web_url fields in Board's GraphQL API
merge_request
:
50947
author
:
type
:
added
doc/api/graphql/reference/gitlab_schema.graphql
View file @
1d2e4ddb
...
...
@@ -1380,6 +1380,16 @@ type Board {
"""
name
:
String
"""
Web
path
of
the
board
.
"""
webPath
:
String
!
"""
Web
URL
of
the
board
.
"""
webUrl
:
String
!
"""
Weight
of
the
board
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
1d2e4ddb
...
...
@@ -3637,6 +3637,42 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the 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 board.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "weight",
"description": "Weight of the board",
doc/api/graphql/reference/index.md
View file @
1d2e4ddb
...
...
@@ -252,6 +252,8 @@ Represents a project or group board.
|
`lists`
| BoardListConnection | Lists of the board |
|
`milestone`
| Milestone | The board milestone |
|
`name`
| String | Name of the board |
|
`webPath`
| String! | Web path of the board. |
|
`webUrl`
| String! | Web URL of the board. |
|
`weight`
| Int | Weight of the board |
### BoardEpic
...
...
lib/gitlab/url_builder.rb
View file @
1d2e4ddb
...
...
@@ -18,6 +18,8 @@ module Gitlab
def
build
(
object
,
**
options
)
# Objects are sometimes wrapped in a BatchLoader instance
case
object
.
itself
when
Board
board_url
(
object
,
**
options
)
when
::
Ci
::
Build
instance
.
project_job_url
(
object
.
project
,
object
,
**
options
)
when
Commit
...
...
@@ -52,6 +54,14 @@ module Gitlab
end
# rubocop:enable Metrics/CyclomaticComplexity
def
board_url
(
board
,
**
options
)
if
board
.
project_board?
instance
.
project_board_url
(
board
.
resource_parent
,
board
,
**
options
)
else
instance
.
group_board_url
(
board
.
resource_parent
,
board
,
**
options
)
end
end
def
commit_url
(
commit
,
**
options
)
return
''
unless
commit
.
project
...
...
spec/factories/boards.rb
View file @
1d2e4ddb
...
...
@@ -31,4 +31,8 @@ FactoryBot.define do
board
.
lists
.
create!
(
list_type: :closed
)
end
end
factory
:group_board
,
parent: :board
do
group
end
end
spec/graphql/types/board_type_spec.rb
View file @
1d2e4ddb
...
...
@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['Board'] do
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:read_board
)
}
it
'has specific fields'
do
expected_fields
=
%w[id name]
expected_fields
=
%w[id name
web_url web_path
]
expect
(
described_class
).
to
include_graphql_fields
(
*
expected_fields
)
end
...
...
spec/lib/gitlab/url_builder_spec.rb
View file @
1d2e4ddb
...
...
@@ -18,6 +18,8 @@ RSpec.describe Gitlab::UrlBuilder do
where
(
:factory
,
:path_generator
)
do
:project
|
->
(
project
)
{
"/
#{
project
.
full_path
}
"
}
:board
|
->
(
board
)
{
"/
#{
board
.
project
.
full_path
}
/-/boards/
#{
board
.
id
}
"
}
:group_board
|
->
(
board
)
{
"/groups/
#{
board
.
group
.
full_path
}
/-/boards/
#{
board
.
id
}
"
}
:commit
|
->
(
commit
)
{
"/
#{
commit
.
project
.
full_path
}
/-/commit/
#{
commit
.
id
}
"
}
:issue
|
->
(
issue
)
{
"/
#{
issue
.
project
.
full_path
}
/-/issues/
#{
issue
.
iid
}
"
}
:merge_request
|
->
(
merge_request
)
{
"/
#{
merge_request
.
project
.
full_path
}
/-/merge_requests/
#{
merge_request
.
iid
}
"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment