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
Léo-Paul Géneau
gitlab-ce
Commits
7fc090b7
Commit
7fc090b7
authored
Feb 22, 2018
by
George Tsiolis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move RecentSearchesDropdownContent vue component
parent
88870c87
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
6 deletions
+114
-6
app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.vue
...ed_search/components/recent_searches_dropdown_content.vue
+104
-0
app/assets/javascripts/filtered_search/recent_searches_root.js
...ssets/javascripts/filtered_search/recent_searches_root.js
+2
-2
changelogs/unreleased/refactor-move-filtered-search-vue-component.yml
...nreleased/refactor-move-filtered-search-vue-component.yml
+5
-0
spec/features/issues/filtered_search/recent_searches_spec.rb
spec/features/issues/filtered_search/recent_searches_spec.rb
+2
-2
spec/javascripts/filtered_search/components/recent_searches_dropdown_content_spec.js
...earch/components/recent_searches_dropdown_content_spec.js
+1
-2
No files found.
app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.
js
→
app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.
vue
View file @
7fc090b7
<
script
>
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
import
FilteredSearchTokenizer
from
'
../filtered_search_tokenizer
'
;
import
FilteredSearchTokenizer
from
'
../filtered_search_tokenizer
'
;
export
default
{
export
default
{
name
:
'
RecentSearchesDropdownContent
'
,
name
:
'
RecentSearchesDropdownContent
'
,
props
:
{
props
:
{
items
:
{
items
:
{
type
:
Array
,
type
:
Array
,
...
@@ -19,7 +19,6 @@ export default {
...
@@ -19,7 +19,6 @@ export default {
required
:
true
,
required
:
true
,
},
},
},
},
computed
:
{
computed
:
{
processedItems
()
{
processedItems
()
{
return
this
.
items
.
map
((
item
)
=>
{
return
this
.
items
.
map
((
item
)
=>
{
...
@@ -42,7 +41,6 @@ export default {
...
@@ -42,7 +41,6 @@ export default {
return
this
.
items
.
length
>
0
;
return
this
.
items
.
length
>
0
;
},
},
},
},
methods
:
{
methods
:
{
onItemActivated
(
text
)
{
onItemActivated
(
text
)
{
eventHub
.
$emit
(
'
recentSearchesItemSelected
'
,
text
);
eventHub
.
$emit
(
'
recentSearchesItemSelected
'
,
text
);
...
@@ -54,49 +52,53 @@ export default {
...
@@ -54,49 +52,53 @@ export default {
eventHub
.
$emit
(
'
requestClearRecentSearches
'
);
eventHub
.
$emit
(
'
requestClearRecentSearches
'
);
},
},
},
},
};
template
:
`
</
script
>
<div>
<
template
>
<div
<div>
v-if="!isLocalStorageAvailable"
<div
class="dropdown-info-note">
v-if=
"!isLocalStorageAvailable"
This feature requires local storage to be enabled
class=
"dropdown-info-note"
>
</div>
This feature requires local storage to be enabled
<ul v-else-if="hasItems">
</div>
<li
<ul
v-else-if=
"hasItems"
>
v-for="(item, index) in processedItems"
<li
:key="index">
v-for=
"(item, index) in processedItems"
<button
:key=
"`processed-items-$
{index}`"
type="button"
>
class="filtered-search-history-dropdown-item"
<button
@click="onItemActivated(item.text)">
type=
"button"
<span>
class=
"filtered-search-history-dropdown-item"
<span
@
click=
"onItemActivated(item.text)"
>
v-for="(token, tokenIndex) in item.tokens"
<span>
class="filtered-search-history-dropdown-token">
<span
<span class="name">{{ token.prefix }}</span><span class="value">{{ token.suffix }}</span>
class=
"filtered-search-history-dropdown-token"
</span>
v-for=
"(token, index) in item.tokens"
</span>
:key=
"`dropdown-token-$
{index}`"
<span class="filtered-search-history-dropdown-search-token">
>
{{ item.searchToken }}
<span
class=
"name"
>
{{
token
.
prefix
}}
</span>
<span
class=
"value"
>
{{
token
.
suffix
}}
</span>
</span>
</span>
</button>
</span>
</li>
<span
class=
"filtered-search-history-dropdown-search-token"
>
<li class="divider"></li>
{{
item
.
searchToken
}}
<li>
</span>
<button
</button>
type="button"
</li>
class="filtered-search-history-clear-button"
<li
class=
"divider"
></li>
@click="onRequestClearRecentSearches($event)">
<li>
Clear recent searches
<button
</button>
type=
"button"
</li>
class=
"filtered-search-history-clear-button"
</ul>
@
click=
"onRequestClearRecentSearches($event)"
>
<div
Clear recent searches
v-else
</button>
class="dropdown-info-note">
</li>
You don't have any recent searches
</ul>
</div>
<div
v-else
class=
"dropdown-info-note"
>
You don't have any recent searches
</div>
</div>
`
,
</div>
};
</
template
>
app/assets/javascripts/filtered_search/recent_searches_root.js
View file @
7fc090b7
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
RecentSearchesDropdownContent
from
'
./components/recent_searches_dropdown_content
'
;
import
RecentSearchesDropdownContent
from
'
./components/recent_searches_dropdown_content
.vue
'
;
import
eventHub
from
'
./event_hub
'
;
import
eventHub
from
'
./event_hub
'
;
class
RecentSearchesRoot
{
class
RecentSearchesRoot
{
...
@@ -33,7 +33,7 @@ class RecentSearchesRoot {
...
@@ -33,7 +33,7 @@ class RecentSearchesRoot {
this
.
vm
=
new
Vue
({
this
.
vm
=
new
Vue
({
el
:
this
.
wrapperElement
,
el
:
this
.
wrapperElement
,
components
:
{
components
:
{
'
recent-searches-dropdown-content
'
:
RecentSearchesDropdownContent
,
RecentSearchesDropdownContent
,
},
},
data
()
{
return
state
;
},
data
()
{
return
state
;
},
template
:
`
template
:
`
...
...
changelogs/unreleased/refactor-move-filtered-search-vue-component.yml
0 → 100644
View file @
7fc090b7
---
title
:
Move RecentSearchesDropdownContent vue component
merge_request
:
16951
author
:
George Tsiolis
type
:
performance
spec/features/issues/filtered_search/recent_searches_spec.rb
View file @
7fc090b7
...
@@ -39,8 +39,8 @@ describe 'Recent searches', :js do
...
@@ -39,8 +39,8 @@ describe 'Recent searches', :js do
items
=
all
(
'.filtered-search-history-dropdown-item'
,
visible:
false
,
count:
2
)
items
=
all
(
'.filtered-search-history-dropdown-item'
,
visible:
false
,
count:
2
)
expect
(
items
[
0
].
text
).
to
eq
(
'label:~qux garply'
)
expect
(
items
[
0
].
text
).
to
eq
(
'label:
~qux garply'
)
expect
(
items
[
1
].
text
).
to
eq
(
'label:~foo bar'
)
expect
(
items
[
1
].
text
).
to
eq
(
'label:
~foo bar'
)
end
end
it
'saved recent searches are restored last on the list'
do
it
'saved recent searches are restored last on the list'
do
...
...
spec/javascripts/filtered_search/components/recent_searches_dropdown_content_spec.js
View file @
7fc090b7
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
eventHub
from
'
~/filtered_search/event_hub
'
;
import
eventHub
from
'
~/filtered_search/event_hub
'
;
import
RecentSearchesDropdownContent
from
'
~/filtered_search/components/recent_searches_dropdown_content
'
;
import
RecentSearchesDropdownContent
from
'
~/filtered_search/components/recent_searches_dropdown_content.vue
'
;
import
FilteredSearchTokenKeys
from
'
~/filtered_search/filtered_search_token_keys
'
;
import
FilteredSearchTokenKeys
from
'
~/filtered_search/filtered_search_token_keys
'
;
const
createComponent
=
(
propsData
)
=>
{
const
createComponent
=
(
propsData
)
=>
{
...
...
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