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
320ae7ee
Commit
320ae7ee
authored
Oct 01, 2020
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fuzzy search support to labels dropdown
Use `fuzzaldrinPlus` to filter labels within Vue Labels Dropdown.
parent
af144667
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
4 deletions
+27
-4
app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue
...debar/labels_select_vue/dropdown_contents_labels_view.vue
+4
-3
changelogs/unreleased/250727-use-fuzzaldrinplus-search-for-labels.yml
...nreleased/250727-use-fuzzaldrinplus-search-for-labels.yml
+5
-0
spec/frontend/sidebar/sidebar_labels_spec.js
spec/frontend/sidebar/sidebar_labels_spec.js
+1
-1
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js
...r/labels_select_vue/dropdown_contents_labels_view_spec.js
+10
-0
spec/frontend/vue_shared/components/sidebar/labels_select_vue/mock_data.js
..._shared/components/sidebar/labels_select_vue/mock_data.js
+7
-0
No files found.
app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue
View file @
320ae7ee
<
script
>
<
script
>
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
GlLoadingIcon
,
GlButton
,
GlSearchBoxByType
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
GlLoadingIcon
,
GlButton
,
GlSearchBoxByType
,
GlLink
}
from
'
@gitlab/ui
'
;
import
fuzzaldrinPlus
from
'
fuzzaldrin-plus
'
;
import
{
UP_KEY_CODE
,
DOWN_KEY_CODE
,
ENTER_KEY_CODE
,
ESC_KEY_CODE
}
from
'
~/lib/utils/keycodes
'
;
import
{
UP_KEY_CODE
,
DOWN_KEY_CODE
,
ENTER_KEY_CODE
,
ESC_KEY_CODE
}
from
'
~/lib/utils/keycodes
'
;
import
SmartVirtualList
from
'
~/vue_shared/components/smart_virtual_list.vue
'
;
import
SmartVirtualList
from
'
~/vue_shared/components/smart_virtual_list.vue
'
;
...
@@ -39,9 +40,9 @@ export default {
...
@@ -39,9 +40,9 @@ export default {
...
mapGetters
([
'
selectedLabelsList
'
,
'
isDropdownVariantSidebar
'
,
'
isDropdownVariantEmbedded
'
]),
...
mapGetters
([
'
selectedLabelsList
'
,
'
isDropdownVariantSidebar
'
,
'
isDropdownVariantEmbedded
'
]),
visibleLabels
()
{
visibleLabels
()
{
if
(
this
.
searchKey
)
{
if
(
this
.
searchKey
)
{
return
this
.
labels
.
filter
(
label
=>
return
fuzzaldrinPlus
.
filter
(
this
.
labels
,
this
.
searchKey
,
{
label
.
title
.
toLowerCase
().
includes
(
this
.
searchKey
.
toLowerCase
())
,
key
:
[
'
title
'
]
,
);
}
);
}
}
return
this
.
labels
;
return
this
.
labels
;
},
},
...
...
changelogs/unreleased/250727-use-fuzzaldrinplus-search-for-labels.yml
0 → 100644
View file @
320ae7ee
---
title
:
Add fuzzy search support to labels dropdown
merge_request
:
43969
author
:
type
:
fixed
spec/frontend/sidebar/sidebar_labels_spec.js
View file @
320ae7ee
...
@@ -114,7 +114,7 @@ describe('sidebar labels', () => {
...
@@ -114,7 +114,7 @@ describe('sidebar labels', () => {
const
expected
=
{
const
expected
=
{
[
defaultProps
.
issuableType
]:
{
[
defaultProps
.
issuableType
]:
{
label_ids
:
[
27
,
28
,
40
],
label_ids
:
[
27
,
28
,
29
,
40
],
},
},
};
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js
View file @
320ae7ee
...
@@ -69,6 +69,16 @@ describe('DropdownContentsLabelsView', () => {
...
@@ -69,6 +69,16 @@ describe('DropdownContentsLabelsView', () => {
expect
(
wrapper
.
vm
.
visibleLabels
[
0
].
title
).
toBe
(
'
Bug
'
);
expect
(
wrapper
.
vm
.
visibleLabels
[
0
].
title
).
toBe
(
'
Bug
'
);
});
});
it
(
'
returns matching labels with fuzzy filtering
'
,
()
=>
{
wrapper
.
setData
({
searchKey
:
'
bg
'
,
});
expect
(
wrapper
.
vm
.
visibleLabels
.
length
).
toBe
(
2
);
expect
(
wrapper
.
vm
.
visibleLabels
[
0
].
title
).
toBe
(
'
Bug
'
);
expect
(
wrapper
.
vm
.
visibleLabels
[
1
].
title
).
toBe
(
'
Boog
'
);
});
it
(
'
returns all labels when `searchKey` is empty
'
,
()
=>
{
it
(
'
returns all labels when `searchKey` is empty
'
,
()
=>
{
wrapper
.
setData
({
wrapper
.
setData
({
searchKey
:
''
,
searchKey
:
''
,
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/mock_data.js
View file @
320ae7ee
...
@@ -24,6 +24,13 @@ export const mockLabels = [
...
@@ -24,6 +24,13 @@ export const mockLabels = [
color
:
'
#FF0000
'
,
color
:
'
#FF0000
'
,
textColor
:
'
#FFFFFF
'
,
textColor
:
'
#FFFFFF
'
,
},
},
{
id
:
29
,
title
:
'
Boog
'
,
description
:
'
Label for bugs
'
,
color
:
'
#FF0000
'
,
textColor
:
'
#FFFFFF
'
,
},
];
];
export
const
mockConfig
=
{
export
const
mockConfig
=
{
...
...
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