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
9669fe22
Commit
9669fe22
authored
Mar 05, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use shared LabelsSelect component
parent
88acf814
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
4 deletions
+56
-4
ee/app/assets/javascripts/boards/components/board_form.vue
ee/app/assets/javascripts/boards/components/board_form.vue
+25
-4
spec/javascripts/boards/components/board_form_spec.js
spec/javascripts/boards/components/board_form_spec.js
+31
-0
No files found.
ee/app/assets/javascripts/boards/components/board_form.vue
View file @
9669fe22
<
script
>
/* global ListLabel */
/* global BoardService */
import
Flash
from
'
~/flash
'
;
import
modal
from
'
~/vue_shared/components/modal.vue
'
;
import
BoardLabelsSelect
from
'
~/vue_shared/components/sidebar/labels_select/base.vue
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
BoardMilestoneSelect
from
'
./milestone_select.vue
'
;
import
BoardWeightSelect
from
'
./weight_select.vue
'
;
import
BoardLabelsSelect
from
'
./labels_select.vue
'
;
import
AssigneeSelect
from
'
./assignee_select.vue
'
;
window
.
gl
=
window
.
gl
||
{};
...
...
@@ -143,6 +144,22 @@ export default {
}
},
methods
:
{
handleLabelClick
(
label
)
{
if
(
label
.
isAny
)
{
this
.
board
.
labels
=
[];
}
else
if
(
!
this
.
board
.
labels
.
find
(
l
=>
l
.
id
===
label
.
id
))
{
this
.
board
.
labels
.
push
(
new
ListLabel
({
id
:
label
.
id
,
title
:
label
.
title
,
color
:
label
.
color
[
0
],
textColor
:
label
.
text_color
,
}));
}
else
{
let
labels
=
this
.
board
.
labels
;
labels
=
labels
.
filter
(
selected
=>
selected
.
id
!==
label
.
id
);
this
.
board
.
labels
=
labels
;
}
},
submit
()
{
if
(
this
.
board
.
name
.
length
===
0
)
return
;
this
.
isLoading
=
true
;
...
...
@@ -251,10 +268,14 @@ export default {
/>
<board-labels-select
:board=
"board
"
:c
an-edit=
"canAdminB
oard"
ability-name=
"issue
"
:c
ontext=
"b
oard"
:labels-path=
"labelsPath"
/>
:can-edit=
"canAdminBoard"
@
onLabelClick=
"handleLabelClick"
>
{{
__
(
'
Any Label
'
)
}}
</board-labels-select>
<assignee-select
any-user-text=
"Any assignee"
...
...
spec/javascripts/boards/components/board_form_spec.js
View file @
9669fe22
...
...
@@ -24,6 +24,37 @@ describe('board_form.vue', () => {
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
handleLabelClick
'
,
()
=>
{
const
label
=
{
id
:
1
,
title
:
'
Foo
'
,
color
:
[
'
#BADA55
'
],
text_color
:
'
#FFFFFF
'
,
};
it
(
'
initializes `board.labels` as empty array when `label.isAny` is `true`
'
,
()
=>
{
const
labelIsAny
=
{
isAny
:
true
};
vm
.
handleLabelClick
(
labelIsAny
);
expect
(
Array
.
isArray
(
vm
.
board
.
labels
)).
toBe
(
true
);
expect
(
vm
.
board
.
labels
.
length
).
toBe
(
0
);
});
it
(
'
adds provided `label` to board.labels
'
,
()
=>
{
vm
.
handleLabelClick
(
label
);
expect
(
vm
.
board
.
labels
.
length
).
toBe
(
1
);
expect
(
vm
.
board
.
labels
[
0
].
id
).
toBe
(
label
.
id
);
vm
.
handleLabelClick
(
label
);
});
it
(
'
filters board.labels to exclude provided `label` if it is already present in `board.labels`
'
,
()
=>
{
const
label2
=
Object
.
assign
({},
label
,
{
id
:
2
});
vm
.
handleLabelClick
(
label
);
vm
.
handleLabelClick
(
label2
);
expect
(
vm
.
board
.
labels
.
length
).
toBe
(
1
);
expect
(
vm
.
board
.
labels
[
0
].
id
).
toBe
(
label2
.
id
);
});
});
describe
(
'
cancel
'
,
()
=>
{
it
(
'
resets currentPage
'
,
(
done
)
=>
{
vm
.
cancel
();
...
...
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