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
4cd0c645
Commit
4cd0c645
authored
Feb 15, 2022
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue boards - Fetch recent board in GraphQL
Review feedback
parent
6be6c776
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
39 deletions
+31
-39
app/helpers/boards_helper.rb
app/helpers/boards_helper.rb
+0
-5
ee/app/helpers/ee/boards_helper.rb
ee/app/helpers/ee/boards_helper.rb
+0
-7
ee/spec/frontend/boards/components/boards_selector_spec.js
ee/spec/frontend/boards/components/boards_selector_spec.js
+1
-1
spec/frontend/boards/components/boards_selector_spec.js
spec/frontend/boards/components/boards_selector_spec.js
+21
-18
spec/frontend/boards/mock_data.js
spec/frontend/boards/mock_data.js
+9
-8
No files found.
app/helpers/boards_helper.rb
View file @
4cd0c645
...
...
@@ -17,7 +17,6 @@ module BoardsHelper
can_update:
can_update?
.
to_s
,
can_admin_list:
can_admin_list?
.
to_s
,
time_tracking_limit_to_hours:
Gitlab
::
CurrentSettings
.
time_tracking_limit_to_hours
.
to_s
,
recent_boards_endpoint:
recent_boards_path
,
parent:
current_board_parent
.
model_name
.
param_key
,
group_id:
group_id
,
labels_filter_base_path:
build_issue_link_base
,
...
...
@@ -128,10 +127,6 @@ module BoardsHelper
}
end
def
recent_boards_path
recent_project_boards_path
(
@project
)
if
current_board_parent
.
is_a?
(
Project
)
end
def
serializer
CurrentBoardSerializer
.
new
end
...
...
ee/app/helpers/ee/boards_helper.rb
View file @
4cd0c645
...
...
@@ -84,12 +84,5 @@ module EE
super
end
override
:recent_boards_path
def
recent_boards_path
return
recent_group_boards_path
(
@group
)
if
current_board_parent
.
is_a?
(
Group
)
super
end
end
end
ee/spec/frontend/boards/components/boards_selector_spec.js
View file @
4cd0c645
...
...
@@ -52,7 +52,7 @@ describe('BoardsSelector', () => {
});
};
const
findDropdown
=
()
=>
wrapper
.
find
(
GlDropdown
);
const
findDropdown
=
()
=>
wrapper
.
find
Component
(
GlDropdown
);
const
projectBoardQueryHandlerSuccess
=
jest
.
fn
().
mockResolvedValue
(
mockProjectBoardResponse
);
const
groupBoardQueryHandlerSuccess
=
jest
.
fn
().
mockResolvedValue
(
mockGroupBoardResponse
);
...
...
spec/frontend/boards/components/boards_selector_spec.js
View file @
4cd0c645
...
...
@@ -21,8 +21,8 @@ import {
mockProjectAllBoardsResponse
,
mockGroupRecentBoardsResponse
,
mockProjectRecentBoardsResponse
,
mockSmall
Group
AllBoardsResponse
,
mockEmpty
Group
RecentBoardsResponse
,
mockSmall
Project
AllBoardsResponse
,
mockEmpty
Project
RecentBoardsResponse
,
boards
,
recentIssueBoards
,
}
from
'
../mock_data
'
;
...
...
@@ -60,9 +60,9 @@ describe('BoardsSelector', () => {
};
const
getDropdownItems
=
()
=>
wrapper
.
findAll
(
'
.js-dropdown-item
'
);
const
getDropdownHeaders
=
()
=>
wrapper
.
findAll
(
GlDropdownSectionHeader
);
const
getLoadingIcon
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
findDropdown
=
()
=>
wrapper
.
find
(
GlDropdown
);
const
getDropdownHeaders
=
()
=>
wrapper
.
findAll
Components
(
GlDropdownSectionHeader
);
const
getLoadingIcon
=
()
=>
wrapper
.
find
Component
(
GlLoadingIcon
);
const
findDropdown
=
()
=>
wrapper
.
find
Component
(
GlDropdown
);
const
projectBoardQueryHandlerSuccess
=
jest
.
fn
().
mockResolvedValue
(
mockProjectBoardResponse
);
const
groupBoardQueryHandlerSuccess
=
jest
.
fn
().
mockResolvedValue
(
mockGroupBoardResponse
);
...
...
@@ -81,22 +81,22 @@ describe('BoardsSelector', () => {
const
smallBoardsQueryHandlerSuccess
=
jest
.
fn
()
.
mockResolvedValue
(
mockSmall
Group
AllBoardsResponse
);
.
mockResolvedValue
(
mockSmall
Project
AllBoardsResponse
);
const
emptyRecentBoardsQueryHandlerSuccess
=
jest
.
fn
()
.
mockResolvedValue
(
mockEmpty
Group
RecentBoardsResponse
);
.
mockResolvedValue
(
mockEmpty
Project
RecentBoardsResponse
);
const
createComponent
=
({
groupBoardsQueryHandler
=
group
BoardsQueryHandlerSuccess
,
groupRecentBoardsQueryHandler
=
group
RecentBoardsQueryHandlerSuccess
,
projectBoardsQueryHandler
=
project
BoardsQueryHandlerSuccess
,
projectRecentBoardsQueryHandler
=
project
RecentBoardsQueryHandlerSuccess
,
}
=
{})
=>
{
fakeApollo
=
createMockApollo
([
[
projectBoardQuery
,
projectBoardQueryHandlerSuccess
],
[
groupBoardQuery
,
groupBoardQueryHandlerSuccess
],
[
projectBoardsQuery
,
projectBoardsQueryHandler
Success
],
[
groupBoardsQuery
,
groupBoardsQueryHandler
],
[
projectRecentBoardsQuery
,
projectRecentBoardsQueryHandler
Success
],
[
groupRecentBoardsQuery
,
groupRecentBoardsQueryHandler
],
[
projectBoardsQuery
,
projectBoardsQueryHandler
],
[
groupBoardsQuery
,
groupBoardsQueryHandler
Success
],
[
projectRecentBoardsQuery
,
projectRecentBoardsQueryHandler
],
[
groupRecentBoardsQuery
,
groupRecentBoardsQueryHandler
Success
],
]);
wrapper
=
mount
(
BoardsSelector
,
{
...
...
@@ -120,11 +120,12 @@ describe('BoardsSelector', () => {
afterEach
(()
=>
{
wrapper
.
destroy
();
fakeApollo
=
null
;
});
describe
(
'
template
'
,
()
=>
{
beforeEach
(()
=>
{
createStore
({
is
Group
Board
:
true
});
createStore
({
is
Project
Board
:
true
});
createComponent
();
});
...
...
@@ -156,7 +157,7 @@ describe('BoardsSelector', () => {
});
it
(
'
fetches all issue boards
'
,
()
=>
{
expect
(
group
BoardsQueryHandlerSuccess
).
toHaveBeenCalled
();
expect
(
project
BoardsQueryHandlerSuccess
).
toHaveBeenCalled
();
});
it
(
'
hides loading spinner
'
,
async
()
=>
{
...
...
@@ -196,19 +197,21 @@ describe('BoardsSelector', () => {
describe
(
'
recent boards section
'
,
()
=>
{
it
(
'
shows only when boards are greater than 10
'
,
async
()
=>
{
await
nextTick
();
expect
(
group
RecentBoardsQueryHandlerSuccess
).
toHaveBeenCalled
();
expect
(
project
RecentBoardsQueryHandlerSuccess
).
toHaveBeenCalled
();
expect
(
getDropdownHeaders
()).
toHaveLength
(
2
);
});
it
(
'
does not show when boards are less than 10
'
,
async
()
=>
{
createComponent
({
group
BoardsQueryHandler
:
smallBoardsQueryHandlerSuccess
});
createComponent
({
project
BoardsQueryHandler
:
smallBoardsQueryHandlerSuccess
});
await
nextTick
();
expect
(
getDropdownHeaders
()).
toHaveLength
(
0
);
});
it
(
'
does not show when recentIssueBoards api returns empty array
'
,
async
()
=>
{
createComponent
({
groupRecentBoardsQueryHandler
:
emptyRecentBoardsQueryHandlerSuccess
});
createComponent
({
projectRecentBoardsQueryHandler
:
emptyRecentBoardsQueryHandlerSuccess
,
});
await
nextTick
();
expect
(
getDropdownHeaders
()).
toHaveLength
(
0
);
...
...
spec/frontend/boards/mock_data.js
View file @
4cd0c645
...
...
@@ -39,6 +39,7 @@ function boardGenerator(n) {
id
,
name
,
weight
:
0
,
__typename
:
'
Board
'
,
},
};
});
...
...
@@ -47,22 +48,22 @@ function boardGenerator(n) {
export
const
boards
=
boardGenerator
(
20
);
export
const
recentIssueBoards
=
boardGenerator
(
5
);
export
const
mockSmall
Group
AllBoardsResponse
=
{
export
const
mockSmall
Project
AllBoardsResponse
=
{
data
:
{
group
:
{
id
:
'
gid://gitlab/
Group
/114
'
,
project
:
{
id
:
'
gid://gitlab/
Project
/114
'
,
boards
:
{
edges
:
boardGenerator
(
3
)
},
__typename
:
'
Group
'
,
__typename
:
'
Project
'
,
},
},
};
export
const
mockEmpty
Group
RecentBoardsResponse
=
{
export
const
mockEmpty
Project
RecentBoardsResponse
=
{
data
:
{
group
:
{
id
:
'
gid://gitlab/
Group
/114
'
,
project
:
{
id
:
'
gid://gitlab/
Project
/114
'
,
recentIssueBoards
:
{
edges
:
[]
},
__typename
:
'
Group
'
,
__typename
:
'
Project
'
,
},
},
};
...
...
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