Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
7fc090b7
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7fc090b7
编写于
2月 22, 2018
作者:
G
George Tsiolis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move RecentSearchesDropdownContent vue component
上级
88870c87
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
114 addition
and
6 deletion
+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
未找到文件。
app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.
js
→
app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.
vue
浏览文件 @
7fc090b7
<
script
>
import
eventHub
from
'
../event_hub
'
;
import
FilteredSearchTokenizer
from
'
../filtered_search_tokenizer
'
;
export
default
{
name
:
'
RecentSearchesDropdownContent
'
,
props
:
{
items
:
{
type
:
Array
,
...
...
@@ -19,7 +19,6 @@ export default {
required
:
true
,
},
},
computed
:
{
processedItems
()
{
return
this
.
items
.
map
((
item
)
=>
{
...
...
@@ -42,7 +41,6 @@ export default {
return
this
.
items
.
length
>
0
;
},
},
methods
:
{
onItemActivated
(
text
)
{
eventHub
.
$emit
(
'
recentSearchesItemSelected
'
,
text
);
...
...
@@ -54,49 +52,53 @@ export default {
eventHub
.
$emit
(
'
requestClearRecentSearches
'
);
},
},
template
:
`
<div>
<div
v-if="!isLocalStorageAvailable"
class="dropdown-info-note">
This feature requires local storage to be enabled
</div>
<ul v-else-if="hasItems">
<li
v-for="(item, index) in processedItems"
:key="index">
<button
type="button"
class="filtered-search-history-dropdown-item"
@click="onItemActivated(item.text)">
<span>
<span
v-for="(token, tokenIndex) in item.tokens"
class="filtered-search-history-dropdown-token">
<span class="name">{{ token.prefix }}</span><span class="value">{{ token.suffix }}</span>
</span>
</span>
<span class="filtered-search-history-dropdown-search-token">
{{ item.searchToken }}
};
</
script
>
<
template
>
<div>
<div
v-if=
"!isLocalStorageAvailable"
class=
"dropdown-info-note"
>
This feature requires local storage to be enabled
</div>
<ul
v-else-if=
"hasItems"
>
<li
v-for=
"(item, index) in processedItems"
:key=
"`processed-items-$
{index}`"
>
<button
type=
"button"
class=
"filtered-search-history-dropdown-item"
@
click=
"onItemActivated(item.text)"
>
<span>
<span
class=
"filtered-search-history-dropdown-token"
v-for=
"(token, index) in item.tokens"
:key=
"`dropdown-token-$
{index}`"
>
<span
class=
"name"
>
{{
token
.
prefix
}}
</span>
<span
class=
"value"
>
{{
token
.
suffix
}}
</span>
</span>
</button>
</li>
<li class="divider"></li>
<li>
<button
type="button"
class="filtered-search-history-clear-button"
@click="onRequestClearRecentSearches($event)">
Clear recent searches
</button>
</li>
</ul>
<div
v-else
class="dropdown-info-note">
You don't have any recent searches
</div>
</span>
<span
class=
"filtered-search-history-dropdown-search-token"
>
{{
item
.
searchToken
}}
</span>
</button>
</li>
<li
class=
"divider"
></li>
<li>
<button
type=
"button"
class=
"filtered-search-history-clear-button"
@
click=
"onRequestClearRecentSearches($event)"
>
Clear recent searches
</button>
</li>
</ul>
<div
v-else
class=
"dropdown-info-note"
>
You don't have any recent searches
</div>
`
,
};
</div>
</
template
>
app/assets/javascripts/filtered_search/recent_searches_root.js
浏览文件 @
7fc090b7
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
'
;
class
RecentSearchesRoot
{
...
...
@@ -33,7 +33,7 @@ class RecentSearchesRoot {
this
.
vm
=
new
Vue
({
el
:
this
.
wrapperElement
,
components
:
{
'
recent-searches-dropdown-content
'
:
RecentSearchesDropdownContent
,
RecentSearchesDropdownContent
,
},
data
()
{
return
state
;
},
template
:
`
...
...
changelogs/unreleased/refactor-move-filtered-search-vue-component.yml
0 → 100644
浏览文件 @
7fc090b7
---
title
:
Move RecentSearchesDropdownContent vue component
merge_request
:
16951
author
:
George Tsiolis
type
:
performance
spec/features/issues/filtered_search/recent_searches_spec.rb
浏览文件 @
7fc090b7
...
...
@@ -39,8 +39,8 @@ describe 'Recent searches', :js do
items
=
all
(
'.filtered-search-history-dropdown-item'
,
visible:
false
,
count:
2
)
expect
(
items
[
0
].
text
).
to
eq
(
'label:~qux garply'
)
expect
(
items
[
1
].
text
).
to
eq
(
'label:~foo bar'
)
expect
(
items
[
0
].
text
).
to
eq
(
'label:
~qux garply'
)
expect
(
items
[
1
].
text
).
to
eq
(
'label:
~foo bar'
)
end
it
'saved recent searches are restored last on the list'
do
...
...
spec/javascripts/filtered_search/components/recent_searches_dropdown_content_spec.js
浏览文件 @
7fc090b7
import
Vue
from
'
vue
'
;
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
'
;
const
createComponent
=
(
propsData
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录