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
fd29d841
Commit
fd29d841
authored
Aug 13, 2021
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use dropdown widget in board scope assignee select
Review feedback
parent
417f6cbe
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
20 deletions
+29
-20
app/assets/javascripts/vue_shared/components/dropdown/dropdown_widget/dropdown_widget.vue
...d/components/dropdown/dropdown_widget/dropdown_widget.vue
+11
-12
ee/app/assets/javascripts/boards/components/assignee_select.vue
.../assets/javascripts/boards/components/assignee_select.vue
+8
-2
ee/app/assets/javascripts/boards/constants.js
ee/app/assets/javascripts/boards/constants.js
+1
-1
ee/spec/frontend/boards/components/assignee_select_spec.js
ee/spec/frontend/boards/components/assignee_select_spec.js
+4
-2
ee/spec/frontend/boards/milestone_select_spec.js
ee/spec/frontend/boards/milestone_select_spec.js
+3
-1
spec/frontend/vue_shared/components/dropdown/dropdown_widget_spec.js
...nd/vue_shared/components/dropdown/dropdown_widget_spec.js
+2
-2
No files found.
app/assets/javascripts/vue_shared/components/dropdown/dropdown_widget/dropdown_widget.vue
View file @
fd29d841
...
...
@@ -54,11 +54,6 @@ export default {
required
:
false
,
default
:
''
,
},
isUserDropdown
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
},
computed
:
{
isSearchEmpty
()
{
...
...
@@ -75,9 +70,8 @@ export default {
isSelected
(
option
)
{
return
(
this
.
selected
&&
(
this
.
isUserDropdown
?
this
.
selected
.
name
===
option
.
name
:
this
.
selected
.
title
===
option
.
title
)
((
option
.
name
&&
this
.
selected
.
name
===
option
.
name
)
||
(
option
.
title
&&
this
.
selected
.
title
===
option
.
title
))
);
},
showDropdown
()
{
...
...
@@ -90,10 +84,11 @@ export default {
this
.
$emit
(
'
set-search
'
,
search
);
},
avatarUrl
(
option
)
{
return
this
.
isUserDropdown
?
option
.
avatar_url
||
option
.
avatarUrl
:
null
;
return
option
.
avatar_url
||
option
.
avatarUrl
||
null
;
},
secondaryText
(
option
)
{
return
this
.
isUserDropdown
?
option
.
username
:
null
;
// TODO: this has some knowledge of the context where the component is used. We could later rework it.
return
option
.
username
||
null
;
},
},
i18n
:
{
...
...
@@ -137,7 +132,9 @@ export default {
:is-check-item=
"true"
@
click=
"selectOption(option)"
>
{{
option
.
title
||
option
.
name
}}
<slot
name=
"preset-item"
:item=
"option"
>
{{
option
.
title
}}
</slot>
</gl-dropdown-item>
<gl-dropdown-divider
/>
</
template
>
...
...
@@ -152,7 +149,9 @@ export default {
data-testid=
"unselected-option"
@
click=
"selectOption(option)"
>
{{ option.title || option.name }}
<slot
name=
"item"
:item=
"option"
>
{{ option.title }}
</slot>
</gl-dropdown-item>
<gl-dropdown-item
v-if=
"noOptionsFound"
class=
"gl-pl-6!"
>
{{ $options.i18n.noMatchingResults }}
...
...
ee/app/assets/javascripts/boards/components/assignee_select.vue
View file @
fd29d841
...
...
@@ -176,10 +176,16 @@ export default {
:is-loading=
"isLoading"
:selected=
"selected"
:search-term=
"search"
:is-user-dropdown=
"true"
@
hide=
"hideDropdown"
@
set-option=
"selectAssignee"
@
set-search=
"setSearch"
/>
>
<template
#preset-item
="
{ item }">
{{
item
.
name
}}
</
template
>
<
template
#item=
"{ item }"
>
{{
item
.
name
}}
</
template
>
</dropdown-widget>
</div>
</template>
ee/app/assets/javascripts/boards/constants.js
View file @
fd29d841
...
...
@@ -81,7 +81,7 @@ export const MilestonesPreset = [
export
const
ANY_ASSIGNEE
=
{
id
:
'
gid://gitlab/User/-1
'
,
titl
e
:
s__
(
'
BoardScope|Any assignee
'
),
nam
e
:
s__
(
'
BoardScope|Any assignee
'
),
};
export
const
AssigneesPreset
=
[
ANY_ASSIGNEE
];
...
...
ee/spec/frontend/boards/components/assignee_select_spec.js
View file @
fd29d841
...
...
@@ -88,9 +88,11 @@ describe('Assignee select component', () => {
});
it
(
'
renders selected assignee
'
,
async
()
=>
{
wrapper
.
vm
.
selected
=
mockUser2
;
findEditButton
().
vm
.
$emit
(
'
click
'
);
await
waitForPromises
();
findDropdown
().
vm
.
$emit
(
'
set-option
'
,
mockUser2
);
await
nextTick
();
expect
(
selectedText
()).
toContain
(
mockUser2
.
username
);
});
});
...
...
ee/spec/frontend/boards/milestone_select_spec.js
View file @
fd29d841
...
...
@@ -98,7 +98,9 @@ describe('Milestone select component', () => {
});
it
(
'
renders selected milestone
'
,
async
()
=>
{
wrapper
.
vm
.
selected
=
mockMilestone1
;
findEditButton
().
vm
.
$emit
(
'
click
'
);
await
waitForPromises
();
findDropdown
().
vm
.
$emit
(
'
set-option
'
,
mockMilestone1
);
await
waitForPromises
();
expect
(
selectedText
()).
toContain
(
mockMilestone1
.
title
);
...
...
spec/frontend/vue_shared/components/dropdown/dropdown_widget_spec.js
View file @
fd29d841
...
...
@@ -77,7 +77,7 @@ describe('DropdownWidget component', () => {
});
});
describe
(
'
when
user dropdown
'
,
()
=>
{
describe
(
'
when
options are users
'
,
()
=>
{
const
mockUser
=
{
id
:
1
,
name
:
'
User name
'
,
...
...
@@ -86,7 +86,7 @@ describe('DropdownWidget component', () => {
};
beforeEach
(()
=>
{
createComponent
({
props
:
{
isUserDropdown
:
true
,
options
:
[
mockUser
]
}
});
createComponent
({
props
:
{
options
:
[
mockUser
]
}
});
});
it
(
'
passes user related props to dropdown item
'
,
()
=>
{
...
...
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