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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
02cc659e
Commit
02cc659e
authored
May 30, 2019
by
Winnie Hellmann
Committed by
Mike Greiling
May 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort by position in issue boards store addList()
parent
5e88463d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
17 deletions
+25
-17
app/assets/javascripts/boards/components/board_blank_state.vue
...ssets/javascripts/boards/components/board_blank_state.vue
+0
-3
app/assets/javascripts/boards/index.js
app/assets/javascripts/boards/index.js
+15
-11
app/assets/javascripts/boards/stores/boards_store.js
app/assets/javascripts/boards/stores/boards_store.js
+1
-3
spec/javascripts/boards/boards_store_spec.js
spec/javascripts/boards/boards_store_spec.js
+9
-0
No files found.
app/assets/javascripts/boards/components/board_blank_state.vue
View file @
02cc659e
<
script
>
<
script
>
/* global ListLabel */
/* global ListLabel */
import
_
from
'
underscore
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
...
@@ -29,8 +28,6 @@ export default {
...
@@ -29,8 +28,6 @@ export default {
});
});
});
});
boardsStore
.
state
.
lists
=
_
.
sortBy
(
boardsStore
.
state
.
lists
,
'
position
'
);
// Save the labels
// Save the labels
gl
.
boardService
gl
.
boardService
.
generateDefaultLists
()
.
generateDefaultLists
()
...
...
app/assets/javascripts/boards/index.js
View file @
02cc659e
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Flash
from
'
~/flash
'
;
import
Flash
from
'
~/flash
'
;
...
@@ -106,18 +105,23 @@ export default () => {
...
@@ -106,18 +105,23 @@ export default () => {
gl
.
boardService
gl
.
boardService
.
all
()
.
all
()
.
then
(
res
=>
res
.
data
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
.
then
(
lists
=>
{
data
.
forEach
(
board
=>
{
lists
.
forEach
(
listObj
=>
{
const
list
=
boardsStore
.
addList
(
board
,
this
.
defaultAvatar
);
let
{
position
}
=
listObj
;
if
(
listObj
.
list_type
===
'
closed
'
)
{
if
(
list
.
type
===
'
closed
'
)
{
position
=
Infinity
;
list
.
position
=
Infinity
;
}
else
if
(
listObj
.
list_type
===
'
backlog
'
)
{
}
else
if
(
list
.
type
===
'
backlog
'
)
{
position
=
-
1
;
list
.
position
=
-
1
;
}
}
});
this
.
state
.
lists
=
_
.
sortBy
(
this
.
state
.
lists
,
'
position
'
);
boardsStore
.
addList
(
{
...
listObj
,
position
,
},
this
.
defaultAvatar
,
);
});
boardsStore
.
addBlankState
();
boardsStore
.
addBlankState
();
this
.
loading
=
false
;
this
.
loading
=
false
;
...
...
app/assets/javascripts/boards/stores/boards_store.js
View file @
02cc659e
...
@@ -45,7 +45,7 @@ const boardsStore = {
...
@@ -45,7 +45,7 @@ const boardsStore = {
},
},
addList
(
listObj
,
defaultAvatar
)
{
addList
(
listObj
,
defaultAvatar
)
{
const
list
=
new
List
(
listObj
,
defaultAvatar
);
const
list
=
new
List
(
listObj
,
defaultAvatar
);
this
.
state
.
lists
.
push
(
list
);
this
.
state
.
lists
=
_
.
sortBy
([...
this
.
state
.
lists
,
list
],
'
position
'
);
return
list
;
return
list
;
},
},
...
@@ -82,8 +82,6 @@ const boardsStore = {
...
@@ -82,8 +82,6 @@ const boardsStore = {
title
:
__
(
'
Welcome to your Issue Board!
'
),
title
:
__
(
'
Welcome to your Issue Board!
'
),
position
:
0
,
position
:
0
,
});
});
this
.
state
.
lists
=
_
.
sortBy
(
this
.
state
.
lists
,
'
position
'
);
},
},
removeBlankState
()
{
removeBlankState
()
{
this
.
removeList
(
'
blank
'
);
this
.
removeList
(
'
blank
'
);
...
...
spec/javascripts/boards/boards_store_spec.js
View file @
02cc659e
...
@@ -44,6 +44,15 @@ describe('Store', () => {
...
@@ -44,6 +44,15 @@ describe('Store', () => {
expect
(
boardsStore
.
state
.
lists
.
length
).
toBe
(
0
);
expect
(
boardsStore
.
state
.
lists
.
length
).
toBe
(
0
);
});
});
describe
(
'
addList
'
,
()
=>
{
it
(
'
sorts by position
'
,
()
=>
{
boardsStore
.
addList
({
position
:
2
});
boardsStore
.
addList
({
position
:
1
});
expect
(
boardsStore
.
state
.
lists
[
0
].
position
).
toBe
(
1
);
});
});
describe
(
'
lists
'
,
()
=>
{
describe
(
'
lists
'
,
()
=>
{
it
(
'
creates new list without persisting to DB
'
,
()
=>
{
it
(
'
creates new list without persisting to DB
'
,
()
=>
{
boardsStore
.
addList
(
listObj
);
boardsStore
.
addList
(
listObj
);
...
...
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