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
c9b18202
Commit
c9b18202
authored
Mar 16, 2022
by
Coung Ngo
Committed by
Kushal Pandya
Mar 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Epic and Label != filtered search suggestions not showing
Changelog: fixed
parent
3510ef5b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
15 deletions
+66
-15
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/base_token.vue
...ared/components/filtered_search_bar/tokens/base_token.vue
+16
-15
ee/app/assets/javascripts/external_issues_list/components/external_issues_list_root.vue
...rnal_issues_list/components/external_issues_list_root.vue
+1
-0
ee/spec/frontend/external_issues_list/components/__snapshots__/external_issues_list_root_spec.js.snap
...ents/__snapshots__/external_issues_list_root_spec.js.snap
+1
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js
.../components/filtered_search_bar/tokens/base_token_spec.js
+45
-0
No files found.
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/base_token.vue
View file @
c9b18202
...
@@ -76,6 +76,7 @@ export default {
...
@@ -76,6 +76,7 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
hasFetched
:
false
,
// use this to avoid flash of `No suggestions found` before fetching
searchKey
:
''
,
searchKey
:
''
,
recentSuggestions
:
this
.
config
.
recentSuggestionsStorageKey
recentSuggestions
:
this
.
config
.
recentSuggestionsStorageKey
?
getRecentlyUsedSuggestions
(
this
.
config
.
recentSuggestionsStorageKey
)
??
[]
?
getRecentlyUsedSuggestions
(
this
.
config
.
recentSuggestionsStorageKey
)
??
[]
...
@@ -86,6 +87,9 @@ export default {
...
@@ -86,6 +87,9 @@ export default {
isRecentSuggestionsEnabled
()
{
isRecentSuggestionsEnabled
()
{
return
Boolean
(
this
.
config
.
recentSuggestionsStorageKey
);
return
Boolean
(
this
.
config
.
recentSuggestionsStorageKey
);
},
},
suggestionsEnabled
()
{
return
!
this
.
config
.
suggestionsDisabled
;
},
recentTokenIds
()
{
recentTokenIds
()
{
return
this
.
recentSuggestions
.
map
((
tokenValue
)
=>
tokenValue
[
this
.
valueIdentifier
]);
return
this
.
recentSuggestions
.
map
((
tokenValue
)
=>
tokenValue
[
this
.
valueIdentifier
]);
},
},
...
@@ -134,17 +138,6 @@ export default {
...
@@ -134,17 +138,6 @@ export default {
showAvailableSuggestions
()
{
showAvailableSuggestions
()
{
return
this
.
availableSuggestions
.
length
>
0
;
return
this
.
availableSuggestions
.
length
>
0
;
},
},
showSuggestions
()
{
// These conditions must match the template under `#suggestions` slot
// See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65817#note_632619411
return
(
this
.
showDefaultSuggestions
||
this
.
showRecentSuggestions
||
this
.
showPreloadedSuggestions
||
this
.
suggestionsLoading
||
this
.
showAvailableSuggestions
);
},
searchTerm
()
{
searchTerm
()
{
return
this
.
searchBy
&&
this
.
activeTokenValue
return
this
.
searchBy
&&
this
.
activeTokenValue
?
this
.
activeTokenValue
[
this
.
searchBy
]
?
this
.
activeTokenValue
[
this
.
searchBy
]
...
@@ -161,6 +154,13 @@ export default {
...
@@ -161,6 +154,13 @@ export default {
}
}
},
},
},
},
suggestionsLoading
:
{
handler
(
loading
)
{
if
(
loading
)
{
this
.
hasFetched
=
true
;
}
},
},
},
},
methods
:
{
methods
:
{
handleInput
:
debounce
(
function
debouncedSearch
({
data
,
operator
})
{
handleInput
:
debounce
(
function
debouncedSearch
({
data
,
operator
})
{
...
@@ -216,7 +216,7 @@ export default {
...
@@ -216,7 +216,7 @@ export default {
<
template
#view=
"viewTokenProps"
>
<
template
#view=
"viewTokenProps"
>
<slot
name=
"view"
:view-token-props=
"
{ ...viewTokenProps, activeTokenValue }">
</slot>
<slot
name=
"view"
:view-token-props=
"
{ ...viewTokenProps, activeTokenValue }">
</slot>
</
template
>
</
template
>
<
template
v-if=
"s
howSuggestions
"
#suggestions
>
<
template
v-if=
"s
uggestionsEnabled
"
#suggestions
>
<template
v-if=
"showDefaultSuggestions"
>
<template
v-if=
"showDefaultSuggestions"
>
<gl-filtered-search-suggestion
<gl-filtered-search-suggestion
v-for=
"token in availableDefaultSuggestions"
v-for=
"token in availableDefaultSuggestions"
...
@@ -238,12 +238,13 @@ export default {
...
@@ -238,12 +238,13 @@ export default {
:suggestions=
"preloadedSuggestions"
:suggestions=
"preloadedSuggestions"
></slot>
></slot>
<gl-loading-icon
v-if=
"suggestionsLoading"
size=
"sm"
/>
<gl-loading-icon
v-if=
"suggestionsLoading"
size=
"sm"
/>
<
template
v-else-if=
"showAvailableSuggestions"
>
<slot
name=
"suggestions-list"
:suggestions=
"availableSuggestions"
></slot>
</
template
>
<gl-dropdown-text
v-else-if=
"showNoMatchesText"
>
<gl-dropdown-text
v-else-if=
"showNoMatchesText"
>
{{ __('No matches found') }}
{{ __('No matches found') }}
</gl-dropdown-text>
</gl-dropdown-text>
<
template
v-else
>
<gl-dropdown-text
v-else-if=
"hasFetched"
>
{{ __('No suggestions found') }}
</gl-dropdown-text>
<slot
name=
"suggestions-list"
:suggestions=
"availableSuggestions"
></slot>
</
template
>
</template>
</template>
</gl-filtered-search-token>
</gl-filtered-search-token>
</template>
</template>
ee/app/assets/javascripts/external_issues_list/components/external_issues_list_root.vue
View file @
c9b18202
...
@@ -150,6 +150,7 @@ export default {
...
@@ -150,6 +150,7 @@ export default {
token
:
LabelToken
,
token
:
LabelToken
,
operators
:
OPERATOR_IS_ONLY
,
operators
:
OPERATOR_IS_ONLY
,
defaultLabels
:
[],
defaultLabels
:
[],
suggestionsDisabled
:
true
,
fetchLabels
:
()
=>
{
fetchLabels
:
()
=>
{
return
Promise
.
resolve
([]);
return
Promise
.
resolve
([]);
},
},
...
...
ee/spec/frontend/external_issues_list/components/__snapshots__/external_issues_list_root_spec.js.snap
View file @
c9b18202
...
@@ -124,6 +124,7 @@ Object {
...
@@ -124,6 +124,7 @@ Object {
"value": "=",
"value": "=",
},
},
],
],
"suggestionsDisabled": true,
"symbol": "~",
"symbol": "~",
"title": "Label",
"title": "Label",
"token": "LabelTokenMock",
"token": "LabelTokenMock",
...
...
locale/gitlab.pot
View file @
c9b18202
...
@@ -25030,6 +25030,9 @@ msgstr ""
...
@@ -25030,6 +25030,9 @@ msgstr ""
msgid "No start date"
msgid "No start date"
msgstr ""
msgstr ""
msgid "No suggestions found"
msgstr ""
msgid "No tag selected"
msgid "No tag selected"
msgstr ""
msgstr ""
...
...
spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js
View file @
c9b18202
...
@@ -4,6 +4,7 @@ import {
...
@@ -4,6 +4,7 @@ import {
GlFilteredSearchSuggestion
,
GlFilteredSearchSuggestion
,
GlDropdownSectionHeader
,
GlDropdownSectionHeader
,
GlDropdownDivider
,
GlDropdownDivider
,
GlDropdownText
,
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
nextTick
}
from
'
vue
'
;
...
@@ -81,6 +82,7 @@ const mockProps = {
...
@@ -81,6 +82,7 @@ const mockProps = {
function
createComponent
({
function
createComponent
({
props
=
{},
props
=
{},
data
=
{},
stubs
=
defaultStubs
,
stubs
=
defaultStubs
,
slots
=
defaultSlots
,
slots
=
defaultSlots
,
scopedSlots
=
defaultScopedSlots
,
scopedSlots
=
defaultScopedSlots
,
...
@@ -100,6 +102,9 @@ function createComponent({
...
@@ -100,6 +102,9 @@ function createComponent({
unregister
:
jest
.
fn
(),
unregister
:
jest
.
fn
(),
},
},
},
},
data
()
{
return
data
;
},
stubs
,
stubs
,
slots
,
slots
,
scopedSlots
,
scopedSlots
,
...
@@ -168,6 +173,24 @@ describe('BaseToken', () => {
...
@@ -168,6 +173,24 @@ describe('BaseToken', () => {
});
});
describe
(
'
suggestions
'
,
()
=>
{
describe
(
'
suggestions
'
,
()
=>
{
describe
(
'
with suggestions disabled
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
=
createComponent
({
props
:
{
config
:
{
suggestionsDisabled
:
true
,
},
suggestions
:
[{
id
:
'
Foo
'
}],
},
mountFn
:
shallowMountExtended
,
});
});
it
(
'
does not render suggestions
'
,
()
=>
{
expect
(
findMockSuggestionList
().
exists
()).
toBe
(
false
);
});
});
describe
(
'
with available suggestions
'
,
()
=>
{
describe
(
'
with available suggestions
'
,
()
=>
{
let
mockSuggestions
;
let
mockSuggestions
;
...
@@ -306,6 +329,28 @@ describe('BaseToken', () => {
...
@@ -306,6 +329,28 @@ describe('BaseToken', () => {
});
});
});
});
});
});
describe
(
'
with no suggestions
'
,
()
=>
{
it
.
each
`
data | expected
${{
searchKey
:
'
search
'
}
} |
${
'
No matches found
'
}
${{
hasFetched
:
true
}
} |
${
'
No suggestions found
'
}
`
(
'
shows $expected text
'
,
({
data
,
expected
})
=>
{
wrapper
=
createComponent
({
props
:
{
config
:
{
recentSuggestionsStorageKey
:
null
},
defaultSuggestions
:
[],
preloadedSuggestions
:
[],
suggestions
:
[],
suggestionsLoading
:
false
,
},
data
,
mountFn
:
shallowMountExtended
,
});
expect
(
wrapper
.
findComponent
(
GlDropdownText
).
text
()).
toBe
(
expected
);
});
});
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
...
...
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