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
50c3fe0a
Commit
50c3fe0a
authored
Mar 05, 2020
by
Dhiraj Bodicherla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use lodash in filtered_search components
This MR replaces underscope with lodash in filtered_search files
parent
85c90276
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
15 deletions
+15
-15
app/assets/javascripts/filtered_search/dropdown_utils.js
app/assets/javascripts/filtered_search/dropdown_utils.js
+4
-4
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
...ripts/filtered_search/filtered_search_dropdown_manager.js
+3
-3
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+2
-2
app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
...ts/filtered_search/issuable_filtered_search_token_keys.js
+2
-2
app/assets/javascripts/filtered_search/stores/recent_searches_store.js
...vascripts/filtered_search/stores/recent_searches_store.js
+2
-2
app/assets/javascripts/filtered_search/visual_token_value.js
app/assets/javascripts/filtered_search/visual_token_value.js
+2
-2
No files found.
app/assets/javascripts/filtered_search/dropdown_utils.js
View file @
50c3fe0a
import
_
from
'
underscore
'
;
import
{
last
}
from
'
lodash
'
;
import
FilteredSearchContainer
from
'
./container
'
;
import
FilteredSearchTokenizer
from
'
./filtered_search_tokenizer
'
;
import
FilteredSearchDropdownManager
from
'
./filtered_search_dropdown_manager
'
;
...
...
@@ -70,11 +70,11 @@ export default class DropdownUtils {
if
(
!
allowMultiple
&&
itemInExistingTokens
)
{
updatedItem
.
droplab_hidden
=
true
;
}
else
if
(
!
isSearchItem
&&
(
!
lastKey
||
_
.
last
(
searchInput
.
split
(
''
))
===
'
'
))
{
}
else
if
(
!
isSearchItem
&&
(
!
lastKey
||
last
(
searchInput
.
split
(
''
))
===
'
'
))
{
updatedItem
.
droplab_hidden
=
false
;
}
else
if
(
lastKey
)
{
const
split
=
lastKey
.
split
(
'
:
'
);
const
tokenName
=
_
.
last
(
split
[
0
].
split
(
'
'
));
const
tokenName
=
last
(
split
[
0
].
split
(
'
'
));
const
match
=
isSearchItem
?
allowedKeys
.
some
(
key
=>
key
.
startsWith
(
tokenName
.
toLowerCase
()))
...
...
@@ -129,7 +129,7 @@ export default class DropdownUtils {
const
values
=
[];
if
(
untilInput
)
{
const
inputIndex
=
_
.
findIndex
(
tokens
,
t
=>
t
.
classList
.
contains
(
'
input-token
'
));
const
inputIndex
=
tokens
.
findIndex
(
t
=>
t
.
classList
.
contains
(
'
input-token
'
));
// Add one to include input-token to the tokens array
tokens
.
splice
(
inputIndex
+
1
);
}
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
View file @
50c3fe0a
import
{
last
}
from
'
lodash
'
;
import
AvailableDropdownMappings
from
'
ee_else_ce/filtered_search/available_dropdown_mappings
'
;
import
_
from
'
underscore
'
;
import
DropLab
from
'
~/droplab/drop_lab
'
;
import
FilteredSearchContainer
from
'
./container
'
;
import
FilteredSearchTokenKeys
from
'
./filtered_search_token_keys
'
;
...
...
@@ -184,8 +184,8 @@ export default class FilteredSearchDropdownManager {
// Eg. token = 'label:'
const
split
=
lastToken
.
split
(
'
:
'
);
const
dropdownName
=
_
.
last
(
split
[
0
].
split
(
'
'
));
const
possibleOperatorToken
=
_
.
last
(
split
[
1
]);
const
dropdownName
=
last
(
split
[
0
].
split
(
'
'
));
const
possibleOperatorToken
=
last
(
split
[
1
]);
const
hasOperator
=
FilteredSearchVisualTokens
.
permissibleOperatorValues
.
includes
(
possibleOperatorToken
&&
possibleOperatorToken
.
trim
(),
...
...
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
50c3fe0a
import
_
from
'
underscore
'
;
import
{
last
}
from
'
lodash
'
;
import
recentSearchesStorageKeys
from
'
ee_else_ce/filtered_search/recent_searches_storage_keys
'
;
import
{
getParameterByName
,
getUrlParamsArray
}
from
'
~/lib/utils/common_utils
'
;
import
IssuableFilteredSearchTokenKeys
from
'
~/filtered_search/issuable_filtered_search_token_keys
'
;
...
...
@@ -456,7 +456,7 @@ export default class FilteredSearchManager {
if
(
fragments
.
length
>
1
)
{
const
inputValues
=
fragments
[
0
].
split
(
'
'
);
const
tokenKey
=
_
.
last
(
inputValues
);
const
tokenKey
=
last
(
inputValues
);
if
(
inputValues
.
length
>
1
)
{
inputValues
.
pop
();
...
...
app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
View file @
50c3fe0a
import
{
flatten
}
from
'
underscore
'
;
import
{
flatten
Deep
}
from
'
lodash
'
;
import
FilteredSearchTokenKeys
from
'
./filtered_search_token_keys
'
;
import
{
__
}
from
'
~/locale
'
;
...
...
@@ -73,7 +73,7 @@ export const alternativeTokenKeys = [
},
];
export
const
conditions
=
flatten
(
export
const
conditions
=
flatten
Deep
(
[
{
url
:
'
assignee_id=None
'
,
...
...
app/assets/javascripts/filtered_search/stores/recent_searches_store.js
View file @
50c3fe0a
import
_
from
'
underscore
'
;
import
{
uniq
}
from
'
lodash
'
;
class
RecentSearchesStore
{
constructor
(
initialState
=
{},
allowedKeys
)
{
...
...
@@ -20,7 +20,7 @@ class RecentSearchesStore {
setRecentSearches
(
searches
=
[])
{
const
trimmedSearches
=
searches
.
map
(
search
=>
search
.
trim
());
this
.
state
.
recentSearches
=
_
.
uniq
(
trimmedSearches
).
slice
(
0
,
5
);
this
.
state
.
recentSearches
=
uniq
(
trimmedSearches
).
slice
(
0
,
5
);
return
this
.
state
.
recentSearches
;
}
}
...
...
app/assets/javascripts/filtered_search/visual_token_value.js
View file @
50c3fe0a
import
_
from
'
underscore
'
;
import
{
escape
as
esc
}
from
'
lodash
'
;
import
{
USER_TOKEN_TYPES
}
from
'
ee_else_ce/filtered_search/constants
'
;
import
FilteredSearchContainer
from
'
~/filtered_search/container
'
;
import
FilteredSearchVisualTokens
from
'
~/filtered_search/filtered_search_visual_tokens
'
;
...
...
@@ -48,7 +48,7 @@ export default class VisualTokenValue {
tokenValueContainer
.
dataset
.
originalValue
=
tokenValue
;
tokenValueElement
.
innerHTML
=
`
<img class="avatar s20" src="
${
user
.
avatar_url
}
" alt="">
${
_
.
escape
(
user
.
name
)}
${
esc
(
user
.
name
)}
`
;
/* eslint-enable no-param-reassign */
})
...
...
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