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
912eb3ad
Commit
912eb3ad
authored
Nov 21, 2019
by
Marvin Karegyeya
Committed by
Martin Wortschack
Nov 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all references of BoardService in the list.js file
parent
69268559
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
29 deletions
+28
-29
app/assets/javascripts/boards/models/list.js
app/assets/javascripts/boards/models/list.js
+12
-14
changelogs/unreleased/Update-boards-models-list-js-to-use-boardsStore.yml
...eased/Update-boards-models-list-js-to-use-boardsStore.yml
+5
-0
spec/javascripts/boards/boards_store_spec.js
spec/javascripts/boards/boards_store_spec.js
+7
-8
spec/javascripts/boards/list_spec.js
spec/javascripts/boards/list_spec.js
+4
-7
No files found.
app/assets/javascripts/boards/models/list.js
View file @
912eb3ad
...
...
@@ -93,7 +93,7 @@ class List {
entityType
=
'
milestone_id
'
;
}
return
gl
.
boardServic
e
return
boardsStor
e
.
createList
(
entity
.
id
,
entityType
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
...
...
@@ -111,14 +111,14 @@ class List {
boardsStore
.
state
.
lists
.
splice
(
index
,
1
);
boardsStore
.
updateNewListDropdown
(
this
.
id
);
gl
.
boardServic
e
.
destroyList
(
this
.
id
).
catch
(()
=>
{
boardsStor
e
.
destroyList
(
this
.
id
).
catch
(()
=>
{
// TODO: handle request error
});
}
update
()
{
const
collapsed
=
!
this
.
isExpanded
;
return
gl
.
boardServic
e
.
updateList
(
this
.
id
,
this
.
position
,
collapsed
).
catch
(()
=>
{
return
boardsStor
e
.
updateList
(
this
.
id
,
this
.
position
,
collapsed
).
catch
(()
=>
{
// TODO: handle request error
});
}
...
...
@@ -147,7 +147,7 @@ class List {
this
.
loading
=
true
;
}
return
gl
.
boardServic
e
return
boardsStor
e
.
getIssuesForList
(
this
.
id
,
data
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
...
...
@@ -168,7 +168,7 @@ class List {
this
.
addIssue
(
issue
,
null
,
0
);
this
.
issuesSize
+=
1
;
return
gl
.
boardServic
e
return
boardsStor
e
.
newIssue
(
this
.
id
,
issue
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
this
.
onNewIssueResponse
(
issue
,
data
));
...
...
@@ -276,7 +276,7 @@ class List {
this
.
issues
.
splice
(
oldIndex
,
1
);
this
.
issues
.
splice
(
newIndex
,
0
,
issue
);
gl
.
boardServic
e
.
moveIssue
(
issue
.
id
,
null
,
null
,
moveBeforeId
,
moveAfterId
).
catch
(()
=>
{
boardsStor
e
.
moveIssue
(
issue
.
id
,
null
,
null
,
moveBeforeId
,
moveAfterId
).
catch
(()
=>
{
// TODO: handle request error
});
}
...
...
@@ -287,7 +287,7 @@ class List {
});
this
.
issues
.
splice
(
newIndex
,
0
,
...
issues
);
gl
.
boardServic
e
boardsStor
e
.
moveMultipleIssues
({
ids
:
issues
.
map
(
issue
=>
issue
.
id
),
fromListId
:
null
,
...
...
@@ -299,15 +299,13 @@ class List {
}
updateIssueLabel
(
issue
,
listFrom
,
moveBeforeId
,
moveAfterId
)
{
gl
.
boardService
.
moveIssue
(
issue
.
id
,
listFrom
.
id
,
this
.
id
,
moveBeforeId
,
moveAfterId
)
.
catch
(()
=>
{
// TODO: handle request error
});
boardsStore
.
moveIssue
(
issue
.
id
,
listFrom
.
id
,
this
.
id
,
moveBeforeId
,
moveAfterId
).
catch
(()
=>
{
// TODO: handle request error
});
}
updateMultipleIssues
(
issues
,
listFrom
,
moveBeforeId
,
moveAfterId
)
{
gl
.
boardServic
e
boardsStor
e
.
moveMultipleIssues
({
ids
:
issues
.
map
(
issue
=>
issue
.
id
),
fromListId
:
listFrom
.
id
,
...
...
@@ -359,7 +357,7 @@ class List {
if
(
this
.
issuesSize
>
1
)
{
const
moveBeforeId
=
this
.
issues
[
1
].
id
;
gl
.
boardServic
e
.
moveIssue
(
issue
.
id
,
null
,
null
,
null
,
moveBeforeId
);
boardsStor
e
.
moveIssue
(
issue
.
id
,
null
,
null
,
null
,
moveBeforeId
);
}
}
}
...
...
changelogs/unreleased/Update-boards-models-list-js-to-use-boardsStore.yml
0 → 100644
View file @
912eb3ad
---
title
:
Removes references of BoardService in list file
merge_request
:
20145
author
:
nuwe1
type
:
other
spec/javascripts/boards/boards_store_spec.js
View file @
912eb3ad
...
...
@@ -11,7 +11,7 @@ import '~/boards/models/list';
import
'
~/boards/services/board_service
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
eventHub
from
'
~/boards/eventhub
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
}
from
'
./mock_data
'
;
import
waitForPromises
from
'
../../frontend/helpers/wait_for_promises
'
;
describe
(
'
Store
'
,
()
=>
{
...
...
@@ -20,17 +20,16 @@ describe('Store', () => {
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
gl
.
boardService
=
mockBoardService
();
boardsStore
.
create
();
spyOn
(
gl
.
boardServic
e
,
'
moveIssue
'
).
and
.
callFake
(
spyOn
(
boardsStor
e
,
'
moveIssue
'
).
and
.
callFake
(
()
=>
new
Promise
(
resolve
=>
{
resolve
();
}),
);
spyOn
(
gl
.
boardServic
e
,
'
moveMultipleIssues
'
).
and
.
callFake
(
spyOn
(
boardsStor
e
,
'
moveMultipleIssues
'
).
and
.
callFake
(
()
=>
new
Promise
(
resolve
=>
{
resolve
();
...
...
@@ -263,7 +262,7 @@ describe('Store', () => {
expect
(
listOne
.
issues
.
length
).
toBe
(
0
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
2
);
expect
(
listTwo
.
issues
[
0
].
id
).
toBe
(
2
);
expect
(
gl
.
boardServic
e
.
moveIssue
).
toHaveBeenCalledWith
(
2
,
listOne
.
id
,
listTwo
.
id
,
null
,
1
);
expect
(
boardsStor
e
.
moveIssue
).
toHaveBeenCalledWith
(
2
,
listOne
.
id
,
listTwo
.
id
,
null
,
1
);
done
();
},
0
);
...
...
@@ -286,7 +285,7 @@ describe('Store', () => {
expect
(
listOne
.
issues
.
length
).
toBe
(
0
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
2
);
expect
(
listTwo
.
issues
[
1
].
id
).
toBe
(
2
);
expect
(
gl
.
boardServic
e
.
moveIssue
).
toHaveBeenCalledWith
(
2
,
listOne
.
id
,
listTwo
.
id
,
1
,
null
);
expect
(
boardsStor
e
.
moveIssue
).
toHaveBeenCalledWith
(
2
,
listOne
.
id
,
listTwo
.
id
,
1
,
null
);
done
();
},
0
);
...
...
@@ -311,7 +310,7 @@ describe('Store', () => {
boardsStore
.
moveIssueInList
(
list
,
issue
,
0
,
1
,
[
1
,
2
]);
expect
(
list
.
issues
[
0
].
id
).
toBe
(
2
);
expect
(
gl
.
boardServic
e
.
moveIssue
).
toHaveBeenCalledWith
(
2
,
null
,
null
,
1
,
null
);
expect
(
boardsStor
e
.
moveIssue
).
toHaveBeenCalledWith
(
2
,
null
,
null
,
1
,
null
);
done
();
});
...
...
@@ -495,7 +494,7 @@ describe('Store', () => {
expect
(
list
.
issues
[
0
].
id
).
toBe
(
issue1
.
id
);
expect
(
gl
.
boardServic
e
.
moveMultipleIssues
).
toHaveBeenCalledWith
({
expect
(
boardsStor
e
.
moveMultipleIssues
).
toHaveBeenCalledWith
({
ids
:
[
issue1
.
id
,
issue2
.
id
],
fromListId
:
null
,
toListId
:
null
,
...
...
spec/javascripts/boards/list_spec.js
View file @
912eb3ad
...
...
@@ -12,7 +12,7 @@ import '~/boards/models/issue';
import
'
~/boards/models/list
'
;
import
'
~/boards/services/board_service
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
}
from
'
./mock_data
'
;
describe
(
'
List model
'
,
()
=>
{
let
list
;
...
...
@@ -21,9 +21,6 @@ describe('List model', () => {
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
gl
.
boardService
=
mockBoardService
({
bulkUpdatePath
:
'
/test/issue-boards/board/1/lists
'
,
});
boardsStore
.
create
();
list
=
new
List
(
listObj
);
...
...
@@ -110,11 +107,11 @@ describe('List model', () => {
list
.
issues
.
push
(
issue
);
listDup
.
issues
.
push
(
issue
);
spyOn
(
gl
.
boardServic
e
,
'
moveIssue
'
).
and
.
callThrough
();
spyOn
(
boardsStor
e
,
'
moveIssue
'
).
and
.
callThrough
();
listDup
.
updateIssueLabel
(
issue
,
list
);
expect
(
gl
.
boardServic
e
.
moveIssue
).
toHaveBeenCalledWith
(
expect
(
boardsStor
e
.
moveIssue
).
toHaveBeenCalledWith
(
issue
.
id
,
list
.
id
,
listDup
.
id
,
...
...
@@ -172,7 +169,7 @@ describe('List model', () => {
describe
(
'
newIssue
'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
gl
.
boardServic
e
,
'
newIssue
'
).
and
.
returnValue
(
spyOn
(
boardsStor
e
,
'
newIssue
'
).
and
.
returnValue
(
Promise
.
resolve
({
data
:
{
id
:
42
,
...
...
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