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
7a075fa2
Commit
7a075fa2
authored
May 04, 2021
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor shared board action
Review feedback
parent
b6b99e4d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
17 deletions
+109
-17
app/assets/javascripts/boards/stores/actions.js
app/assets/javascripts/boards/stores/actions.js
+5
-2
ee/app/assets/javascripts/boards/constants.js
ee/app/assets/javascripts/boards/constants.js
+3
-3
ee/app/assets/javascripts/boards/stores/actions.js
ee/app/assets/javascripts/boards/stores/actions.js
+3
-9
ee/spec/frontend/boards/stores/actions_spec.js
ee/spec/frontend/boards/stores/actions_spec.js
+52
-1
spec/frontend/boards/stores/actions_spec.js
spec/frontend/boards/stores/actions_spec.js
+46
-2
No files found.
app/assets/javascripts/boards/stores/actions.js
View file @
7a075fa2
...
...
@@ -11,6 +11,7 @@ import {
deleteListQueries
,
listsQuery
,
updateListQueries
,
issuableTypes
,
}
from
'
ee_else_ce/boards/constants
'
;
import
createBoardListMutation
from
'
ee_else_ce/boards/graphql/board_list_create.mutation.graphql
'
;
import
issueMoveListMutation
from
'
ee_else_ce/boards/graphql/issue_move_list.mutation.graphql
'
;
...
...
@@ -92,8 +93,10 @@ export default {
fullPath
,
boardId
:
fullBoardId
,
filters
:
filterParams
,
...(
issuableType
===
issuableTypes
.
issue
&&
{
isGroup
:
boardType
===
BoardType
.
group
,
isProject
:
boardType
===
BoardType
.
project
,
}),
};
return
gqlClient
...
...
ee/app/assets/javascripts/boards/constants.js
View file @
7a075fa2
/* eslint-disable import/export */
import
{
issuableTypes
}
from
'
~/boards/constants
'
;
import
destroyBoardListMutation
from
'
~/boards/graphql/board_list_destroy.mutation.graphql
'
;
import
updateBoardListMutation
from
'
~/boards/graphql/board_list_update.mutation.graphql
'
;
...
...
@@ -9,6 +10,8 @@ import destroyEpicBoardListMutation from './graphql/epic_board_list_destroy.muta
import
updateEpicBoardListMutation
from
'
./graphql/epic_board_list_update.mutation.graphql
'
;
import
epicBoardListsQuery
from
'
./graphql/epic_board_lists.query.graphql
'
;
export
*
from
'
~/boards/constants
'
;
export
const
DRAGGABLE_TAG
=
'
div
'
;
export
const
EPIC_LANE_BASE_HEIGHT
=
40
;
...
...
@@ -63,9 +66,6 @@ export const ErrorMessages = {
),
};
/* eslint-disable import/export */
export
*
from
'
~/boards/constants
'
;
export
const
listsQuery
=
{
[
issuableTypes
.
issue
]:
{
query
:
boardListsQuery
,
...
...
ee/app/assets/javascripts/boards/stores/actions.js
View file @
7a075fa2
...
...
@@ -9,10 +9,9 @@ import {
import
{
BoardType
,
SupportedFilters
}
from
'
~/boards/constants
'
;
import
eventHub
from
'
~/boards/eventhub
'
;
import
listsIssuesQuery
from
'
~/boards/graphql/lists_issues.query.graphql
'
;
import
actionsCE
from
'
~/boards/stores/actions
'
;
import
actionsCE
,
{
gqlClient
}
from
'
~/boards/stores/actions
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
*
as
typesCE
from
'
~/boards/stores/mutation_types
'
;
import
createGqClient
,
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
historyPushState
,
...
...
@@ -58,13 +57,6 @@ const notImplemented = () => {
throw
new
Error
(
'
Not implemented!
'
);
};
export
const
gqlClient
=
createGqClient
(
{},
{
fetchPolicy
:
fetchPolicies
.
NO_CACHE
,
},
);
const
fetchAndFormatListIssues
=
(
state
,
extraVariables
)
=>
{
const
{
fullPath
,
boardId
,
boardType
,
filterParams
}
=
state
;
...
...
@@ -115,6 +107,8 @@ const fetchAndFormatListEpics = (state, extraVariables) => {
});
};
export
{
gqlClient
};
export
default
{
...
actionsCE
,
...
...
ee/spec/frontend/boards/stores/actions_spec.js
View file @
7a075fa2
...
...
@@ -2,7 +2,7 @@ import axios from 'axios';
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
GroupByParamType
}
from
'
ee/boards/constants
'
;
import
{
BoardType
,
GroupByParamType
,
listsQuery
,
issuableTypes
}
from
'
ee/boards/constants
'
;
import
actions
,
{
gqlClient
}
from
'
ee/boards/stores/actions
'
;
import
boardsStoreEE
from
'
ee/boards/stores/boards_store_ee
'
;
import
*
as
types
from
'
ee/boards/stores/mutation_types
'
;
...
...
@@ -152,6 +152,57 @@ describe('performSearch', () => {
});
});
describe
(
'
fetchLists
'
,
()
=>
{
const
queryResponse
=
{
data
:
{
group
:
{
board
:
{
hideBacklogList
:
true
,
lists
:
{
nodes
:
[
mockLists
[
1
]],
},
},
},
},
};
it
.
each
`
issuableType | boardType | fullBoardId | isGroup | isProject
${
issuableTypes
.
epic
}
|
${
BoardType
.
group
}
|
${
'
gid://gitlab/Boards::EpicBoard/1
'
}
|
${
undefined
}
|
${
undefined
}
`
(
'
calls $issuableType query with correct variables
'
,
async
({
issuableType
,
boardType
,
fullBoardId
,
isGroup
,
isProject
})
=>
{
const
commit
=
jest
.
fn
();
const
dispatch
=
jest
.
fn
();
const
state
=
{
fullPath
:
'
gitlab-org
'
,
fullBoardId
,
filterParams
:
{},
boardType
,
issuableType
,
};
const
variables
=
{
query
:
listsQuery
[
issuableType
].
query
,
variables
:
{
fullPath
:
'
gitlab-org
'
,
boardId
:
fullBoardId
,
filters
:
{},
isGroup
,
isProject
,
},
};
jest
.
spyOn
(
gqlClient
,
'
query
'
).
mockResolvedValue
(
queryResponse
);
await
actions
.
fetchLists
({
commit
,
state
,
dispatch
});
expect
(
gqlClient
.
query
).
toHaveBeenCalledWith
(
variables
);
},
);
});
describe
(
'
fetchEpicsSwimlanes
'
,
()
=>
{
const
state
=
{
fullPath
:
'
gitlab-org
'
,
...
...
spec/frontend/boards/stores/actions_spec.js
View file @
7a075fa2
import
*
as
Sentry
from
'
@sentry/browser
'
;
import
{
inactiveId
,
ISSUABLE
,
ListType
,
issuableTypes
,
BoardType
,
listsQuery
,
}
from
'
ee_else_ce/boards/constants
'
;
import
issueMoveListMutation
from
'
ee_else_ce/boards/graphql/issue_move_list.mutation.graphql
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
{
...
...
@@ -8,7 +16,6 @@ import {
formatIssue
,
getMoveData
,
}
from
'
~/boards/boards_util
'
;
import
{
inactiveId
,
ISSUABLE
,
ListType
,
issuableTypes
}
from
'
~/boards/constants
'
;
import
destroyBoardListMutation
from
'
~/boards/graphql/board_list_destroy.mutation.graphql
'
;
import
issueCreateMutation
from
'
~/boards/graphql/issue_create.mutation.graphql
'
;
import
actions
,
{
gqlClient
}
from
'
~/boards/stores/actions
'
;
...
...
@@ -131,7 +138,7 @@ describe('setActiveId', () => {
});
describe
(
'
fetchLists
'
,
()
=>
{
cons
t
state
=
{
le
t
state
=
{
fullPath
:
'
gitlab-org
'
,
fullBoardId
:
'
gid://gitlab/Board/1
'
,
filterParams
:
{},
...
...
@@ -218,6 +225,43 @@ describe('fetchLists', () => {
done
,
);
});
it
.
each
`
issuableType | boardType | fullBoardId | isGroup | isProject
${
issuableTypes
.
issue
}
|
${
BoardType
.
group
}
|
${
'
gid://gitlab/Board/1
'
}
|
${
true
}
|
${
false
}
${
issuableTypes
.
issue
}
|
${
BoardType
.
project
}
|
${
'
gid://gitlab/Board/1
'
}
|
${
false
}
|
${
true
}
`
(
'
calls $issuableType query with correct variables
'
,
async
({
issuableType
,
boardType
,
fullBoardId
,
isGroup
,
isProject
})
=>
{
const
commit
=
jest
.
fn
();
const
dispatch
=
jest
.
fn
();
state
=
{
fullPath
:
'
gitlab-org
'
,
fullBoardId
,
filterParams
:
{},
boardType
,
issuableType
,
};
const
variables
=
{
query
:
listsQuery
[
issuableType
].
query
,
variables
:
{
fullPath
:
'
gitlab-org
'
,
boardId
:
fullBoardId
,
filters
:
{},
isGroup
,
isProject
,
},
};
jest
.
spyOn
(
gqlClient
,
'
query
'
).
mockResolvedValue
(
queryResponse
);
await
actions
.
fetchLists
({
commit
,
state
,
dispatch
});
expect
(
gqlClient
.
query
).
toHaveBeenCalledWith
(
variables
);
},
);
});
describe
(
'
createList
'
,
()
=>
{
...
...
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