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
a0189744
Commit
a0189744
authored
Oct 10, 2018
by
Mike Greiling
Committed by
Fatih Acet
Oct 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert remaining issue board components into ES module syntax
parent
62bd3045
Changes
31
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
261 additions
and
261 deletions
+261
-261
app/assets/javascripts/boards/components/board.js
app/assets/javascripts/boards/components/board.js
+13
-16
app/assets/javascripts/boards/components/board_blank_state.vue
...ssets/javascripts/boards/components/board_blank_state.vue
+7
-8
app/assets/javascripts/boards/components/board_card.vue
app/assets/javascripts/boards/components/board_card.vue
+4
-5
app/assets/javascripts/boards/components/board_delete.js
app/assets/javascripts/boards/components/board_delete.js
+5
-9
app/assets/javascripts/boards/components/board_list.vue
app/assets/javascripts/boards/components/board_list.vue
+38
-29
app/assets/javascripts/boards/components/board_new_issue.vue
app/assets/javascripts/boards/components/board_new_issue.vue
+3
-4
app/assets/javascripts/boards/components/board_sidebar.js
app/assets/javascripts/boards/components/board_sidebar.js
+7
-11
app/assets/javascripts/boards/components/issue_card_inner.vue
...assets/javascripts/boards/components/issue_card_inner.vue
+4
-5
app/assets/javascripts/boards/components/modal/footer.vue
app/assets/javascripts/boards/components/modal/footer.vue
+2
-1
app/assets/javascripts/boards/components/modal/lists_dropdown.vue
...ts/javascripts/boards/components/modal/lists_dropdown.vue
+2
-1
app/assets/javascripts/boards/components/new_list_dropdown.js
...assets/javascripts/boards/components/new_list_dropdown.js
+10
-14
app/assets/javascripts/boards/components/sidebar/remove_issue.vue
...ts/javascripts/boards/components/sidebar/remove_issue.vue
+2
-3
app/assets/javascripts/boards/filtered_search_boards.js
app/assets/javascripts/boards/filtered_search_boards.js
+2
-1
app/assets/javascripts/boards/index.js
app/assets/javascripts/boards/index.js
+29
-33
app/assets/javascripts/boards/mixins/sortable_default_options.js
...ets/javascripts/boards/mixins/sortable_default_options.js
+11
-14
app/assets/javascripts/boards/models/issue.js
app/assets/javascripts/boards/models/issue.js
+2
-1
app/assets/javascripts/boards/models/list.js
app/assets/javascripts/boards/models/list.js
+5
-4
app/assets/javascripts/boards/stores/boards_store.js
app/assets/javascripts/boards/stores/boards_store.js
+15
-4
app/assets/javascripts/due_date_select.js
app/assets/javascripts/due_date_select.js
+4
-3
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+5
-4
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+4
-3
spec/javascripts/boards/board_blank_state_spec.js
spec/javascripts/boards/board_blank_state_spec.js
+8
-8
spec/javascripts/boards/board_card_spec.js
spec/javascripts/boards/board_card_spec.js
+11
-11
spec/javascripts/boards/board_list_spec.js
spec/javascripts/boards/board_list_spec.js
+3
-4
spec/javascripts/boards/board_new_issue_spec.js
spec/javascripts/boards/board_new_issue_spec.js
+5
-5
spec/javascripts/boards/boards_store_spec.js
spec/javascripts/boards/boards_store_spec.js
+48
-48
spec/javascripts/boards/components/board_spec.js
spec/javascripts/boards/components/board_spec.js
+2
-2
spec/javascripts/boards/issue_card_spec.js
spec/javascripts/boards/issue_card_spec.js
+0
-1
spec/javascripts/boards/issue_spec.js
spec/javascripts/boards/issue_spec.js
+2
-2
spec/javascripts/boards/list_spec.js
spec/javascripts/boards/list_spec.js
+6
-6
spec/javascripts/boards/mock_data.js
spec/javascripts/boards/mock_data.js
+2
-1
No files found.
app/assets/javascripts/boards/components/board.js
View file @
a0189744
...
@@ -4,20 +4,17 @@ import { n__ } from '~/locale';
...
@@ -4,20 +4,17 @@ import { n__ } from '~/locale';
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
Tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
AccessorUtilities
from
'
../../lib/utils/accessor
'
;
import
AccessorUtilities
from
'
../../lib/utils/accessor
'
;
import
boardList
from
'
./board_list.vue
'
;
import
BoardBlankState
from
'
./board_blank_state.vue
'
;
import
BoardBlankState
from
'
./board_blank_state.vue
'
;
import
'
./board_delete
'
;
import
BoardDelete
from
'
./board_delete
'
;
import
BoardList
from
'
./board_list.vue
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
import
{
getBoardSortableDefaultOptions
,
sortableEnd
}
from
'
../mixins/sortable_default_options
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
export
default
Vue
.
extend
({
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
gl
.
issueBoards
.
Board
=
Vue
.
extend
({
components
:
{
components
:
{
boardList
,
'
board-delete
'
:
gl
.
issueBoards
.
BoardDelete
,
BoardBlankState
,
BoardBlankState
,
BoardDelete
,
BoardList
,
Icon
,
Icon
,
},
},
directives
:
{
directives
:
{
...
@@ -47,8 +44,8 @@ gl.issueBoards.Board = Vue.extend({
...
@@ -47,8 +44,8 @@ gl.issueBoards.Board = Vue.extend({
},
},
data
()
{
data
()
{
return
{
return
{
detailIssue
:
Store
.
detail
,
detailIssue
:
boards
Store
.
detail
,
filter
:
Store
.
filter
,
filter
:
boards
Store
.
filter
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -70,20 +67,20 @@ gl.issueBoards.Board = Vue.extend({
...
@@ -70,20 +67,20 @@ gl.issueBoards.Board = Vue.extend({
}
}
},
},
mounted
()
{
mounted
()
{
this
.
sortableOptions
=
g
l
.
issueBoards
.
g
etBoardSortableDefaultOptions
({
this
.
sortableOptions
=
getBoardSortableDefaultOptions
({
disabled
:
this
.
disabled
,
disabled
:
this
.
disabled
,
group
:
'
boards
'
,
group
:
'
boards
'
,
draggable
:
'
.is-draggable
'
,
draggable
:
'
.is-draggable
'
,
handle
:
'
.js-board-handle
'
,
handle
:
'
.js-board-handle
'
,
onEnd
:
(
e
)
=>
{
onEnd
:
(
e
)
=>
{
gl
.
issueBoards
.
on
End
();
sortable
End
();
if
(
e
.
newIndex
!==
undefined
&&
e
.
oldIndex
!==
e
.
newIndex
)
{
if
(
e
.
newIndex
!==
undefined
&&
e
.
oldIndex
!==
e
.
newIndex
)
{
const
order
=
this
.
sortable
.
toArray
();
const
order
=
this
.
sortable
.
toArray
();
const
list
=
Store
.
findList
(
'
id
'
,
parseInt
(
e
.
item
.
dataset
.
id
,
10
));
const
list
=
boards
Store
.
findList
(
'
id
'
,
parseInt
(
e
.
item
.
dataset
.
id
,
10
));
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
Store
.
moveList
(
list
,
order
);
boards
Store
.
moveList
(
list
,
order
);
});
});
}
}
}
}
...
...
app/assets/javascripts/boards/components/board_blank_state.vue
View file @
a0189744
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
/* global ListLabel */
/* global ListLabel */
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -19,7 +18,7 @@ export default {
...
@@ -19,7 +18,7 @@ export default {
this
.
clearBlankState
();
this
.
clearBlankState
();
this
.
predefinedLabels
.
forEach
((
label
,
i
)
=>
{
this
.
predefinedLabels
.
forEach
((
label
,
i
)
=>
{
Store
.
addList
({
boards
Store
.
addList
({
title
:
label
.
title
,
title
:
label
.
title
,
position
:
i
,
position
:
i
,
list_type
:
'
label
'
,
list_type
:
'
label
'
,
...
@@ -30,14 +29,14 @@ export default {
...
@@ -30,14 +29,14 @@ export default {
});
});
});
});
Store
.
state
.
lists
=
_
.
sortBy
(
Store
.
state
.
lists
,
'
position
'
);
boardsStore
.
state
.
lists
=
_
.
sortBy
(
boards
Store
.
state
.
lists
,
'
position
'
);
// Save the labels
// Save the labels
gl
.
boardService
.
generateDefaultLists
()
gl
.
boardService
.
generateDefaultLists
()
.
then
(
res
=>
res
.
data
)
.
then
(
res
=>
res
.
data
)
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
data
.
forEach
((
listObj
)
=>
{
data
.
forEach
((
listObj
)
=>
{
const
list
=
Store
.
findList
(
'
title
'
,
listObj
.
title
);
const
list
=
boards
Store
.
findList
(
'
title
'
,
listObj
.
title
);
list
.
id
=
listObj
.
id
;
list
.
id
=
listObj
.
id
;
list
.
label
.
id
=
listObj
.
label
.
id
;
list
.
label
.
id
=
listObj
.
label
.
id
;
...
@@ -48,14 +47,14 @@ export default {
...
@@ -48,14 +47,14 @@ export default {
});
});
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
Store
.
removeList
(
undefined
,
'
label
'
);
boards
Store
.
removeList
(
undefined
,
'
label
'
);
Cookies
.
remove
(
'
issue_board_welcome_hidden
'
,
{
Cookies
.
remove
(
'
issue_board_welcome_hidden
'
,
{
path
:
''
,
path
:
''
,
});
});
Store
.
addBlankState
();
boards
Store
.
addBlankState
();
});
});
},
},
clearBlankState
:
Store
.
removeBlankState
.
bind
(
Store
),
clearBlankState
:
boardsStore
.
removeBlankState
.
bind
(
boards
Store
),
},
},
};
};
...
...
app/assets/javascripts/boards/components/board_card.vue
View file @
a0189744
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
/* eslint-disable vue/require-default-prop */
/* eslint-disable vue/require-default-prop */
import
IssueCardInner
from
'
./issue_card_inner.vue
'
;
import
IssueCardInner
from
'
./issue_card_inner.vue
'
;
import
eventHub
from
'
../eventhub
'
;
import
eventHub
from
'
../eventhub
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
export
default
{
export
default
{
name
:
'
BoardsIssueCard
'
,
name
:
'
BoardsIssueCard
'
,
...
@@ -42,7 +41,7 @@
...
@@ -42,7 +41,7 @@
data
()
{
data
()
{
return
{
return
{
showDetail
:
false
,
showDetail
:
false
,
detailIssue
:
Store
.
detail
,
detailIssue
:
boards
Store
.
detail
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -63,11 +62,11 @@
...
@@ -63,11 +62,11 @@
if
(
this
.
showDetail
)
{
if
(
this
.
showDetail
)
{
this
.
showDetail
=
false
;
this
.
showDetail
=
false
;
if
(
Store
.
detail
.
issue
&&
Store
.
detail
.
issue
.
id
===
this
.
issue
.
id
)
{
if
(
boardsStore
.
detail
.
issue
&&
boards
Store
.
detail
.
issue
.
id
===
this
.
issue
.
id
)
{
eventHub
.
$emit
(
'
clearDetailIssue
'
);
eventHub
.
$emit
(
'
clearDetailIssue
'
);
}
else
{
}
else
{
eventHub
.
$emit
(
'
newDetailIssue
'
,
this
.
issue
);
eventHub
.
$emit
(
'
newDetailIssue
'
,
this
.
issue
);
Store
.
detail
.
list
=
this
.
list
;
boards
Store
.
detail
.
list
=
this
.
list
;
}
}
}
}
},
},
...
...
app/assets/javascripts/boards/components/board_delete.js
View file @
a0189744
/* eslint-disable no-alert */
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
window
.
gl
=
window
.
gl
||
{};
export
default
Vue
.
extend
({
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
gl
.
issueBoards
.
BoardDelete
=
Vue
.
extend
({
props
:
{
props
:
{
list
:
{
list
:
{
type
:
Object
,
type
:
Object
,
...
@@ -14,12 +9,13 @@ gl.issueBoards.BoardDelete = Vue.extend({
...
@@ -14,12 +9,13 @@ gl.issueBoards.BoardDelete = Vue.extend({
},
},
},
},
methods
:
{
methods
:
{
deleteBoard
()
{
deleteBoard
()
{
$
(
this
.
$el
).
tooltip
(
'
hide
'
);
$
(
this
.
$el
).
tooltip
(
'
hide
'
);
// eslint-disable-next-line no-alert
if
(
window
.
confirm
(
'
Are you sure you want to delete this list?
'
))
{
if
(
window
.
confirm
(
'
Are you sure you want to delete this list?
'
))
{
this
.
list
.
destroy
();
this
.
list
.
destroy
();
}
}
}
}
,
}
}
,
});
});
app/assets/javascripts/boards/components/board_list.vue
View file @
a0189744
...
@@ -3,8 +3,8 @@ import Sortable from 'sortablejs';
...
@@ -3,8 +3,8 @@ import Sortable from 'sortablejs';
import
boardNewIssue
from
'
./board_new_issue.vue
'
;
import
boardNewIssue
from
'
./board_new_issue.vue
'
;
import
boardCard
from
'
./board_card.vue
'
;
import
boardCard
from
'
./board_card.vue
'
;
import
eventHub
from
'
../eventhub
'
;
import
eventHub
from
'
../eventhub
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
import
{
getBoardSortableDefaultOptions
,
sortableStart
}
from
'
../mixins/sortable_default_options
'
;
export
default
{
export
default
{
name
:
'
BoardList
'
,
name
:
'
BoardList
'
,
...
@@ -46,7 +46,7 @@ export default {
...
@@ -46,7 +46,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
scrollOffset
:
250
,
scrollOffset
:
250
,
filters
:
Store
.
state
.
filters
,
filters
:
boards
Store
.
state
.
filters
,
showCount
:
false
,
showCount
:
false
,
showIssueForm
:
false
,
showIssueForm
:
false
,
};
};
...
@@ -61,11 +61,12 @@ export default {
...
@@ -61,11 +61,12 @@ export default {
},
},
issues
()
{
issues
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
scrollHeight
()
<=
this
.
listHeight
()
&&
if
(
this
.
list
.
issuesSize
>
this
.
list
.
issues
.
length
)
{
this
.
scrollHeight
()
<=
this
.
listHeight
()
&&
this
.
list
.
issuesSize
>
this
.
list
.
issues
.
length
)
{
this
.
list
.
page
+=
1
;
this
.
list
.
page
+=
1
;
this
.
list
.
getIssues
(
false
)
this
.
list
.
getIssues
(
false
).
catch
(()
=>
{
.
catch
(()
=>
{
// TODO: handle request error
// TODO: handle request error
});
});
}
}
...
@@ -83,7 +84,7 @@ export default {
...
@@ -83,7 +84,7 @@ export default {
eventHub
.
$on
(
`scroll-board-list-
${
this
.
list
.
id
}
`
,
this
.
scrollToTop
);
eventHub
.
$on
(
`scroll-board-list-
${
this
.
list
.
id
}
`
,
this
.
scrollToTop
);
},
},
mounted
()
{
mounted
()
{
const
options
=
g
l
.
issueBoards
.
g
etBoardSortableDefaultOptions
({
const
options
=
getBoardSortableDefaultOptions
({
scroll
:
true
,
scroll
:
true
,
disabled
:
this
.
disabled
,
disabled
:
this
.
disabled
,
filter
:
'
.board-list-count, .is-disabled
'
,
filter
:
'
.board-list-count, .is-disabled
'
,
...
@@ -108,7 +109,8 @@ export default {
...
@@ -108,7 +109,8 @@ export default {
// So from there, we can get reference to actual container
// So from there, we can get reference to actual container
// and thus the container type to enable Copy or Move
// and thus the container type to enable Copy or Move
if
(
e
.
target
)
{
if
(
e
.
target
)
{
const
containerEl
=
e
.
target
.
closest
(
'
.js-board-list
'
)
||
e
.
target
.
querySelector
(
'
.js-board-list
'
);
const
containerEl
=
e
.
target
.
closest
(
'
.js-board-list
'
)
||
e
.
target
.
querySelector
(
'
.js-board-list
'
);
const
toBoardType
=
containerEl
.
dataset
.
boardType
;
const
toBoardType
=
containerEl
.
dataset
.
boardType
;
const
cloneActions
=
{
const
cloneActions
=
{
label
:
[
'
milestone
'
,
'
assignee
'
],
label
:
[
'
milestone
'
,
'
assignee
'
],
...
@@ -120,8 +122,9 @@ export default {
...
@@ -120,8 +122,9 @@ export default {
const
fromBoardType
=
this
.
list
.
type
;
const
fromBoardType
=
this
.
list
.
type
;
// For each list we check if the destination list is
// For each list we check if the destination list is
// a the list were we should clone the issue
// a the list were we should clone the issue
const
shouldClone
=
Object
.
entries
(
cloneActions
).
some
(
entry
=>
(
const
shouldClone
=
Object
.
entries
(
cloneActions
).
some
(
fromBoardType
===
entry
[
0
]
&&
entry
[
1
].
includes
(
toBoardType
)));
entry
=>
fromBoardType
===
entry
[
0
]
&&
entry
[
1
].
includes
(
toBoardType
),
);
if
(
shouldClone
)
{
if
(
shouldClone
)
{
return
'
clone
'
;
return
'
clone
'
;
...
@@ -133,28 +136,36 @@ export default {
...
@@ -133,28 +136,36 @@ export default {
},
},
revertClone
:
true
,
revertClone
:
true
,
},
},
onStart
:
(
e
)
=>
{
onStart
:
e
=>
{
const
card
=
this
.
$refs
.
issue
[
e
.
oldIndex
];
const
card
=
this
.
$refs
.
issue
[
e
.
oldIndex
];
card
.
showDetail
=
false
;
card
.
showDetail
=
false
;
Store
.
moving
.
list
=
card
.
list
;
boards
Store
.
moving
.
list
=
card
.
list
;
Store
.
moving
.
issue
=
Store
.
moving
.
list
.
findIssue
(
+
e
.
item
.
dataset
.
issueId
);
boardsStore
.
moving
.
issue
=
boards
Store
.
moving
.
list
.
findIssue
(
+
e
.
item
.
dataset
.
issueId
);
gl
.
issueBoards
.
on
Start
();
sortable
Start
();
},
},
onAdd
:
(
e
)
=>
{
onAdd
:
e
=>
{
gl
.
issueBoards
.
BoardsStore
boardsStore
.
moveIssueToList
(
.
moveIssueToList
(
Store
.
moving
.
list
,
this
.
list
,
Store
.
moving
.
issue
,
e
.
newIndex
);
boardsStore
.
moving
.
list
,
this
.
list
,
boardsStore
.
moving
.
issue
,
e
.
newIndex
,
);
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
e
.
item
.
remove
();
e
.
item
.
remove
();
});
});
},
},
onUpdate
:
(
e
)
=>
{
onUpdate
:
e
=>
{
const
sortedArray
=
this
.
sortable
.
toArray
()
const
sortedArray
=
this
.
sortable
.
toArray
().
filter
(
id
=>
id
!==
'
-1
'
);
.
filter
(
id
=>
id
!==
'
-1
'
);
boardsStore
.
moveIssueInList
(
gl
.
issueBoards
.
BoardsStore
this
.
list
,
.
moveIssueInList
(
this
.
list
,
Store
.
moving
.
issue
,
e
.
oldIndex
,
e
.
newIndex
,
sortedArray
);
boardsStore
.
moving
.
issue
,
e
.
oldIndex
,
e
.
newIndex
,
sortedArray
,
);
},
},
onMove
(
e
)
{
onMove
(
e
)
{
return
!
e
.
related
.
classList
.
contains
(
'
board-list-count
'
);
return
!
e
.
related
.
classList
.
contains
(
'
board-list-count
'
);
...
@@ -192,16 +203,14 @@ export default {
...
@@ -192,16 +203,14 @@ export default {
if
(
getIssues
)
{
if
(
getIssues
)
{
this
.
list
.
loadingMore
=
true
;
this
.
list
.
loadingMore
=
true
;
getIssues
getIssues
.
then
(
loadingDone
).
catch
(
loadingDone
);
.
then
(
loadingDone
)
.
catch
(
loadingDone
);
}
}
},
},
toggleForm
()
{
toggleForm
()
{
this
.
showIssueForm
=
!
this
.
showIssueForm
;
this
.
showIssueForm
=
!
this
.
showIssueForm
;
},
},
onScroll
()
{
onScroll
()
{
if
(
!
this
.
list
.
loadingMore
&&
(
this
.
scrollTop
()
>
this
.
scrollHeight
()
-
this
.
scrollOffset
)
)
{
if
(
!
this
.
list
.
loadingMore
&&
this
.
scrollTop
()
>
this
.
scrollHeight
()
-
this
.
scrollOffset
)
{
this
.
loadNextPage
();
this
.
loadNextPage
();
}
}
},
},
...
...
app/assets/javascripts/boards/components/board_new_issue.vue
View file @
a0189744
...
@@ -4,8 +4,7 @@ import { Button } from '@gitlab-org/gitlab-ui';
...
@@ -4,8 +4,7 @@ import { Button } from '@gitlab-org/gitlab-ui';
import
eventHub
from
'
../eventhub
'
;
import
eventHub
from
'
../eventhub
'
;
import
ProjectSelect
from
'
./project_select.vue
'
;
import
ProjectSelect
from
'
./project_select.vue
'
;
import
ListIssue
from
'
../models/issue
'
;
import
ListIssue
from
'
../models/issue
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
export
default
{
export
default
{
name
:
'
BoardNewIssue
'
,
name
:
'
BoardNewIssue
'
,
...
@@ -68,8 +67,8 @@ export default {
...
@@ -68,8 +67,8 @@ export default {
// Need this because our jQuery very kindly disables buttons on ALL form submissions
// Need this because our jQuery very kindly disables buttons on ALL form submissions
$
(
this
.
$refs
.
submitButton
).
enable
();
$
(
this
.
$refs
.
submitButton
).
enable
();
Store
.
detail
.
issue
=
issue
;
boards
Store
.
detail
.
issue
=
issue
;
Store
.
detail
.
list
=
this
.
list
;
boards
Store
.
detail
.
list
=
this
.
list
;
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
// Need this because our jQuery very kindly disables buttons on ALL form submissions
// Need this because our jQuery very kindly disables buttons on ALL form submissions
...
...
app/assets/javascripts/boards/components/board_sidebar.js
View file @
a0189744
...
@@ -14,13 +14,9 @@ import IssuableContext from '../../issuable_context';
...
@@ -14,13 +14,9 @@ import IssuableContext from '../../issuable_context';
import
LabelsSelect
from
'
../../labels_select
'
;
import
LabelsSelect
from
'
../../labels_select
'
;
import
Subscriptions
from
'
../../sidebar/components/subscriptions/subscriptions.vue
'
;
import
Subscriptions
from
'
../../sidebar/components/subscriptions/subscriptions.vue
'
;
import
MilestoneSelect
from
'
../../milestone_select
'
;
import
MilestoneSelect
from
'
../../milestone_select
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
export
default
Vue
.
extend
({
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
gl
.
issueBoards
.
BoardSidebar
=
Vue
.
extend
({
components
:
{
components
:
{
AssigneeTitle
,
AssigneeTitle
,
Assignees
,
Assignees
,
...
@@ -35,7 +31,7 @@ gl.issueBoards.BoardSidebar = Vue.extend({
...
@@ -35,7 +31,7 @@ gl.issueBoards.BoardSidebar = Vue.extend({
},
},
data
()
{
data
()
{
return
{
return
{
detail
:
Store
.
detail
,
detail
:
boards
Store
.
detail
,
issue
:
{},
issue
:
{},
list
:
{},
list
:
{},
loadingAssignees
:
false
,
loadingAssignees
:
false
,
...
@@ -117,18 +113,18 @@ gl.issueBoards.BoardSidebar = Vue.extend({
...
@@ -117,18 +113,18 @@ gl.issueBoards.BoardSidebar = Vue.extend({
this
.
saveAssignees
();
this
.
saveAssignees
();
},
},
removeAssignee
(
a
)
{
removeAssignee
(
a
)
{
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
removeAssignee
(
a
);
b
oardsStore
.
detail
.
issue
.
removeAssignee
(
a
);
},
},
addAssignee
(
a
)
{
addAssignee
(
a
)
{
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
addAssignee
(
a
);
b
oardsStore
.
detail
.
issue
.
addAssignee
(
a
);
},
},
removeAllAssignees
()
{
removeAllAssignees
()
{
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
removeAllAssignees
();
b
oardsStore
.
detail
.
issue
.
removeAllAssignees
();
},
},
saveAssignees
()
{
saveAssignees
()
{
this
.
loadingAssignees
=
true
;
this
.
loadingAssignees
=
true
;
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
update
()
b
oardsStore
.
detail
.
issue
.
update
()
.
then
(()
=>
{
.
then
(()
=>
{
this
.
loadingAssignees
=
false
;
this
.
loadingAssignees
=
false
;
})
})
...
...
app/assets/javascripts/boards/components/issue_card_inner.vue
View file @
a0189744
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
import
UserAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
UserAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
eventHub
from
'
../eventhub
'
;
import
eventHub
from
'
../eventhub
'
;
import
tooltip
from
'
../../vue_shared/directives/tooltip
'
;
import
tooltip
from
'
../../vue_shared/directives/tooltip
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -110,7 +109,7 @@
...
@@ -110,7 +109,7 @@
filterByLabel
(
label
,
e
)
{
filterByLabel
(
label
,
e
)
{
if
(
!
this
.
updateFilters
)
return
;
if
(
!
this
.
updateFilters
)
return
;
const
filterPath
=
gl
.
issueBoards
.
B
oardsStore
.
filter
.
path
.
split
(
'
&
'
);
const
filterPath
=
b
oardsStore
.
filter
.
path
.
split
(
'
&
'
);
const
labelTitle
=
encodeURIComponent
(
label
.
title
);
const
labelTitle
=
encodeURIComponent
(
label
.
title
);
const
param
=
`label_name[]=
${
labelTitle
}
`
;
const
param
=
`label_name[]=
${
labelTitle
}
`
;
const
labelIndex
=
filterPath
.
indexOf
(
param
);
const
labelIndex
=
filterPath
.
indexOf
(
param
);
...
@@ -122,9 +121,9 @@
...
@@ -122,9 +121,9 @@
filterPath
.
splice
(
labelIndex
,
1
);
filterPath
.
splice
(
labelIndex
,
1
);
}
}
gl
.
issueBoards
.
B
oardsStore
.
filter
.
path
=
filterPath
.
join
(
'
&
'
);
b
oardsStore
.
filter
.
path
=
filterPath
.
join
(
'
&
'
);
Store
.
updateFiltersUrl
();
boards
Store
.
updateFiltersUrl
();
eventHub
.
$emit
(
'
updateTokens
'
);
eventHub
.
$emit
(
'
updateTokens
'
);
},
},
...
...
app/assets/javascripts/boards/components/modal/footer.vue
View file @
a0189744
...
@@ -5,6 +5,7 @@ import ListsDropdown from './lists_dropdown.vue';
...
@@ -5,6 +5,7 @@ import ListsDropdown from './lists_dropdown.vue';
import
{
pluralize
}
from
'
../../../lib/utils/text_utility
'
;
import
{
pluralize
}
from
'
../../../lib/utils/text_utility
'
;
import
ModalStore
from
'
../../stores/modal_store
'
;
import
ModalStore
from
'
../../stores/modal_store
'
;
import
modalMixin
from
'
../../mixins/modal_mixins
'
;
import
modalMixin
from
'
../../mixins/modal_mixins
'
;
import
boardsStore
from
'
../../stores/boards_store
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -14,7 +15,7 @@ export default {
...
@@ -14,7 +15,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
modal
:
ModalStore
.
store
,
modal
:
ModalStore
.
store
,
state
:
gl
.
issueBoards
.
B
oardsStore
.
state
,
state
:
b
oardsStore
.
state
,
};
};
},
},
computed
:
{
computed
:
{
...
...
app/assets/javascripts/boards/components/modal/lists_dropdown.vue
View file @
a0189744
<
script
>
<
script
>
import
{
Link
}
from
'
@gitlab-org/gitlab-ui
'
;
import
{
Link
}
from
'
@gitlab-org/gitlab-ui
'
;
import
ModalStore
from
'
../../stores/modal_store
'
;
import
ModalStore
from
'
../../stores/modal_store
'
;
import
boardsStore
from
'
../../stores/boards_store
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -9,7 +10,7 @@ export default {
...
@@ -9,7 +10,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
modal
:
ModalStore
.
store
,
modal
:
ModalStore
.
store
,
state
:
gl
.
issueBoards
.
B
oardsStore
.
state
,
state
:
b
oardsStore
.
state
,
};
};
},
},
computed
:
{
computed
:
{
...
...
app/assets/javascripts/boards/components/new_list_dropdown.js
View file @
a0189744
...
@@ -4,16 +4,12 @@ import $ from 'jquery';
...
@@ -4,16 +4,12 @@ import $ from 'jquery';
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
CreateLabelDropdown
from
'
../../create_label
'
;
import
CreateLabelDropdown
from
'
../../create_label
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
$
(
document
).
off
(
'
created.label
'
).
on
(
'
created.label
'
,
(
e
,
label
)
=>
{
$
(
document
).
off
(
'
created.label
'
).
on
(
'
created.label
'
,
(
e
,
label
)
=>
{
Store
.
new
({
boards
Store
.
new
({
title
:
label
.
title
,
title
:
label
.
title
,
position
:
Store
.
state
.
lists
.
length
-
2
,
position
:
boards
Store
.
state
.
lists
.
length
-
2
,
list_type
:
'
label
'
,
list_type
:
'
label
'
,
label
:
{
label
:
{
id
:
label
.
id
,
id
:
label
.
id
,
...
@@ -23,7 +19,7 @@ $(document).off('created.label').on('created.label', (e, label) => {
...
@@ -23,7 +19,7 @@ $(document).off('created.label').on('created.label', (e, label) => {
});
});
});
});
gl
.
issueBoards
.
newListDropdownInit
=
()
=>
{
export
default
function
initNewListDropdown
()
{
$
(
'
.js-new-board-list
'
).
each
(
function
()
{
$
(
'
.js-new-board-list
'
).
each
(
function
()
{
const
$this
=
$
(
this
);
const
$this
=
$
(
this
);
new
CreateLabelDropdown
(
$this
.
closest
(
'
.dropdown
'
).
find
(
'
.dropdown-new-label
'
),
$this
.
data
(
'
namespacePath
'
),
$this
.
data
(
'
projectPath
'
));
new
CreateLabelDropdown
(
$this
.
closest
(
'
.dropdown
'
).
find
(
'
.dropdown-new-label
'
),
$this
.
data
(
'
namespacePath
'
),
$this
.
data
(
'
projectPath
'
));
...
@@ -36,7 +32,7 @@ gl.issueBoards.newListDropdownInit = () => {
...
@@ -36,7 +32,7 @@ gl.issueBoards.newListDropdownInit = () => {
});
});
},
},
renderRow
(
label
)
{
renderRow
(
label
)
{
const
active
=
Store
.
findList
(
'
title
'
,
label
.
title
);
const
active
=
boards
Store
.
findList
(
'
title
'
,
label
.
title
);
const
$li
=
$
(
'
<li />
'
);
const
$li
=
$
(
'
<li />
'
);
const
$a
=
$
(
'
<a />
'
,
{
const
$a
=
$
(
'
<a />
'
,
{
class
:
(
active
?
`is-active js-board-list-
${
active
.
id
}
`
:
''
),
class
:
(
active
?
`is-active js-board-list-
${
active
.
id
}
`
:
''
),
...
@@ -62,10 +58,10 @@ gl.issueBoards.newListDropdownInit = () => {
...
@@ -62,10 +58,10 @@ gl.issueBoards.newListDropdownInit = () => {
const
label
=
options
.
selectedObj
;
const
label
=
options
.
selectedObj
;
e
.
preventDefault
();
e
.
preventDefault
();
if
(
!
Store
.
findList
(
'
title
'
,
label
.
title
))
{
if
(
!
boards
Store
.
findList
(
'
title
'
,
label
.
title
))
{
Store
.
new
({
boards
Store
.
new
({
title
:
label
.
title
,
title
:
label
.
title
,
position
:
Store
.
state
.
lists
.
length
-
2
,
position
:
boards
Store
.
state
.
lists
.
length
-
2
,
list_type
:
'
label
'
,
list_type
:
'
label
'
,
label
:
{
label
:
{
id
:
label
.
id
,
id
:
label
.
id
,
...
@@ -74,9 +70,9 @@ gl.issueBoards.newListDropdownInit = () => {
...
@@ -74,9 +70,9 @@ gl.issueBoards.newListDropdownInit = () => {
},
},
});
});
Store
.
state
.
lists
=
_
.
sortBy
(
Store
.
state
.
lists
,
'
position
'
);
boardsStore
.
state
.
lists
=
_
.
sortBy
(
boards
Store
.
state
.
lists
,
'
position
'
);
}
}
},
},
});
});
});
});
}
;
}
app/assets/javascripts/boards/components/sidebar/remove_issue.vue
View file @
a0189744
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Flash
from
'
../../../flash
'
;
import
Flash
from
'
../../../flash
'
;
import
{
__
}
from
'
../../../locale
'
;
import
{
__
}
from
'
../../../locale
'
;
import
boardsStore
from
'
../../stores/boards_store
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
props
:
{
props
:
{
...
@@ -49,7 +48,7 @@
...
@@ -49,7 +48,7 @@
list
.
removeIssue
(
issue
);
list
.
removeIssue
(
issue
);
});
});
Store
.
detail
.
issue
=
{};
boards
Store
.
detail
.
issue
=
{};
},
},
/**
/**
* Build the default patch request.
* Build the default patch request.
...
...
app/assets/javascripts/boards/filtered_search_boards.js
View file @
a0189744
import
FilteredSearchContainer
from
'
../filtered_search/container
'
;
import
FilteredSearchContainer
from
'
../filtered_search/container
'
;
import
FilteredSearchManager
from
'
../filtered_search/filtered_search_manager
'
;
import
FilteredSearchManager
from
'
../filtered_search/filtered_search_manager
'
;
import
boardsStore
from
'
./stores/boards_store
'
;
export
default
class
FilteredSearchBoards
extends
FilteredSearchManager
{
export
default
class
FilteredSearchBoards
extends
FilteredSearchManager
{
constructor
(
store
,
updateUrl
=
false
,
cantEdit
=
[])
{
constructor
(
store
,
updateUrl
=
false
,
cantEdit
=
[])
{
...
@@ -23,7 +24,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
...
@@ -23,7 +24,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
this
.
store
.
path
=
path
.
substr
(
1
);
this
.
store
.
path
=
path
.
substr
(
1
);
if
(
this
.
updateUrl
)
{
if
(
this
.
updateUrl
)
{
gl
.
issueBoards
.
B
oardsStore
.
updateFiltersUrl
();
b
oardsStore
.
updateFiltersUrl
();
}
}
}
}
...
...
app/assets/javascripts/boards/index.js
View file @
a0189744
...
@@ -14,24 +14,22 @@ import './models/issue';
...
@@ -14,24 +14,22 @@ import './models/issue';
import
'
./models/list
'
;
import
'
./models/list
'
;
import
'
./models/milestone
'
;
import
'
./models/milestone
'
;
import
'
./models/project
'
;
import
'
./models/project
'
;
import
'
./stores/boards_store
'
;
import
boardsStore
from
'
./stores/boards_store
'
;
import
ModalStore
from
'
./stores/modal_store
'
;
import
ModalStore
from
'
./stores/modal_store
'
;
import
BoardService
from
'
./services/board_service
'
;
import
BoardService
from
'
./services/board_service
'
;
import
modalMixin
from
'
./mixins/modal_mixins
'
;
import
modalMixin
from
'
./mixins/modal_mixins
'
;
import
'
./mixins/sortable_default_options
'
;
import
'
./filters/due_date_filters
'
;
import
'
./filters/due_date_filters
'
;
import
'
./components/board
'
;
import
Board
from
'
./components/board
'
;
import
'
./components/board_sidebar
'
;
import
BoardSidebar
from
'
./components/board_sidebar
'
;
import
'
./components/new_list_dropdown
'
;
import
initNewListDropdown
from
'
./components/new_list_dropdown
'
;
import
BoardAddIssuesModal
from
'
./components/modal/index.vue
'
;
import
BoardAddIssuesModal
from
'
./components/modal/index.vue
'
;
import
'
~/vue_shared/vue_resource_interceptor
'
;
import
'
~/vue_shared/vue_resource_interceptor
'
;
import
{
NavigationType
}
from
'
~/lib/utils/common_utils
'
;
import
{
NavigationType
}
from
'
~/lib/utils/common_utils
'
;
let
issueBoardsApp
;
export
default
()
=>
{
export
default
()
=>
{
const
$boardApp
=
document
.
getElementById
(
'
board-app
'
);
const
$boardApp
=
document
.
getElementById
(
'
board-app
'
);
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
window
.
gl
=
window
.
gl
||
{};
// check for browser back and trigger a hard reload to circumvent browser caching.
// check for browser back and trigger a hard reload to circumvent browser caching.
window
.
addEventListener
(
'
pageshow
'
,
(
event
)
=>
{
window
.
addEventListener
(
'
pageshow
'
,
(
event
)
=>
{
...
@@ -43,25 +41,21 @@ export default () => {
...
@@ -43,25 +41,21 @@ export default () => {
}
}
});
});
if
(
gl
.
I
ssueBoardsApp
)
{
if
(
i
ssueBoardsApp
)
{
gl
.
I
ssueBoardsApp
.
$destroy
(
true
);
i
ssueBoardsApp
.
$destroy
(
true
);
}
}
Store
.
create
();
boardsStore
.
create
();
// hack to allow sidebar scripts like milestone_select manipulate the BoardsStore
gl
.
issueBoards
.
boardStoreIssueSet
=
(...
args
)
=>
Vue
.
set
(
Store
.
detail
.
issue
,
...
args
);
gl
.
issueBoards
.
boardStoreIssueDelete
=
(...
args
)
=>
Vue
.
delete
(
Store
.
detail
.
issue
,
...
args
);
gl
.
I
ssueBoardsApp
=
new
Vue
({
i
ssueBoardsApp
=
new
Vue
({
el
:
$boardApp
,
el
:
$boardApp
,
components
:
{
components
:
{
board
:
gl
.
issueBoards
.
Board
,
Board
,
'
board-sidebar
'
:
gl
.
issueBoards
.
BoardSidebar
,
BoardSidebar
,
BoardAddIssuesModal
,
BoardAddIssuesModal
,
},
},
data
:
{
data
:
{
state
:
Store
.
state
,
state
:
boards
Store
.
state
,
loading
:
true
,
loading
:
true
,
boardsEndpoint
:
$boardApp
.
dataset
.
boardsEndpoint
,
boardsEndpoint
:
$boardApp
.
dataset
.
boardsEndpoint
,
listsEndpoint
:
$boardApp
.
dataset
.
listsEndpoint
,
listsEndpoint
:
$boardApp
.
dataset
.
listsEndpoint
,
...
@@ -70,7 +64,7 @@ export default () => {
...
@@ -70,7 +64,7 @@ export default () => {
issueLinkBase
:
$boardApp
.
dataset
.
issueLinkBase
,
issueLinkBase
:
$boardApp
.
dataset
.
issueLinkBase
,
rootPath
:
$boardApp
.
dataset
.
rootPath
,
rootPath
:
$boardApp
.
dataset
.
rootPath
,
bulkUpdatePath
:
$boardApp
.
dataset
.
bulkUpdatePath
,
bulkUpdatePath
:
$boardApp
.
dataset
.
bulkUpdatePath
,
detailIssue
:
Store
.
detail
,
detailIssue
:
boards
Store
.
detail
,
defaultAvatar
:
$boardApp
.
dataset
.
defaultAvatar
,
defaultAvatar
:
$boardApp
.
dataset
.
defaultAvatar
,
},
},
computed
:
{
computed
:
{
...
@@ -85,7 +79,7 @@ export default () => {
...
@@ -85,7 +79,7 @@ export default () => {
bulkUpdatePath
:
this
.
bulkUpdatePath
,
bulkUpdatePath
:
this
.
bulkUpdatePath
,
boardId
:
this
.
boardId
,
boardId
:
this
.
boardId
,
});
});
Store
.
rootPath
=
this
.
boardsEndpoint
;
boards
Store
.
rootPath
=
this
.
boardsEndpoint
;
eventHub
.
$on
(
'
updateTokens
'
,
this
.
updateTokens
);
eventHub
.
$on
(
'
updateTokens
'
,
this
.
updateTokens
);
eventHub
.
$on
(
'
newDetailIssue
'
,
this
.
updateDetailIssue
);
eventHub
.
$on
(
'
newDetailIssue
'
,
this
.
updateDetailIssue
);
...
@@ -99,16 +93,16 @@ export default () => {
...
@@ -99,16 +93,16 @@ export default () => {
sidebarEventHub
.
$off
(
'
toggleSubscription
'
,
this
.
toggleSubscription
);
sidebarEventHub
.
$off
(
'
toggleSubscription
'
,
this
.
toggleSubscription
);
},
},
mounted
()
{
mounted
()
{
this
.
filterManager
=
new
FilteredSearchBoards
(
Store
.
filter
,
true
,
Store
.
cantEdit
);
this
.
filterManager
=
new
FilteredSearchBoards
(
boardsStore
.
filter
,
true
,
boards
Store
.
cantEdit
);
this
.
filterManager
.
setup
();
this
.
filterManager
.
setup
();
Store
.
disabled
=
this
.
disabled
;
boards
Store
.
disabled
=
this
.
disabled
;
gl
.
boardService
gl
.
boardService
.
all
()
.
all
()
.
then
(
res
=>
res
.
data
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
.
then
(
data
=>
{
data
.
forEach
(
board
=>
{
data
.
forEach
(
board
=>
{
const
list
=
Store
.
addList
(
board
,
this
.
defaultAvatar
);
const
list
=
boards
Store
.
addList
(
board
,
this
.
defaultAvatar
);
if
(
list
.
type
===
'
closed
'
)
{
if
(
list
.
type
===
'
closed
'
)
{
list
.
position
=
Infinity
;
list
.
position
=
Infinity
;
...
@@ -119,7 +113,7 @@ export default () => {
...
@@ -119,7 +113,7 @@ export default () => {
this
.
state
.
lists
=
_
.
sortBy
(
this
.
state
.
lists
,
'
position
'
);
this
.
state
.
lists
=
_
.
sortBy
(
this
.
state
.
lists
,
'
position
'
);
Store
.
addBlankState
();
boards
Store
.
addBlankState
();
this
.
loading
=
false
;
this
.
loading
=
false
;
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
@@ -148,13 +142,13 @@ export default () => {
...
@@ -148,13 +142,13 @@ export default () => {
});
});
}
}
Store
.
detail
.
issue
=
newIssue
;
boards
Store
.
detail
.
issue
=
newIssue
;
},
},
clearDetailIssue
()
{
clearDetailIssue
()
{
Store
.
detail
.
issue
=
{};
boards
Store
.
detail
.
issue
=
{};
},
},
toggleSubscription
(
id
)
{
toggleSubscription
(
id
)
{
const
{
issue
}
=
Store
.
detail
;
const
{
issue
}
=
boards
Store
.
detail
;
if
(
issue
.
id
===
id
&&
issue
.
toggleSubscriptionEndpoint
)
{
if
(
issue
.
id
===
id
&&
issue
.
toggleSubscriptionEndpoint
)
{
issue
.
setFetchingState
(
'
subscriptions
'
,
true
);
issue
.
setFetchingState
(
'
subscriptions
'
,
true
);
BoardService
.
toggleIssueSubscription
(
issue
.
toggleSubscriptionEndpoint
)
BoardService
.
toggleIssueSubscription
(
issue
.
toggleSubscriptionEndpoint
)
...
@@ -173,26 +167,28 @@ export default () => {
...
@@ -173,26 +167,28 @@ export default () => {
},
},
});
});
gl
.
IssueBoardsSearch
=
new
Vue
({
// eslint-disable-next-line no-new
new
Vue
({
el
:
document
.
getElementById
(
'
js-add-list
'
),
el
:
document
.
getElementById
(
'
js-add-list
'
),
data
:
{
data
:
{
filters
:
Store
.
state
.
filters
,
filters
:
boards
Store
.
state
.
filters
,
},
},
mounted
()
{
mounted
()
{
gl
.
issueBoards
.
newListDropdownInit
();
initNewListDropdown
();
},
},
});
});
const
issueBoardsModal
=
document
.
getElementById
(
'
js-add-issues-btn
'
);
const
issueBoardsModal
=
document
.
getElementById
(
'
js-add-issues-btn
'
);
if
(
issueBoardsModal
)
{
if
(
issueBoardsModal
)
{
gl
.
IssueBoardsModalAddBtn
=
new
Vue
({
// eslint-disable-next-line no-new
new
Vue
({
el
:
issueBoardsModal
,
el
:
issueBoardsModal
,
mixins
:
[
modalMixin
],
mixins
:
[
modalMixin
],
data
()
{
data
()
{
return
{
return
{
modal
:
ModalStore
.
store
,
modal
:
ModalStore
.
store
,
store
:
Store
.
state
,
store
:
boards
Store
.
state
,
canAdminList
:
this
.
$options
.
el
.
hasAttribute
(
'
data-can-admin-list
'
),
canAdminList
:
this
.
$options
.
el
.
hasAttribute
(
'
data-can-admin-list
'
),
};
};
},
},
...
...
app/assets/javascripts/boards/mixins/sortable_default_options.js
View file @
a0189744
...
@@ -3,32 +3,29 @@
...
@@ -3,32 +3,29 @@
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
sortableConfig
from
'
../../sortable/sortable_config
'
;
import
sortableConfig
from
'
../../sortable/sortable_config
'
;
window
.
gl
=
window
.
gl
||
{};
export
function
sortableStart
()
{
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
gl
.
issueBoards
.
onStart
=
()
=>
{
$
(
'
.has-tooltip
'
).
tooltip
(
'
hide
'
)
$
(
'
.has-tooltip
'
).
tooltip
(
'
hide
'
)
.
tooltip
(
'
disable
'
);
.
tooltip
(
'
disable
'
);
document
.
body
.
classList
.
add
(
'
is-dragging
'
);
document
.
body
.
classList
.
add
(
'
is-dragging
'
);
}
;
}
gl
.
issueBoards
.
onEnd
=
()
=>
{
export
function
sortableEnd
()
{
$
(
'
.has-tooltip
'
).
tooltip
(
'
enable
'
);
$
(
'
.has-tooltip
'
).
tooltip
(
'
enable
'
);
document
.
body
.
classList
.
remove
(
'
is-dragging
'
);
document
.
body
.
classList
.
remove
(
'
is-dragging
'
);
}
;
}
gl
.
issueBoards
.
touchEnabled
=
(
'
ontouchstart
'
in
window
)
||
window
.
DocumentTouch
&&
document
instanceof
DocumentTouch
;
export
function
getBoardSortableDefaultOptions
(
obj
)
{
const
touchEnabled
=
(
'
ontouchstart
'
in
window
)
||
window
.
DocumentTouch
&&
document
instanceof
DocumentTouch
;
gl
.
issueBoards
.
getBoardSortableDefaultOptions
=
(
obj
)
=>
{
const
defaultSortOptions
=
Object
.
assign
({},
sortableConfig
,
{
const
defaultSortOptions
=
Object
.
assign
({},
sortableConfig
,
{
filter
:
'
.board-delete, .btn
'
,
filter
:
'
.board-delete, .btn
'
,
delay
:
gl
.
issueBoards
.
touchEnabled
?
100
:
0
,
delay
:
touchEnabled
?
100
:
0
,
scrollSensitivity
:
gl
.
issueBoards
.
touchEnabled
?
60
:
100
,
scrollSensitivity
:
touchEnabled
?
60
:
100
,
scrollSpeed
:
20
,
scrollSpeed
:
20
,
onStart
:
gl
.
issueBoards
.
on
Start
,
onStart
:
sortable
Start
,
onEnd
:
gl
.
issueBoards
.
on
End
,
onEnd
:
sortable
End
,
});
});
Object
.
keys
(
obj
).
forEach
((
key
)
=>
{
defaultSortOptions
[
key
]
=
obj
[
key
];
});
Object
.
keys
(
obj
).
forEach
((
key
)
=>
{
defaultSortOptions
[
key
]
=
obj
[
key
];
});
return
defaultSortOptions
;
return
defaultSortOptions
;
}
;
}
app/assets/javascripts/boards/models/issue.js
View file @
a0189744
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
'
~/vue_shared/models/label
'
;
import
'
~/vue_shared/models/label
'
;
import
IssueProject
from
'
./project
'
;
import
IssueProject
from
'
./project
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
class
ListIssue
{
class
ListIssue
{
constructor
(
obj
,
defaultAvatar
)
{
constructor
(
obj
,
defaultAvatar
)
{
...
@@ -86,7 +87,7 @@ class ListIssue {
...
@@ -86,7 +87,7 @@ class ListIssue {
}
}
getLists
()
{
getLists
()
{
return
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
filter
(
list
=>
list
.
findIssue
(
this
.
id
));
return
b
oardsStore
.
state
.
lists
.
filter
(
list
=>
list
.
findIssue
(
this
.
id
));
}
}
updateData
(
newData
)
{
updateData
(
newData
)
{
...
...
app/assets/javascripts/boards/models/list.js
View file @
a0189744
...
@@ -5,6 +5,7 @@ import { __ } from '~/locale';
...
@@ -5,6 +5,7 @@ import { __ } from '~/locale';
import
ListLabel
from
'
~/vue_shared/models/label
'
;
import
ListLabel
from
'
~/vue_shared/models/label
'
;
import
ListAssignee
from
'
~/vue_shared/models/assignee
'
;
import
ListAssignee
from
'
~/vue_shared/models/assignee
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
const
PER_PAGE
=
20
;
const
PER_PAGE
=
20
;
...
@@ -89,9 +90,9 @@ class List {
...
@@ -89,9 +90,9 @@ class List {
}
}
destroy
()
{
destroy
()
{
const
index
=
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
indexOf
(
this
);
const
index
=
b
oardsStore
.
state
.
lists
.
indexOf
(
this
);
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
splice
(
index
,
1
);
b
oardsStore
.
state
.
lists
.
splice
(
index
,
1
);
gl
.
issueBoards
.
B
oardsStore
.
updateNewListDropdown
(
this
.
id
);
b
oardsStore
.
updateNewListDropdown
(
this
.
id
);
gl
.
boardService
.
destroyList
(
this
.
id
).
catch
(()
=>
{
gl
.
boardService
.
destroyList
(
this
.
id
).
catch
(()
=>
{
// TODO: handle request error
// TODO: handle request error
...
@@ -116,7 +117,7 @@ class List {
...
@@ -116,7 +117,7 @@ class List {
getIssues
(
emptyIssues
=
true
)
{
getIssues
(
emptyIssues
=
true
)
{
const
data
=
{
const
data
=
{
...
urlParamsToObject
(
gl
.
issueBoards
.
B
oardsStore
.
filter
.
path
),
...
urlParamsToObject
(
b
oardsStore
.
filter
.
path
),
page
:
this
.
page
,
page
:
this
.
page
,
};
};
...
...
app/assets/javascripts/boards/stores/boards_store.js
View file @
a0189744
...
@@ -3,13 +3,11 @@
...
@@ -3,13 +3,11 @@
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
Vue
from
'
vue
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
getUrlParamsArray
}
from
'
~/lib/utils/common_utils
'
;
import
{
getUrlParamsArray
}
from
'
~/lib/utils/common_utils
'
;
window
.
gl
=
window
.
gl
||
{};
const
boardsStore
=
{
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
gl
.
issueBoards
.
BoardsStore
=
{
disabled
:
false
,
disabled
:
false
,
filter
:
{
filter
:
{
path
:
''
,
path
:
''
,
...
@@ -167,3 +165,16 @@ gl.issueBoards.BoardsStore = {
...
@@ -167,3 +165,16 @@ gl.issueBoards.BoardsStore = {
window
.
history
.
pushState
(
null
,
null
,
`?
${
this
.
filter
.
path
}
`
);
window
.
history
.
pushState
(
null
,
null
,
`?
${
this
.
filter
.
path
}
`
);
}
}
};
};
// hacks added in order to allow milestone_select to function properly
// TODO: remove these
export
function
boardStoreIssueSet
(...
args
)
{
Vue
.
set
(
boardsStore
.
detail
.
issue
,
...
args
);
}
export
function
boardStoreIssueDelete
(...
args
)
{
Vue
.
delete
(
boardsStore
.
detail
.
issue
,
...
args
);
}
export
default
boardsStore
;
app/assets/javascripts/due_date_select.js
View file @
a0189744
...
@@ -5,6 +5,7 @@ import { __ } from '~/locale';
...
@@ -5,6 +5,7 @@ import { __ } from '~/locale';
import
axios
from
'
./lib/utils/axios_utils
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
{
timeFor
}
from
'
./lib/utils/datetime_utility
'
;
import
{
timeFor
}
from
'
./lib/utils/datetime_utility
'
;
import
{
parsePikadayDate
,
pikadayToString
}
from
'
./lib/utils/datefix
'
;
import
{
parsePikadayDate
,
pikadayToString
}
from
'
./lib/utils/datefix
'
;
import
boardsStore
from
'
./boards/stores/boards_store
'
;
class
DueDateSelect
{
class
DueDateSelect
{
constructor
({
$dropdown
,
$loading
}
=
{})
{
constructor
({
$dropdown
,
$loading
}
=
{})
{
...
@@ -58,7 +59,7 @@ class DueDateSelect {
...
@@ -58,7 +59,7 @@ class DueDateSelect {
$dueDateInput
.
val
(
calendar
.
toString
(
dateText
));
$dueDateInput
.
val
(
calendar
.
toString
(
dateText
));
if
(
this
.
$dropdown
.
hasClass
(
'
js-issue-boards-due-date
'
))
{
if
(
this
.
$dropdown
.
hasClass
(
'
js-issue-boards-due-date
'
))
{
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
dueDate
=
$dueDateInput
.
val
();
b
oardsStore
.
detail
.
issue
.
dueDate
=
$dueDateInput
.
val
();
this
.
updateIssueBoardIssue
();
this
.
updateIssueBoardIssue
();
}
else
{
}
else
{
this
.
saveDueDate
(
true
);
this
.
saveDueDate
(
true
);
...
@@ -79,7 +80,7 @@ class DueDateSelect {
...
@@ -79,7 +80,7 @@ class DueDateSelect {
calendar
.
setDate
(
null
);
calendar
.
setDate
(
null
);
if
(
this
.
$dropdown
.
hasClass
(
'
js-issue-boards-due-date
'
))
{
if
(
this
.
$dropdown
.
hasClass
(
'
js-issue-boards-due-date
'
))
{
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
dueDate
=
''
;
b
oardsStore
.
detail
.
issue
.
dueDate
=
''
;
this
.
updateIssueBoardIssue
();
this
.
updateIssueBoardIssue
();
}
else
{
}
else
{
$
(
`input[name='
${
this
.
fieldName
}
']`
).
val
(
''
);
$
(
`input[name='
${
this
.
fieldName
}
']`
).
val
(
''
);
...
@@ -123,7 +124,7 @@ class DueDateSelect {
...
@@ -123,7 +124,7 @@ class DueDateSelect {
this
.
$loading
.
fadeOut
();
this
.
$loading
.
fadeOut
();
};
};
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
b
oardsStore
.
detail
.
issue
.
update
(
this
.
$dropdown
.
attr
(
'
data-issue-update
'
))
.
update
(
this
.
$dropdown
.
attr
(
'
data-issue-update
'
))
.
then
(
fadeOutLoader
)
.
then
(
fadeOutLoader
)
.
catch
(
fadeOutLoader
);
.
catch
(
fadeOutLoader
);
...
...
app/assets/javascripts/labels_select.js
View file @
a0189744
...
@@ -11,6 +11,7 @@ import DropdownUtils from './filtered_search/dropdown_utils';
...
@@ -11,6 +11,7 @@ import DropdownUtils from './filtered_search/dropdown_utils';
import
CreateLabelDropdown
from
'
./create_label
'
;
import
CreateLabelDropdown
from
'
./create_label
'
;
import
flash
from
'
./flash
'
;
import
flash
from
'
./flash
'
;
import
ModalStore
from
'
./boards/stores/modal_store
'
;
import
ModalStore
from
'
./boards/stores/modal_store
'
;
import
boardsStore
from
'
./boards/stores/boards_store
'
;
export
default
class
LabelsSelect
{
export
default
class
LabelsSelect
{
constructor
(
els
,
options
=
{})
{
constructor
(
els
,
options
=
{})
{
...
@@ -378,7 +379,7 @@ export default class LabelsSelect {
...
@@ -378,7 +379,7 @@ export default class LabelsSelect {
}
}
else
if
(
$dropdown
.
hasClass
(
'
js-issue-board-sidebar
'
))
{
else
if
(
$dropdown
.
hasClass
(
'
js-issue-board-sidebar
'
))
{
if
(
$el
.
hasClass
(
'
is-active
'
))
{
if
(
$el
.
hasClass
(
'
is-active
'
))
{
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
labels
.
push
(
new
ListLabel
({
b
oardsStore
.
detail
.
issue
.
labels
.
push
(
new
ListLabel
({
id
:
label
.
id
,
id
:
label
.
id
,
title
:
label
.
title
,
title
:
label
.
title
,
color
:
label
.
color
[
0
],
color
:
label
.
color
[
0
],
...
@@ -386,16 +387,16 @@ export default class LabelsSelect {
...
@@ -386,16 +387,16 @@ export default class LabelsSelect {
}));
}));
}
}
else
{
else
{
var
{
labels
}
=
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
;
var
{
labels
}
=
b
oardsStore
.
detail
.
issue
;
labels
=
labels
.
filter
(
function
(
selectedLabel
)
{
labels
=
labels
.
filter
(
function
(
selectedLabel
)
{
return
selectedLabel
.
id
!==
label
.
id
;
return
selectedLabel
.
id
!==
label
.
id
;
});
});
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
labels
=
labels
;
b
oardsStore
.
detail
.
issue
.
labels
=
labels
;
}
}
$loading
.
fadeIn
();
$loading
.
fadeIn
();
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
update
(
$dropdown
.
attr
(
'
data-issue-update
'
))
b
oardsStore
.
detail
.
issue
.
update
(
$dropdown
.
attr
(
'
data-issue-update
'
))
.
then
(
fadeOutLoader
)
.
then
(
fadeOutLoader
)
.
catch
(
fadeOutLoader
);
.
catch
(
fadeOutLoader
);
}
}
...
...
app/assets/javascripts/milestone_select.js
View file @
a0189744
...
@@ -9,6 +9,7 @@ import '~/gl_dropdown';
...
@@ -9,6 +9,7 @@ import '~/gl_dropdown';
import
axios
from
'
./lib/utils/axios_utils
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
{
timeFor
}
from
'
./lib/utils/datetime_utility
'
;
import
{
timeFor
}
from
'
./lib/utils/datetime_utility
'
;
import
ModalStore
from
'
./boards/stores/modal_store
'
;
import
ModalStore
from
'
./boards/stores/modal_store
'
;
import
boardsStore
,
{
boardStoreIssueSet
,
boardStoreIssueDelete
}
from
'
./boards/stores/boards_store
'
;
export
default
class
MilestoneSelect
{
export
default
class
MilestoneSelect
{
constructor
(
currentProject
,
els
,
options
=
{})
{
constructor
(
currentProject
,
els
,
options
=
{})
{
...
@@ -187,7 +188,7 @@ export default class MilestoneSelect {
...
@@ -187,7 +188,7 @@ export default class MilestoneSelect {
return
$dropdown
.
closest
(
'
form
'
).
submit
();
return
$dropdown
.
closest
(
'
form
'
).
submit
();
}
else
if
(
$dropdown
.
hasClass
(
'
js-issue-board-sidebar
'
))
{
}
else
if
(
$dropdown
.
hasClass
(
'
js-issue-board-sidebar
'
))
{
if
(
selected
.
id
!==
-
1
&&
isSelecting
)
{
if
(
selected
.
id
!==
-
1
&&
isSelecting
)
{
gl
.
issueBoards
.
boardStoreIssueSet
(
boardStoreIssueSet
(
'
milestone
'
,
'
milestone
'
,
new
ListMilestone
({
new
ListMilestone
({
id
:
selected
.
id
,
id
:
selected
.
id
,
...
@@ -195,13 +196,13 @@ export default class MilestoneSelect {
...
@@ -195,13 +196,13 @@ export default class MilestoneSelect {
}),
}),
);
);
}
else
{
}
else
{
gl
.
issueBoards
.
boardStoreIssueDelete
(
'
milestone
'
);
boardStoreIssueDelete
(
'
milestone
'
);
}
}
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
$loading
.
removeClass
(
'
hidden
'
).
fadeIn
();
$loading
.
removeClass
(
'
hidden
'
).
fadeIn
();
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
b
oardsStore
.
detail
.
issue
.
update
(
$dropdown
.
attr
(
'
data-issue-update
'
))
.
update
(
$dropdown
.
attr
(
'
data-issue-update
'
))
.
then
(()
=>
{
.
then
(()
=>
{
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
...
...
spec/javascripts/boards/board_blank_state_spec.js
View file @
a0189744
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
BoardBlankState
from
'
~/boards/components/board_blank_state.vue
'
;
import
BoardBlankState
from
'
~/boards/components/board_blank_state.vue
'
;
import
{
mockBoardService
}
from
'
./mock_data
'
;
import
{
mockBoardService
}
from
'
./mock_data
'
;
...
@@ -10,7 +10,7 @@ describe('Boards blank state', () => {
...
@@ -10,7 +10,7 @@ describe('Boards blank state', () => {
beforeEach
((
done
)
=>
{
beforeEach
((
done
)
=>
{
const
Comp
=
Vue
.
extend
(
BoardBlankState
);
const
Comp
=
Vue
.
extend
(
BoardBlankState
);
gl
.
issueBoards
.
B
oardsStore
.
create
();
b
oardsStore
.
create
();
gl
.
boardService
=
mockBoardService
();
gl
.
boardService
=
mockBoardService
();
spyOn
(
gl
.
boardService
,
'
generateDefaultLists
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
spyOn
(
gl
.
boardService
,
'
generateDefaultLists
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -57,7 +57,7 @@ describe('Boards blank state', () => {
...
@@ -57,7 +57,7 @@ describe('Boards blank state', () => {
vm
.
$el
.
querySelector
(
'
.btn-default
'
).
click
();
vm
.
$el
.
querySelector
(
'
.btn-default
'
).
click
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
welcomeIsHidden
()).
toBeTruthy
();
expect
(
b
oardsStore
.
welcomeIsHidden
()).
toBeTruthy
();
done
();
done
();
});
});
...
@@ -67,9 +67,9 @@ describe('Boards blank state', () => {
...
@@ -67,9 +67,9 @@ describe('Boards blank state', () => {
vm
.
$el
.
querySelector
(
'
.btn-success
'
).
click
();
vm
.
$el
.
querySelector
(
'
.btn-success
'
).
click
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
[
0
].
title
).
toEqual
(
'
To Do
'
);
expect
(
b
oardsStore
.
state
.
lists
[
0
].
title
).
toEqual
(
'
To Do
'
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
[
1
].
title
).
toEqual
(
'
Doing
'
);
expect
(
b
oardsStore
.
state
.
lists
[
1
].
title
).
toEqual
(
'
Doing
'
);
done
();
done
();
});
});
...
@@ -81,8 +81,8 @@ describe('Boards blank state', () => {
...
@@ -81,8 +81,8 @@ describe('Boards blank state', () => {
vm
.
$el
.
querySelector
(
'
.btn-success
'
).
click
();
vm
.
$el
.
querySelector
(
'
.btn-success
'
).
click
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
welcomeIsHidden
()).
toBeFalsy
();
expect
(
b
oardsStore
.
welcomeIsHidden
()).
toBeFalsy
();
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
done
();
done
();
});
});
...
...
spec/javascripts/boards/board_card_spec.js
View file @
a0189744
...
@@ -10,7 +10,7 @@ import eventHub from '~/boards/eventhub';
...
@@ -10,7 +10,7 @@ import eventHub from '~/boards/eventhub';
import
'
~/vue_shared/models/label
'
;
import
'
~/vue_shared/models/label
'
;
import
'
~/vue_shared/models/assignee
'
;
import
'
~/vue_shared/models/assignee
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardCard
from
'
~/boards/components/board_card.vue
'
;
import
boardCard
from
'
~/boards/components/board_card.vue
'
;
import
{
listObj
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
import
{
listObj
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
...
@@ -23,8 +23,8 @@ describe('Board card', () => {
...
@@ -23,8 +23,8 @@ describe('Board card', () => {
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
gl
.
boardService
=
mockBoardService
();
gl
.
boardService
=
mockBoardService
();
gl
.
issueBoards
.
B
oardsStore
.
create
();
b
oardsStore
.
create
();
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
=
{};
b
oardsStore
.
detail
.
issue
=
{};
const
BoardCardComp
=
Vue
.
extend
(
boardCard
);
const
BoardCardComp
=
Vue
.
extend
(
boardCard
);
const
list
=
new
List
(
listObj
);
const
list
=
new
List
(
listObj
);
...
@@ -62,7 +62,7 @@ describe('Board card', () => {
...
@@ -62,7 +62,7 @@ describe('Board card', () => {
});
});
it
(
'
returns true when detailIssue is equal to card issue
'
,
()
=>
{
it
(
'
returns true when detailIssue is equal to card issue
'
,
()
=>
{
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
=
vm
.
issue
;
b
oardsStore
.
detail
.
issue
=
vm
.
issue
;
expect
(
vm
.
issueDetailVisible
).
toBe
(
true
);
expect
(
vm
.
issueDetailVisible
).
toBe
(
true
);
});
});
...
@@ -119,19 +119,19 @@ describe('Board card', () => {
...
@@ -119,19 +119,19 @@ describe('Board card', () => {
});
});
it
(
'
does not set detail issue if showDetail is false
'
,
()
=>
{
it
(
'
does not set detail issue if showDetail is false
'
,
()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
).
toEqual
({});
expect
(
b
oardsStore
.
detail
.
issue
).
toEqual
({});
});
});
it
(
'
does not set detail issue if link is clicked
'
,
()
=>
{
it
(
'
does not set detail issue if link is clicked
'
,
()
=>
{
triggerEvent
(
'
mouseup
'
,
vm
.
$el
.
querySelector
(
'
a
'
));
triggerEvent
(
'
mouseup
'
,
vm
.
$el
.
querySelector
(
'
a
'
));
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
).
toEqual
({});
expect
(
b
oardsStore
.
detail
.
issue
).
toEqual
({});
});
});
it
(
'
does not set detail issue if button is clicked
'
,
()
=>
{
it
(
'
does not set detail issue if button is clicked
'
,
()
=>
{
triggerEvent
(
'
mouseup
'
,
vm
.
$el
.
querySelector
(
'
button
'
));
triggerEvent
(
'
mouseup
'
,
vm
.
$el
.
querySelector
(
'
button
'
));
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
).
toEqual
({});
expect
(
b
oardsStore
.
detail
.
issue
).
toEqual
({});
});
});
it
(
'
does not set detail issue if img is clicked
'
,
(
done
)
=>
{
it
(
'
does not set detail issue if img is clicked
'
,
(
done
)
=>
{
...
@@ -145,7 +145,7 @@ describe('Board card', () => {
...
@@ -145,7 +145,7 @@ describe('Board card', () => {
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
triggerEvent
(
'
mouseup
'
,
vm
.
$el
.
querySelector
(
'
img
'
));
triggerEvent
(
'
mouseup
'
,
vm
.
$el
.
querySelector
(
'
img
'
));
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
).
toEqual
({});
expect
(
b
oardsStore
.
detail
.
issue
).
toEqual
({});
done
();
done
();
});
});
...
@@ -154,7 +154,7 @@ describe('Board card', () => {
...
@@ -154,7 +154,7 @@ describe('Board card', () => {
it
(
'
does not set detail issue if showDetail is false after mouseup
'
,
()
=>
{
it
(
'
does not set detail issue if showDetail is false after mouseup
'
,
()
=>
{
triggerEvent
(
'
mouseup
'
);
triggerEvent
(
'
mouseup
'
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
).
toEqual
({});
expect
(
b
oardsStore
.
detail
.
issue
).
toEqual
({});
});
});
it
(
'
sets detail issue to card issue on mouse up
'
,
()
=>
{
it
(
'
sets detail issue to card issue on mouse up
'
,
()
=>
{
...
@@ -164,7 +164,7 @@ describe('Board card', () => {
...
@@ -164,7 +164,7 @@ describe('Board card', () => {
triggerEvent
(
'
mouseup
'
);
triggerEvent
(
'
mouseup
'
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
newDetailIssue
'
,
vm
.
issue
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
newDetailIssue
'
,
vm
.
issue
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
list
).
toEqual
(
vm
.
list
);
expect
(
b
oardsStore
.
detail
.
list
).
toEqual
(
vm
.
list
);
});
});
it
(
'
adds active class if detail issue is set
'
,
(
done
)
=>
{
it
(
'
adds active class if detail issue is set
'
,
(
done
)
=>
{
...
@@ -181,7 +181,7 @@ describe('Board card', () => {
...
@@ -181,7 +181,7 @@ describe('Board card', () => {
it
(
'
resets detail issue to empty if already set
'
,
()
=>
{
it
(
'
resets detail issue to empty if already set
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
=
vm
.
issue
;
b
oardsStore
.
detail
.
issue
=
vm
.
issue
;
triggerEvent
(
'
mousedown
'
);
triggerEvent
(
'
mousedown
'
);
triggerEvent
(
'
mouseup
'
);
triggerEvent
(
'
mouseup
'
);
...
...
spec/javascripts/boards/board_list_spec.js
View file @
a0189744
/* global List */
/* global List */
/* global ListIssue */
/* global ListIssue */
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
Sortable
from
'
sortablejs
'
;
import
Sortable
from
'
sortablejs
'
;
import
BoardList
from
'
~/boards/components/board_list.vue
'
;
import
BoardList
from
'
~/boards/components/board_list.vue
'
;
import
eventHub
from
'
~/boards/eventhub
'
;
import
eventHub
from
'
~/boards/eventhub
'
;
import
'
~/boards/mixins/sortable_default_options
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
listObj
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
import
{
listObj
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
window
.
Sortable
=
Sortable
;
window
.
Sortable
=
Sortable
;
...
@@ -25,8 +25,7 @@ describe('Board list component', () => {
...
@@ -25,8 +25,7 @@ describe('Board list component', () => {
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
gl
.
boardService
=
mockBoardService
();
gl
.
boardService
=
mockBoardService
();
gl
.
issueBoards
.
BoardsStore
.
create
();
boardsStore
.
create
();
gl
.
IssueBoardsApp
=
new
Vue
();
const
BoardListComp
=
Vue
.
extend
(
BoardList
);
const
BoardListComp
=
Vue
.
extend
(
BoardList
);
const
list
=
new
List
(
listObj
);
const
list
=
new
List
(
listObj
);
...
...
spec/javascripts/boards/board_new_issue_spec.js
View file @
a0189744
...
@@ -4,6 +4,7 @@ import Vue from 'vue';
...
@@ -4,6 +4,7 @@ import Vue from 'vue';
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
boardNewIssue
from
'
~/boards/components/board_new_issue.vue
'
;
import
boardNewIssue
from
'
~/boards/components/board_new_issue.vue
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
{
listObj
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
import
{
listObj
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
...
@@ -36,8 +37,7 @@ describe('Issue boards new issue form', () => {
...
@@ -36,8 +37,7 @@ describe('Issue boards new issue form', () => {
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
gl
.
boardService
=
mockBoardService
();
gl
.
boardService
=
mockBoardService
();
gl
.
issueBoards
.
BoardsStore
.
create
();
boardsStore
.
create
();
gl
.
IssueBoardsApp
=
new
Vue
();
list
=
new
List
(
listObj
);
list
=
new
List
(
listObj
);
...
@@ -148,13 +148,13 @@ describe('Issue boards new issue form', () => {
...
@@ -148,13 +148,13 @@ describe('Issue boards new issue form', () => {
});
});
it
(
'
sets detail issue after submit
'
,
(
done
)
=>
{
it
(
'
sets detail issue after submit
'
,
(
done
)
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
title
).
toBe
(
undefined
);
expect
(
b
oardsStore
.
detail
.
issue
.
title
).
toBe
(
undefined
);
vm
.
title
=
'
submit issue
'
;
vm
.
title
=
'
submit issue
'
;
Vue
.
nextTick
()
Vue
.
nextTick
()
.
then
(
submitIssue
)
.
then
(
submitIssue
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
issue
.
title
).
toBe
(
'
submit issue
'
);
expect
(
b
oardsStore
.
detail
.
issue
.
title
).
toBe
(
'
submit issue
'
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
@@ -166,7 +166,7 @@ describe('Issue boards new issue form', () => {
...
@@ -166,7 +166,7 @@ describe('Issue boards new issue form', () => {
Vue
.
nextTick
()
Vue
.
nextTick
()
.
then
(
submitIssue
)
.
then
(
submitIssue
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
detail
.
list
.
id
).
toBe
(
list
.
id
);
expect
(
b
oardsStore
.
detail
.
list
.
id
).
toBe
(
list
.
id
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
spec/javascripts/boards/boards_store_spec.js
View file @
a0189744
...
@@ -11,7 +11,7 @@ import '~/vue_shared/models/assignee';
...
@@ -11,7 +11,7 @@ import '~/vue_shared/models/assignee';
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
describe
(
'
Store
'
,
()
=>
{
describe
(
'
Store
'
,
()
=>
{
...
@@ -21,7 +21,7 @@ describe('Store', () => {
...
@@ -21,7 +21,7 @@ describe('Store', () => {
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
mock
.
onAny
().
reply
(
boardsMockInterceptor
);
gl
.
boardService
=
mockBoardService
();
gl
.
boardService
=
mockBoardService
();
gl
.
issueBoards
.
B
oardsStore
.
create
();
b
oardsStore
.
create
();
spyOn
(
gl
.
boardService
,
'
moveIssue
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
spyOn
(
gl
.
boardService
,
'
moveIssue
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
resolve
();
resolve
();
...
@@ -38,35 +38,35 @@ describe('Store', () => {
...
@@ -38,35 +38,35 @@ describe('Store', () => {
});
});
it
(
'
starts with a blank state
'
,
()
=>
{
it
(
'
starts with a blank state
'
,
()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
0
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
0
);
});
});
describe
(
'
lists
'
,
()
=>
{
describe
(
'
lists
'
,
()
=>
{
it
(
'
creates new list without persisting to DB
'
,
()
=>
{
it
(
'
creates new list without persisting to DB
'
,
()
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
b
oardsStore
.
addList
(
listObj
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
});
});
it
(
'
finds list by ID
'
,
()
=>
{
it
(
'
finds list by ID
'
,
()
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
b
oardsStore
.
addList
(
listObj
);
const
list
=
gl
.
issueBoards
.
B
oardsStore
.
findList
(
'
id
'
,
listObj
.
id
);
const
list
=
b
oardsStore
.
findList
(
'
id
'
,
listObj
.
id
);
expect
(
list
.
id
).
toBe
(
listObj
.
id
);
expect
(
list
.
id
).
toBe
(
listObj
.
id
);
});
});
it
(
'
finds list by type
'
,
()
=>
{
it
(
'
finds list by type
'
,
()
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
b
oardsStore
.
addList
(
listObj
);
const
list
=
gl
.
issueBoards
.
B
oardsStore
.
findList
(
'
type
'
,
'
label
'
);
const
list
=
b
oardsStore
.
findList
(
'
type
'
,
'
label
'
);
expect
(
list
).
toBeDefined
();
expect
(
list
).
toBeDefined
();
});
});
it
(
'
gets issue when new list added
'
,
(
done
)
=>
{
it
(
'
gets issue when new list added
'
,
(
done
)
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
b
oardsStore
.
addList
(
listObj
);
const
list
=
gl
.
issueBoards
.
B
oardsStore
.
findList
(
'
id
'
,
listObj
.
id
);
const
list
=
b
oardsStore
.
findList
(
'
id
'
,
listObj
.
id
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
list
.
issues
.
length
).
toBe
(
1
);
expect
(
list
.
issues
.
length
).
toBe
(
1
);
...
@@ -76,7 +76,7 @@ describe('Store', () => {
...
@@ -76,7 +76,7 @@ describe('Store', () => {
});
});
it
(
'
persists new list
'
,
(
done
)
=>
{
it
(
'
persists new list
'
,
(
done
)
=>
{
gl
.
issueBoards
.
B
oardsStore
.
new
({
b
oardsStore
.
new
({
title
:
'
Test
'
,
title
:
'
Test
'
,
list_type
:
'
label
'
,
list_type
:
'
label
'
,
label
:
{
label
:
{
...
@@ -86,10 +86,10 @@ describe('Store', () => {
...
@@ -86,10 +86,10 @@ describe('Store', () => {
description
:
'
testing;
'
description
:
'
testing;
'
}
}
});
});
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
const
list
=
gl
.
issueBoards
.
B
oardsStore
.
findList
(
'
id
'
,
listObj
.
id
);
const
list
=
b
oardsStore
.
findList
(
'
id
'
,
listObj
.
id
);
expect
(
list
).
toBeDefined
();
expect
(
list
).
toBeDefined
();
expect
(
list
.
id
).
toBe
(
listObj
.
id
);
expect
(
list
.
id
).
toBe
(
listObj
.
id
);
expect
(
list
.
position
).
toBe
(
0
);
expect
(
list
.
position
).
toBe
(
0
);
...
@@ -98,61 +98,61 @@ describe('Store', () => {
...
@@ -98,61 +98,61 @@ describe('Store', () => {
});
});
it
(
'
check for blank state adding
'
,
()
=>
{
it
(
'
check for blank state adding
'
,
()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
shouldAddBlankState
()).
toBe
(
true
);
expect
(
b
oardsStore
.
shouldAddBlankState
()).
toBe
(
true
);
});
});
it
(
'
check for blank state not adding
'
,
()
=>
{
it
(
'
check for blank state not adding
'
,
()
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
b
oardsStore
.
addList
(
listObj
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
shouldAddBlankState
()).
toBe
(
false
);
expect
(
b
oardsStore
.
shouldAddBlankState
()).
toBe
(
false
);
});
});
it
(
'
check for blank state adding when closed list exist
'
,
()
=>
{
it
(
'
check for blank state adding when closed list exist
'
,
()
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addList
({
b
oardsStore
.
addList
({
list_type
:
'
closed
'
list_type
:
'
closed
'
});
});
expect
(
gl
.
issueBoards
.
B
oardsStore
.
shouldAddBlankState
()).
toBe
(
true
);
expect
(
b
oardsStore
.
shouldAddBlankState
()).
toBe
(
true
);
});
});
it
(
'
adds the blank state
'
,
()
=>
{
it
(
'
adds the blank state
'
,
()
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addBlankState
();
b
oardsStore
.
addBlankState
();
const
list
=
gl
.
issueBoards
.
B
oardsStore
.
findList
(
'
type
'
,
'
blank
'
,
'
blank
'
);
const
list
=
b
oardsStore
.
findList
(
'
type
'
,
'
blank
'
,
'
blank
'
);
expect
(
list
).
toBeDefined
();
expect
(
list
).
toBeDefined
();
});
});
it
(
'
removes list from state
'
,
()
=>
{
it
(
'
removes list from state
'
,
()
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
b
oardsStore
.
addList
(
listObj
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
gl
.
issueBoards
.
B
oardsStore
.
removeList
(
listObj
.
id
,
'
label
'
);
b
oardsStore
.
removeList
(
listObj
.
id
,
'
label
'
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
0
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
0
);
});
});
it
(
'
moves the position of lists
'
,
()
=>
{
it
(
'
moves the position of lists
'
,
()
=>
{
const
listOne
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
const
listOne
=
b
oardsStore
.
addList
(
listObj
);
const
listTwo
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObjDuplicate
);
const
listTwo
=
b
oardsStore
.
addList
(
listObjDuplicate
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
gl
.
issueBoards
.
B
oardsStore
.
moveList
(
listOne
,
[
listObjDuplicate
.
id
,
listObj
.
id
]);
b
oardsStore
.
moveList
(
listOne
,
[
listObjDuplicate
.
id
,
listObj
.
id
]);
expect
(
listOne
.
position
).
toBe
(
1
);
expect
(
listOne
.
position
).
toBe
(
1
);
});
});
it
(
'
moves an issue from one list to another
'
,
(
done
)
=>
{
it
(
'
moves an issue from one list to another
'
,
(
done
)
=>
{
const
listOne
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
const
listOne
=
b
oardsStore
.
addList
(
listObj
);
const
listTwo
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObjDuplicate
);
const
listTwo
=
b
oardsStore
.
addList
(
listObjDuplicate
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
listOne
.
issues
.
length
).
toBe
(
1
);
expect
(
listOne
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
gl
.
issueBoards
.
B
oardsStore
.
moveIssueToList
(
listOne
,
listTwo
,
listOne
.
findIssue
(
1
));
b
oardsStore
.
moveIssueToList
(
listOne
,
listTwo
,
listOne
.
findIssue
(
1
));
expect
(
listOne
.
issues
.
length
).
toBe
(
0
);
expect
(
listOne
.
issues
.
length
).
toBe
(
0
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
...
@@ -162,19 +162,19 @@ describe('Store', () => {
...
@@ -162,19 +162,19 @@ describe('Store', () => {
});
});
it
(
'
moves an issue from backlog to a list
'
,
(
done
)
=>
{
it
(
'
moves an issue from backlog to a list
'
,
(
done
)
=>
{
const
backlog
=
gl
.
issueBoards
.
B
oardsStore
.
addList
({
const
backlog
=
b
oardsStore
.
addList
({
...
listObj
,
...
listObj
,
list_type
:
'
backlog
'
,
list_type
:
'
backlog
'
,
});
});
const
listTwo
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObjDuplicate
);
const
listTwo
=
b
oardsStore
.
addList
(
listObjDuplicate
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
backlog
.
issues
.
length
).
toBe
(
1
);
expect
(
backlog
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
gl
.
issueBoards
.
B
oardsStore
.
moveIssueToList
(
backlog
,
listTwo
,
backlog
.
findIssue
(
1
));
b
oardsStore
.
moveIssueToList
(
backlog
,
listTwo
,
backlog
.
findIssue
(
1
));
expect
(
backlog
.
issues
.
length
).
toBe
(
0
);
expect
(
backlog
.
issues
.
length
).
toBe
(
0
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
...
@@ -184,10 +184,10 @@ describe('Store', () => {
...
@@ -184,10 +184,10 @@ describe('Store', () => {
});
});
it
(
'
moves issue to top of another list
'
,
(
done
)
=>
{
it
(
'
moves issue to top of another list
'
,
(
done
)
=>
{
const
listOne
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
const
listOne
=
b
oardsStore
.
addList
(
listObj
);
const
listTwo
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObjDuplicate
);
const
listTwo
=
b
oardsStore
.
addList
(
listObjDuplicate
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
listOne
.
issues
[
0
].
id
=
2
;
listOne
.
issues
[
0
].
id
=
2
;
...
@@ -195,7 +195,7 @@ describe('Store', () => {
...
@@ -195,7 +195,7 @@ describe('Store', () => {
expect
(
listOne
.
issues
.
length
).
toBe
(
1
);
expect
(
listOne
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
gl
.
issueBoards
.
B
oardsStore
.
moveIssueToList
(
listOne
,
listTwo
,
listOne
.
findIssue
(
2
),
0
);
b
oardsStore
.
moveIssueToList
(
listOne
,
listTwo
,
listOne
.
findIssue
(
2
),
0
);
expect
(
listOne
.
issues
.
length
).
toBe
(
0
);
expect
(
listOne
.
issues
.
length
).
toBe
(
0
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
2
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
2
);
...
@@ -207,10 +207,10 @@ describe('Store', () => {
...
@@ -207,10 +207,10 @@ describe('Store', () => {
});
});
it
(
'
moves issue to bottom of another list
'
,
(
done
)
=>
{
it
(
'
moves issue to bottom of another list
'
,
(
done
)
=>
{
const
listOne
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
const
listOne
=
b
oardsStore
.
addList
(
listObj
);
const
listTwo
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObjDuplicate
);
const
listTwo
=
b
oardsStore
.
addList
(
listObjDuplicate
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
listOne
.
issues
[
0
].
id
=
2
;
listOne
.
issues
[
0
].
id
=
2
;
...
@@ -218,7 +218,7 @@ describe('Store', () => {
...
@@ -218,7 +218,7 @@ describe('Store', () => {
expect
(
listOne
.
issues
.
length
).
toBe
(
1
);
expect
(
listOne
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
1
);
gl
.
issueBoards
.
B
oardsStore
.
moveIssueToList
(
listOne
,
listTwo
,
listOne
.
findIssue
(
2
),
1
);
b
oardsStore
.
moveIssueToList
(
listOne
,
listTwo
,
listOne
.
findIssue
(
2
),
1
);
expect
(
listOne
.
issues
.
length
).
toBe
(
0
);
expect
(
listOne
.
issues
.
length
).
toBe
(
0
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
2
);
expect
(
listTwo
.
issues
.
length
).
toBe
(
2
);
...
@@ -238,14 +238,14 @@ describe('Store', () => {
...
@@ -238,14 +238,14 @@ describe('Store', () => {
labels
:
[],
labels
:
[],
assignees
:
[],
assignees
:
[],
});
});
const
list
=
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
const
list
=
b
oardsStore
.
addList
(
listObj
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
list
.
addIssue
(
issue
);
list
.
addIssue
(
issue
);
expect
(
list
.
issues
.
length
).
toBe
(
2
);
expect
(
list
.
issues
.
length
).
toBe
(
2
);
gl
.
issueBoards
.
B
oardsStore
.
moveIssueInList
(
list
,
issue
,
0
,
1
,
[
1
,
2
]);
b
oardsStore
.
moveIssueInList
(
list
,
issue
,
0
,
1
,
[
1
,
2
]);
expect
(
list
.
issues
[
0
].
id
).
toBe
(
2
);
expect
(
list
.
issues
[
0
].
id
).
toBe
(
2
);
expect
(
gl
.
boardService
.
moveIssue
).
toHaveBeenCalledWith
(
2
,
null
,
null
,
1
,
null
);
expect
(
gl
.
boardService
.
moveIssue
).
toHaveBeenCalledWith
(
2
,
null
,
null
,
1
,
null
);
...
...
spec/javascripts/boards/components/board_spec.js
View file @
a0189744
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/components/board
'
;
import
Board
from
'
~/boards/components/board
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
{
mockBoardService
}
from
'
../mock_data
'
;
import
{
mockBoardService
}
from
'
../mock_data
'
;
...
@@ -21,7 +21,7 @@ describe('Board component', () => {
...
@@ -21,7 +21,7 @@ describe('Board component', () => {
boardId
:
1
,
boardId
:
1
,
});
});
vm
=
new
gl
.
issueBoards
.
Board
({
vm
=
new
Board
({
propsData
:
{
propsData
:
{
boardId
:
'
1
'
,
boardId
:
'
1
'
,
disabled
:
false
,
disabled
:
false
,
...
...
spec/javascripts/boards/issue_card_spec.js
View file @
a0189744
...
@@ -8,7 +8,6 @@ import '~/vue_shared/models/label';
...
@@ -8,7 +8,6 @@ import '~/vue_shared/models/label';
import
'
~/vue_shared/models/assignee
'
;
import
'
~/vue_shared/models/assignee
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/stores/boards_store
'
;
import
IssueCardInner
from
'
~/boards/components/issue_card_inner.vue
'
;
import
IssueCardInner
from
'
~/boards/components/issue_card_inner.vue
'
;
import
{
listObj
}
from
'
./mock_data
'
;
import
{
listObj
}
from
'
./mock_data
'
;
...
...
spec/javascripts/boards/issue_spec.js
View file @
a0189744
...
@@ -6,7 +6,7 @@ import '~/vue_shared/models/assignee';
...
@@ -6,7 +6,7 @@ import '~/vue_shared/models/assignee';
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
mockBoardService
}
from
'
./mock_data
'
;
import
{
mockBoardService
}
from
'
./mock_data
'
;
describe
(
'
Issue model
'
,
()
=>
{
describe
(
'
Issue model
'
,
()
=>
{
...
@@ -14,7 +14,7 @@ describe('Issue model', () => {
...
@@ -14,7 +14,7 @@ describe('Issue model', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
gl
.
boardService
=
mockBoardService
();
gl
.
boardService
=
mockBoardService
();
gl
.
issueBoards
.
B
oardsStore
.
create
();
b
oardsStore
.
create
();
issue
=
new
ListIssue
({
issue
=
new
ListIssue
({
title
:
'
Testing
'
,
title
:
'
Testing
'
,
...
...
spec/javascripts/boards/list_spec.js
View file @
a0189744
...
@@ -9,7 +9,7 @@ import '~/vue_shared/models/assignee';
...
@@ -9,7 +9,7 @@ import '~/vue_shared/models/assignee';
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
,
mockBoardService
}
from
'
./mock_data
'
;
describe
(
'
List model
'
,
()
=>
{
describe
(
'
List model
'
,
()
=>
{
...
@@ -22,7 +22,7 @@ describe('List model', () => {
...
@@ -22,7 +22,7 @@ describe('List model', () => {
gl
.
boardService
=
mockBoardService
({
gl
.
boardService
=
mockBoardService
({
bulkUpdatePath
:
'
/test/issue-boards/board/1/lists
'
,
bulkUpdatePath
:
'
/test/issue-boards/board/1/lists
'
,
});
});
gl
.
issueBoards
.
B
oardsStore
.
create
();
b
oardsStore
.
create
();
list
=
new
List
(
listObj
);
list
=
new
List
(
listObj
);
});
});
...
@@ -58,13 +58,13 @@ describe('List model', () => {
...
@@ -58,13 +58,13 @@ describe('List model', () => {
});
});
it
(
'
destroys the list
'
,
(
done
)
=>
{
it
(
'
destroys the list
'
,
(
done
)
=>
{
gl
.
issueBoards
.
B
oardsStore
.
addList
(
listObj
);
b
oardsStore
.
addList
(
listObj
);
list
=
gl
.
issueBoards
.
B
oardsStore
.
findList
(
'
id
'
,
listObj
.
id
);
list
=
b
oardsStore
.
findList
(
'
id
'
,
listObj
.
id
);
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
list
.
destroy
();
list
.
destroy
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
gl
.
issueBoards
.
B
oardsStore
.
state
.
lists
.
length
).
toBe
(
0
);
expect
(
b
oardsStore
.
state
.
lists
.
length
).
toBe
(
0
);
done
();
done
();
},
0
);
},
0
);
});
});
...
...
spec/javascripts/boards/mock_data.js
View file @
a0189744
/* global BoardService */
import
BoardService
from
'
~/boards/services/board_service
'
;
export
const
listObj
=
{
export
const
listObj
=
{
id
:
300
,
id
:
300
,
position
:
0
,
position
:
0
,
...
...
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