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
Boxiang Sun
gitlab-ce
Commits
f03a6574
Commit
f03a6574
authored
Feb 08, 2019
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a feature flag to the diff fuzzy file finder
Closes
https://gitlab.com/gitlab-org/gitlab-ce/issues/57403
parent
c8fe0d6a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
13 deletions
+64
-13
app/assets/javascripts/diffs/components/tree_list.vue
app/assets/javascripts/diffs/components/tree_list.vue
+57
-13
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+4
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
app/assets/javascripts/diffs/components/tree_list.vue
View file @
f03a6574
...
@@ -13,18 +13,43 @@ export default {
...
@@ -13,18 +13,43 @@ export default {
Icon
,
Icon
,
FileRow
,
FileRow
,
},
},
data
()
{
return
{
search
:
''
,
};
},
computed
:
{
computed
:
{
...
mapState
(
'
diffs
'
,
[
'
tree
'
,
'
renderTreeList
'
]),
...
mapState
(
'
diffs
'
,
[
'
tree
'
,
'
renderTreeList
'
]),
...
mapGetters
(
'
diffs
'
,
[
'
allBlobs
'
]),
...
mapGetters
(
'
diffs
'
,
[
'
allBlobs
'
]),
filteredTreeList
()
{
filteredTreeList
()
{
return
this
.
renderTreeList
?
this
.
tree
:
this
.
allBlobs
;
const
search
=
this
.
search
.
toLowerCase
().
trim
();
if
(
search
===
''
||
this
.
$options
.
fuzzyFileFinderEnabled
)
return
this
.
renderTreeList
?
this
.
tree
:
this
.
allBlobs
;
return
this
.
allBlobs
.
reduce
((
acc
,
folder
)
=>
{
const
tree
=
folder
.
tree
.
filter
(
f
=>
f
.
path
.
toLowerCase
().
indexOf
(
search
)
>=
0
);
if
(
tree
.
length
)
{
return
acc
.
concat
({
...
folder
,
tree
,
});
}
return
acc
;
},
[]);
},
},
},
},
methods
:
{
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
toggleTreeOpen
'
,
'
scrollToFile
'
,
'
toggleFileFinder
'
]),
...
mapActions
(
'
diffs
'
,
[
'
toggleTreeOpen
'
,
'
scrollToFile
'
,
'
toggleFileFinder
'
]),
clearSearch
()
{
this
.
search
=
''
;
},
},
},
shortcutKeyCharacter
:
`
${
/
Mac
/
i
.
test
(
navigator
.
userAgent
)
?
'
⌘
'
:
'
Ctrl
'
}
+P`
,
shortcutKeyCharacter
:
`
${
/
Mac
/
i
.
test
(
navigator
.
userAgent
)
?
'
⌘
'
:
'
Ctrl
'
}
+P`
,
FileRowStats
,
FileRowStats
,
diffTreeFiltering
:
gon
.
features
&&
gon
.
features
.
diffTreeFiltering
,
};
};
</
script
>
</
script
>
...
@@ -33,17 +58,36 @@ export default {
...
@@ -33,17 +58,36 @@ export default {
<div
class=
"append-bottom-8 position-relative tree-list-search d-flex"
>
<div
class=
"append-bottom-8 position-relative tree-list-search d-flex"
>
<div
class=
"flex-fill d-flex"
>
<div
class=
"flex-fill d-flex"
>
<icon
name=
"search"
class=
"position-absolute tree-list-icon"
/>
<icon
name=
"search"
class=
"position-absolute tree-list-icon"
/>
<button
<template
v-if=
"$options.diffTreeFiltering"
>
type=
"button"
<input
class=
"form-control text-left text-secondary"
v-model=
"search"
@
click=
"toggleFileFinder(true)"
:placeholder=
"s__('MergeRequest|Filter files')"
>
type=
"search"
{{
s__
(
'
MergeRequest|Search files
'
)
}}
class=
"form-control"
</button>
/>
<span
<button
class=
"position-absolute text-secondary diff-tree-search-shortcut"
v-show=
"search"
v-html=
"$options.shortcutKeyCharacter"
:aria-label=
"__('Clear search')"
></span>
type=
"button"
class=
"position-absolute bg-transparent tree-list-icon tree-list-clear-icon border-0 p-0"
@
click=
"clearSearch"
>
<icon
name=
"close"
/>
</button>
</
template
>
<
template
v-else
>
<button
type=
"button"
class=
"form-control text-left text-secondary"
@
click=
"toggleFileFinder(true)"
>
{{
s__
(
'
MergeRequest|Search files
'
)
}}
</button>
<span
class=
"position-absolute text-secondary diff-tree-search-shortcut"
v-html=
"$options.shortcutKeyCharacter"
></span>
</
template
>
</div>
</div>
</div>
</div>
<div
:class=
"{ 'pt-0 tree-list-blobs': !renderTreeList }"
class=
"tree-list-scroll"
>
<div
:class=
"{ 'pt-0 tree-list-blobs': !renderTreeList }"
class=
"tree-list-scroll"
>
...
@@ -79,7 +123,7 @@ export default {
...
@@ -79,7 +123,7 @@ export default {
pointer-events
:
none
;
pointer-events
:
none
;
}
}
.tree-list-icon
{
.tree-list-icon
:not
(
button
)
{
pointer-events
:
none
;
pointer-events
:
none
;
}
}
</
style
>
</
style
>
app/controllers/projects/merge_requests_controller.rb
View file @
f03a6574
...
@@ -16,6 +16,10 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
...
@@ -16,6 +16,10 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action
:authenticate_user!
,
only:
[
:assign_related_issues
]
before_action
:authenticate_user!
,
only:
[
:assign_related_issues
]
before_action
:check_user_can_push_to_source_branch!
,
only:
[
:rebase
]
before_action
:check_user_can_push_to_source_branch!
,
only:
[
:rebase
]
before_action
only:
[
:show
]
do
push_frontend_feature_flag
(
:diff_tree_filtering
,
default_enabled:
true
)
end
def
index
def
index
@merge_requests
=
@issuables
@merge_requests
=
@issuables
...
...
locale/gitlab.pot
View file @
f03a6574
...
@@ -4494,6 +4494,9 @@ msgstr ""
...
@@ -4494,6 +4494,9 @@ msgstr ""
msgid "MergeRequest| %{paragraphStart}changed the description %{descriptionChangedTimes} times %{timeDifferenceMinutes}%{paragraphEnd}"
msgid "MergeRequest| %{paragraphStart}changed the description %{descriptionChangedTimes} times %{timeDifferenceMinutes}%{paragraphEnd}"
msgstr ""
msgstr ""
msgid "MergeRequest|Filter files"
msgstr ""
msgid "MergeRequest|No files found"
msgid "MergeRequest|No files found"
msgstr ""
msgstr ""
...
...
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